#ifndef OAEVENT_ITRACKIDMAP_HXX #define OAEVENT_ITRACKIDMAP_HXX #include #include namespace COMET { class ITrackIDMap; } /// Class to store mapping from generated track IDs to input track IDs class COMET::ITrackIDMap:public COMET::IDatum{ public: ITrackIDMap(int minNew=0, const char* name="TrackID_Mapping") :IDatum(name), fMinNewTrkID(minNew) {}; typedef std::map TrackIDMapping; /// Set the minimum ID for any new track IDs /// This should correspond to the largest found track ID in the previous /// section (i.e. read in from an input file). void SetMinNewTrackID(int newValue) {fMinNewTrkID = newValue;}; /// Get const int GetMinNewTrkID()const {return fMinNewTrkID;}; /// Add an explict mapping to the track ID map. void Add(int oldID, int newID) {fNewToGlobal[oldID] = newID;}; /// Check if the mapping exists. /// If no mapping exists, create a new track ID for this ID. int Get(int oldID) { if (oldID == 0) return oldID; if (fNewToGlobal.find(oldID) == fNewToGlobal.end()) { fNewToGlobal[oldID] = oldID + fMinNewTrkID; } return fNewToGlobal[oldID]; } virtual void ls(Option_t* opt = "") const; private: TrackIDMapping fNewToGlobal; int fMinNewTrkID; ClassDef(ITrackIDMap,1) }; #endif // OAEVENT_ITRACKIDMAP_HXX