CMS 3D CMS Logo

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