// PTrack.h #ifndef PTrack_H #define PTrack_H // This class describes a track with an associated path, i.e. one in // the midst of path-based track finding. It consists of an MTtrack, // a path, and the layer status from the last propagation. #include #include #include "ptr/Ptr.h" #include "ptr/LocalSharedDeletePolicy.h" #include "trfutil/Tuple.h" #include "trffit/MTrack.h" #include "trflayer/LayerStatChain.h" #include "CandidateLayer.h" class CpuTimerTuple; namespace trf { class Path; class ETrack; class CutRecord; class PTrack; class TrfReportingObject; // Output stream. std::ostream& operator<<(std::ostream& stream, PTrack& trp); class PTrack : public RefCounter { public: // typedefs // list of candidate layers typedef std::list CandidateList; // Candidate layer iterator typedef CandidateList::const_iterator CandidateIterator; // Delete pointer for a PTrack typedef Ptr PTrackPtr; // list of PTrack's typedef std::list PTrackList; // PTrack list iterator typedef PTrackList::iterator PTrackIterator; private: // static attributes // contructor counter static int _count; // ntuple flag - set true to enable ntuple static bool _ltuple; public: // static methods // global enable of ntuple for this class static void enable_tuple() { _ltuple = true; }; // global disable of ntuple for this class static void disable_tuple() { _ltuple = false; }; // return global enable status static bool tuple_is_enabled() { return _ltuple; }; private: // attributes // path const Path& _path; // track MTrack _trm; // Status for the last layer propagation. LayerStatChain _chain; // Flag indicating track is stopped, i.e. can not be propagated further. // The track is at the exit of its layer and the path has a stop or // has no children. // set inside propagate // cleared with clear_stop() bool _stopped; // Flag indicating track has reached the end of a path. bool _end_of_path; // Pointer to ntuple. Zero means no ntuple. Tuple* _ptup; // unique identifier for this path int _id; // parent path id int _parent_id; // Cut record. CutRecord* _pcut_record; private: // methods // complete constructor PTrack(const Path& path, const MTrack& trm, const LayerStatChain& chain, Tuple* ptup, CutRecord* prec=0); // Hide the copy constructor. PTrack(const PTrack&); // Hide the assignment operator. PTrack& operator=(const PTrack&); // apply checkers and return true if all pass bool check(); // apply post checkers and return true if all pass bool post_check(); // output stream void ostr(std::ostream& stream); // Assign the cut record. void assign_cut_record(); public: // methods // constructor from starting path and track PTrack(const Path& path, const ETrack& tre); // constructor from starting path and track with hits and misses PTrack(const Path& path, const MTrack& trm); // destructor ~PTrack(); // Fetch the track. const MTrack& get_track() const { return _trm; }; // Fetch the track. MTrack& get_mutable_track() { return _trm; }; // Fetch the path. const Path& get_path() const { return _path; }; // Fetch the layer status chain. const LayerStatChain& get_status_chain() { return _chain; }; // Return new tracks propagated to the next surface in the current // layer or the first surface in the next layer(s). // debug - true to display debugging messages. // Ptimer - nonzero to record timing // prep - nonzero to send messages to this reporter PTrackList propagate(bool debug=false, CpuTimerTuple* ptimer=0, const TrfReportingObject* prep =0) const; // Unset the stopped flag if the path has children. void clear_stop(); // return whether the track is stopped (i.e. path has a stop, // track is at exit of layer and filters have not beeen run. bool is_stopped() const { return _stopped; }; // Check if track is at the end of its path. // If the we are at the exit of the layer and the track has // no children or is has its end flag set, then set the // end of path flag. // The end of path flag is returned. // This method should be called after propagation bool check_end_of_path(); // Return whether a track is at a path endpoint as indicated // by its endpoint flag. // Use check_end_of_path to set the flag. bool at_end_of_path() const { return _end_of_path; }; // Create an ntuple for this Ptrack and all its copies. // Return 0 for success. int set_tuple(const char* name); // Return the ntuple Tuple* get_tuple() const { return _ptup; }; // return true if ntuple is defined and enabled bool tuple_is_active() const { return _ptup && tuple_is_enabled(); }; // Return the track id. int get_id() const { return _id; }; // Set the parent track id. void set_parent_id(int id); // Return the parent track id. int get_parent_id() const { return _parent_id; }; // Return the cut record. CutRecord* get_cut_record() const { return _pcut_record;} public: // friends // Output stream. friend std::ostream& operator<<(std::ostream& stream, PTrack& trp); }; } // end namespace trf #endif