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
void validateCode(unsigned transformCode)
unsigned transform(const HcalDetId &id, unsigned transformCode)