CMS 3D CMS Logo

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