test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Enumerations | Functions
HcalDetIdTransform Namespace Reference

Enumerations

enum  {
  RAWID = 0, IETA, IETAABS, SUBDET,
  N_TRANSFORMS
}
 

Functions

unsigned transform (const HcalDetId &id, unsigned transformCode)
 
void validateCode (unsigned transformCode)
 

Enumeration Type Documentation

anonymous enum
Enumerator
RAWID 
IETA 
IETAABS 
SUBDET 
N_TRANSFORMS 

Definition at line 11 of file HcalDetIdTransform.h.

Function Documentation

unsigned HcalDetIdTransform::transform ( const HcalDetId id,
unsigned  transformCode 
)

Definition at line 8 of file HcalDetIdTransform.cc.

References Exception, IETA, IETAABS, N_TRANSFORMS, RAWID, SUBDET, and t.

Referenced by HcalItemCollById< HFPhase1PMTData >::getIndex(), and HcalItemArrayCollById< Item, N >::getIndex().

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  }
void HcalDetIdTransform::validateCode ( unsigned  transformCode)

Definition at line 42 of file HcalDetIdTransform.cc.

References Exception, and N_TRANSFORMS.

Referenced by HcalItemArrayCollById< Item, N >::HcalItemArrayCollById(), and HcalItemCollById< HFPhase1PMTData >::HcalItemCollById().

43  {
44  if (transformCode >= N_TRANSFORMS)
45  throw cms::Exception("In HcalDetIdTransform::validateCode:"
46  " invalid transform code");
47  }