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 
4  hcalElectronicsId_=0xffffffffu;
5 }
6 
9 }
10 
11 HcalElectronicsId::HcalElectronicsId(int fiberChan, int fiberIndex, int spigot, int dccid) {
12  hcalElectronicsId_=(fiberChan&0x3) | (((fiberIndex-1)&0x7)<<2) |
13  ((spigot&0xF)<<5) | ((dccid&0x1F)<<9);
14 }
15 
16 HcalElectronicsId::HcalElectronicsId(int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb) {
17  hcalElectronicsId_=(slbChan&0x3) | (((slbSite)&0x7)<<2) |
18  ((spigot&0xF)<<5) | ((dccid&0x1F)<<9);
19  hcalElectronicsId_|=((tb&0x1)<<19) | ((slot&0x1f)<<14) | ((crate&0x3f)<<20);
20  hcalElectronicsId_|=0x02000000;
21 }
22 
23 HcalElectronicsId::HcalElectronicsId(int crate, int slot, int fiber, int fc, bool isTrigger) {
24  hcalElectronicsId_=(fc&0xF) | (((fiber)&0x1F)<<4) |
25  ((slot&0xF)<<9) | ((crate&0x3F)<<13);
26  if (isTrigger) hcalElectronicsId_|=0x02000000;
27  hcalElectronicsId_|=0x04000000;
28 }
29 
31  std::string retval;
32  if (isTriggerChainId() && isVMEid()) {
33  if (htrTopBottom()) { // top
34  switch (slbChannelIndex()) {
35  case (0): retval="A0"; break;
36  case (1): retval="A1"; break;
37  case (2): retval="C0"; break;
38  case (3): retval="C1"; break;
39  }
40  } else {
41  switch (slbChannelIndex()) {
42  case (0): retval="B0"; break;
43  case (1): retval="B1"; break;
44  case (2): retval="D0"; break;
45  case (3): retval="D1"; break;
46  }
47  }
48  }
49  return retval;
50 }
51 
52 void HcalElectronicsId::setHTR(int crate, int slot, int tb) {
53  if (isUTCAid()) return; // cannot do this for uTCA
54  hcalElectronicsId_&=0x3FFF; // keep the readout chain info
55  hcalElectronicsId_|=((tb&0x1)<<19) | ((slot&0x1f)<<14) | ((crate&0x3f)<<20);
56 }
57 
58 std::ostream& operator<<(std::ostream& os,const HcalElectronicsId& id) {
59  if (id.isUTCAid()) {
60  if (id.isTriggerChainId()) os << "UTCA(trigger): ";
61  else os << "UTCA: ";
62  return os << id.crateId() << ',' << id.slot() << ',' << id.fiberIndex() << ',' << id.fiberChanId();
63  } else {
64  if (id.isTriggerChainId()) {
65  return os << id.dccid() << ',' << id.spigot() << ",SLB" << id.slbSiteNumber() << ',' << id.slbChannelIndex() << " (HTR "
66  << id.readoutVMECrateId() << ":" << id.htrSlot() << ((id.htrTopBottom()==1)?('t'):('b')) << ')';
67 
68  } else {
69  return os << id.dccid() << ',' << id.spigot() << ',' << id.fiberIndex() << ',' << id.fiberChanId() << " (HTR "
70  << id.readoutVMECrateId() << ":" << id.htrSlot() << ((id.htrTopBottom()==1)?('t'):('b')) << ')';
71  }
72  }
73 }
74 
75 
static int slbChan(const HcalTriggerPrimitiveSample &theSample)
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), valid for VME
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 VME trigger-chain ids)
void setHTR(int crate, int slot, int tb)
bool isVMEid() const
bool isTriggerChainId() const
Readout chain identification for Hcal.
bool isUTCAid() const