CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
30  id_|=(HOCrosstalk<<17); // Calibration Category, bits [17:19] (= "2" for HOX)
31  id_|=(iphi&0x7F) // phi index, bits [0:6]
32  |((abs(ieta)&0xF)<<7) // eta index, bits [7:10]
33  |(((ieta > 0)?(1):(0))<<11); // z side, bit [11]
34 }
35 
37  if (!gen.null() && (gen.det()!=Hcal || gen.subdetId()!=HcalOther)) {
38  throw cms::Exception("Invalid DetId") << "Cannot initialize HcalCalibDetId from " << std::hex << gen.rawId() << std::dec;
39  }
40  id_=gen.rawId();
41  if (subdet()!=HcalCalibration) {
42  throw cms::Exception("Invalid DetId") << "Cannot initialize HcalCalibDetId from " << std::hex << gen.rawId() << std::dec;
43  }
44 }
45 
47  if (!gen.null() && (gen.det()!=Hcal || gen.subdetId()!=HcalOther)) {
48  throw cms::Exception("Invalid DetId") << "Cannot assign HcalCalibDetId from " << std::hex << gen.rawId() << std::dec;
49  }
50  id_=gen.rawId();
51  if (subdet()!=HcalCalibration) {
52  throw cms::Exception("Invalid DetId") << "Cannot assign HcalCalibDetId from " << std::hex << gen.rawId() << std::dec;
53  }
54  return *this;
55 }
56 
58  return (calibFlavor()==CalibrationBox)?(id_&0xF):(0);
59 }
60 
62  return (HcalSubdetector)((calibFlavor()==CalibrationBox)?((id_>>14)&0x7):(0));
63 }
64 
65 int HcalCalibDetId::ieta() const {
66  return (calibFlavor()==CalibrationBox)?(((id_>>11)&0x7)-2):((calibFlavor()==HOCrosstalk)?(((id_>>7)&0xF)*zside()):(0));
67 }
68 
69 int HcalCalibDetId::iphi() const {
70  return (calibFlavor()==CalibrationBox)?((id_>>4)&0x7F):((calibFlavor()==HOCrosstalk)?(id_&0x7F):(0));
71 }
72 
73 int HcalCalibDetId::zside() const {
74  return (calibFlavor()==HOCrosstalk)?(((id_>>11)&0x1)?(1):(-1)):(0);
75 }
76 
78  switch (cboxChannel()) {
79  case(cbox_MixerHigh): return "Mixer-High";
80  case(cbox_MixerLow): return "Mixer-Low";
81  case(cbox_LaserMegatile): return "Megatile";
82  case(cbox_RadDam_Layer0_RM4): return "RadDam-L0-RM4";
83  case(cbox_RadDam_Layer7_RM4): return "RadDam-L7-RM4";
84  case(cbox_RadDam_Layer0_RM1): return "RadDam-L0-RM1";
85  case(cbox_RadDam_Layer7_RM1): return "RadDam-L7-RM1";
86  case(cbox_HOCrosstalkPIN): return "HO-Crosstalk-PIN";
87  case(cbox_HF_ScintillatorPIN): return "HF-Scint-PIN";
88  default : return "";
89  }
90 }
91 
92 std::ostream& operator<<(std::ostream& s,const HcalCalibDetId& id) {
94  switch (id.hcalSubdet()) {
95  case(HcalBarrel) : sd="HB"; break;
96  case(HcalEndcap) : sd="HE"; break;
97  case(HcalOuter) : sd="HO"; break;
98  case(HcalForward) : sd="HF"; break;
99  default: break;
100  }
101  switch (id.calibFlavor()) {
103  return s << "(HcalCalibBox " << sd << ' ' << id.ieta() << "," << id.iphi()
104  << ' ' << id.cboxChannelString() << ')';
106  return s << "(HOCrosstalk " << id.ieta() << "," << id.iphi()
107  << ')';
108  default: return s;
109  };
110 }
CalibDetType calibFlavor() const
get the flavor of this calibration detid
static const int cbox_RadDam_Layer7_RM4
static const int cbox_HF_ScintillatorPIN
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
int ieta() const
get the rbx name (if relevant)
static const int cbox_RadDam_Layer7_RM1
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const int cbox_LaserMegatile
std::string cboxChannelString() const
get the calibration box channel as a string (if relevant)
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
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:55
bool null() const
is this a null id ?
Definition: DetId.h:45
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)
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
static const int cbox_MixerLow
static const int cbox_RadDam_Layer0_RM4
static const int cbox_MixerHigh
constants