CMS 3D CMS Logo

HcalDetIdTransform.cc
Go to the documentation of this file.
3 
5 
6 namespace HcalDetIdTransform {
7  unsigned transform(const HcalDetId& id, const unsigned transformCode) {
8  static const int ietaShift = 1024;
9  static const int maxHcalDepth = 64;
10 
11  if (transformCode >= N_TRANSFORMS)
12  throw cms::Exception(
13  "In HcalDetIdTransform::transform:"
14  " invalid transform code");
15  unsigned t = 0;
16  switch (transformCode) {
17  case RAWID:
18  t = id.rawId();
19  break;
20 
21  case IETA:
22  t = id.ieta() + ietaShift;
23  break;
24 
25  case IETAABS:
26  t = id.ietaAbs();
27  break;
28 
29  case SUBDET:
30  t = id.subdetId();
31  break;
32 
33  case IETADEPTH:
34  t = (id.ieta() + ietaShift) * maxHcalDepth + id.depth();
35  break;
36 
37  case IETAABSDEPTH:
38  t = id.ietaAbs() * maxHcalDepth + id.depth();
39  break;
40 
41  default:
42  throw cms::Exception(
43  "In HcalDetIdTransform::transform:"
44  " unhandled switch clause. This is a bug."
45  " Please report.");
46  }
47  return t;
48  }
49 
50  void validateCode(const unsigned transformCode) {
51  if (transformCode >= N_TRANSFORMS)
52  throw cms::Exception(
53  "In HcalDetIdTransform::validateCode:"
54  " invalid transform code");
55  }
56 } // namespace HcalDetIdTransform
HcalDetIdTransform.h
HcalDetIdTransform::IETAABS
Definition: HcalDetIdTransform.h:13
HcalDetIdTransform::N_TRANSFORMS
Definition: HcalDetIdTransform.h:17
HcalDetIdTransform::IETADEPTH
Definition: HcalDetIdTransform.h:15
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
OrderedSet.t
t
Definition: OrderedSet.py:90
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
HcalDetIdTransform::IETA
Definition: HcalDetIdTransform.h:12
HcalDetId.h
HcalDetId
Definition: HcalDetId.h:12
HcalDetIdTransform::RAWID
Definition: HcalDetIdTransform.h:11
HcalDetIdTransform
Definition: HcalDetIdTransform.h:6
HcalDetIdTransform::SUBDET
Definition: HcalDetIdTransform.h:14
HcalDetIdTransform::IETAABSDEPTH
Definition: HcalDetIdTransform.h:16
Exception
Definition: hltDiff.cc:246
Exception.h
HcalDetIdTransform::validateCode
void validateCode(unsigned transformCode)
Definition: HcalDetIdTransform.cc:50