Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:30:09

0001 #ifndef TrackingAnalysis_EncodedTruthId_h
0002 #define TrackingAnalysis_EncodedTruthId_h
0003 
0004 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
0005 #include <iosfwd>
0006 
0007 class EncodedTruthId : public EncodedEventId {
0008   friend std::ostream &operator<<(std::ostream &os, const EncodedTruthId &id);
0009 
0010 public:
0011   // Constructors
0012   EncodedTruthId();
0013   EncodedTruthId(EncodedEventId eid, int index);
0014 
0015   // Getters
0016   int index() const { return index_; }
0017 
0018   // Operators
0019   int operator==(const EncodedTruthId &id) const {
0020     if (EncodedEventId::operator==(id)) {
0021       return index_ == id.index_;
0022     } else {
0023       return EncodedEventId::operator==(id);
0024     }
0025   }
0026 
0027   int operator!=(const EncodedTruthId &id) const { return !(operator==(id)); }
0028 
0029   int operator<(const EncodedTruthId &id) const {
0030     if (EncodedEventId::operator==(id)) {
0031       return index_ < id.index_;
0032     } else {
0033       return (EncodedEventId::operator<(id));
0034     }
0035   }
0036 
0037 private:
0038   int index_;
0039 };
0040 
0041 std::ostream &operator<<(std::ostream &os, EncodedTruthId &id);
0042 
0043 #endif