CMS 3D CMS Logo

HcalCalibDetId.cc
Go to the documentation of this file.
4 
6 
7 HcalCalibDetId::HcalCalibDetId(uint32_t rawid) : HcalOtherDetId(rawid) {}
8 
11  id_ |= (CalibrationBox << 17); // Calibration Category, bits [17:19] (= "1" for CalibrationBox)
12  id_ |= (ctype & 0xF); // calibration channel type, bits [0:3]
13  id_ |= (((ieta + 2) & 0x7) << 11); // eta index, bits [11:13]
14  id_ |= ((subdet & 0x7) << 14); // subdetector, bits [14:16]
15  if (subdet == 4)
16  id_ |= ((((((((iphi - 1) & 0x7E) + 1) / 18) * 18) + 1) & 0x7F)
17  << 4); // phi index, bits [4:10] dphi = 18 for HF, values 1,19,37,55 (lower edge)
18  //if (subdet==4) id_|=(((((((((iphi-1)>>1)<<1)+1)/18)*18)+1)&0x7F)<<4); // phi index, bits [4:10] dphi = 18 for HF, values 1,19,37,55 (lower edge)
19  //else if (subdet==1||subdet==2||subdet==3) id_|=((((((iphi+1)&0x7C)+71)%72)&0x7F)<<4); // phi index, bits [4:10] dphi=4 for HBHEHO, values 3,7,...,71, (lower edge)
20  else if (subdet == 1 || subdet == 2)
21  id_ |= (((((((iphi + 1) >> 2) & 0x1F) << 2) + 71) % 72)
22  << 4); // phi index, bits [4:10] dphi=4 for HBHE, values 3,7,...,71, (lower edge)
23  else if (subdet == 3 && ieta == 0)
24  id_ |= (((((((iphi + 1) / 6) * 6) + 71) % 72) & 0x7F)
25  << 4); // phi index, bits [4:10] dphi=6 for HO0, values 5,11,...,71, (lower edge)
26  else if (subdet == 3 && ieta != 0)
27  id_ |= (((((((iphi + 1) / 12) * 12) + 71) % 72) & 0x7F)
28  << 4); // phi index, bits [4:10] dphi=12 for HOP and HOM, values 11,23,,...,71, (lower edge)
29  else
30  id_ |= ((iphi & 0x7F) << 4); // phi index, bits [4:10], simply allow all values from 0-127, shouldn't be any
31 }
32 
33 // keep old HOX constructor for back-compatibility
35  id_ |= (HOCrosstalk << 17); // Calibration Category, bits [17:19] (= "2" for HOX)
36  id_ |= (iphi & 0x7F) // phi index, bits [0:6]
37  | ((abs(ieta) & 0xF) << 7) // eta index, bits [7:10]
38  | (((ieta > 0) ? (1) : (0)) << 11); // z side, bit [11]
39 }
40 
42  id_ |= (dt << 17); // Calibration Category, bits [17:19] (= "2" for HOX, "6" for HBX, "7" for HEX)
43  id_ |= (iphi & 0x7F); // phi index, bits [0:6];
44 
45  (dt == HOCrosstalk) ? (id_ |= ((abs(ieta) & 0xF) << 7) | (((ieta > 0) ? (1) : (0)) << 11))
46  : (id_ |= ((abs(ieta) & 0x1F) << 7) | (((ieta > 0) ? (1) : (0)) << 12));
47 }
48 
50  id_ |= (dt << 17);
51  id_ |= value & 0xFF;
52 }
53 
55  id_ |= (dt << 17); // Calibration Category, bits [17:19]
56  id_ |= (value1 & 0x3F) << 10;
57  id_ |= (value2 & 0x1F) << 5;
58  id_ |= (value3 & 0x1F);
59 }
60 
62  if (!gen.null() && (gen.det() != Hcal || gen.subdetId() != HcalOther)) {
63  throw cms::Exception("Invalid DetId")
64  << "Cannot initialize HcalCalibDetId from " << std::hex << gen.rawId() << std::dec;
65  }
66  id_ = gen.rawId();
67  if (subdet() != HcalCalibration) {
68  throw cms::Exception("Invalid DetId")
69  << "Cannot initialize HcalCalibDetId from " << std::hex << gen.rawId() << std::dec;
70  }
71 }
72 
74  if (!gen.null() && (gen.det() != Hcal || gen.subdetId() != HcalOther)) {
75  throw cms::Exception("Invalid DetId")
76  << "Cannot assign HcalCalibDetId from " << std::hex << gen.rawId() << std::dec;
77  }
78  id_ = gen.rawId();
79  if (subdet() != HcalCalibration) {
80  throw cms::Exception("Invalid DetId")
81  << "Cannot assign HcalCalibDetId from " << std::hex << gen.rawId() << std::dec;
82  }
83  return *this;
84 }
85 
87  return (calibFlavor() == CalibrationBox || calibFlavor() == LASERMON) ? (id_ & 0xF) : (0);
88 }
89 
91  return (HcalSubdetector)((calibFlavor() == CalibrationBox) ? ((id_ >> 14) & 0x7) : (0));
92 }
93 
94 int HcalCalibDetId::ieta() const {
96  return (cf == CalibrationBox)
97  ? (((id_ >> 11) & 0x7) - 2)
98  : ((cf == HOCrosstalk)
99  ? (((id_ >> 7) & 0xF) * zside())
100  : (cf == LASERMON ? ((id_ >> 10) & 0x3F)
101  : (((cf == HBX || cf == HEX) ? ((id_ >> 7) & 0x1F) * zside() : (0)))));
102 }
103 
104 int HcalCalibDetId::iphi() const {
105  CalibDetType cf = calibFlavor();
106  return (cf == CalibrationBox)
107  ? ((id_ >> 4) & 0x7F)
108  : ((cf == HOCrosstalk || cf == HBX || cf == HEX) ? (id_ & 0x7F)
109  : (cf == LASERMON ? ((id_ >> 5) & 0x1F) : (0)));
110 }
111 
113  CalibDetType cf = calibFlavor();
114  return (cf == HOCrosstalk) ? (((id_ >> 11) & 0x1) ? (1) : (-1))
115  : ((cf == HBX || cf == HEX) ? (((id_ >> 12) & 0x1) ? (1) : (-1)) : (0));
116 }
117 
119  switch (cboxChannel()) {
120  case (cbox_MixerHigh):
121  return "Mixer-High";
122  case (cbox_MixerLow):
123  return "Mixer-Low";
124  case (cbox_LaserMegatile):
125  return "Megatile";
126  case (cbox_RadDam_Layer0_RM4):
127  return "RadDam-L0-RM4";
128  case (cbox_RadDam_Layer7_RM4):
129  return "RadDam-L7-RM4";
130  case (cbox_RadDam_Layer0_RM1):
131  return "RadDam-L0-RM1";
132  case (cbox_RadDam_Layer7_RM1):
133  return "RadDam-L7-RM1";
134  case (cbox_HOCrosstalkPIN):
135  return "HO-Crosstalk-PIN";
137  return "HF-Scint-PIN";
138  default:
139  return "";
140  }
141 }
142 
143 int HcalCalibDetId::channel() const { return (calibFlavor() == uMNqie) ? (id_ & 0xFF) : (id_ & 0x1F); }
144 
145 int HcalCalibDetId::fiber() const { return (calibFlavor() == CastorRadFacility) ? ((id_ >> 5) & 0x1F) : (0); }
146 
147 int HcalCalibDetId::rm() const { return (calibFlavor() == CastorRadFacility) ? ((id_ >> 10) & 0x3F) : (0); }
148 
149 std::ostream& operator<<(std::ostream& s, const HcalCalibDetId& id) {
150  std::string sd;
151  switch (id.hcalSubdet()) {
152  case (HcalBarrel):
153  sd = "HB";
154  break;
155  case (HcalEndcap):
156  sd = "HE";
157  break;
158  case (HcalOuter):
159  sd = "HO";
160  break;
161  case (HcalForward):
162  sd = "HF";
163  break;
164  default:
165  break;
166  }
167  switch (id.calibFlavor()) {
169  return s << "(HcalCalibBox " << sd << ' ' << id.ieta() << "," << id.iphi() << ' ' << id.cboxChannelString()
170  << ')';
172  return s << "(HOCrosstalk " << id.ieta() << "," << id.iphi() << ')';
173  case (HcalCalibDetId::uMNqie):
174  return s << "(uMNqie " << id.channel() << ')';
176  return s << "(LASERMON" << id.channel() << ')';
178  return s << "(CastorRadFacility " << id.rm() << " / " << id.fiber() << " / " << id.channel() << ')';
179  case (HcalCalibDetId::HBX):
180  return s << "(HBX " << id.ieta() << "," << id.iphi() << ")";
181  case (HcalCalibDetId::HEX):
182  return s << "(HEX " << id.ieta() << "," << id.iphi() << ")";
183  default:
184  return s;
185  };
186 }
int cboxChannel() const
get the calibration box channel (if relevant)
float dt
Definition: AMPTWrapper.h:136
static const int cbox_RadDam_Layer7_RM4
static const int cbox_HF_ScintillatorPIN
std::string cboxChannelString() const
get the calibration box channel as a string (if relevant)
int ieta() const
HcalSubdetector hcalSubdet() const
get the HcalSubdetector (if relevant)
static const int cbox_RadDam_Layer7_RM1
static const int cbox_LaserMegatile
std::ostream & operator<<(std::ostream &s, const HcalCalibDetId &id)
int iphi() const
get the low-edge iphi (if relevant)
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: value.py:1
int rm() const
get the rm (where relevant)
int zside() const
get the sign of ieta (+/-1)
HcalCalibDetId & operator=(const DetId &id)
Definition: DetId.h:17
uint32_t id_
Definition: DetId.h:69
CalibDetType calibFlavor() const
get the flavor of this calibration detid
static const int cbox_RadDam_Layer0_RM1
int fiber() const
get the fiber (where relevant)
static const int cbox_HOCrosstalkPIN
int channel() const
get the channel (for uMNio/qie or similar)
static const int cbox_MixerLow
static const int cbox_RadDam_Layer0_RM4
static const int cbox_MixerHigh
constants
HcalOtherSubdetector subdet() const
get the category