CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/DataFormats/HcalDetId/interface/CastorElectronicsId.h

Go to the documentation of this file.
00001 #ifndef DATAFORMATS_HCALDETID_CASTORELECTRONICSID_H
00002 #define DATAFORMATS_HCALDETID_CASTORELECTRONICSID_H 1
00003 
00004 #include <string>
00005 #include <ostream>
00006 #include <stdint.h>
00007 
00020 class CastorElectronicsId {
00021 public:
00023   CastorElectronicsId();
00024   CastorElectronicsId(uint32_t);
00025   CastorElectronicsId(int fiberChan, int fiberIndex, int spigot, int dccid);
00026   CastorElectronicsId(int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb);
00027   uint32_t operator()() { return castorElectronicsId_; }
00028 
00029   uint32_t rawId() const { return castorElectronicsId_; }
00030 
00031   bool isTriggerChainId() const { return (castorElectronicsId_&0x02000000)!=0; }
00032 
00033   void setHTR(int crate, int slot, int tb);
00034   int fiberChanId() const { return castorElectronicsId_&0x3; }
00035   int fiberIndex() const { return ((castorElectronicsId_>>2)&0xf)+1; }
00036   int slbChannelIndex() const { return castorElectronicsId_&0x3; }
00037   int slbSiteNumber() const { return ((castorElectronicsId_>>2)&0xf)+1; }
00038 
00039   std::string slbChannelCode() const;
00040 
00041   int htrChanId() const { return (fiberChanId()+1)+((fiberIndex()-1)*3); }
00042   int spigot() const { return (castorElectronicsId_>>6)&0xF; }
00043   int dccid() const { return (castorElectronicsId_>>10)&0xF; }
00044   int htrSlot() const { return (castorElectronicsId_>>14)&0x1F; }
00045   int htrTopBottom() const { return (castorElectronicsId_>>19)&0x1; }
00046   int readoutVMECrateId() const { return (castorElectronicsId_>>20)&0x1F; }
00047   int linearIndex() const { return (castorElectronicsId_)&0x3FFF; }
00048 
00049   static const int maxLinearIndex = 0x3FFF;
00050   static const int maxDCCId = 15;
00051   
00053   int operator==(const CastorElectronicsId& id) const { return id.castorElectronicsId_==castorElectronicsId_; }
00054   int operator!=(const CastorElectronicsId& id) const { return id.castorElectronicsId_!=castorElectronicsId_; }
00056   int operator<(const CastorElectronicsId& id) const { return castorElectronicsId_<id.castorElectronicsId_; }
00057 
00058 private:
00059   uint32_t castorElectronicsId_;
00060 };
00061 
00062 std::ostream& operator<<(std::ostream&,const CastorElectronicsId&);
00063 
00064 
00065 #endif