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 
12  if (transformCode >= N_TRANSFORMS)
13  throw cms::Exception("In HcalDetIdTransform::transform:"
14  " invalid transform code");
15  unsigned t = 0;
16  switch (transformCode)
17  {
18  case RAWID:
19  t = id.rawId();
20  break;
21 
22  case IETA:
23  t = id.ieta() + ietaShift;
24  break;
25 
26  case IETAABS:
27  t = id.ietaAbs();
28  break;
29 
30  case SUBDET:
31  t = id.subdetId();
32  break;
33 
34  default:
35  throw cms::Exception("In HcalDetIdTransform::transform:"
36  " unhandled switch clause. This is a bug."
37  " Please report.");
38  }
39  return t;
40  }
41 
42  void validateCode(const unsigned transformCode)
43  {
44  if (transformCode >= N_TRANSFORMS)
45  throw cms::Exception("In HcalDetIdTransform::validateCode:"
46  " invalid transform code");
47  }
48 }
void validateCode(unsigned transformCode)
unsigned transform(const HcalDetId &id, unsigned transformCode)