// Hit.cpp #include "Hit.h" #include "ETrack.h" #include "Surface.h" using std::ostream; using trf::Cluster; using trf::Hit; using trf::ClusterPtr; using trf::McIdList; using trf::HitList; using trf::Surface; using trf::ETrack; //********************************************************************** // Free functions. //********************************************************************** namespace { // Surface creators. ObjPtr create_Hit(const ObjData& data) { return ObjPtr(0); } ObjPtr create_Cluster(const ObjData& data) { return ObjPtr(0); } } //********************************************************************** // Empty list for default implementation of method to return MC ID's. namespace { McIdList empty_mc_id_list; } //********************************************************************** // Cluster //********************************************************************** // constructor Cluster::Cluster( ) { } //********************************************************************** // copy constructor Cluster::Cluster( const Cluster& clus ) { } //********************************************************************** // destructor Cluster::~Cluster( ) { } //********************************************************************** // Return the creator. ObjCreator Cluster::get_creator() { return create_Cluster; } //********************************************************************** // Return the ID's of MC tracks contributing to this cluster. const McIdList& Cluster::get_mc_ids() const { return empty_mc_id_list; } //********************************************************************** // Generate and return the predictions for a track. HitList Cluster::predict(const ETrack& tre) const { // use virtual method to fetch list HitList hits = _predict(tre); // assign the parent cluster for each prediction // we must cast away const to do this HitList::iterator ihit; for ( ihit=hits.begin(); ihit!=hits.end(); ++ihit ) { Hit* mutable_hit_ptr = (Hit*) (*ihit).pointer(); mutable_hit_ptr->set_parent_pointer(this); } return hits; } //********************************************************************** bool Cluster::operator==( const Cluster& rhs ) const { if ( get_type() != rhs.get_type() ) return false; return equal(rhs); } //********************************************************************** ostream& trf::operator<<(ostream& stream, const Cluster& clus) { clus.ostr( stream ); return stream; } //********************************************************************** // Hit //********************************************************************** // constructor Hit::Hit( ) : _pclus (0) { } //********************************************************************** // copy constructor Hit::Hit(const Hit& hit) : _pclus(hit._pclus) { } //********************************************************************** // destructor Hit::~Hit( ) { } //********************************************************************** // Register the parent cluster. // This should only be called once. void Hit::set_parent_pointer(const ClusterPtr& pclus) { assert( _pclus == 0 || _pclus == pclus ); _pclus = pclus; } //********************************************************************** // Return the creator. ObjCreator Hit::get_creator() { return create_Hit; } //********************************************************************** // Return the parent cluster surface. const Surface& Hit::get_surface() const { return get_cluster()->get_surface(); } //********************************************************************** bool Hit::operator==( const Hit& rhs) const { if ( get_type() != rhs.get_type() ) return false; if ( *get_cluster() != *rhs.get_cluster() ) return false; return equal(rhs); } //********************************************************************** ostream& trf::operator<<(ostream& stream, const Hit& hit) { hit.ostr( stream ); return stream; } //**********************************************************************