CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
HBHELinearMap Class Reference

#include <HBHELinearMap.h>

Classes

class  HBHEChannelId
 

Public Types

enum  { ChannelCount = 5184U }
 

Public Member Functions

void getChannelTriple (unsigned index, unsigned *depth, int *ieta, unsigned *iphi) const
 
 HBHELinearMap ()
 
bool isValidTriple (unsigned depth, int ieta, unsigned iphi) const
 
unsigned linearIndex (unsigned depth, int ieta, unsigned iphi) const
 

Static Public Member Functions

static HcalSubdetector getSubdetector (unsigned depth, int ieta)
 

Private Types

typedef std::vector< MapPairChannelMap
 
typedef std::pair< HBHEChannelId, unsigned > MapPair
 

Private Member Functions

unsigned find (unsigned depth, int ieta, unsigned iphi) const
 

Private Attributes

ChannelMap inverse_
 
HBHEChannelId lookup_ [ChannelCount]
 

Detailed Description

Definition at line 16 of file HBHELinearMap.h.

Member Typedef Documentation

◆ ChannelMap

typedef std::vector<MapPair> HBHELinearMap::ChannelMap
private

Definition at line 78 of file HBHELinearMap.h.

◆ MapPair

typedef std::pair<HBHEChannelId, unsigned> HBHELinearMap::MapPair
private

Definition at line 77 of file HBHELinearMap.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ChannelCount 

Definition at line 18 of file HBHELinearMap.h.

Constructor & Destructor Documentation

◆ HBHELinearMap()

HBHELinearMap::HBHELinearMap ( )

Definition at line 44 of file HBHELinearMap.cc.

References cms::cuda::assert(), ChannelCount, LEDCalibrationChannels::depth, mps_fire::i, LEDCalibrationChannels::ieta, inverse_, LEDCalibrationChannels::iphi, cmsLHEtoEOSManager::l, lookup_, and jetsAK4_CHS_cff::sort.

44  {
45  unsigned l = 0;
46  unsigned depth = 1;
47 
48  for (int ieta = -29; ieta <= -21; ++ieta)
49  for (unsigned iphi = 1; iphi < 72; iphi += 2)
50  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
51 
52  for (int ieta = -20; ieta <= 20; ++ieta)
53  if (ieta)
54  for (unsigned iphi = 1; iphi <= 72; ++iphi)
55  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
56 
57  for (int ieta = 21; ieta <= 29; ++ieta)
58  for (unsigned iphi = 1; iphi < 72; iphi += 2)
59  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
60 
61  depth = 2;
62 
63  for (int ieta = -29; ieta <= -21; ++ieta)
64  for (unsigned iphi = 1; iphi < 72; iphi += 2)
65  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
66 
67  for (int ieta = -20; ieta <= -18; ++ieta)
68  for (unsigned iphi = 1; iphi <= 72; ++iphi)
69  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
70 
71  for (int ieta = -16; ieta <= -15; ++ieta)
72  for (unsigned iphi = 1; iphi <= 72; ++iphi)
73  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
74 
75  for (int ieta = 15; ieta <= 16; ++ieta)
76  for (unsigned iphi = 1; iphi <= 72; ++iphi)
77  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
78 
79  for (int ieta = 18; ieta <= 20; ++ieta)
80  for (unsigned iphi = 1; iphi <= 72; ++iphi)
81  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
82 
83  for (int ieta = 21; ieta <= 29; ++ieta)
84  for (unsigned iphi = 1; iphi < 72; iphi += 2)
85  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
86 
87  depth = 3;
88 
89  for (int ieta = -28; ieta <= -27; ++ieta)
90  for (unsigned iphi = 1; iphi < 72; iphi += 2)
91  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
92 
93  for (int ieta = -16; ieta <= -16; ++ieta)
94  for (unsigned iphi = 1; iphi <= 72; ++iphi)
95  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
96 
97  for (int ieta = 16; ieta <= 16; ++ieta)
98  for (unsigned iphi = 1; iphi <= 72; ++iphi)
99  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
100 
101  for (int ieta = 27; ieta <= 28; ++ieta)
102  for (unsigned iphi = 1; iphi < 72; iphi += 2)
103  lookup_[l++] = HBHEChannelId(depth, ieta, iphi);
104 
105  assert(l == ChannelCount);
106 
107  inverse_.reserve(ChannelCount);
108  for (unsigned i = 0; i < ChannelCount; ++i)
109  inverse_.push_back(MapPair(lookup_[i], i));
110  std::sort(inverse_.begin(), inverse_.end());
111 }
HBHEChannelId lookup_[ChannelCount]
Definition: HBHELinearMap.h:82
assert(be >=bs)
ChannelMap inverse_
Definition: HBHELinearMap.h:83

Member Function Documentation

◆ find()

unsigned HBHELinearMap::find ( unsigned  depth,
int  ieta,
unsigned  iphi 
) const
private

◆ getChannelTriple()

void HBHELinearMap::getChannelTriple ( unsigned  index,
unsigned *  depth,
int *  ieta,
unsigned *  iphi 
) const

Definition at line 7 of file HBHELinearMap.cc.

References ChannelCount, LEDCalibrationChannels::depth, Exception, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, and lookup_.

7  {
8  if (index >= ChannelCount)
9  throw cms::Exception(
10  "In HBHELinearMap::getChannelTriple: "
11  "input index out of range");
12  const HBHEChannelId& id = lookup_[index];
13  if (depth)
14  *depth = id.depth();
15  if (ieta)
16  *ieta = id.ieta();
17  if (iphi)
18  *iphi = id.iphi();
19 }
HBHEChannelId lookup_[ChannelCount]
Definition: HBHELinearMap.h:82

◆ getSubdetector()

HcalSubdetector HBHELinearMap::getSubdetector ( unsigned  depth,
int  ieta 
)
static

Definition at line 113 of file HBHELinearMap.cc.

References funct::abs(), LEDCalibrationChannels::depth, Exception, HcalBarrel, HcalEndcap, LEDCalibrationChannels::ieta, and mitigatedMETSequence_cff::U.

113  {
114  const unsigned abseta = std::abs(ieta);
115 
116  // Make sure the arguments are in range
117  if (!(abseta <= 29U))
118  throw cms::Exception(
119  "In HBHELinearMap::getSubdetector: "
120  "eta argument out of range");
121  if (!(depth > 0U && depth < 4U))
122  throw cms::Exception(
123  "In HBHELinearMap::getSubdetector: "
124  "depth argument out of range");
125  if (abseta == 29U)
126  if (!(depth <= 2U))
127  throw cms::Exception(
128  "In HBHELinearMap::getSubdetector: "
129  "depth argument out of range "
130  "for |ieta| = 29");
131  if (abseta <= 15U)
132  return HcalBarrel;
133  else if (abseta == 16U)
134  return depth <= 2U ? HcalBarrel : HcalEndcap;
135  else
136  return HcalEndcap;
137 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ isValidTriple()

bool HBHELinearMap::isValidTriple ( unsigned  depth,
int  ieta,
unsigned  iphi 
) const

◆ linearIndex()

unsigned HBHELinearMap::linearIndex ( unsigned  depth,
int  ieta,
unsigned  iphi 
) const

Definition at line 35 of file HBHELinearMap.cc.

References ChannelCount, LEDCalibrationChannels::depth, Exception, find(), LEDCalibrationChannels::ieta, and LEDCalibrationChannels::iphi.

Referenced by HcalInterpolatedPulseColl::getChannelPulse().

35  {
36  const unsigned ind = find(depth, ieta, iphi);
37  if (ind >= ChannelCount)
38  throw cms::Exception(
39  "In HBHELinearMap::linearIndex: "
40  "invalid channel triple");
41  return ind;
42 }
unsigned find(unsigned depth, int ieta, unsigned iphi) const

Member Data Documentation

◆ inverse_

ChannelMap HBHELinearMap::inverse_
private

Definition at line 83 of file HBHELinearMap.h.

Referenced by find(), and HBHELinearMap().

◆ lookup_

HBHEChannelId HBHELinearMap::lookup_[ChannelCount]
private

Definition at line 82 of file HBHELinearMap.h.

Referenced by getChannelTriple(), and HBHELinearMap().