CMS 3D CMS Logo

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, boost::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 23 of file HcalHPDRBXMap.h.

Constructor & Destructor Documentation

HcalHPDRBXMap::HcalHPDRBXMap ( )
private

Definition at line 14 of file HcalHPDRBXMap.cc.

Referenced by numRBXsPerSubdet().

14 {}
HcalHPDRBXMap::~HcalHPDRBXMap ( )
private

Definition at line 15 of file HcalHPDRBXMap.cc.

Referenced by numRBXsPerSubdet().

15 {}

Member Function Documentation

int HcalHPDRBXMap::indexHPD ( const HcalDetId id)
static

Definition at line 187 of file HcalHPDRBXMap.cc.

References funct::abs(), particleFlowClusterECALTimeSelected_cfi::depth, Exception, HcalBarrel, HcalEndcap, diffTreeTool::index, isValid(), edm::errors::LogicError, NUM_HPDS_PER_SUBDET, and HcalDigiParam_cfi::zside.

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

188 {
189  // return bad index if subdetector is invalid
190  if(!isValid(id)) {
192  << " HcalDetId " << id << " is invalid in HcalHPDRBXMap::indexHPD().\n";
193  }
194 
195  // specify the readout module (subdet and number)
196  int subdet=-1;
197  if(id.subdet()==HcalBarrel && id.zside()==1) subdet=0;
198  if(id.subdet()==HcalBarrel && id.zside()==-1) subdet=1;
199  if(id.subdet()==HcalEndcap && id.zside()==1) subdet=2;
200  if(id.subdet()==HcalEndcap && id.zside()==-1) subdet=3;
201 
202  int iphi=id.iphi();
203  int absieta=abs(id.ieta());
204 
205  // adjust for offset between iphi and the HPD index
206  // index-->iphi
207  // 0-->71, 1-->72, 2-->1, 3-->2, 4-->3, ..., 70-->69, 71-->70
208  int index=iphi+1;
209  if(index>=NUM_HPDS_PER_SUBDET) index-=NUM_HPDS_PER_SUBDET;
210  index+=subdet*NUM_HPDS_PER_SUBDET;
211 
212  // modify the index in the HE
213  if((subdet==2 || subdet==3) && absieta>=21 && absieta<=29) {
214  if(iphi%4==3 && absieta%2==1 && absieta!=29) index++;
215  if(iphi%4==3 && absieta==29 && id.depth()==2) index++;
216  if(iphi%4==1 && absieta%2==0 && absieta!=29) index++;
217  if(iphi%4==1 && absieta==29 && id.depth()==1) index++;
218  }
219  return index;
220 }
static const int NUM_HPDS_PER_SUBDET
Definition: HcalHPDRBXMap.h:30
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 227 of file HcalHPDRBXMap.cc.

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

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

228 {
229  // clear the vector
230  hpdindices.clear();
231  int absieta=abs(ieta);
232 
233  if(absieta<=15) { // HB only, depth doesn't matter
234  hpdindices.push_back(indexHPD(HcalDetId(HcalBarrel, ieta, iphi, 1)));
235  } else if(absieta==16) { // HB and HE, depth doesn't matter
236  hpdindices.push_back(indexHPD(HcalDetId(HcalBarrel, ieta, iphi, 1)));
237  hpdindices.push_back(indexHPD(HcalDetId(HcalEndcap, ieta, iphi, 3)));
238  } else if(absieta<29) { // HE only, depth doesn't matter
239  hpdindices.push_back(indexHPD(HcalDetId(HcalEndcap, ieta, iphi, 1)));
240  } else { // HE only, but depth matters
241  hpdindices.push_back(indexHPD(HcalDetId(HcalEndcap, ieta, iphi, 1)));
242  hpdindices.push_back(indexHPD(HcalDetId(HcalEndcap, ieta, iphi, 2)));
243  }
244 
245  return;
246 }
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 222 of file HcalHPDRBXMap.cc.

References indexHPD(), and indexRBXfromHPD().

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

223 {
224  return indexRBXfromHPD(indexHPD(id));
225 }
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 248 of file HcalHPDRBXMap.cc.

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

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

249 {
250  // clear the vector
251  rbxindices.clear();
252  int absieta=abs(ieta);
253 
254  if(absieta<=15) { // HB only
255  rbxindices.push_back(indexRBX(HcalDetId(HcalBarrel, ieta, iphi, 1)));
256  } else if(absieta==16) { // HB and HE
257  rbxindices.push_back(indexRBX(HcalDetId(HcalBarrel, ieta, iphi, 1)));
258  rbxindices.push_back(indexRBX(HcalDetId(HcalEndcap, ieta, iphi, 3)));
259  } else { // HE only
260  rbxindices.push_back(indexRBX(HcalDetId(HcalEndcap, ieta, iphi, 1)));
261  }
262 
263  return;
264 }
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 176 of file HcalHPDRBXMap.cc.

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

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

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:32
static bool isValidHPD(int index)
void HcalHPDRBXMap::indicesHPDfromRBX ( int  rbxindex,
boost::array< int, NUM_HPDS_PER_RBX > &  hpdindices 
)
static

Definition at line 163 of file HcalHPDRBXMap.cc.

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

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

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

Definition at line 126 of file HcalHPDRBXMap.cc.

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

Referenced by iphihiRBX(), and numRBXsPerSubdet().

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) iphi+=NUM_HPDS_PER_SUBDET;
137 
138  // HB
139  if(subdetHPD(index)==HcalBarrel) return iphi;
140 
141  // HE
142  if(iphi%2==0) return iphi;
143  else return iphi+1;
144 }
static HcalSubdetector subdetHPD(int index)
static const int NUM_HPDS_PER_SUBDET
Definition: HcalHPDRBXMap.h:30
static bool isValidHPD(int index)
int HcalHPDRBXMap::iphihiRBX ( int  index)
static

Definition at line 147 of file HcalHPDRBXMap.cc.

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

Referenced by numRBXsPerSubdet().

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

Definition at line 90 of file HcalHPDRBXMap.cc.

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

Referenced by iphiloRBX(), and numRBXsPerSubdet().

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

Definition at line 111 of file HcalHPDRBXMap.cc.

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

Referenced by numRBXsPerSubdet().

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

Definition at line 29 of file HcalHPDRBXMap.cc.

References HcalBarrel, and HcalEndcap.

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

30 {
31  if(id.subdet()!=HcalBarrel && id.subdet()!=HcalEndcap) return false;
32  return isValid(id.ieta(),id.iphi());
33 }
static bool isValid(const HcalDetId &)
bool HcalHPDRBXMap::isValid ( int  ieta,
int  iphi 
)
static

Definition at line 35 of file HcalHPDRBXMap.cc.

References funct::abs().

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

36 {
37  int absieta=abs(ieta);
38  if(absieta<=29 && absieta>=1 && iphi>=1 && iphi<=72) {
39  if(absieta<=20) return true;
40  if(absieta>=21 && iphi%2==1) return true;
41  }
42  return false;
43 }
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(), numRBXsPerSubdet(), subdetHPD(), and zsideHPD().

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

Definition at line 24 of file HcalHPDRBXMap.cc.

References NUM_RBXS.

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

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

Definition at line 39 of file HcalHPDRBXMap.h.

References NUM_HPDS.

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

Definition at line 41 of file HcalHPDRBXMap.h.

References NUM_HPDS_PER_RBX.

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

Definition at line 40 of file HcalHPDRBXMap.h.

References NUM_HPDS_PER_SUBDET.

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

Definition at line 42 of file HcalHPDRBXMap.h.

References NUM_RBXS.

42 { return NUM_RBXS; }
static const int NUM_RBXS
Definition: HcalHPDRBXMap.h:34
static int HcalHPDRBXMap::numRBXsPerSubdet ( void  )
inlinestatic
HcalSubdetector HcalHPDRBXMap::subdetHPD ( int  index)
static

Definition at line 46 of file HcalHPDRBXMap.cc.

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

Referenced by iphihiHPD(), iphiloHPD(), and numRBXsPerSubdet().

47 {
48  if(!isValidHPD(index))
50  << " HPD index " << index << " is invalid in HcalHPDRBXMap::subdetHPD().\n";
51 
52  if(index/NUM_HPDS_PER_SUBDET<=1) return HcalBarrel;
53  else return HcalEndcap;
54 }
static const int NUM_HPDS_PER_SUBDET
Definition: HcalHPDRBXMap.h:30
static bool isValidHPD(int index)
HcalSubdetector HcalHPDRBXMap::subdetRBX ( int  index)
static

Definition at line 57 of file HcalHPDRBXMap.cc.

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

Referenced by numRBXsPerSubdet().

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

Definition at line 68 of file HcalHPDRBXMap.cc.

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

Referenced by numRBXsPerSubdet().

69 {
70  if(!isValidHPD(index))
72  << " HPD index " << index << " is invalid in HcalHPDRBXMap::zsideHPD().\n";
73 
74  if(index/NUM_HPDS_PER_SUBDET==0 || index/NUM_HPDS_PER_SUBDET==2) return 1;
75  else return -1;
76 }
static const int NUM_HPDS_PER_SUBDET
Definition: HcalHPDRBXMap.h:30
static bool isValidHPD(int index)
int HcalHPDRBXMap::zsideRBX ( int  index)
static

Definition at line 79 of file HcalHPDRBXMap.cc.

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

Referenced by numRBXsPerSubdet().

80 {
81  if(!isValidRBX(index))
83  << " RBX index " << index << " is invalid in HcalHPDRBXMap::zsideRBX().\n";
84 
85  if(index/NUM_RBXS_PER_SUBDET==0 || index/NUM_RBXS_PER_SUBDET==2) return 1;
86  else return -1;
87 }
static bool isValidRBX(int index)
static const int NUM_RBXS_PER_SUBDET
Definition: HcalHPDRBXMap.h:36

Member Data Documentation

const int HcalHPDRBXMap::NUM_HPDS =288
static

Definition at line 28 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 30 of file HcalHPDRBXMap.h.

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

const int HcalHPDRBXMap::NUM_RBXS =72
static

Definition at line 34 of file HcalHPDRBXMap.h.

Referenced by isValidRBX(), and numRBXs().

const int HcalHPDRBXMap::NUM_RBXS_PER_SUBDET =18
static

Definition at line 36 of file HcalHPDRBXMap.h.

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