CMS 3D CMS Logo

Enumerations | Functions
HcalDetIdTransform Namespace Reference

Enumerations

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

Functions

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

Enumeration Type Documentation

anonymous enum
Enumerator
RAWID 
IETA 
IETAABS 
SUBDET 
IETADEPTH 
IETAABSDEPTH 
N_TRANSFORMS 

Definition at line 11 of file HcalDetIdTransform.h.

11  {
12  RAWID = 0, // Raw detector id
13  IETA, // ieta() + shift
14  IETAABS, // ietaAbs()
15  SUBDET, // subdetId()
16  IETADEPTH, // maps ieta() and depth() into a unique number
17  IETAABSDEPTH, // maps ietaAbs() and depth() into a unique number
19  };

Function Documentation

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

Definition at line 8 of file HcalDetIdTransform.cc.

References egammaForCoreTracking_cff::depth, Exception, IETA, IETAABS, IETAABSDEPTH, IETADEPTH, N_TRANSFORMS, RAWID, SUBDET, and protons_cff::t.

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

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

Definition at line 51 of file HcalDetIdTransform.cc.

References Exception, and N_TRANSFORMS.

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

52  {
53  if (transformCode >= N_TRANSFORMS)
54  throw cms::Exception("In HcalDetIdTransform::validateCode:"
55  " invalid transform code");
56  }