// HitCylPhiZGenerator.cpp #include "HitCylPhiZGenerator.h" #include #include "trfutil/trfstream.h" #include "HitCylPhiZ.h" #include "trfbase/VTrack.h" #include "trfbase/CrossStat.h" using std::ostream; using namespace trf; //********************************************************************** // output stream void HitCylPhiZGenerator::ostr(ostream& stream) const { stream << begin_object; stream << "Surface: " << *_psrf << new_line; stream << "Stereo slope: " << _stereo << new_line; stream << "Measurement error (dphiz): " << _dphiz << new_line; RandomGenerator::raw_ostr(stream); stream << end_object; } //********************************************************************** // Constructor. HitCylPhiZGenerator:: HitCylPhiZGenerator(const SurfCylinder& srf, double stereo, double dphiz) : HitGenerator(), _psrf(srf.new_surface()), _stereo(stereo), _dphiz(dphiz) { assert( _dphiz >= 0.0 ); } //********************************************************************** // Constructor with seed. HitCylPhiZGenerator:: HitCylPhiZGenerator(const SurfCylinder& srf, double stereo, double dphiz, long seed) : HitGenerator(seed), _psrf(srf.new_surface()), _stereo(stereo), _dphiz(dphiz) { assert( _dphiz >= 0.0 ); } //********************************************************************** // Copy constructor. HitCylPhiZGenerator::HitCylPhiZGenerator(const HitCylPhiZGenerator& rhs) : HitGenerator(rhs), _psrf(rhs._psrf), _stereo(rhs._stereo), _dphiz(rhs._dphiz) { assert( _dphiz >= 0.0 ); } //********************************************************************** // Destructor. HitCylPhiZGenerator::~HitCylPhiZGenerator() { } //********************************************************************** // Generate a new cluster. // Caller must delete. // Return 0 for failure. Cluster* HitCylPhiZGenerator::new_cluster(const VTrack& trv) { // Create cluster pointer. Cluster* pclu = 0; // Check track has been propagated to the surface. assert( _psrf->pure_equal( *trv.get_surface() ) ); if ( ! _psrf->pure_equal( *trv.get_surface() ) ) return pclu; // Require that track is in bounds if surface is bounded. CrossStat xstat =_psrf->status(trv); if ( (! _psrf->is_pure()) && (! xstat.in_bounds()) ) return pclu; // calculate phiz. double phiz = trv.get_vector()(0) + _stereo*trv.get_vector()(1) + _dphiz*gauss(); // construct cluster double radius = _psrf->get_parameter(SurfCylinder::RADIUS); pclu = new ClusCylPhiZ( radius, phiz, _dphiz, _stereo ); return pclu; } //**********************************************************************