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.

18 { ChannelCount = 5184U };

Constructor & Destructor Documentation

◆ HBHELinearMap()

HBHELinearMap::HBHELinearMap ( )

Definition at line 44 of file HBHELinearMap.cc.

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 }

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

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.

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 }

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

◆ getSubdetector()

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

Definition at line 113 of file HBHELinearMap.cc.

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 }

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

◆ isValidTriple()

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

Definition at line 30 of file HBHELinearMap.cc.

30  {
31  const unsigned ind = find(depth, ieta, iphi);
32  return ind < ChannelCount;
33 }

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

◆ linearIndex()

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

Definition at line 35 of file HBHELinearMap.cc.

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 }

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

Referenced by HcalInterpolatedPulseColl::getChannelPulse().

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().

mps_fire.i
i
Definition: mps_fire.py:428
HBHELinearMap::ChannelCount
Definition: HBHELinearMap.h:18
cms::cuda::assert
assert(be >=bs)
HcalBarrel
Definition: HcalAssistant.h:33
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HBHELinearMap::MapPair
std::pair< HBHEChannelId, unsigned > MapPair
Definition: HBHELinearMap.h:77
HBHELinearMap::find
unsigned find(unsigned depth, int ieta, unsigned iphi) const
Definition: HBHELinearMap.cc:21
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
MapPair
Definition: DDLMap.cc:14
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
HBHELinearMap::lookup_
HBHEChannelId lookup_[ChannelCount]
Definition: HBHELinearMap.h:82
HBHELinearMap::inverse_
ChannelMap inverse_
Definition: HBHELinearMap.h:83
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
HcalEndcap
Definition: HcalAssistant.h:34
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
Exception
Definition: hltDiff.cc:245
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22