CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/DataFormats/HcalDetId/interface/HcalElectronicsId.h

Go to the documentation of this file.
00001 #ifndef DATAFORMATS_HCALDETID_HCALELECTRONICSID_H
00002 #define DATAFORMATS_HCALDETID_HCALELECTRONICSID_H 1
00003 
00004 #include <string>
00005 #include <ostream>
00006 #include <stdint.h>
00007 
00019 class HcalElectronicsId {
00020 public:
00022   HcalElectronicsId();
00024   HcalElectronicsId(uint32_t);
00026   HcalElectronicsId(int fiberChan, int fiberIndex, int spigot, int dccid);
00028   HcalElectronicsId(int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb);
00029   uint32_t operator()() { return hcalElectronicsId_; }
00030 
00031   uint32_t rawId() const { return hcalElectronicsId_; }
00032 
00033   bool isTriggerChainId() const { return (hcalElectronicsId_&0x02000000)!=0; }
00034 
00036   void setHTR(int crate, int slot, int tb);
00037 
00039   int fiberChanId() const { return hcalElectronicsId_&0x3; }
00041   int fiberIndex() const { return ((hcalElectronicsId_>>2)&0x7)+1; }
00043   int slbChannelIndex() const { return hcalElectronicsId_&0x3; }
00045   int slbSiteNumber() const { return ((hcalElectronicsId_>>2)&0x7); }
00046 
00048   std::string slbChannelCode() const;
00049 
00051   int htrChanId() const { return (fiberChanId()+1)+((fiberIndex()-1)*3); }
00053   int spigot() const { return (hcalElectronicsId_>>5)&0xF; }
00055   int dccid() const { return (hcalElectronicsId_>>9)&0x1F; }
00057   int htrSlot() const { return (hcalElectronicsId_>>14)&0x1F; }
00059   int htrTopBottom() const { return (hcalElectronicsId_>>19)&0x1; }
00061   int readoutVMECrateId() const { return (hcalElectronicsId_>>20)&0x1F; }
00063   int linearIndex() const { return (hcalElectronicsId_)&0x3FFF; }
00064 
00065   static const int maxLinearIndex = 0x3FFF;
00066   static const int maxDCCId = 31;
00067   
00069   int operator==(const HcalElectronicsId& id) const { return id.hcalElectronicsId_==hcalElectronicsId_; }
00071   int operator!=(const HcalElectronicsId& id) const { return id.hcalElectronicsId_!=hcalElectronicsId_; }
00073   int operator<(const HcalElectronicsId& id) const { return hcalElectronicsId_<id.hcalElectronicsId_; }
00074 
00075 private:
00076   uint32_t hcalElectronicsId_;
00077 };
00078 
00079 std::ostream& operator<<(std::ostream&,const HcalElectronicsId&);
00080 
00081 
00082 #endif