// GTrack.hpp #ifndef GTrack_H #define GTrack_H // This class describes a global track consisting of a list of states // which specify the fit and hit or miss at different points along // the track trajectory. See GTrackState.h for a more complete // description of the states. // // Global track chunks contain object of this type. This class is // not directly persistent unde D0OM. // #include #include #include #include "ptr/Ptr.h" #include "trfbase/PropagatorPtr.h" #include "GTrackState.hpp" #define GTrack_holds_chunk_id #ifdef GTrack_holds_chunk_id #include "identifiers/ChunkID.hpp" #include "edm/LinkIndex.hpp" #endif class GTrack { public: // embedded classes // Comparison for states. // States are ordered by s and are considered equal if they // have the same s. class StateCompare { public: bool operator()(const GTrackState& lhs, const GTrackState& rhs) const { return lhs.s() < rhs.s(); } }; public: // static attributes // Minimum and maximum values for s. // All states should have values in the range SMIN <= s <= SMAX. static const double SMIN; static const double SMAX; public: // typedefs // list of cluster indices typedef std::vector ClusterList; // list of states typedef std::set StateList; private: // static attributes // propagator static trf::PropagatorPtr _pprop; private: // attributes // Flag indicating the track is valid. // This set false for the default constructor. bool _valid; // List of states. StateList _states; // ID of the chunk holding this track. edm::ChunkID _cid; // Object ID within the chunk. unsigned int _oid; public: // methods // Default constructor. // Puts track into invalid state. GTrack(); // Constructor from a list of states. // Track is set valid if all states meet the following: // 1. have SMIN <= s <= SMAX // 2. are valid // 3. have valid fits (not INVALID) GTrack(const StateList& states); // destructor ~GTrack(); // Drop the fit for the state at the specified s. // Returns 0 for success. int drop_fit(double s); // Is the track valid? bool is_valid() const { return _valid; } // Fetch the list of states. const StateList& get_states() const { return _states; } // Return a state at an s. // Return an invalid state is there is no state at that s. const GTrackState& get_state(double s) const; // Return the existing state at a particular surface. // The first match with s1 < s < s2 is returned. // A reference to an invalid state is returned if the surface // cannot be matched. // Surface bounds are not required to match. const GTrackState& get_state(const trf::SurfacePtr& psrf, double s1 =SMIN, double s2 =SMAX) const; // Return the number of measurements in the fit for this track int get_num_measurements() const; #ifdef GTrack_holds_chunk_id // Set the chunk and object ID's. void set_ids(edm::ChunkID cid, unsigned int oid); // Return a LinkIndex constructed from this object and its // chunk and object ID's. edm::LinkIndex index() const; #endif }; // output stream std::ostream& operator<<(std::ostream& stream, const GTrack& gtr); // equality bool operator==(const GTrack& lhs, const GTrack& rhs); // inequality bool operator!=(const GTrack& lhs, const GTrack& rhs); #endif