// HitZPlane1Generator.cpp #include "HitZPlane1Generator.h" #include #include "HitZPlane1.h" #include "trfbase/VTrack.h" #include "trfutil/trfstream.h" using namespace trf; //********************************************************************** // output stream void HitZPlane1Generator::ostr(ostream& stream) const { stream << begin_object ; stream << "Surface: " << _szp << new_line; stream << "X slope: " << _wx <<" Y slope: " << _wy<< new_line; stream << "Measurement error (daxy): " << _daxy << new_line; RandomGenerator::raw_ostr(stream); stream << end_object; } //********************************************************************** // Constructor. HitZPlane1Generator:: HitZPlane1Generator(double zpos,double wx, double wy, double daxy ) : HitGenerator(), _szp(zpos), _wx(wx), _wy(wy), _daxy(daxy) { assert( _daxy >= 0.0 ); } //********************************************************************** // Constructor with seed. HitZPlane1Generator::HitZPlane1Generator( double zpos,double wx, double wy, double daxy, long seed) : HitGenerator(seed), _szp(zpos), _wx(wx), _wy(wy), _daxy(daxy) { assert( _daxy >= 0.0 ); } //********************************************************************** // Copy constructor. HitZPlane1Generator::HitZPlane1Generator(const HitZPlane1Generator& rhs) : HitGenerator(rhs), _szp(rhs._szp), _wx(rhs._wx), _wy(rhs._wy), _daxy(rhs._daxy) { assert( _daxy >= 0.0 ); } //********************************************************************** // Destructor. HitZPlane1Generator::~HitZPlane1Generator() { } //********************************************************************** // Generate a new cluster. // Caller must delete. // Return 0 for failure. Cluster* HitZPlane1Generator::new_cluster(const VTrack& trv) { // Create cluster pointer. Cluster* pclu = 0; // Check track has been propagated to the surface. assert( _szp.pure_equal( *trv.get_surface() ) ); if ( ! _szp.pure_equal( *trv.get_surface() ) ) return pclu; // calculate axy. double x_track = trv.get_vector()(SurfZPlane::IX); double y_track = trv.get_vector()(SurfZPlane::IY); double axy = _wx*x_track + _wy*y_track + _daxy*gauss(); // construct cluster double zpos = _szp.get_parameter(SurfZPlane::ZPOS); pclu = new ClusZPlane1(zpos, _wx, _wy, axy, _daxy ); return pclu; } //**********************************************************************