CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Static Public Member Functions | Static Public Attributes | Private Member Functions
HcalHPDRBXMap Class Reference

#include <HcalHPDRBXMap.h>

Static Public Member Functions

static int indexHPD (const HcalDetId &)
 
static void indexHPDfromEtaPhi (int ieta, int iphi, std::vector< int > &hpdindices)
 
static int indexRBX (const HcalDetId &)
 
static void indexRBXfromEtaPhi (int ieta, int iphi, std::vector< int > &rbxindices)
 
static int indexRBXfromHPD (int hpdindex)
 
static void indicesHPDfromRBX (int rbxindex, std::array< int, NUM_HPDS_PER_RBX > &hpdindices)
 
static int iphihiHPD (int index)
 
static int iphihiRBX (int index)
 
static int iphiloHPD (int index)
 
static int iphiloRBX (int index)
 
static bool isValid (const HcalDetId &)
 
static bool isValid (int ieta, int iphi)
 
static bool isValidHPD (int index)
 
static bool isValidRBX (int index)
 
static int numHPDs (void)
 
static int numHPDsPerRBX (void)
 
static int numHPDsPerSubdet (void)
 
static int numRBXs (void)
 
static int numRBXsPerSubdet (void)
 
static HcalSubdetector subdetHPD (int index)
 
static HcalSubdetector subdetRBX (int index)
 
static int zsideHPD (int index)
 
static int zsideRBX (int index)
 

Static Public Attributes

static const int NUM_HPDS = 288
 
static const int NUM_HPDS_PER_RBX = 4
 
static const int NUM_HPDS_PER_SUBDET = 72
 
static const int NUM_RBXS = 72
 
static const int NUM_RBXS_PER_SUBDET = 18
 

Private Member Functions

 HcalHPDRBXMap ()
 
 ~HcalHPDRBXMap ()
 

Detailed Description

Definition at line 22 of file HcalHPDRBXMap.h.

Constructor & Destructor Documentation

HcalHPDRBXMap::HcalHPDRBXMap ( )
private

Definition at line 14 of file HcalHPDRBXMap.cc.

14 {}
HcalHPDRBXMap::~HcalHPDRBXMap ( )
private

Definition at line 15 of file HcalHPDRBXMap.cc.

15 {}

Member Function Documentation

int HcalHPDRBXMap::indexHPD ( const HcalDetId id)
static

Definition at line 186 of file HcalHPDRBXMap.cc.

References funct::abs(), HLT_FULL_cff::depth, Exception, HcalBarrel, HcalEndcap, isValid(), edm::errors::LogicError, NUM_HPDS_PER_SUBDET, and ecaldqm::zside().

Referenced by reco::HcalNoiseRBXArray::findHPD(), indexHPDfromEtaPhi(), and indexRBX().

186  {
187  // return bad index if subdetector is invalid
188  if (!isValid(id)) {
190  << " HcalDetId " << id << " is invalid in HcalHPDRBXMap::indexHPD().\n";
191  }
192 
193  // specify the readout module (subdet and number)
194  int subdet = -1;
195  if (id.subdet() == HcalBarrel && id.zside() == 1)
196  subdet = 0;
197  if (id.subdet() == HcalBarrel && id.zside() == -1)
198  subdet = 1;
199  if (id.subdet() == HcalEndcap && id.zside() == 1)
200  subdet = 2;
201  if (id.subdet() == HcalEndcap && id.zside() == -1)
202  subdet = 3;
203 
204  int iphi = id.iphi();
205  int absieta = abs(id.ieta());
206 
207  // adjust for offset between iphi and the HPD index
208  // index-->iphi
209  // 0-->71, 1-->72, 2-->1, 3-->2, 4-->3, ..., 70-->69, 71-->70
210  int index = iphi + 1;
211  if (index >= NUM_HPDS_PER_SUBDET)
212  index -= NUM_HPDS_PER_SUBDET;
213  index += subdet * NUM_HPDS_PER_SUBDET;
214 
215  // modify the index in the HE
216  if ((subdet == 2 || subdet == 3) && absieta >= 21 && absieta <= 29) {
217  if (iphi % 4 == 3 && absieta % 2 == 1 && absieta != 29)
218  index++;
219  if (iphi % 4 == 3 && absieta == 29 && id.depth() == 2)
220  index++;
221  if (iphi % 4 == 1 && absieta % 2 == 0 && absieta != 29)
222  index++;
223  if (iphi % 4 == 1 && absieta == 29 && id.depth() == 1)
224  index++;
225  }
226  return index;
227 }
int zside(DetId const &)
static const int NUM_HPDS_PER_SUBDET
Definition: HcalHPDRBXMap.h:28
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static bool isValid(const HcalDetId &)
void HcalHPDRBXMap::indexHPDfromEtaPhi ( int  ieta,
int  iphi,
std::vector< int > &  hpdindices 
)
static

Definition at line 231 of file HcalHPDRBXMap.cc.

References funct::abs(), HcalBarrel, HcalEndcap, and indexHPD().

Referenced by reco::HcalNoiseRBXArray::findHPD().

231  {
232  // clear the vector
233  hpdindices.clear();
234  int absieta = abs(ieta);
235 
236  if (absieta <= 15) { // HB only, depth doesn't matter
237  hpdindices.push_back(indexHPD(HcalDetId(HcalBarrel, ieta, iphi, 1)));
238  } else if (absieta == 16) { // HB and HE, depth doesn't matter
239  hpdindices.push_back(indexHPD(HcalDetId(HcalBarrel, ieta, iphi, 1)));
240  hpdindices.push_back(indexHPD(HcalDetId(HcalEndcap, ieta, iphi, 3)));
241  } else if (absieta < 29) { // HE only, depth doesn't matter
242  hpdindices.push_back(indexHPD(HcalDetId(HcalEndcap, ieta, iphi, 1)));
243  } else { // HE only, but depth matters
244  hpdindices.push_back(indexHPD(HcalDetId(HcalEndcap, ieta, iphi, 1)));
245  hpdindices.push_back(indexHPD(HcalDetId(HcalEndcap, ieta, iphi, 2)));
246  }
247 
248  return;
249 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static int indexHPD(const HcalDetId &)
int HcalHPDRBXMap::indexRBX ( const HcalDetId id)
static

Definition at line 229 of file HcalHPDRBXMap.cc.

References indexHPD(), and indexRBXfromHPD().

Referenced by reco::HcalNoiseRBXArray::findRBX(), and indexRBXfromEtaPhi().

229 { return indexRBXfromHPD(indexHPD(id)); }
static int indexRBXfromHPD(int hpdindex)
static int indexHPD(const HcalDetId &)
void HcalHPDRBXMap::indexRBXfromEtaPhi ( int  ieta,
int  iphi,
std::vector< int > &  rbxindices 
)
static

Definition at line 251 of file HcalHPDRBXMap.cc.

References funct::abs(), HcalBarrel, HcalEndcap, and indexRBX().

Referenced by reco::HcalNoiseRBXArray::findRBX().

251  {
252  // clear the vector
253  rbxindices.clear();
254  int absieta = abs(ieta);
255 
256  if (absieta <= 15) { // HB only
257  rbxindices.push_back(indexRBX(HcalDetId(HcalBarrel, ieta, iphi, 1)));
258  } else if (absieta == 16) { // HB and HE
259  rbxindices.push_back(indexRBX(HcalDetId(HcalBarrel, ieta, iphi, 1)));
260  rbxindices.push_back(indexRBX(HcalDetId(HcalEndcap, ieta, iphi, 3)));
261  } else { // HE only
262  rbxindices.push_back(indexRBX(HcalDetId(HcalEndcap, ieta, iphi, 1)));
263  }
264 
265  return;
266 }
static int indexRBX(const HcalDetId &)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int HcalHPDRBXMap::indexRBXfromHPD ( int  hpdindex)
static

Definition at line 177 of file HcalHPDRBXMap.cc.

References Exception, isValidHPD(), edm::errors::LogicError, and NUM_HPDS_PER_RBX.

Referenced by reco::HcalNoiseRBXArray::findHPD(), and indexRBX().

177  {
178  if (!isValidHPD(hpdindex))
180  << " HPD index " << hpdindex << " is invalid in HcalHPDRBXMap::indexRBX().\n";
181 
182  return hpdindex / NUM_HPDS_PER_RBX;
183 }
static const int NUM_HPDS_PER_RBX
Definition: HcalHPDRBXMap.h:30
static bool isValidHPD(int index)
void HcalHPDRBXMap::indicesHPDfromRBX ( int  rbxindex,
std::array< int, NUM_HPDS_PER_RBX > &  hpdindices 
)
static

Definition at line 165 of file HcalHPDRBXMap.cc.

References Exception, mps_fire::i, isValidRBX(), edm::errors::LogicError, and NUM_HPDS_PER_RBX.

Referenced by reco::HcalNoiseRBXArray::HcalNoiseRBXArray(), iphihiRBX(), and iphiloRBX().

165  {
166  if (!isValidRBX(rbxindex))
168  << " RBX index " << rbxindex << " is invalid in HcalHPDRBXMap::indicesHPD().\n";
169 
170  for (unsigned int i = 0; i < hpdindices.size(); i++)
171  hpdindices[i] = rbxindex * NUM_HPDS_PER_RBX + i;
172 
173  return;
174 }
static const int NUM_HPDS_PER_RBX
Definition: HcalHPDRBXMap.h:30
static bool isValidRBX(int index)
int HcalHPDRBXMap::iphihiHPD ( int  index)
static

Definition at line 127 of file HcalHPDRBXMap.cc.

References Exception, HcalBarrel, isValidHPD(), edm::errors::LogicError, NUM_HPDS_PER_SUBDET, and subdetHPD().

Referenced by iphihiRBX().

127  {
128  if (!isValidHPD(index))
130  << " HPD index " << index << " is invalid in HcalHPDRBXMap::iphihiHPD().\n";
131 
132  // adjust for offset between iphi and the HPD index
133  // index-->iphi
134  // 0-->71, 1-->72, 2-->1, 3-->2, 4-->3, ..., 70-->69, 71-->70
135  int iphi = index % NUM_HPDS_PER_SUBDET - 1;
136  if (iphi <= 0)
137  iphi += NUM_HPDS_PER_SUBDET;
138 
139  // HB
140  if (subdetHPD(index) == HcalBarrel)
141  return iphi;
142 
143  // HE
144  if (iphi % 2 == 0)
145  return iphi;
146  else
147  return iphi + 1;
148 }
static HcalSubdetector subdetHPD(int index)
static const int NUM_HPDS_PER_SUBDET
Definition: HcalHPDRBXMap.h:28
static bool isValidHPD(int index)
int HcalHPDRBXMap::iphihiRBX ( int  index)
static

Definition at line 151 of file HcalHPDRBXMap.cc.

References Exception, indicesHPDfromRBX(), iphihiHPD(), isValidRBX(), edm::errors::LogicError, and NUM_HPDS_PER_RBX.

151  {
152  if (!isValidRBX(index))
154  << " RBX index " << index << " is invalid in HcalHPDRBXMap::iphihiRBX().\n";
155 
156  // get the list of HPD indices in the RBX
157  std::array<int, NUM_HPDS_PER_RBX> arr;
158  indicesHPDfromRBX(index, arr);
159 
160  // return the highest iphi of the last HPD
161  return iphihiHPD(arr[NUM_HPDS_PER_RBX - 1]);
162 }
static const int NUM_HPDS_PER_RBX
Definition: HcalHPDRBXMap.h:30
static void indicesHPDfromRBX(int rbxindex, std::array< int, NUM_HPDS_PER_RBX > &hpdindices)
static bool isValidRBX(int index)
static int iphihiHPD(int index)
int HcalHPDRBXMap::iphiloHPD ( int  index)
static

Definition at line 89 of file HcalHPDRBXMap.cc.

References Exception, HcalBarrel, isValidHPD(), edm::errors::LogicError, NUM_HPDS_PER_SUBDET, and subdetHPD().

Referenced by iphiloRBX().

89  {
90  if (!isValidHPD(index))
92  << " HPD index " << index << " is invalid in HcalHPDRBXMap::iphiloHPD().\n";
93 
94  // adjust for offset between iphi and the HPD index
95  // index-->iphi
96  // 0-->71, 1-->72, 2-->1, 3-->2, 4-->3, ..., 70-->69, 71-->70
97  int iphi = index % NUM_HPDS_PER_SUBDET - 1;
98  if (iphi <= 0)
99  iphi += NUM_HPDS_PER_SUBDET;
100 
101  // HB
102  if (subdetHPD(index) == HcalBarrel)
103  return iphi;
104 
105  // HE
106  if (iphi % 2 == 0)
107  return iphi - 1;
108  else
109  return iphi;
110 }
static HcalSubdetector subdetHPD(int index)
static const int NUM_HPDS_PER_SUBDET
Definition: HcalHPDRBXMap.h:28
static bool isValidHPD(int index)
int HcalHPDRBXMap::iphiloRBX ( int  index)
static

Definition at line 113 of file HcalHPDRBXMap.cc.

References Exception, indicesHPDfromRBX(), iphiloHPD(), isValidRBX(), and edm::errors::LogicError.

113  {
114  if (!isValidRBX(index))
116  << " RBX index " << index << " is invalid in HcalHPDRBXMap::iphiloRBX().\n";
117 
118  // get the list of HPD indices in the RBX
119  std::array<int, NUM_HPDS_PER_RBX> arr;
120  indicesHPDfromRBX(index, arr);
121 
122  // return the lowest iphi of the first HPD
123  return iphiloHPD(arr[0]);
124 }
static void indicesHPDfromRBX(int rbxindex, std::array< int, NUM_HPDS_PER_RBX > &hpdindices)
static int iphiloHPD(int index)
static bool isValidRBX(int index)
bool HcalHPDRBXMap::isValid ( const HcalDetId id)
static

Definition at line 23 of file HcalHPDRBXMap.cc.

References HcalBarrel, and HcalEndcap.

Referenced by ntupleDataFormat._Object::_checkIsValid(), reco::HcalNoiseRBXArray::findHPD(), reco::HcalNoiseRBXArray::findRBX(), indexHPD(), and core.AutoHandle.AutoHandle::ReallyLoad().

23  {
24  if (id.subdet() != HcalBarrel && id.subdet() != HcalEndcap)
25  return false;
26  return isValid(id.ieta(), id.iphi());
27 }
static bool isValid(const HcalDetId &)
bool HcalHPDRBXMap::isValid ( int  ieta,
int  iphi 
)
static

Definition at line 29 of file HcalHPDRBXMap.cc.

References funct::abs().

Referenced by ntupleDataFormat._Object::_checkIsValid(), and core.AutoHandle.AutoHandle::ReallyLoad().

29  {
30  int absieta = abs(ieta);
31  if (absieta <= 29 && absieta >= 1 && iphi >= 1 && iphi <= 72) {
32  if (absieta <= 20)
33  return true;
34  if (absieta >= 21 && iphi % 2 == 1)
35  return true;
36  }
37  return false;
38 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool HcalHPDRBXMap::isValidHPD ( int  index)
static

Definition at line 18 of file HcalHPDRBXMap.cc.

References NUM_HPDS.

Referenced by reco::HcalNoiseRBXArray::findHPD(), indexRBXfromHPD(), iphihiHPD(), iphiloHPD(), subdetHPD(), and zsideHPD().

18 { return (index >= 0 && index <= NUM_HPDS - 1); }
static const int NUM_HPDS
Definition: HcalHPDRBXMap.h:26
bool HcalHPDRBXMap::isValidRBX ( int  index)
static

Definition at line 21 of file HcalHPDRBXMap.cc.

References NUM_RBXS.

Referenced by reco::HcalNoiseRBXArray::findRBX(), indicesHPDfromRBX(), iphihiRBX(), iphiloRBX(), subdetRBX(), and zsideRBX().

21 { return (index >= 0 && index <= NUM_RBXS - 1); }
static const int NUM_RBXS
Definition: HcalHPDRBXMap.h:32
static int HcalHPDRBXMap::numHPDs ( void  )
inlinestatic

Definition at line 37 of file HcalHPDRBXMap.h.

References NUM_HPDS.

37 { return NUM_HPDS; }
static const int NUM_HPDS
Definition: HcalHPDRBXMap.h:26
static int HcalHPDRBXMap::numHPDsPerRBX ( void  )
inlinestatic

Definition at line 39 of file HcalHPDRBXMap.h.

References NUM_HPDS_PER_RBX.

39 { return NUM_HPDS_PER_RBX; }
static const int NUM_HPDS_PER_RBX
Definition: HcalHPDRBXMap.h:30
static int HcalHPDRBXMap::numHPDsPerSubdet ( void  )
inlinestatic

Definition at line 38 of file HcalHPDRBXMap.h.

References NUM_HPDS_PER_SUBDET.

38 { return NUM_HPDS_PER_SUBDET; }
static const int NUM_HPDS_PER_SUBDET
Definition: HcalHPDRBXMap.h:28
static int HcalHPDRBXMap::numRBXs ( void  )
inlinestatic

Definition at line 40 of file HcalHPDRBXMap.h.

References NUM_RBXS.

40 { return NUM_RBXS; }
static const int NUM_RBXS
Definition: HcalHPDRBXMap.h:32
static int HcalHPDRBXMap::numRBXsPerSubdet ( void  )
inlinestatic

Definition at line 41 of file HcalHPDRBXMap.h.

References NUM_RBXS_PER_SUBDET.

41 { return NUM_RBXS_PER_SUBDET; }
static const int NUM_RBXS_PER_SUBDET
Definition: HcalHPDRBXMap.h:34
HcalSubdetector HcalHPDRBXMap::subdetHPD ( int  index)
static

Definition at line 41 of file HcalHPDRBXMap.cc.

References Exception, HcalBarrel, HcalEndcap, isValidHPD(), edm::errors::LogicError, and NUM_HPDS_PER_SUBDET.

Referenced by iphihiHPD(), and iphiloHPD().

41  {
42  if (!isValidHPD(index))
44  << " HPD index " << index << " is invalid in HcalHPDRBXMap::subdetHPD().\n";
45 
46  if (index / NUM_HPDS_PER_SUBDET <= 1)
47  return HcalBarrel;
48  else
49  return HcalEndcap;
50 }
static const int NUM_HPDS_PER_SUBDET
Definition: HcalHPDRBXMap.h:28
static bool isValidHPD(int index)
HcalSubdetector HcalHPDRBXMap::subdetRBX ( int  index)
static

Definition at line 53 of file HcalHPDRBXMap.cc.

References Exception, HcalBarrel, HcalEndcap, isValidRBX(), edm::errors::LogicError, and NUM_RBXS_PER_SUBDET.

53  {
54  if (!isValidRBX(index))
56  << " RBX index " << index << " is invalid in HcalHPDRBXMap::subdetRBX().\n";
57 
58  if (index / NUM_RBXS_PER_SUBDET <= 1)
59  return HcalBarrel;
60  else
61  return HcalEndcap;
62 }
static bool isValidRBX(int index)
static const int NUM_RBXS_PER_SUBDET
Definition: HcalHPDRBXMap.h:34
int HcalHPDRBXMap::zsideHPD ( int  index)
static

Definition at line 65 of file HcalHPDRBXMap.cc.

References Exception, isValidHPD(), edm::errors::LogicError, and NUM_HPDS_PER_SUBDET.

65  {
66  if (!isValidHPD(index))
68  << " HPD index " << index << " is invalid in HcalHPDRBXMap::zsideHPD().\n";
69 
71  return 1;
72  else
73  return -1;
74 }
static const int NUM_HPDS_PER_SUBDET
Definition: HcalHPDRBXMap.h:28
static bool isValidHPD(int index)
int HcalHPDRBXMap::zsideRBX ( int  index)
static

Definition at line 77 of file HcalHPDRBXMap.cc.

References Exception, isValidRBX(), edm::errors::LogicError, and NUM_RBXS_PER_SUBDET.

77  {
78  if (!isValidRBX(index))
80  << " RBX index " << index << " is invalid in HcalHPDRBXMap::zsideRBX().\n";
81 
83  return 1;
84  else
85  return -1;
86 }
static bool isValidRBX(int index)
static const int NUM_RBXS_PER_SUBDET
Definition: HcalHPDRBXMap.h:34

Member Data Documentation

const int HcalHPDRBXMap::NUM_HPDS = 288
static

Definition at line 26 of file HcalHPDRBXMap.h.

Referenced by isValidHPD(), and numHPDs().

const int HcalHPDRBXMap::NUM_HPDS_PER_RBX = 4
static
const int HcalHPDRBXMap::NUM_HPDS_PER_SUBDET = 72
static

Definition at line 28 of file HcalHPDRBXMap.h.

Referenced by indexHPD(), iphihiHPD(), iphiloHPD(), numHPDsPerSubdet(), subdetHPD(), and zsideHPD().

const int HcalHPDRBXMap::NUM_RBXS = 72
static

Definition at line 32 of file HcalHPDRBXMap.h.

Referenced by isValidRBX(), and numRBXs().

const int HcalHPDRBXMap::NUM_RBXS_PER_SUBDET = 18
static

Definition at line 34 of file HcalHPDRBXMap.h.

Referenced by numRBXsPerSubdet(), subdetRBX(), and zsideRBX().