CMS 3D CMS Logo

CastorElectronicsId.cc
Go to the documentation of this file.
2 
4 
6 
7 CastorElectronicsId::CastorElectronicsId(int fiberChan, int fiberIndex, int spigot, int dccid) {
9  (fiberChan & 0x3) | (((fiberIndex - 1) & 0xf) << 2) | ((spigot & 0xF) << 6) | ((dccid & 0xF) << 10);
10 }
11 
12 CastorElectronicsId::CastorElectronicsId(int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb) {
13  castorElectronicsId_ = (slbChan & 0x3) | (((slbSite - 1) & 0xf) << 2) | ((spigot & 0xF) << 6) | ((dccid & 0xF) << 10);
14  castorElectronicsId_ |= ((tb & 0x1) << 19) | ((slot & 0x1f) << 14) | ((crate & 0x3f) << 20);
15  castorElectronicsId_ |= 0x02000000;
16 }
17 
19  std::string retval;
20  if (isTriggerChainId()) {
21  if (htrTopBottom()) { // top
22  switch (slbChannelIndex()) {
23  case (0):
24  retval = "A0";
25  break;
26  case (1):
27  retval = "A1";
28  break;
29  case (2):
30  retval = "C0";
31  break;
32  case (3):
33  retval = "C1";
34  break;
35  }
36  } else {
37  switch (slbChannelIndex()) {
38  case (0):
39  retval = "B0";
40  break;
41  case (1):
42  retval = "B1";
43  break;
44  case (2):
45  retval = "D0";
46  break;
47  case (3):
48  retval = "D1";
49  break;
50  }
51  }
52  }
53  return retval;
54 }
55 
56 void CastorElectronicsId::setHTR(int crate, int slot, int tb) {
57  castorElectronicsId_ &= 0x3FFF; // keep the readout chain info
58  castorElectronicsId_ |= ((tb & 0x1) << 19) | ((slot & 0x1f) << 14) | ((crate & 0x3f) << 20);
59 }
60 
61 std::ostream& operator<<(std::ostream& os, const CastorElectronicsId& id) {
62  if (id.isTriggerChainId()) {
63  return os << id.dccid() << ',' << id.spigot() << ",SLB" << id.slbSiteNumber() << ',' << id.slbChannelIndex()
64  << " (HTR " << id.readoutVMECrateId() << ":" << id.htrSlot() << ((id.htrTopBottom() == 1) ? ('t') : ('b'))
65  << ')';
66 
67  } else {
68  return os << id.dccid() << ',' << id.spigot() << ',' << id.fiberIndex() << ',' << id.fiberChanId() << " (HTR "
69  << id.readoutVMECrateId() << ":" << id.htrSlot() << ((id.htrTopBottom() == 1) ? ('t') : ('b')) << ')';
70  }
71 }
std::ostream & operator<<(std::ostream &os, const CastorElectronicsId &id)
void setHTR(int crate, int slot, int tb)
static int slbChan(const HcalTriggerPrimitiveSample &theSample)
bool isTriggerChainId() const
std::string slbChannelCode() const
Readout chain identification for Castor Bits for the readout chain : some names need change! [31:26] ...