// HTrack.h #ifndef HTrack_H #define HTrack_H // This class describes a track as an ordered list of hits plus // an ETrack (fitted vector and error matrix at a surface) and // the fit chi-square. // // Hits are ordered as they were fit. // // The access to the list of hits is minimal. Users are expected to // construct a new object to do more than update the fit or add a // hit to the end of the list. // // The method is_fit returns true if the track has been fit with all its hits. // This state is set by calling set_fit and is unset when hits are added. // No hits are required to be on the track (so one can store a fit without // any hits). // #include "ref_count/RefCounter.hpp" #include "trfbase/ETrack.h" #include "trfbase/Hit.h" #include "trfbase/Propagator.h" #include "TrackMcHitInfo.h" namespace trf { class Surface; class PropStat; class PropDir; class HTrack; // friend output stream std::ostream& operator<<(std::ostream& stream, const HTrack& trh); class HTrack : public RefCounter { private: // Number of hits used in the current fit. // -1 for a track which has never been fit int _nfit; protected: // list of hits HitList _hits; // fitted track (or starting track) ETrack _tre; // fit chi-square double _chisq; protected: // output stream called from subclass virtual void ostr(std::ostream& stream) const; public: // Default constructor (for STL) HTrack(); // Constructor specifying the starting track. // There are no hits on the track. HTrack(const ETrack& tre); // Destructor. virtual ~HTrack(); // Add a hit to the back of the list. virtual void add_hit(const HitPtr& phit); // Drop the last hit on the list. virtual void drop_hit(); // Drop all hits. virtual void drop_hits(); // Set the fit parameters for the current list of hits. // Be sure to add all relevant hits before invocation. // It is assumed the track has been fit with all of its hits. void set_fit(const ETrack& tre, double chisq); // Unset the fit. void unset_fit(); // Unset the fit and reset the starting track. void unset_fit(const ETrack& tre); // Fetch the list of hits. const HitList& get_hits() const { return _hits; }; // Fetch the fit track. const ETrack& get_track() const { return _tre; }; // Fetch the chi-square. double get_chi_square() const { return _chisq; }; //Fetch the number of measurements on this track int get_num_meas() const; //Return the MC track information for hits on this track TrackMcHitInfo get_mcinfo() const; // Return the ID's of the intersection of the MC tracks contributing // to the clusters on this track. McIdList get_mc_ids() const; // Return the fit status: true if track has one or more hits // and has been fit with all of its hits. bool is_fit() const { return _tre.is_valid() && ( _nfit == _hits.size() ); } // propagate the fit track PropStat propagate(const Propagator& prop, const Surface& srf); // propagate the fit track in a specified direction PropStat propagate(const Propagator& prop, const Surface& srf, Propagator::PropDir dir); // friend output stream friend std::ostream& operator<<(std::ostream& stream, const HTrack& trh); }; } // end namespace trf // Equality. // Same hits, ETrack, chi_square and is_fit(). bool operator==(const trf::HTrack& lhs, const trf::HTrack& rhs); // Inequality. // Opposite of above. bool operator!=(const trf::HTrack& lhs, const trf::HTrack& rhs); #endif