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  id_|=(dt<<17);
38  id_|=value&0xFF;
39 }
40 
42  id_|=(dt<<17);
43  id_|=(value1&0x3F)<<10;
44  id_|=(value2&0x1F)<<5;
45  id_|=(value3&0x1F);
46 }
47 
49  if (!gen.null() && (gen.det()!=Hcal || gen.subdetId()!=HcalOther)) {
50  throw cms::Exception("Invalid DetId") << "Cannot initialize HcalCalibDetId from " << std::hex << gen.rawId() << std::dec;
51  }
52  id_=gen.rawId();
53  if (subdet()!=HcalCalibration) {
54  throw cms::Exception("Invalid DetId") << "Cannot initialize HcalCalibDetId from " << std::hex << gen.rawId() << std::dec;
55  }
56 }
57 
59  if (!gen.null() && (gen.det()!=Hcal || gen.subdetId()!=HcalOther)) {
60  throw cms::Exception("Invalid DetId") << "Cannot assign HcalCalibDetId from " << std::hex << gen.rawId() << std::dec;
61  }
62  id_=gen.rawId();
63  if (subdet()!=HcalCalibration) {
64  throw cms::Exception("Invalid DetId") << "Cannot assign HcalCalibDetId from " << std::hex << gen.rawId() << std::dec;
65  }
66  return *this;
67 }
68 
70  return (calibFlavor()==CalibrationBox)?(id_&0xF):(0);
71 }
72 
74  return (HcalSubdetector)((calibFlavor()==CalibrationBox)?((id_>>14)&0x7):(0));
75 }
76 
77 int HcalCalibDetId::ieta() const {
78  return (calibFlavor()==CalibrationBox)?(((id_>>11)&0x7)-2):((calibFlavor()==HOCrosstalk)?(((id_>>7)&0xF)*zside()):(0));
79 }
80 
81 int HcalCalibDetId::iphi() const {
82  return (calibFlavor()==CalibrationBox)?((id_>>4)&0x7F):((calibFlavor()==HOCrosstalk)?(id_&0x7F):(0));
83 }
84 
85 int HcalCalibDetId::zside() const {
86  return (calibFlavor()==HOCrosstalk)?(((id_>>11)&0x1)?(1):(-1)):(0);
87 }
88 
90  switch (cboxChannel()) {
91  case(cbox_MixerHigh): return "Mixer-High";
92  case(cbox_MixerLow): return "Mixer-Low";
93  case(cbox_LaserMegatile): return "Megatile";
94  case(cbox_RadDam_Layer0_RM4): return "RadDam-L0-RM4";
95  case(cbox_RadDam_Layer7_RM4): return "RadDam-L7-RM4";
96  case(cbox_RadDam_Layer0_RM1): return "RadDam-L0-RM1";
97  case(cbox_RadDam_Layer7_RM1): return "RadDam-L7-RM1";
98  case(cbox_HOCrosstalkPIN): return "HO-Crosstalk-PIN";
99  case(cbox_HF_ScintillatorPIN): return "HF-Scint-PIN";
100  default : return "";
101  }
102 }
103 
104 int HcalCalibDetId::channel() const { return (calibFlavor()==uMNqie)?(id_&0xFF):(id_&0x1F); }
105 
106 int HcalCalibDetId::fiber() const { return (calibFlavor()==CastorRadFacility)?((id_>>5)&0x1F):(0); }
107 
108 int HcalCalibDetId::rm() const { return (calibFlavor()==CastorRadFacility)?((id_>>10)&0x3F):(0); }
109 
110 
111 std::ostream& operator<<(std::ostream& s,const HcalCalibDetId& id) {
112  std::string sd;
113  switch (id.hcalSubdet()) {
114  case(HcalBarrel) : sd="HB"; break;
115  case(HcalEndcap) : sd="HE"; break;
116  case(HcalOuter) : sd="HO"; break;
117  case(HcalForward) : sd="HF"; break;
118  default: break;
119  }
120  switch (id.calibFlavor()) {
122  return s << "(HcalCalibBox " << sd << ' ' << id.ieta() << "," << id.iphi()
123  << ' ' << id.cboxChannelString() << ')';
125  return s << "(HOCrosstalk " << id.ieta() << "," << id.iphi()
126  << ')';
127  case (HcalCalibDetId::uMNqie):
128  return s << "(uMNqie " << id.channel() << ')';
130  return s << "(CastorRadFacility " << id.rm() << " / " << id.fiber() << " / " << id.channel() << ')';
131  default: return s;
132  };
133 }
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
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
int ieta() const
get the rbx name (if relevant)
static const int cbox_RadDam_Layer7_RM1
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
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
int channel() const
get the channel (for uMNio/qie or similar)
static const int cbox_MixerHigh
constants