CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalElectronicsId.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_HCALDETID_HCALELECTRONICSID_H
2 #define DATAFORMATS_HCALDETID_HCALELECTRONICSID_H 1
3 
4 #include <string>
5 #include <ostream>
6 #include <stdint.h>
7 
33 public:
37  HcalElectronicsId(uint32_t);
39  HcalElectronicsId(int fiberChan, int fiberIndex, int spigot, int dccid);
41  HcalElectronicsId(int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb);
43  HcalElectronicsId(int crate, int slot, int fiber, int fiberchan, bool isTrigger);
44 
45  uint32_t operator()() { return hcalElectronicsId_; }
46 
47  uint32_t rawId() const { return hcalElectronicsId_; }
48 
49  bool isVMEid() const { return (hcalElectronicsId_&0x04000000)==0; }
50  bool isUTCAid() const { return (hcalElectronicsId_&0x04000000)!=0; }
51  bool isTriggerChainId() const { return (hcalElectronicsId_&0x02000000)!=0; }
52 
54  void setHTR(int crate, int slot, int tb);
55 
57  int subtype() const { return (isUTCAid())?((hcalElectronicsId_>>21)&0x1F):(-1); }
59  int fiberChanId() const { return (isVMEid())?(hcalElectronicsId_&0x3):(hcalElectronicsId_&0xF); }
61  int fiberIndex() const { return (isVMEid())?(((hcalElectronicsId_>>2)&0x7)+1):((hcalElectronicsId_>>4)&0x1F); }
63  int slbChannelIndex() const { return hcalElectronicsId_&0x3; }
65  int slbSiteNumber() const { return ((hcalElectronicsId_>>2)&0x7); }
66 
68  int htrChanId() const { return isVMEid()?((fiberChanId()+1)+((fiberIndex()-1)*3)):(0); }
69 
72 
74  int spigot() const { return (isVMEid())?((hcalElectronicsId_>>5)&0xF):slot(); }
76  int dccid() const { return (isVMEid())?((hcalElectronicsId_>>9)&0x1F):crateId(); }
78  int htrSlot() const { return slot(); }
80  int slot() const { return (isVMEid())?((hcalElectronicsId_>>14)&0x1F):((hcalElectronicsId_>>9)&0xF); }
82  int htrTopBottom() const { return (isVMEid())?((hcalElectronicsId_>>19)&0x1):(-1); }
84  int readoutVMECrateId() const { return crateId(); }
86  int crateId() const { return (isVMEid())?((hcalElectronicsId_>>20)&0x1F):((hcalElectronicsId_>>13)&0x3F); }
88  int linearIndex() const { return (isVMEid())?((hcalElectronicsId_)&0x3FFF):((hcalElectronicsId_)&0x7FFFF); }
89 
90  static const int maxLinearIndex = 0x7FFFF; //
91  static const int maxDCCId = 31;
92 
94  int operator==(const HcalElectronicsId& id) const { return id.hcalElectronicsId_==hcalElectronicsId_; }
96  int operator!=(const HcalElectronicsId& id) const { return id.hcalElectronicsId_!=hcalElectronicsId_; }
98  int operator<(const HcalElectronicsId& id) const { return hcalElectronicsId_<id.hcalElectronicsId_; }
99 
100 private:
102 };
103 
104 std::ostream& operator<<(std::ostream&,const HcalElectronicsId&);
105 
106 
107 #endif
int fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...
uint32_t rawId() const
int htrSlot() const
get the htr slot
static int slbChan(const HcalTriggerPrimitiveSample &theSample)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
int crateId() const
get the readout VME crate number
int readoutVMECrateId() const
get the readout VME crate number
int operator<(const HcalElectronicsId &id) const
Compare the id to another id for use in a map.
int operator!=(const HcalElectronicsId &id) const
int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
std::string slbChannelCode() const
get the HTR-wide slb channel code (letter plus number)
int htrChanId() const
get the HTR channel id (1-24)
int dccid() const
get the (Hcal local) DCC id for VME, crate number for uTCA
int fiberChanId() const
get the fiber channel id (which of channels on a fiber)
int spigot() const
get the spigot (input number on DCC, AMC card number for uTCA)
int slbChannelIndex() const
get the SLB channel index (valid only for VME trigger-chain ids)
void setHTR(int crate, int slot, int tb)
bool isVMEid() const
int slot() const
get the htr or uHTR slot
bool isTriggerChainId() const
int operator==(const HcalElectronicsId &id) const
int subtype() const
get subtype for this channel (valid for uTCA only)
static const int maxDCCId
int linearIndex() const
get a fast, compact, unique index for linear lookups
int slbSiteNumber() const
get the SLB site number (valid only for VME trigger-chain ids)
static const int maxLinearIndex
Readout chain identification for Hcal.
bool isUTCAid() const