// Layer.cpp #include "Layer.h" #include "trfbase/Hit.h" #include "trfbase/Miss.h" using std::ostream; using trf::ClusterList; using trf::LayerStat; using trf::LTrack; using trf::Layer; // Assertion arguments. // Set false to enable assertions. static bool GET_CLUSTERS_HAS_NO_CLUSTERS = false; static bool GET_CLUSTERS_SURFACE_HAS_NO_CLUSTERS = false; static bool ADD_CLUSTER_HAS_NO_CLUSTERS = false; static bool ADD_CLUSTER_SURFACE_HAS_NO_CLUSTERS = false; static bool DROP_CLUSTERS_HAS_NO_CLUSTERS = false; //********************************************************************** // Free functions. //********************************************************************** namespace { // Creator. ObjPtr create_Layer(const ObjData& data) { return ObjPtr(0); } } //********************************************************************** // Member functions. //********************************************************************** // constructor Layer::Layer() { } //********************************************************************** // destructor Layer::~Layer() { } //********************************************************************** // Return the creator. ObjCreator Layer::get_creator() { return create_Layer; } //********************************************************************** // Subclasses call this method if they are passed an invalid // surface. void Layer::report_invalid_surface(SurfacePtr psrf) const { } //********************************************************************** // propagate a track to the first surface in this layer void Layer::propagate(const ETrack& tre, const Propagator& prop, LTrackList& ltracks) const { LayerStat lstat(*this); LTrack trl(tre,lstat); propagate(trl, prop, ltracks); } //********************************************************************** // propagate a track to the next surface in this layer void Layer::propagate(const LTrack& trl, const Propagator& prop, LTrackList& ltracks) const { // Check that the status corresponds to this layer. // If not, crash or return an empty list. const Layer* plyr = &trl.get_status().get_layer(); assert( plyr == this ); if ( plyr != this ) { ltracks.erase(ltracks.begin(), ltracks.end()); return; } // propagate _propagate(trl, prop, ltracks); // Check status still points to this layer. // If not, crash or return an empty list. plyr = &trl.get_status().get_layer(); assert( plyr == this ); if ( plyr != this ) { ltracks.erase(ltracks.begin(), ltracks.end()); return; } } //********************************************************************** // Return the list of active surfaces -- i.e. surfaces associated // with clusters. These should include surfaces in sublayers. // Default method reports no surfaces. Layer::SurfaceList Layer::get_cluster_surfaces() const { return SurfaceList(); } //********************************************************************** // Return all the clusters associated with the current layer // or its descendants. // Default is to return an empty list. ClusterList Layer::get_clusters() const { assert( GET_CLUSTERS_HAS_NO_CLUSTERS ); return ClusterList(); } //********************************************************************** // Return all the clusters associated with a particular surface in // the current layer or its descendants. // Default is to return an empty list. ClusterList Layer::get_clusters(SurfacePtr psrf) const { report_invalid_surface(psrf); assert( GET_CLUSTERS_SURFACE_HAS_NO_CLUSTERS ); return ClusterList(); } //********************************************************************** // Add a cluster to the layer. int Layer::add_cluster(const ClusterPtr& pclu) { assert( ADD_CLUSTER_HAS_NO_CLUSTERS ); return -1; } //********************************************************************** // Add a cluster to asurface in the layer. int Layer::add_cluster(const ClusterPtr& pclu, SurfacePtr psrf) { report_invalid_surface(psrf); assert( ADD_CLUSTER_SURFACE_HAS_NO_CLUSTERS ); return -1; } //********************************************************************** // Drop all clusters from this layer. void Layer::drop_clusters() { if ( has_clusters() ) assert( DROP_CLUSTERS_HAS_NO_CLUSTERS ); } //********************************************************************** // External functions. //********************************************************************** // output stream ostream& trf::operator<<(ostream& stream, const Layer& lyr) { lyr.ostr(stream); return stream; } //**********************************************************************