// HitCylPhiGenerator.cpp #include "HitCylPhiGenerator.h" #include #include "trfutil/trfstream.h" #include "HitCylPhi.h" #include "trfbase/VTrack.h" #include "trfbase/CrossStat.h" using namespace trf; //********************************************************************** // output stream void HitCylPhiGenerator::ostr(ostream& stream) const { stream << begin_object; stream << "Surface: " << get_surface() << new_line; stream << "Measurement error (dphi): " << _dphi << new_line; RandomGenerator::raw_ostr(stream); stream << end_object; } //********************************************************************** // Constructor. HitCylPhiGenerator:: HitCylPhiGenerator(const SurfCylinder& srf, double dphi) : HitGenerator(), _psrf(srf.new_surface()), _dphi(dphi) { assert( _dphi >= 0.0 ); } //********************************************************************** // Constructor with seed. HitCylPhiGenerator:: HitCylPhiGenerator(const SurfCylinder& srf, double dphi, long seed) : HitGenerator(seed), _psrf(srf.new_surface()), _dphi(dphi) { assert( _dphi >= 0.0 ); } //********************************************************************** // Copy constructor. HitCylPhiGenerator::HitCylPhiGenerator(const HitCylPhiGenerator& rhs) : HitGenerator(rhs), _psrf(rhs._psrf), _dphi(rhs._dphi) { assert( _dphi >= 0.0 ); } //********************************************************************** // Destructor. HitCylPhiGenerator::~HitCylPhiGenerator() { } //********************************************************************** // Generate a new cluster. // Caller must delete. // Return 0 for failure. Cluster* HitCylPhiGenerator::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 phi. double phi = trv.get_vector()(0) + _dphi*gauss(); // construct cluster double radius = _psrf->get_parameter(SurfCylinder::RADIUS); pclu = new ClusCylPhi( radius, phi, _dphi ); return pclu; } //**********************************************************************