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 }
CastorElectronicsId::slbChannelIndex
int slbChannelIndex() const
Definition: CastorElectronicsId.h:36
CastorElectronicsId::fiberIndex
int fiberIndex() const
Definition: CastorElectronicsId.h:35
CastorElectronicsId::castorElectronicsId_
uint32_t castorElectronicsId_
Definition: CastorElectronicsId.h:59
CastorElectronicsId
Readout chain identification for Castor Bits for the readout chain : some names need change!...
Definition: CastorElectronicsId.h:20
CastorElectronicsId::CastorElectronicsId
CastorElectronicsId()
Definition: CastorElectronicsId.cc:3
slbChan
static int slbChan(const HcalTriggerPrimitiveSample &theSample)
Definition: CastorUnpacker.cc:72
CastorElectronicsId::htrTopBottom
int htrTopBottom() const
Definition: CastorElectronicsId.h:45
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CastorElectronicsId.h
operator<<
std::ostream & operator<<(std::ostream &os, const CastorElectronicsId &id)
Definition: CastorElectronicsId.cc:61
CastorElectronicsId::setHTR
void setHTR(int crate, int slot, int tb)
Definition: CastorElectronicsId.cc:56
CastorElectronicsId::spigot
int spigot() const
Definition: CastorElectronicsId.h:42
CastorElectronicsId::isTriggerChainId
bool isTriggerChainId() const
Definition: CastorElectronicsId.h:31
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
CastorElectronicsId::dccid
int dccid() const
Definition: CastorElectronicsId.h:43
CastorElectronicsId::slbChannelCode
std::string slbChannelCode() const
Definition: CastorElectronicsId.cc:18