test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorElectronicsId.cc
Go to the documentation of this file.
2 
3 
5  castorElectronicsId_=0xffffffffu;
6 }
7 
10 }
11 
12 CastorElectronicsId::CastorElectronicsId(int fiberChan, int fiberIndex, int spigot, int dccid) {
13  castorElectronicsId_=(fiberChan&0x3) | (((fiberIndex-1)&0xf)<<2) |
14  ((spigot&0xF)<<6) | ((dccid&0xF)<<10);
15 }
16 
17 CastorElectronicsId::CastorElectronicsId(int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb) {
18  castorElectronicsId_=(slbChan&0x3) | (((slbSite-1)&0xf)<<2) |
19  ((spigot&0xF)<<6) | ((dccid&0xF)<<10);
20  castorElectronicsId_|=((tb&0x1)<<19) | ((slot&0x1f)<<14) | ((crate&0x3f)<<20);
21  castorElectronicsId_|=0x02000000;
22 }
23 
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 CastorElectronicsId::setHTR(int crate, int slot, int tb) {
47  castorElectronicsId_&=0x3FFF; // keep the readout chain info
48  castorElectronicsId_|=((tb&0x1)<<19) | ((slot&0x1f)<<14) | ((crate&0x3f)<<20);
49 }
50 
51 std::ostream& operator<<(std::ostream& os,const CastorElectronicsId& 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 
void setHTR(int crate, int slot, int tb)
std::string slbChannelCode() const
static int slbChan(const HcalTriggerPrimitiveSample &theSample)
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
bool isTriggerChainId() const
Readout chain identification for Castor Bits for the readout chain : some names need change! [31:26] ...
int slbChannelIndex() const