CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalElectronicsId.cc
Go to the documentation of this file.
2 
3 
5  hcalElectronicsId_=0xffffffffu;
6 }
7 
10 }
11 
12 HcalElectronicsId::HcalElectronicsId(int fiberChan, int fiberIndex, int spigot, int dccid) {
13  hcalElectronicsId_=(fiberChan&0x3) | (((fiberIndex-1)&0x7)<<2) |
14  ((spigot&0xF)<<5) | ((dccid&0x1F)<<9);
15 }
16 
17 HcalElectronicsId::HcalElectronicsId(int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb) {
18  hcalElectronicsId_=(slbChan&0x3) | (((slbSite)&0x7)<<2) |
19  ((spigot&0xF)<<5) | ((dccid&0x1F)<<9);
20  hcalElectronicsId_|=((tb&0x1)<<19) | ((slot&0x1f)<<14) | ((crate&0x3f)<<20);
21  hcalElectronicsId_|=0x02000000;
22 }
23 
24 std::string HcalElectronicsId::slbChannelCode() const {
25  std::string retval;
26  if (isTriggerChainId()) {
27  if (htrTopBottom()) { // top
28  switch (slbChannelIndex()) {
29  case (0): retval="A0"; break;
30  case (1): retval="A1"; break;
31  case (2): retval="C0"; break;
32  case (3): retval="C1"; break;
33  }
34  } else {
35  switch (slbChannelIndex()) {
36  case (0): retval="B0"; break;
37  case (1): retval="B1"; break;
38  case (2): retval="D0"; break;
39  case (3): retval="D1"; break;
40  }
41  }
42  }
43  return retval;
44 }
45 
46 void HcalElectronicsId::setHTR(int crate, int slot, int tb) {
47  hcalElectronicsId_&=0x3FFF; // keep the readout chain info
48  hcalElectronicsId_|=((tb&0x1)<<19) | ((slot&0x1f)<<14) | ((crate&0x3f)<<20);
49 }
50 
51 std::ostream& operator<<(std::ostream& os,const HcalElectronicsId& id) {
52  if (id.isTriggerChainId()) {
53  return os << id.dccid() << ',' << id.spigot() << ",SLB" << id.slbSiteNumber() << ',' << id.slbChannelIndex() << " (HTR "
54  << id.readoutVMECrateId() << ":" << id.htrSlot() << ((id.htrTopBottom()==1)?('t'):('b')) << ')';
55 
56  } else {
57  return os << id.dccid() << ',' << id.spigot() << ',' << id.fiberIndex() << ',' << id.fiberChanId() << " (HTR "
58  << id.readoutVMECrateId() << ":" << id.htrSlot() << ((id.htrTopBottom()==1)?('t'):('b')) << ')';
59  }
60 }
61 
62 
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom)
std::string slbChannelCode() const
get the HTR-wide slb channel code (letter plus number)
int slbChannelIndex() const
get the SLB channel index (valid only for trigger-chain ids)
void setHTR(int crate, int slot, int tb)
bool isTriggerChainId() const
Readout chain identification for Hcal [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...