CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/DataFormats/HcalDetId/interface/HcalFrontEndId.h

Go to the documentation of this file.
00001 #ifndef HcalFrontEndId_h
00002 #define HcalFrontEndId_h
00003 
00004 #include <string>
00005 #include <stdint.h>
00006 #include <iosfwd>
00007 
00008 class HcalFrontEndId {
00009  public:
00010   HcalFrontEndId() : hcalFrontEndId_(0) {}
00011   HcalFrontEndId(uint32_t id) {hcalFrontEndId_=id;};
00012   HcalFrontEndId(const std::string& rbx,int rm,int pixel,int rmfiber,int fiberchannel,int qiecard,int adc);
00013   ~HcalFrontEndId();
00014   uint32_t rawId() const {return hcalFrontEndId_;}
00015 
00016   // index which uniquely identifies an RBX within HCAL
00017   int rbxIndex() const {return (hcalFrontEndId_>>18);}
00018   static const int maxRbxIndex=0xFF;
00019   // index which uniquely identifies an RM (e.g. HPD) within HCAL
00020   int rmIndex() const {return ((rm()-1)&0x3)+(rbxIndex()<<2);}
00021   static const int maxRmIndex=0x3FF;
00022 
00023   bool null() const { return hcalFrontEndId_==0; }
00024 
00025   std::string rbx() const;
00026   int rm() const {return ((hcalFrontEndId_>>15)&0x7)+1;}
00027   int pixel() const {return (hcalFrontEndId_>>10)&0x1F;}
00028   int rmFiber() const {return ((hcalFrontEndId_>>7)&0x7)+1;}
00029   int fiberChannel() const {return (hcalFrontEndId_>>5)&0x3;}
00030   int qieCard() const {return ((hcalFrontEndId_>>3)&0x3)+1;}
00031   int adc() const {return (hcalFrontEndId_&0x7)-1;}
00032 
00033   int operator==(const HcalFrontEndId& id) const { return id.hcalFrontEndId_==hcalFrontEndId_; }
00034   int operator!=(const HcalFrontEndId& id) const { return id.hcalFrontEndId_!=hcalFrontEndId_; }
00035   int operator<(const HcalFrontEndId& id) const { return hcalFrontEndId_<id.hcalFrontEndId_; }
00036 
00037  private:
00038   uint32_t hcalFrontEndId_;
00039 };
00040 
00041 std::ostream& operator<<(std::ostream&,const HcalFrontEndId& id);
00042 
00043 #endif
00044