CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/SimGeneral/TrackingAnalysis/interface/EncodedTruthId.h

Go to the documentation of this file.
00001 #ifndef TrackingAnalysis_EncodedTruthId_h
00002 #define TrackingAnalysis_EncodedTruthId_h
00003 
00004 #include <iosfwd>
00005 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
00006 
00007 class EncodedTruthId : public EncodedEventId
00008 {
00009 
00010     friend std::ostream& operator<< (std::ostream& os, const EncodedTruthId & id);
00011 
00012 public:
00013 
00014 // Constructors
00015     EncodedTruthId();
00016     EncodedTruthId(EncodedEventId eid, int index);
00017 
00018 // Getters
00019     int index() const
00020     {
00021         return index_;
00022     }
00023 
00024 // Operators
00025     int operator==(const EncodedTruthId& id) const
00026     {
00027         if (EncodedEventId::operator==(id))
00028         {
00029             return index_ == id.index_;
00030         }
00031         else
00032         {
00033             return EncodedEventId::operator==(id);
00034         }
00035     }
00036 
00037     int operator!=(const EncodedTruthId& id) const
00038     {
00039         return !(operator==(id));
00040     }
00041 
00042     int operator<( const EncodedTruthId& id) const
00043     {
00044         if (EncodedEventId::operator==(id))
00045         {
00046             return index_ < id.index_;
00047         }
00048         else
00049         {
00050             return (EncodedEventId::operator<(id));
00051         }
00052     }
00053 
00054 private:
00055     int index_;
00056 };
00057 
00058 std::ostream& operator<<(std::ostream & os , EncodedTruthId& id);
00059 
00060 #endif