CMS 3D CMS Logo

HBHELinearMap.cc
Go to the documentation of this file.
1 #include <cassert>
3 #include <algorithm>
4 
6 
7 void HBHELinearMap::getChannelTriple(const unsigned index, unsigned* depth, int* ieta, unsigned* iphi) const {
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 }
20 
21 unsigned HBHELinearMap::find(const unsigned depth, const int ieta, const unsigned iphi) const {
22  const HBHEChannelId id(depth, ieta, iphi);
23  const unsigned loc = std::lower_bound(inverse_.begin(), inverse_.end(), MapPair(id, 0U)) - inverse_.begin();
24  if (loc < ChannelCount)
25  if (inverse_[loc].first == id)
26  return inverse_[loc].second;
27  return ChannelCount;
28 }
29 
30 bool HBHELinearMap::isValidTriple(const unsigned depth, const int ieta, const unsigned iphi) const {
31  const unsigned ind = find(depth, ieta, iphi);
32  return ind < ChannelCount;
33 }
34 
35 unsigned HBHELinearMap::linearIndex(const unsigned depth, const int ieta, const unsigned iphi) const {
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 }
43 
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)
51 
52  for (int ieta = -20; ieta <= 20; ++ieta)
53  if (ieta)
54  for (unsigned iphi = 1; iphi <= 72; ++iphi)
56 
57  for (int ieta = 21; ieta <= 29; ++ieta)
58  for (unsigned iphi = 1; iphi < 72; iphi += 2)
60 
61  depth = 2;
62 
63  for (int ieta = -29; ieta <= -21; ++ieta)
64  for (unsigned iphi = 1; iphi < 72; iphi += 2)
66 
67  for (int ieta = -20; ieta <= -18; ++ieta)
68  for (unsigned iphi = 1; iphi <= 72; ++iphi)
70 
71  for (int ieta = -16; ieta <= -15; ++ieta)
72  for (unsigned iphi = 1; iphi <= 72; ++iphi)
74 
75  for (int ieta = 15; ieta <= 16; ++ieta)
76  for (unsigned iphi = 1; iphi <= 72; ++iphi)
78 
79  for (int ieta = 18; ieta <= 20; ++ieta)
80  for (unsigned iphi = 1; iphi <= 72; ++iphi)
82 
83  for (int ieta = 21; ieta <= 29; ++ieta)
84  for (unsigned iphi = 1; iphi < 72; iphi += 2)
86 
87  depth = 3;
88 
89  for (int ieta = -28; ieta <= -27; ++ieta)
90  for (unsigned iphi = 1; iphi < 72; iphi += 2)
92 
93  for (int ieta = -16; ieta <= -16; ++ieta)
94  for (unsigned iphi = 1; iphi <= 72; ++iphi)
96 
97  for (int ieta = 16; ieta <= 16; ++ieta)
98  for (unsigned iphi = 1; iphi <= 72; ++iphi)
100 
101  for (int ieta = 27; ieta <= 28; ++ieta)
102  for (unsigned iphi = 1; iphi < 72; iphi += 2)
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 }
112 
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 }
138 
140  static const HBHELinearMap chMap;
141  return chMap;
142 }
HBHELinearMap::getChannelTriple
void getChannelTriple(unsigned index, unsigned *depth, int *ieta, unsigned *iphi) const
Definition: HBHELinearMap.cc:7
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
HBHELinearMap::getSubdetector
static HcalSubdetector getSubdetector(unsigned depth, int ieta)
Definition: HBHELinearMap.cc:113
dqmdumpme.first
first
Definition: dqmdumpme.py:55
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HBHELinearMap::MapPair
std::pair< HBHEChannelId, unsigned > MapPair
Definition: HBHELinearMap.h:77
HBHELinearMap::HBHELinearMap
HBHELinearMap()
Definition: HBHELinearMap.cc:44
HBHELinearMap::find
unsigned find(unsigned depth, int ieta, unsigned iphi) const
Definition: HBHELinearMap.cc:21
HBHELinearMap.h
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
HBHELinearMap::isValidTriple
bool isValidTriple(unsigned depth, int ieta, unsigned iphi) const
Definition: HBHELinearMap.cc:30
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
HBHELinearMap::linearIndex
unsigned linearIndex(unsigned depth, int ieta, unsigned iphi) const
Definition: HBHELinearMap.cc:35
HBHELinearMap::HBHEChannelId
Definition: HBHELinearMap.h:41
HBHELinearMap::lookup_
HBHEChannelId lookup_[ChannelCount]
Definition: HBHELinearMap.h:82
hbheChannelMap
const HBHELinearMap & hbheChannelMap()
Definition: HBHELinearMap.cc:139
HBHELinearMap::inverse_
ChannelMap inverse_
Definition: HBHELinearMap.h:83
HBHELinearMap
Definition: HBHELinearMap.h:16
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
HcalSubdetector
HcalSubdetector
Definition: HcalAssistant.h:31
HcalEndcap
Definition: HcalAssistant.h:34
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
Exception
Definition: hltDiff.cc:246
Exception.h
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22