// McTrack.hpp #ifndef gtr_McTrack_H #define gtr_McTrack_H // This class describes a propagated Monte Carlo track. // It is made up of a set of McTrackStates along the trajectory // of the track. // // We use a set to guarantee ordering in s. // // The first state is the start of the trajectory (production // or entering detector volume) and the last is the end of the // trajectory (decay or volume exit). // // The VTrack's represent the changing state of the track. // // Users may fetch the entire set of states or may request the // state at a specified surface. // #include #include #include "McTrackState.hpp" #include "McParent.hpp" class McTrack { public: // typedefs // Set of track states. typedef std::set StateList; private: // attributes // Version number int _version; // List of states. StateList _states; // MC Particle Id // Id of the MC particle which created the states of this track int _mctrackid; // PDG particle type int _pdgid; // Particle Parentage // Packed word containing information about particles heritage int _parentword; private: // methods // Return the iterator for the first matching state. // Return end if there is no match. StateList::const_iterator find(const trf::Surface& srf) const; public: // methods // Default constructor. // Leaves object in invalid state. McTrack(); // Constructor from a list of states, the MC Track ID, and a // packed parent word (see gtrbase/McParent). // Size must be nonzero and all states must be valid or // assertion is thrown and all states are discarded. McTrack(const StateList& states, int mcid, int parentword, int pdgid=13); // Destructor ~McTrack(); // Return if object is valid (has one or more states). bool is_valid() const { return _states.size(); } // Fetch the list of states. const StateList& get_states() const { return _states; }; // Return whether a surface can be matched. bool has_surface(const trf::Surface& srf) const; // Return the state for a particular surface. // The first match is returned. // Surface bounds are not required to match. // A reference to an invalid state is returned if the surface // cannot be matched. const McTrackState& get_state(const trf::Surface& srf) const; //Return the MC Id for the Track creating this track's states int get_mctrackid() const; //Return the PDG particle Id for the Track creating this track's states int get_pdgid() const; //Return the parentage of this particle McParent get_parent() const; }; // Output stream. std::ostream& operator<<(std::ostream& stream, const McTrack& rhs); // Equality. bool operator==(const McTrack& lhs, const McTrack& rhs); // Inequality. bool operator!=(const McTrack& lhs, const McTrack& rhs); #endif