CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions
HcalGenericDetId Class Reference

#include <HcalGenericDetId.h>

Inheritance diagram for HcalGenericDetId:
DetId

Public Types

enum  hashlimits {
  HBhalf = 1296, HEhalf = 1296, HEhalfh2mode = 4032, HOhalf = 1080,
  HFhalf = 864, HThalf = 2088, ZDChalf = 11, CASTORhalf = 224,
  CALIBhalf = 693
}
 
enum  HcalGenericSubdetector {
  HcalGenEmpty =0, HcalGenBarrel =1, HcalGenEndcap =2, HcalGenOuter =3,
  HcalGenForward =4, HcalGenTriggerTower =5, HcalGenZDC =8, HcalGenCalibration =9,
  HcalGenCastor =10, HcalGenUnknown =99
}
 
- Public Types inherited from DetId
enum  Detector {
  Tracker =1, Muon =2, Ecal =3, Hcal =4,
  Calo =5
}
 

Public Member Functions

HcalGenericSubdetector genericSubdet () const
 
int hashedId (bool h2mode_=false) const
 
 HcalGenericDetId ()
 
 HcalGenericDetId (uint32_t rawid)
 
 HcalGenericDetId (const DetId &id)
 
bool isHcalCalibDetId () const
 
bool isHcalCastorDetId () const
 
bool isHcalDetId () const
 
bool isHcalTrigTowerDetId () const
 
bool isHcalZDCDetId () const
 
HcalOtherSubdetector otherSubdet () const
 
- Public Member Functions inherited from DetId
Detector det () const
 get the detector field from this detid More...
 
 DetId ()
 Create an empty or null id (also for persistence) More...
 
 DetId (uint32_t id)
 Create an id from a raw number. More...
 
 DetId (Detector det, int subdet)
 Create an id, filling the detector and subdetector fields as specified. More...
 
bool null () const
 is this a null id ? More...
 
 operator uint32_t () const
 
bool operator!= (DetId id) const
 inequality More...
 
uint32_t operator() () const
 
bool operator< (DetId id) const
 comparison More...
 
bool operator== (DetId id) const
 equality More...
 
uint32_t rawId () const
 get the raw id More...
 
int subdetId () const
 get the contents of the subdetector field (not cast into any detector's numbering enum) More...
 

Additional Inherited Members

- Static Public Attributes inherited from DetId
static const int kDetOffset = 28
 
static const int kSubdetOffset = 25
 
- Protected Attributes inherited from DetId
uint32_t id_
 

Detailed Description

Author
F.Ratnikov, UMd Generic HCAL detector ID suitable for all Hcal subdetectors
Id:
HcalGenericDetId.h,v 1.7 2008/07/15 20:14:11 rofierzy Exp

R.Ofierzynski, 22.02.2008, added hashedId

Author
F.Ratnikov, UMd Generic HCAL detector ID suitable for all Hcal subdetectors

Definition at line 16 of file HcalGenericDetId.h.

Member Enumeration Documentation

Enumerator
HBhalf 
HEhalf 
HEhalfh2mode 
HOhalf 
HFhalf 
HThalf 
ZDChalf 
CASTORhalf 
CALIBhalf 

Definition at line 35 of file HcalGenericDetId.h.

Constructor & Destructor Documentation

HcalGenericDetId::HcalGenericDetId ( )
inline

Definition at line 20 of file HcalGenericDetId.h.

20 : DetId () {}
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:28
HcalGenericDetId::HcalGenericDetId ( uint32_t  rawid)
inline

Definition at line 21 of file HcalGenericDetId.h.

21 : DetId (rawid) {}
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:28
HcalGenericDetId::HcalGenericDetId ( const DetId id)
inline

Definition at line 22 of file HcalGenericDetId.h.

22 : DetId (id) {}
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:28

Member Function Documentation

HcalGenericDetId::HcalGenericSubdetector HcalGenericDetId::genericSubdet ( ) const

Definition at line 20 of file HcalGenericDetId.cc.

References DetId::Calo, DetId::det(), DetId::Hcal, HcalBarrel, HcalCalibration, HcalEndcap, HcalForward, HcalGenBarrel, HcalGenCalibration, HcalGenCastor, HcalGenEmpty, HcalGenEndcap, HcalGenForward, HcalGenOuter, HcalGenTriggerTower, HcalGenUnknown, HcalGenZDC, HcalOther, HcalOuter, HcalTriggerTower, DetId::null(), otherSubdet(), HcalZDCDetId::SubdetectorId, HcalCastorDetId::SubdetectorId, and DetId::subdetId().

Referenced by HcalAmplifier::addPedestals(), HcalCovarianceMatrices::addValues(), HcalCholeskyMatrices::addValues(), HcalCondObjectContainer< Item >::addValues(), CastorCondObjectContainer< Item >::addValues(), HcalLuttoDB::analyze(), HcalCovarianceMatrices::exists(), HcalCholeskyMatrices::exists(), HcalCondObjectContainer< Item >::exists(), CastorCondObjectContainer< Item >::exists(), HcalPacker::findSamples(), HcalLogicalMap::getHcalFrontEndId(), HcalSeverityLevelComputer::getSeverityLevel(), HcalCovarianceMatrices::getValues(), HcalCondObjectContainer< Item >::getValues(), HcalCholeskyMatrices::getValues(), CastorCondObjectContainer< Item >::getValues(), hashedId(), HcalText2DetIdConverter::init(), isHcalCalibDetId(), isHcalCastorDetId(), isHcalDetId(), isHcalTrigTowerDetId(), isHcalZDCDetId(), CastorDbHardcode::makeGain(), CastorDbHardcode::makePedestal(), CastorDbHardcode::makeQIECoder(), CastorDbASCIIIO::DetIdLess::operator()(), and HcalSeverityLevelComputer::recoveredRecHit().

20  {
21  if (null()) return HcalGenEmpty;
22  switch (det()) {
23  case Calo :
24  switch (subdetId()) {
27  default: return HcalGenUnknown;
28  }
29  case Hcal :
30  switch (HcalSubdetector(subdetId())) {
31  case 0: return HcalGenEmpty;
32  case HcalBarrel: return HcalGenBarrel;
33  case HcalEndcap: return HcalGenEndcap;
34  case HcalOuter: return HcalGenOuter;
35  case HcalForward: return HcalGenForward;
37  case HcalOther:
38  switch (otherSubdet ()) {
40  default: return HcalGenUnknown;
41  }
42  default: return HcalGenUnknown;
43  }
44  default: return HcalGenUnknown;
45  }
46  return HcalGenUnknown;
47 }
HcalSubdetector
Definition: HcalAssistant.h:32
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
static const int SubdetectorId
static const int SubdetectorId
Definition: HcalZDCDetId.h:22
bool null() const
is this a null id ?
Definition: DetId.h:47
HcalOtherSubdetector otherSubdet() const
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
int HcalGenericDetId::hashedId ( bool  h2mode_ = false) const

Definition at line 91 of file HcalGenericDetId.cc.

References abs, HcalCalibDetId::calibFlavor(), HcalCalibDetId::CalibrationBox, CASTORhalf, HcalCalibDetId::cboxChannel(), HcalZDCDetId::channel(), gather_cfg::cout, HcalDetId::depth(), HcalZDCDetId::EM, genericSubdet(), HcalZDCDetId::HAD, HBhalf, HcalBarrel, HcalEndcap, HcalForward, HcalGenBarrel, HcalGenCalibration, HcalGenCastor, HcalGenEndcap, HcalGenForward, HcalGenOuter, HcalGenTriggerTower, HcalGenZDC, HcalOuter, HcalCalibDetId::hcalSubdet(), HEhalf, HFhalf, HcalCalibDetId::HOCrosstalk, HOhalf, HThalf, HcalCalibDetId::ieta(), HcalDetId::ietaAbs(), HcalTrigTowerDetId::ietaAbs(), getHLTprescales::index, HcalDetId::iphi(), HcalTrigTowerDetId::iphi(), HcalCalibDetId::iphi(), HcalZDCDetId::LUM, HcalCastorDetId::module(), DetId::rawId(), HcalZDCDetId::section(), HcalCastorDetId::sector(), ZDChalf, HcalDetId::zside(), HcalZDCDetId::zside(), HcalTrigTowerDetId::zside(), HcalCastorDetId::zside(), and HcalCalibDetId::zside().

Referenced by HcalCovarianceMatrices::addValues(), HcalCholeskyMatrices::addValues(), HcalCondObjectContainer< Item >::addValues(), CastorCondObjectContainer< Item >::addValues(), HcalLogicalMapGenerator::buildCALIBMap(), HcalLogicalMapGenerator::buildHBEFTMap(), HcalLogicalMapGenerator::buildHOXMap(), HcalCovarianceMatrices::exists(), HcalCholeskyMatrices::exists(), HcalCondObjectContainer< Item >::exists(), CastorCondObjectContainer< Item >::exists(), HcalLogicalMap::getHcalFrontEndId(), HcalCovarianceMatrices::getValues(), HcalCholeskyMatrices::getValues(), HcalCondObjectContainer< Item >::getValues(), and CastorCondObjectContainer< Item >::getValues().

91  {
92  int index = -1;
93 
94  int zside=0, ietaAbs=0, ieta=0, iphi=0, depth=0, channel=0, sector=0, module=0;
95 
96  switch (genericSubdet()) {
97  // HB valid DetIds: phi=1-72,eta=1-14,depth=1; phi=1-72,eta=15-16,depth=1-2
99  {
100  HcalDetId tid(rawId() );
101  zside = tid.zside();
102  ietaAbs = tid.ietaAbs();
103  iphi = tid.iphi();
104  depth = tid.depth();
105 
106  // if (ietaAbs < 16) index = (iphi - 1)*18 + (ietaAbs - 1) + (depth - 1);
107  // if (ietaAbs == 16) index = (iphi - 1)*18 + ietaAbs + (depth - 1);
108 
109  index = (iphi - 1)*18 + ietaAbs + depth - 2;
110  if (ietaAbs == 16) ++index;
111 
112  if (zside == -1) index += HBhalf;
113  }
114  break;
115  // HE valid DetIds: phi=1-72,eta=16-17,depth=1; phi=1-72,eta=18-20,depth=1-2;
116  // phi=1-71(in steps of 2),eta=21-26,depth=1-2; phi=1-71(in steps of 2),eta=27-28,depth=1-3
117  // phi=1-71(in steps of 2),eta=29,depth=1-2
119  {
120  HcalDetId tid(rawId() );
121  zside = tid.zside();
122  ietaAbs = tid.ietaAbs();
123  iphi = tid.iphi();
124  depth = tid.depth();
125 
126  if (!h2mode_)
127  {
128  if (ietaAbs == 16 || ietaAbs == 17) index = (iphi - 1)*8 + (iphi/2)*20 + (ietaAbs - 16);
129  if (ietaAbs >= 18 && ietaAbs <= 20) index = (iphi - 1)*8 + (iphi/2)*20 + 2 + 2*(ietaAbs-18) + (depth - 1);
130  if (ietaAbs >= 21 && ietaAbs <= 26) index = (iphi - 1)*8 + (iphi/2)*20 + 8 + 2*(ietaAbs-21) + (depth - 1);
131  if (ietaAbs >= 27 && ietaAbs <= 28) index = (iphi - 1)*8 + (iphi/2)*20 + 20 + 3*(ietaAbs-27) + (depth - 1);
132  if (ietaAbs == 29) index = (iphi - 1)*8 + (iphi/2)*20 + 26 + 2*(ietaAbs-29) + (depth - 1);
133  }
134  else
135  {
136  // make as general as possible, don't care about tight packing for the moment
137  // index = (iphi-1)*(4*14) + (ietaAbs - 16)*4 + (depth - 1);
138  index = 4*( 14*(iphi-1) + (ietaAbs - 16)) + (depth - 1);
139 
140  // if (ietaAbs == 16) index = (iphi - 1)*11 + (iphi/2)*20 + (ietaAbs - 16);
141  // if (ietaAbs == 17) index = (iphi - 1)*11 + (iphi/2)*20 + 1 + (ietaAbs - 17) + (depth - 1);
142  // if (ietaAbs >= 18 && ietaAbs <= 20) index = (iphi - 1)*11 + (iphi/2)*20 + 5 + 2*(ietaAbs-18) + (depth - 1);
143  // if (ietaAbs >= 21 && ietaAbs <= 26) index = (iphi - 1)*11 + (iphi/2)*20 + 11 + 2*(ietaAbs-21) + (depth - 1);
144  // if (ietaAbs >= 27 && ietaAbs <= 28) index = (iphi - 1)*11 + (iphi/2)*20 + 23 + 3*(ietaAbs-27) + (depth - 1);
145  // if (ietaAbs == 29) index = (iphi - 1)*11 + (iphi/2)*20 + 29 + 2*(ietaAbs-29) + (depth - 1);
146  }
147  if (zside == -1) index += HEhalf;
148 
149  }
150  break;
151  // HO valid DetIds: phi=1-72,eta=1-15,depth=4!
153  {
154  HcalDetId tid(rawId() );
155  zside = tid.zside();
156  ietaAbs = tid.ietaAbs();
157  iphi = tid.iphi();
158  depth = tid.depth();
159 
160  index = (iphi - 1)*15 + (ietaAbs - 1);
161 
162  if (zside == -1) index += HOhalf;
163  }
164  break;
165  // HF valid DetIds: phi=1-71(in steps of 2),eta=29-39,depth=1-2; phi=3-71(in steps of 4),eta=40-41,depth=1-2
167  {
168  HcalDetId tid(rawId() );
169  zside = tid.zside();
170  ietaAbs = tid.ietaAbs();
171  iphi = tid.iphi();
172  depth = tid.depth();
173 
174  index = ((iphi-1)/4)*4 + ((iphi-1)/2)*22 + 2*(ietaAbs-29) + (depth - 1);
175 
176  if (zside == -1) index += HFhalf;
177  }
178  break;
179  // TriggerTower:
181  {
182  HcalTrigTowerDetId tid(rawId() );
183  zside = tid.zside();
184  ietaAbs = tid.ietaAbs();
185  iphi = tid.iphi();
186 
187  if ((iphi-1)%4==0) index = (iphi-1)*32 + (ietaAbs-1) - (12*((iphi-1)/4));
188  else index = (iphi-1)*28 + (ietaAbs-1) + (4*(((iphi-1)/4)+1));
189 
190  if (zside == -1) index += HThalf;
191  // ieta = ietaAbs*zside;
192  }
193  break;
194  // ZDC: ZDC_EM: 1 to 5, ZDC_HAD: 1 to 4, ZDC_LUM: 1,2, eta = +1, -1
196  {
197  HcalZDCDetId tid(rawId() );
198  zside = tid.zside();
199  channel = tid.channel();
200  //depth = tid.depth();//depth is not unique, channel is
201 
202  switch (tid.section() ) {
203  case HcalZDCDetId::EM: index = (channel-1); break;
204  case HcalZDCDetId::HAD: index = 5 + (channel-1); break;
205  case HcalZDCDetId::LUM: index = 9 + (channel-1); break;
206  default: break;
207  }
208  if (zside == -1) index += ZDChalf;
209  }
210  break;
211  // Castor: zside +-1, sector (phi-segmentation) 1..16, module (z segm.) 1..14
212  // total: 14*16=224 per zside
214  {
215  HcalCastorDetId tid(rawId() );
216  zside = tid.zside();
217  sector = tid.sector();
218  module = tid.module();
219 
220  index = 14*(sector-1) + (module-1);
221  if (zside == -1) index += CASTORhalf;
222 
223  }
224  break;
225  // Calibration channels: no zside=-1 ! with current naming convention
227  {
228  HcalCalibDetId tid(rawId() );
229  channel = tid.cboxChannel();
230  ieta = tid.ieta();
231  iphi = tid.iphi();
232  zside = tid.zside();
233 
234 
235  if (tid.calibFlavor()==HcalCalibDetId::CalibrationBox) {
236 
237  HcalSubdetector subDet = tid.hcalSubdet();
238 
239  if (subDet==HcalBarrel) {
240  //std::cout<<"CALIB_HB: ";
241  //dphi = 4 (18 phi values), 3 channel types (0,1,2), eta = -1 or 1
242  //total of 18*3*2=108 channels
243  index = ((iphi+1)/4-1) + 18*channel + 27*(ieta+1);
244  }
245  else if (subDet==HcalEndcap) {
246  //std::cout<<"CALIB_HE: ";
247  //dphi = 4 (18 phi values), 6 channel types (0,1,3,4,5,6), eta = -1 or 1
248  //total of 18*6*2=216 channels
249  if (channel>2) channel-=1;
250  index = ((iphi+1)/4-1) + 18*channel + 54*(ieta+1) + 108;
251  }
252  else if (subDet==HcalForward) {
253  //std::cout<<"CALIB_HF: ";
254  //dphi = 18 (4 phi values), 3 channel types (0,1,8), eta = -1 or 1
255  if (channel==8) channel = 2;
256  //total channels 4*3*2=24
257  index = (iphi-1)/18 + 4*channel + 6*(ieta+1) + 324;
258  }
259  else if (subDet==HcalOuter) {
260  //std::cout<<"CALIB_HO: ";
261  //there are 5 special calib crosstalk channels, one in each ring
262  if (channel==7) {
263  channel = 2;
264  index = (ieta+2) + 420;
265  }
266  //for HOM/HOP dphi = 6 (12 phi values), 2 channel types (0,1), eta = -2,-1 or 1,2
267  //for HO0/YB0 dphi = 12 (6 phi values), 2 channel types (0,1), eta = 0
268  else{
269  if (ieta<0) index = ((iphi+1)/12-1) + 36*channel + 6*(ieta+2) + 348;
270  else if (ieta>0) index = ((iphi+1)/12-1) + 36*channel + 6*(ieta+2) + 6 + 348;
271  else index = ((iphi+1)/6-1) + 36*channel + 6*(ieta+2) + 348;
272  }
273  }
274  else {
275  std::cout << "HCAL Det Id not valid!" << std::endl;
276  index = 0;
277  }
278 
279  }
280  else if (tid.calibFlavor()==HcalCalibDetId::HOCrosstalk) {
281  //std::cout<<"HX: ";
282  //for YB0/HO0 phi is grouped in 6 groups of 6 with dphi=2 but the transitions are 1 or 3
283  // in such a way that the %36 operation yeilds unique values for every iphi
284  if (abs(ieta)==4) index = ((iphi-1)%36) + (((zside+1)*36)/2) + 72 + 425; //ieta = 1 YB0/HO0;
285  else index = (iphi-1) + (36*(zside+1)*2) + 425; //ieta = 0 for HO2M/HO1M ieta=2 for HO1P/HO2P;
286  }
287  //std::cout << " " << ieta << " " << zside << " " << iphi << " " << depth << " " << index << std::endl;
288  }
289  //std::cout << "eta: " << ieta << " side: " << zside << " phi: " << iphi << " depth: " << depth << " index: " << index << std::endl;
290 
291  break;
292  default: break;
293 
294  } // end switch
295 
296  return index;
297 }
module()
Definition: vlib.cc:994
#define abs(x)
Definition: mlp_lapack.h:159
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
HcalSubdetector
Definition: HcalAssistant.h:32
tuple cout
Definition: gather_cfg.py:41
HcalGenericSubdetector genericSubdet() const
Definition: vlib.h:209
bool HcalGenericDetId::isHcalCalibDetId ( ) const
bool HcalGenericDetId::isHcalCastorDetId ( ) const
bool HcalGenericDetId::isHcalDetId ( ) const
bool HcalGenericDetId::isHcalTrigTowerDetId ( ) const
bool HcalGenericDetId::isHcalZDCDetId ( ) const
HcalOtherSubdetector HcalGenericDetId::otherSubdet ( ) const

Definition at line 15 of file HcalGenericDetId.cc.

References HcalOther, HcalOtherEmpty, DetId::rawId(), and DetId::subdetId().

Referenced by genericSubdet().

15  {
17  return HcalOtherSubdetector ((rawId()>>20)&0x1F);
18 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
HcalOtherSubdetector
Definition: HcalAssistant.h:33
HcalSubdetector
Definition: HcalAssistant.h:32
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39