CMS 3D CMS Logo

CastorElectronicsId.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_HCALDETID_CASTORELECTRONICSID_H
2 #define DATAFORMATS_HCALDETID_CASTORELECTRONICSID_H 1
3 
4 #include <string>
5 #include <ostream>
6 #include <cstdint>
7 
21 public:
24  CastorElectronicsId(uint32_t);
25  CastorElectronicsId(int fiberChan, int fiberIndex, int spigot, int dccid);
26  CastorElectronicsId(int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb);
27  uint32_t operator()() { return castorElectronicsId_; }
28 
29  uint32_t rawId() const { return castorElectronicsId_; }
30 
31  bool isTriggerChainId() const { return (castorElectronicsId_&0x02000000)!=0; }
32 
33  void setHTR(int crate, int slot, int tb);
34  int fiberChanId() const { return castorElectronicsId_&0x3; }
35  int fiberIndex() const { return ((castorElectronicsId_>>2)&0xf)+1; }
36  int slbChannelIndex() const { return castorElectronicsId_&0x3; }
37  int slbSiteNumber() const { return ((castorElectronicsId_>>2)&0xf)+1; }
38 
40 
41  int htrChanId() const { return (fiberChanId()+1)+((fiberIndex()-1)*3); }
42  int spigot() const { return (castorElectronicsId_>>6)&0xF; }
43  int dccid() const { return (castorElectronicsId_>>10)&0xF; }
44  int htrSlot() const { return (castorElectronicsId_>>14)&0x1F; }
45  int htrTopBottom() const { return (castorElectronicsId_>>19)&0x1; }
46  int readoutVMECrateId() const { return (castorElectronicsId_>>20)&0x1F; }
47  int linearIndex() const { return (castorElectronicsId_)&0x3FFF; }
48 
49  static const int maxLinearIndex = 0x3FFF;
50  static const int maxDCCId = 15;
51 
53  int operator==(const CastorElectronicsId& id) const { return id.castorElectronicsId_==castorElectronicsId_; }
54  int operator!=(const CastorElectronicsId& id) const { return id.castorElectronicsId_!=castorElectronicsId_; }
56  int operator<(const CastorElectronicsId& id) const { return castorElectronicsId_<id.castorElectronicsId_; }
57 
58 private:
60 };
61 
62 std::ostream& operator<<(std::ostream&,const CastorElectronicsId&);
63 
64 
65 #endif
int readoutVMECrateId() const
std::ostream & operator<<(std::ostream &, const CastorElectronicsId &)
static const int maxLinearIndex
void setHTR(int crate, int slot, int tb)
static const int maxDCCId
std::string slbChannelCode() const
static int slbChan(const HcalTriggerPrimitiveSample &theSample)
int operator!=(const CastorElectronicsId &id) const
uint32_t rawId() const
bool isTriggerChainId() const
int operator==(const CastorElectronicsId &id) const
Readout chain identification for Castor Bits for the readout chain : some names need change! [31:26] ...
int slbChannelIndex() const
int operator<(const CastorElectronicsId &id) const
Compare the id to another one for use in a map.