// LayerStatChain.h #ifndef LayerStatChain_H #define LayerStatChain_H // This class maintains a list of LayerStat objects, a pointer to // the current such object and a pointer to the cluster status. // The cluster status is the one holding the relevant cluster list // and miss. // // These chains are constructed and modified by class LTrack. // // Class LTrack is a friend so it can manipulate the chain and // iterators though private accessor methods. // // The only public methods are the destructor and methods to return // the cluster list and miss. // #include #include #include #include "LayerStat.h" #include "trfbase/Hit.h" namespace trf { class LTrack; class CutRecord; class ClusterContainer; class LayerStatChain; // Output stream. std::ostream& operator<<(std::ostream& stream, const LayerStatChain& rhs); class LayerStatChain { friend class LTrack; private: // typedefs // chain of LayerStat objects typedef std::vector StatList; public: // typedefs // Iterator for the objects in the chain. typedef StatList::const_iterator Iterator; private: // attributes // chain StatList _stats; // current stats StatList::iterator _istat_current; // cluster status StatList::iterator _istat_cluster; private: // methods // output stream void ostr(std::ostream& stream) const; // constructor from a layer status // current status is set, cluster status is left unset LayerStatChain(const LayerStat& lstat); // return if the current status is set bool current_status_is_valid() const; // return the cluster status LayerStat& get_cluster_status() const; public: // methods // default constructor LayerStatChain(); // copy constructor LayerStatChain(const LayerStatChain& rhs); // assignment operator LayerStatChain& operator=(const LayerStatChain& rhs); // destructor ~LayerStatChain(); // Is the cluster status set? bool cluster_status_is_valid() const; // Is the cluster status at the first element of the list? bool cluster_status_at_first() const; // Is the cluster status at the last element of the list? // (Last real entry -- not stl end().) bool cluster_status_at_last() const; // return the current status LayerStat& get_current_status() const; // Are there clusters associated with this chain? bool has_clusters() const; // return the list of clusters ClusterList get_clusters() const; // return the list of clusters near a track and generate CutRecords. const ClusterContainer& get_clusters(const ETrack& tre, const CutRecord* pcut_record, std::map* precs) const; // Is there a miss associated with this chain? bool has_miss() const; // Return the miss. // Use get_miss()->new_copy() to get a mutable copy of the miss. MissPtr get_miss() const; // Return the begin and end const iterators for the layer stat chain // so users can examine the contents. // This iterator can be used like and std const iterator. Iterator begin() const; Iterator end() const; // Output stream. friend std::ostream& operator<<(std::ostream& stream, const LayerStatChain& rhs); }; } // end namespace trf #endif