CMS 3D CMS Logo

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

#include <HcalTopology.h>

Inheritance diagram for HcalTopology:
CaloSubdetectorTopology

Public Member Functions

int decIEta (const HcalDetId &id, HcalDetId neighbors[2]) const
 
bool decIPhi (const HcalDetId &id, HcalDetId &neighbor) const
 
void depthBinInformation (HcalSubdetector subdet, int etaRing, int &nDepthBins, int &startingBin) const
 finds the number of depth bins and which is the number to start with More...
 
int doublePhiBins () const
 
virtual std::vector< DetIddown (const DetId &id) const
 
virtual std::vector< DetIdeast (const DetId &id) const
 
void exclude (const HcalDetId &id)
 
int exclude (HcalSubdetector subdet, int ieta1, int ieta2, int iphi1, int iphi2, int depth1=1, int depth2=4)
 
void excludeSubdetector (HcalSubdetector subdet)
 
int firstHBRing () const
 
int firstHEDoublePhiRing () const
 
int firstHERing () const
 
int firstHETripleDepthRing () const
 
int firstHFQuadPhiRing () const
 
int firstHFRing () const
 
int firstHORing () const
 
 HcalTopology (bool h2_mode=false)
 
int incIEta (const HcalDetId &id, HcalDetId neighbors[2]) const
 
bool incIPhi (const HcalDetId &id, HcalDetId &neighbor) const
 
bool incrementDepth (HcalDetId &id) const
 
int lastHBRing () const
 
int lastHERing () const
 
int lastHFRing () const
 
int lastHORing () const
 
virtual std::vector< DetIdnorth (const DetId &id) const
 
int nPhiBins (int etaRing) const
 how many phi segments in this ring More...
 
int singlePhiBins () const
 
virtual std::vector< DetIdsouth (const DetId &id) const
 
virtual std::vector< DetIdup (const DetId &id) const
 
virtual bool valid (const HcalDetId &id) const
 
virtual std::vector< DetIdwest (const DetId &id) const
 
- Public Member Functions inherited from CaloSubdetectorTopology
 CaloSubdetectorTopology ()
 standard constructor More...
 
virtual std::vector< DetIdgetAllNeighbours (const DetId &id) const
 
virtual std::vector< DetIdgetNeighbours (const DetId &id, const CaloDirection &dir) const
 
virtual std::vector< DetIdgetWindow (const DetId &id, const int &northSouthSize, const int &eastWestSize) const
 
virtual bool valid (const DetId &) const
 is this detid present in the Topology? More...
 
virtual ~CaloSubdetectorTopology ()
 virtual destructor More...
 

Private Member Functions

int decAIEta (const HcalDetId &id, HcalDetId neighbors[2]) const
 
int incAIEta (const HcalDetId &id, HcalDetId neighbors[2]) const
 
bool isExcluded (const HcalDetId &id) const
 
bool validRaw (const HcalDetId &id) const
 

Private Attributes

const int doublePhiBins_
 
bool excludeHB_
 
bool excludeHE_
 
bool excludeHF_
 
bool excludeHO_
 
std::vector< HcalDetIdexclusionList_
 
const int firstHBRing_
 
const int firstHEDoublePhiRing_
 
const int firstHERing_
 
const int firstHETripleDepthRing_
 
const int firstHFQuadPhiRing_
 
const int firstHFRing_
 
const int firstHORing_
 
bool h2mode_
 
const int lastHBRing_
 
const int lastHERing_
 
const int lastHFRing_
 
const int lastHORing_
 
const int singlePhiBins_
 

Additional Inherited Members

- Protected Types inherited from CaloSubdetectorTopology
typedef std::pair< int, int > Coordinate
 
- Protected Member Functions inherited from CaloSubdetectorTopology
Coordinate getNeighbourIndex (const Coordinate &coord, const CaloDirection &dir) const
 

Detailed Description

The HcalTopology class contains a set of hardcoded constants which represent the topology (tower relationship) of the CMS HCAL as built. These constants can be used to determine neighbor relationships and existence of cells.

For use with limited setups (testbeam, cosmic stands, etc), the topology can be limited by creating a rejection list – a list of cells which would normally exist in the full CMS HCAL, but are not present for the specified topology.

Date:
2007/05/11 14:12:24
Revision:
1.8
Author
J. Mans - Minnesota

Definition at line 24 of file HcalTopology.h.

Constructor & Destructor Documentation

HcalTopology::HcalTopology ( bool  h2_mode = false)

Definition at line 9 of file HcalTopology.cc.

Referenced by HcalTopologyIdealEP::produce().

9  :
10  excludeHB_(false),
11  excludeHE_(false),
12  excludeHO_(false),
13  excludeHF_(false),
14  h2mode_(h2_mode),
15  firstHBRing_(1),
16  lastHBRing_(16),
17  firstHERing_(16),
18  lastHERing_(29),
19  firstHFRing_(29),
20  lastHFRing_(41),
21  firstHORing_(1),
22  lastHORing_(15),
23  firstHEDoublePhiRing_((h2_mode)?(22):(21)),
25  firstHETripleDepthRing_((h2_mode)?(24):(27)),
26  singlePhiBins_(72),
27  doublePhiBins_(36)
28 {
29 }
const int lastHBRing_
Definition: HcalTopology.h:99
const int firstHETripleDepthRing_
Definition: HcalTopology.h:109
const int firstHFQuadPhiRing_
Definition: HcalTopology.h:108
const int lastHERing_
Definition: HcalTopology.h:101
const int lastHORing_
Definition: HcalTopology.h:105
const int firstHBRing_
Definition: HcalTopology.h:98
const int firstHFRing_
Definition: HcalTopology.h:102
const int firstHEDoublePhiRing_
Definition: HcalTopology.h:107
const int firstHERing_
Definition: HcalTopology.h:100
const int firstHORing_
Definition: HcalTopology.h:104
const int lastHFRing_
Definition: HcalTopology.h:103
const int singlePhiBins_
Definition: HcalTopology.h:110
const int doublePhiBins_
Definition: HcalTopology.h:111

Member Function Documentation

int HcalTopology::decAIEta ( const HcalDetId id,
HcalDetId  neighbors[2] 
) const
private

Get the neighbors of the given cell with lower absolute ieta

Decreasing in |ieta|, there are be two neighbors of 40 and 21

Definition at line 317 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHFQuadPhiRing(), HcalBarrel, HcalEndcap, HcalForward, IPHI_MAX, lastHBRing(), lastHERing(), n, and valid().

Referenced by decIEta(), and incIEta().

317  {
318  int n=1;
319  int aieta=id.ietaAbs();
320 
321  if (aieta==firstHEDoublePhiRing()) {
322  n=2;
323  neighbors[0]=HcalDetId(HcalEndcap,(aieta-1)*id.zside(),id.iphi(),id.depth());
324  neighbors[1]=HcalDetId(HcalEndcap,(aieta-1)*id.zside(),id.iphi()+1,id.depth());
325  } else if (aieta==firstHFQuadPhiRing()) {
326  n=2;
327  neighbors[0]=HcalDetId(HcalForward,(aieta-1)*id.zside(),id.iphi(),id.depth());
328  if (id.iphi()==IPHI_MAX-1) neighbors[1]=HcalDetId(HcalForward,(aieta-1)*id.zside(),1,id.depth());
329  else neighbors[1]=HcalDetId(HcalForward,(aieta-1)*id.zside(),id.iphi()+2,id.depth());
330  } else if (aieta==1) {
331  neighbors[0]=HcalDetId(id.subdet(),-aieta*id.zside(),id.iphi(),id.depth());
332  } else if (aieta==lastHBRing()+1) {
333  neighbors[0]=HcalDetId(HcalBarrel,(aieta-1)*id.zside(),id.iphi(),id.depth());
334  } else if (aieta==lastHERing()+1) {
335  neighbors[0]=HcalDetId(HcalEndcap,(aieta-1)*id.zside(),id.iphi(),id.depth());
336  } else
337  neighbors[0]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi(),id.depth());
338 
339  if (!valid(neighbors[0]) && n==2) {
340  if (!valid(neighbors[1])) n=0;
341  else {
342  n=1;
343  neighbors[0]=neighbors[1];
344  }
345  }
346  if (n==2 && !valid(neighbors[1])) n=1;
347  if (n==1 && !valid(neighbors[0])) n=0;
348 
349  return n;
350 }
virtual bool valid(const HcalDetId &id) const
Definition: HcalTopology.cc:32
int lastHBRing() const
Definition: HcalTopology.h:62
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:70
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:71
int lastHERing() const
Definition: HcalTopology.h:64
static const int IPHI_MAX
Definition: HcalTopology.cc:7
int HcalTopology::decIEta ( const HcalDetId id,
HcalDetId  neighbors[2] 
) const

Get the neighbors of the given cell with lower (signed) ieta

Definition at line 291 of file HcalTopology.cc.

References decAIEta(), and incAIEta().

Referenced by east().

291  {
292  if (id.zside()==1) return decAIEta(id,neighbors);
293  else return incAIEta(id,neighbors);
294 }
int decAIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
int incAIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
bool HcalTopology::decIPhi ( const HcalDetId id,
HcalDetId neighbor 
) const

Get the neighbor (if present) of the given cell with lower iphi

Definition at line 253 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHFQuadPhiRing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, IPHI_MAX, convertSQLiteXML::ok, and valid().

Referenced by south().

253  {
254  bool ok=valid(id);
255  if (ok) {
256  switch (id.subdet()) {
257  case (HcalBarrel):
258  case (HcalOuter):
259  if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX,id.depth());
260  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-1,id.depth());
261  break;
262  case (HcalEndcap):
263  if (id.ietaAbs()>=firstHEDoublePhiRing()) {
264  if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth());
265  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-2,id.depth());
266  } else {
267  if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX,id.depth());
268  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-1,id.depth());
269  }
270  break;
271  case (HcalForward):
272  if (id.ietaAbs()>=firstHFQuadPhiRing()) {
273  if (id.iphi()==3) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth());
274  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-4,id.depth());
275  } else {
276  if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth());
277  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-2,id.depth());
278  }
279  break;
280  default: ok=false;
281  }
282  }
283  return ok;
284 }
virtual bool valid(const HcalDetId &id) const
Definition: HcalTopology.cc:32
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:70
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:71
static const int IPHI_MAX
Definition: HcalTopology.cc:7
void HcalTopology::depthBinInformation ( HcalSubdetector  subdet,
int  etaRing,
int &  nDepthBins,
int &  startingBin 
) const

finds the number of depth bins and which is the number to start with

Definition at line 353 of file HcalTopology.cc.

References dtNoiseDBValidation_cfg::cerr, firstHETripleDepthRing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, and lastHERing().

Referenced by CaloTowerConstituentsMap::constituentsOf(), HcalTrigTowerGeometry::detIds(), HcalHardcodeGeometryLoader::fill(), incrementDepth(), and HcalHardcodeGeometryLoader::makeCell().

354  {
355  if(subdet == HcalBarrel) {
356  if (etaRing<=14) {
357  nDepthBins = 1;
358  startingBin = 1;
359  } else {
360  nDepthBins = 2;
361  startingBin = 1;
362  }
363  } else if(subdet == HcalEndcap) {
364  if (etaRing==16) {
365  nDepthBins = 1;
366  startingBin = 3;
367  } else if (etaRing==17) {
368  nDepthBins = 1;
369  startingBin = 1;
370  } else if (etaRing==lastHERing()) {
371  nDepthBins = 2;
372  startingBin = 1;
373  }
374  else {
375  nDepthBins = (etaRing >= firstHETripleDepthRing()) ? 3 : 2;
376  startingBin = 1;
377  }
378  }
379 
380  else if(subdet == HcalForward) {
381  nDepthBins = 2;
382  startingBin = 1;
383  }
384 
385  else if(subdet == HcalOuter) {
386  nDepthBins = 1;
387  startingBin = 4;
388  }
389 
390  else {
391  std::cerr << "Bad HCAL subdetector " << subdet << std::endl;
392  }
393 }
int firstHETripleDepthRing() const
Definition: HcalTopology.h:72
int lastHERing() const
Definition: HcalTopology.h:64
int HcalTopology::doublePhiBins ( ) const
inline

Definition at line 74 of file HcalTopology.h.

References doublePhiBins_.

74 {return doublePhiBins_;}
const int doublePhiBins_
Definition: HcalTopology.h:111
std::vector< DetId > HcalTopology::down ( const DetId id) const
virtual

Get the neighbors of the given cell in down direction (inward)

Implements CaloSubdetectorTopology.

Definition at line 120 of file HcalTopology.cc.

References gather_cfg::cout.

120  {
121  std::cout << "HcalTopology::down() not yet implemented" << std::endl;
122  std::vector<DetId> vNeighborsDetId;
123  return vNeighborsDetId;
124 }
tuple cout
Definition: gather_cfg.py:121
std::vector< DetId > HcalTopology::east ( const DetId id) const
virtual

Get the neighbors of the given cell in east direction

Implements CaloSubdetectorTopology.

Definition at line 76 of file HcalTopology.cc.

References decIEta(), and i.

Referenced by spr::newHCALIdEW().

76  {
77  std::vector<DetId> vNeighborsDetId;
78  HcalDetId neighbors[2];
79  for (int i=0;i<decIEta(HcalDetId(id),neighbors);i++)
80  vNeighborsDetId.push_back(DetId(neighbors[i].rawId()));
81  return vNeighborsDetId;
82 }
int i
Definition: DBlmapReader.cc:9
int decIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
Definition: DetId.h:20
void HcalTopology::exclude ( const HcalDetId id)

Add a cell to exclusion list

Definition at line 59 of file HcalTopology.cc.

References exclusionList_, i, and errorMatrix2Lands_multiChannel::id.

Referenced by exclude(), and HcalTopologyRestrictionParser::parse().

59  {
60  std::vector<HcalDetId>::iterator i=std::lower_bound(exclusionList_.begin(),exclusionList_.end(),id);
61  if (i==exclusionList_.end() || *i!=id) {
62  exclusionList_.insert(i,id);
63  }
64 }
int i
Definition: DBlmapReader.cc:9
std::vector< HcalDetId > exclusionList_
Definition: HcalTopology.h:92
int HcalTopology::exclude ( HcalSubdetector  subdet,
int  ieta1,
int  ieta2,
int  iphi1,
int  iphi2,
int  depth1 = 1,
int  depth2 = 4 
)

Exclude an eta/phi/depth range for a given subdetector

Definition at line 126 of file HcalTopology.cc.

References exclude(), excludeHB_, excludeHE_, excludeHF_, excludeHO_, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, errorMatrix2Lands_multiChannel::id, max(), min, n, and validRaw().

126  {
127 
128  bool exed=false;
129  // first, check the full detector exclusions... (fast)
130  switch (subdet) {
131  case(HcalBarrel): exed=excludeHB_; break;
132  case(HcalEndcap): exed=excludeHE_; break;
133  case(HcalOuter): exed=excludeHO_; break;
134  case(HcalForward): exed=excludeHF_; break;
135  default: exed=false;
136  }
137  if (exed) return 0; // if the whole detector is excluded...
138 
139  int ieta_l=std::min(ieta1,ieta2);
140  int ieta_h=std::max(ieta1,ieta2);
141  int iphi_l=std::min(iphi1,iphi2);
142  int iphi_h=std::max(iphi1,iphi2);
143  int depth_l=std::min(depth1,depth2);
144  int depth_h=std::max(depth1,depth2);
145 
146  int n=0;
147  for (int ieta=ieta_l; ieta<=ieta_h; ieta++)
148  for (int iphi=iphi_l; iphi<=iphi_h; iphi++)
149  for (int depth=depth_l; depth<=depth_h; depth++) {
150  HcalDetId id(subdet,ieta,iphi,depth);
151  if (validRaw(id)) { // use 'validRaw' to include check validity in "uncut" detector
152  exclude(id);
153  n++;
154  }
155  }
156  return n;
157 }
void exclude(const HcalDetId &id)
Definition: HcalTopology.cc:59
#define min(a, b)
Definition: mlp_lapack.h:161
bool validRaw(const HcalDetId &id) const
const T & max(const T &a, const T &b)
void HcalTopology::excludeSubdetector ( HcalSubdetector  subdet)

Exclude an entire subdetector

Definition at line 66 of file HcalTopology.cc.

References excludeHB_, excludeHE_, excludeHF_, excludeHO_, HcalBarrel, HcalEndcap, HcalForward, and HcalOuter.

Referenced by HcalTopologyRestrictionParser::parse().

66  {
67  switch (subdet) {
68  case(HcalBarrel): excludeHB_=true; break;
69  case(HcalEndcap): excludeHE_=true; break;
70  case(HcalOuter): excludeHO_=true; break;
71  case(HcalForward): excludeHF_=true; break;
72  default: break;
73  }
74 }
int HcalTopology::firstHBRing ( ) const
inline

Definition at line 61 of file HcalTopology.h.

References firstHBRing_.

Referenced by HcalHardcodeGeometryLoader::load().

61 {return firstHBRing_;}
const int firstHBRing_
Definition: HcalTopology.h:98
int HcalTopology::firstHEDoublePhiRing ( ) const
inline
int HcalTopology::firstHERing ( ) const
inline
int HcalTopology::firstHETripleDepthRing ( ) const
inline

Definition at line 72 of file HcalTopology.h.

References firstHETripleDepthRing_.

Referenced by depthBinInformation(), and validRaw().

const int firstHETripleDepthRing_
Definition: HcalTopology.h:109
int HcalTopology::firstHFQuadPhiRing ( ) const
inline
int HcalTopology::firstHFRing ( ) const
inline
int HcalTopology::firstHORing ( ) const
inline

Definition at line 67 of file HcalTopology.h.

References firstHORing_.

Referenced by HcalHardcodeGeometryLoader::load().

67 {return firstHORing_;}
const int firstHORing_
Definition: HcalTopology.h:104
int HcalTopology::incAIEta ( const HcalDetId id,
HcalDetId  neighbors[2] 
) const
private

Get the neighbors of the given cell with higher absolute ieta

Increasing in |ieta|, there is always at most one neighbor

Definition at line 297 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHFQuadPhiRing(), HcalEndcap, HcalForward, lastHBRing(), lastHERing(), n, and valid().

Referenced by decIEta(), and incIEta().

297  {
298  int n=1;
299  int aieta=id.ietaAbs();
300 
301  if (aieta==firstHEDoublePhiRing()-1 && (id.iphi()%2)==0)
302  neighbors[0]=HcalDetId(HcalEndcap,(aieta+1)*id.zside(),id.iphi()-1,id.depth());
303  else if (aieta==firstHFQuadPhiRing()-1 && ((id.iphi()+1)%4)!=0)
304  neighbors[0]=(id.iphi()==1)? HcalDetId(HcalForward,(aieta+1)*id.zside(),71,id.depth()) : HcalDetId(HcalForward,(aieta+1)*id.zside(),(id.iphi()-2),id.depth());
305  else if (aieta==lastHBRing())
306  neighbors[0]=HcalDetId(HcalEndcap,(aieta+1)*id.zside(),id.iphi(),1);
307  else if (aieta==lastHERing())
308  neighbors[0]=HcalDetId(HcalForward,(aieta+1)*id.zside(),id.iphi(),1);
309  else
310  neighbors[0]=HcalDetId(id.subdet(),(aieta+1)*id.zside(),id.iphi(),id.depth());
311 
312  if (!valid(neighbors[0])) n=0;
313  return n;
314 }
virtual bool valid(const HcalDetId &id) const
Definition: HcalTopology.cc:32
int lastHBRing() const
Definition: HcalTopology.h:62
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:70
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:71
int lastHERing() const
Definition: HcalTopology.h:64
int HcalTopology::incIEta ( const HcalDetId id,
HcalDetId  neighbors[2] 
) const

Get the neighbors of the given cell with higher (signed) ieta

Definition at line 286 of file HcalTopology.cc.

References decAIEta(), and incAIEta().

Referenced by west().

286  {
287  if (id.zside()==1) return incAIEta(id,neighbors);
288  else return decAIEta(id,neighbors);
289 }
int decAIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
int incAIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
bool HcalTopology::incIPhi ( const HcalDetId id,
HcalDetId neighbor 
) const

Get the neighbor (if present) of the given cell with higher iphi

Definition at line 219 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHFQuadPhiRing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, IPHI_MAX, convertSQLiteXML::ok, and valid().

Referenced by north().

219  {
220  bool ok=valid(id);
221  if (ok) {
222  switch (id.subdet()) {
223  case (HcalBarrel):
224  case (HcalOuter):
225  if (id.iphi()==IPHI_MAX) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
226  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+1,id.depth());
227  break;
228  case (HcalEndcap):
229  if (id.ietaAbs()>=firstHEDoublePhiRing()) {
230  if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
231  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+2,id.depth());
232  } else {
233  if (id.iphi()==IPHI_MAX) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
234  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+1,id.depth());
235  }
236  break;
237  case (HcalForward):
238  if (id.ietaAbs()>=firstHFQuadPhiRing()) {
239  if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),3,id.depth());
240  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+4,id.depth());
241  } else {
242  if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
243  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+2,id.depth());
244  }
245  break;
246  default: ok=false;
247  }
248  }
249  return ok;
250 }
virtual bool valid(const HcalDetId &id) const
Definition: HcalTopology.cc:32
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:70
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:71
static const int IPHI_MAX
Definition: HcalTopology.cc:7
bool HcalTopology::incrementDepth ( HcalDetId id) const

Get the detector behind this one

Definition at line 396 of file HcalTopology.cc.

References HcalDetId::depth(), depthBinInformation(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), lastHBRing(), lastHERing(), lastHORing(), HcalDetId::subdet(), and validRaw().

Referenced by HcalGeometry::getClosestCell(), and up().

397 {
398  HcalSubdetector subdet = detId.subdet();
399  int ieta = detId.ieta();
400  int etaRing = detId.ietaAbs();
401  int depth = detId.depth();
402  int nDepthBins, startingBin;
403  depthBinInformation(subdet, etaRing, nDepthBins, startingBin);
404 
405  // see if the new depth bin exists
406  ++depth;
407  if(depth > nDepthBins)
408  {
409  // handle on a case-by-case basis
410  if(subdet == HcalBarrel && etaRing < lastHORing())
411  {
412  // HO
413  subdet = HcalOuter;
414  depth = 4;
415  }
416  else if(subdet == HcalBarrel && etaRing == lastHBRing())
417  {
418  // overlap
419  subdet = HcalEndcap;
420  }
421  else if(subdet == HcalEndcap && etaRing == lastHERing()-1)
422  {
423  // guard ring HF29 is behind HE 28
424  subdet = HcalForward;
425  (ieta > 0) ? ++ieta : --ieta;
426  depth = 1;
427  }
428  else if(subdet == HcalEndcap && etaRing == lastHERing())
429  {
430  // split cells go to bigger granularity. Ring 29 -> 28
431  (ieta > 0) ? --ieta : ++ieta;
432  }
433  else
434  {
435  // no more chances
436  detId = HcalDetId();
437  return false;
438  }
439  }
440  detId = HcalDetId(subdet, ieta, detId.iphi(), depth);
441  //A.N.
442  // assert(validRaw(detId));
443  return validRaw(detId);
444  //A.N. return true;
445 }
int lastHBRing() const
Definition: HcalTopology.h:62
bool validRaw(const HcalDetId &id) const
HcalSubdetector
Definition: HcalAssistant.h:32
void depthBinInformation(HcalSubdetector subdet, int etaRing, int &nDepthBins, int &startingBin) const
finds the number of depth bins and which is the number to start with
int lastHORing() const
Definition: HcalTopology.h:68
int lastHERing() const
Definition: HcalTopology.h:64
bool HcalTopology::isExcluded ( const HcalDetId id) const
private

Definition at line 41 of file HcalTopology.cc.

References excludeHB_, excludeHE_, excludeHF_, excludeHO_, exclusionList_, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, i, and errorMatrix2Lands_multiChannel::id.

Referenced by valid().

41  {
42  bool exed=false;
43  // first, check the full detector exclusions... (fast)
44  switch (id.subdet()) {
45  case(HcalBarrel): exed=excludeHB_; break;
46  case(HcalEndcap): exed=excludeHE_; break;
47  case(HcalOuter): exed=excludeHO_; break;
48  case(HcalForward): exed=excludeHF_; break;
49  default: exed=false;
50  }
51  // next, check the list (slower)
52  if (!exed && !exclusionList_.empty()) {
53  std::vector<HcalDetId>::const_iterator i=std::lower_bound(exclusionList_.begin(),exclusionList_.end(),id);
54  if (i!=exclusionList_.end() && *i==id) exed=true;
55  }
56  return exed;
57 }
int i
Definition: DBlmapReader.cc:9
std::vector< HcalDetId > exclusionList_
Definition: HcalTopology.h:92
int HcalTopology::lastHBRing ( ) const
inline
int HcalTopology::lastHERing ( ) const
inline
int HcalTopology::lastHFRing ( ) const
inline
int HcalTopology::lastHORing ( ) const
inline
std::vector< DetId > HcalTopology::north ( const DetId id) const
virtual

Get the neighbors of the given cell in north direction

Implements CaloSubdetectorTopology.

Definition at line 92 of file HcalTopology.cc.

References incIPhi(), and DetId::rawId().

Referenced by spr::newHCALIdNS().

92  {
93  std::vector<DetId> vNeighborsDetId;
94  HcalDetId neighbor;
95  if (incIPhi(HcalDetId(id),neighbor))
96  vNeighborsDetId.push_back(DetId(neighbor.rawId()));
97  return vNeighborsDetId;
98 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
bool incIPhi(const HcalDetId &id, HcalDetId &neighbor) const
Definition: DetId.h:20
int HcalTopology::nPhiBins ( int  etaRing) const

how many phi segments in this ring

Definition at line 448 of file HcalTopology.cc.

References doublePhiBins_, firstHEDoublePhiRing(), firstHFQuadPhiRing(), and singlePhiBins_.

Referenced by HcalHardcodeGeometryLoader::fill(), CaloTowerHardcodeGeometryLoader::makeCell(), HcalHardcodeGeometryLoader::makeCell(), and HcalGeometry::phiBin().

448  {
449  int lastPhiBin=singlePhiBins_;
450  if (etaRing>= firstHFQuadPhiRing()) lastPhiBin=doublePhiBins_/2;
451  else if (etaRing>= firstHEDoublePhiRing()) lastPhiBin=doublePhiBins_;
452  return lastPhiBin;
453 }
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:70
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:71
const int singlePhiBins_
Definition: HcalTopology.h:110
const int doublePhiBins_
Definition: HcalTopology.h:111
int HcalTopology::singlePhiBins ( ) const
inline

Definition at line 73 of file HcalTopology.h.

References singlePhiBins_.

73 {return singlePhiBins_;}
const int singlePhiBins_
Definition: HcalTopology.h:110
std::vector< DetId > HcalTopology::south ( const DetId id) const
virtual

Get the neighbors of the given cell in south direction

Implements CaloSubdetectorTopology.

Definition at line 100 of file HcalTopology.cc.

References decIPhi(), and DetId::rawId().

Referenced by spr::newHCALIdNS().

100  {
101  std::vector<DetId> vNeighborsDetId;
102  HcalDetId neighbor;
103  if (decIPhi(HcalDetId(id),neighbor))
104  vNeighborsDetId.push_back(DetId(neighbor.rawId()));
105  return vNeighborsDetId;
106 }
bool decIPhi(const HcalDetId &id, HcalDetId &neighbor) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
Definition: DetId.h:20
std::vector< DetId > HcalTopology::up ( const DetId id) const
virtual

Get the neighbors of the given cell in up direction (outward)

Implements CaloSubdetectorTopology.

Definition at line 108 of file HcalTopology.cc.

References errorMatrix2Lands_multiChannel::id, and incrementDepth().

Referenced by spr::matrixHCALIdsDepth().

108  {
109  HcalDetId neighbor = id;
110  //A.N.
111  // incrementDepth(neighbor);
112  std::vector<DetId> vNeighborsDetId;
113  if(incrementDepth(neighbor))
114  {
115  vNeighborsDetId.push_back(neighbor);
116  }
117  return vNeighborsDetId;
118 }
bool incrementDepth(HcalDetId &id) const
bool HcalTopology::valid ( const HcalDetId id) const
virtual

Is this a valid cell id?

Definition at line 32 of file HcalTopology.cc.

References isExcluded(), convertSQLiteXML::ok, and validRaw().

Referenced by decAIEta(), decIPhi(), HcalHardcodeGeometryLoader::fill(), fillDefaults(), incAIEta(), incIPhi(), HcalHPDRBXMap::isValid(), CaloMiscalibMapHcal::prefillMap(), undefinedCells(), and HcaluLUTTPGCoder::updateXML().

32  {
33  // check the raw rules
34  bool ok=validRaw(id);
35 
36  ok=ok && !isExcluded(id);
37 
38  return ok;
39 }
bool isExcluded(const HcalDetId &id) const
Definition: HcalTopology.cc:41
bool validRaw(const HcalDetId &id) const
bool HcalTopology::validRaw ( const HcalDetId id) const
private

Is this a valid cell id, ignoring the exclusion list

Basic rules used to derive this code:

HB has 72 towers in iphi. Ieta 1-14 have depth=1, Ieta 15-16 have depth=1 or 2.

HE ieta=16-20 have 72 towers in iphi ieta=21-29 have 36 towers in iphi ieta=16 is depth 3 only ieta=17 is depth 1 only ieta=18-26 & 29 have depth 1 and 2 ieta=27-28 has depth 1-3

HF ieta=29-39 have 36 in iphi ieta=40-41 have 18 in iphi (71,3,7,11...) all have two depths

HO has 15 towers in ieta and 72 in iphi and depth = 4 (one value)

At H2:

HE ieta 17 is two depths HE ieta 22- have 36 towers in iphi (starts one higher) HE ieta 24- has three depthsIs this a valid cell id?

Definition at line 186 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHETripleDepthRing(), firstHFQuadPhiRing(), firstHFRing(), h2mode_, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, IPHI_MAX, lastHERing(), lastHFRing(), and convertSQLiteXML::ok.

Referenced by exclude(), incrementDepth(), and valid().

186  {
187  bool ok=true;
188  int ieta=id.ieta();
189  int aieta=id.ietaAbs();
190  int depth=id.depth();
191  int iphi=id.iphi();
192 
193  if ((ieta==0 || iphi<=0 || iphi>IPHI_MAX) || aieta>41) return false; // outer limits
194 
195  if (ok) {
196  HcalSubdetector subdet=id.subdet();
197  if (subdet==HcalBarrel) {
198  if (aieta>16 || depth>2 || (aieta<=14 && depth>1)) ok=false;
199  } else if (subdet==HcalEndcap) {
200  if (depth>3 || aieta<16 || aieta>lastHERing() ||
201  (aieta==16 && depth!=3) ||
202  (aieta==17 && depth!=1 && !h2mode_) || // special case at H2
203  (((aieta>=17 && aieta<firstHETripleDepthRing()) || aieta==29) && depth>2) ||
204  (aieta>=firstHEDoublePhiRing() && (iphi%2)==0)) ok=false;
205  } else if (subdet==HcalOuter) {
206  if (aieta>15 || iphi>IPHI_MAX || depth!=4) ok=false;
207  } else if (subdet==HcalForward) {
208  if (aieta<firstHFRing() || aieta>lastHFRing() ||
209  ((iphi%2)==0) ||
210  (depth>2) ||
211  (aieta>=firstHFQuadPhiRing() && ((iphi+1)%4)!=0)) ok=false;
212  } else ok=false;
213  }
214 
215  return ok;
216 }
int firstHFRing() const
Definition: HcalTopology.h:65
int firstHETripleDepthRing() const
Definition: HcalTopology.h:72
int lastHFRing() const
Definition: HcalTopology.h:66
HcalSubdetector
Definition: HcalAssistant.h:32
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:70
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:71
int lastHERing() const
Definition: HcalTopology.h:64
static const int IPHI_MAX
Definition: HcalTopology.cc:7
std::vector< DetId > HcalTopology::west ( const DetId id) const
virtual

Get the neighbors of the given cell in west direction

Implements CaloSubdetectorTopology.

Definition at line 84 of file HcalTopology.cc.

References i, and incIEta().

Referenced by spr::newHCALIdEW().

84  {
85  std::vector<DetId> vNeighborsDetId;
86  HcalDetId neighbors[2];
87  for (int i=0;i<incIEta(HcalDetId(id),neighbors);i++)
88  vNeighborsDetId.push_back(DetId(neighbors[i].rawId()));
89  return vNeighborsDetId;
90 }
int i
Definition: DBlmapReader.cc:9
int incIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
Definition: DetId.h:20

Member Data Documentation

const int HcalTopology::doublePhiBins_
private

Definition at line 111 of file HcalTopology.h.

Referenced by doublePhiBins(), and nPhiBins().

bool HcalTopology::excludeHB_
private

Definition at line 93 of file HcalTopology.h.

Referenced by exclude(), excludeSubdetector(), and isExcluded().

bool HcalTopology::excludeHE_
private

Definition at line 93 of file HcalTopology.h.

Referenced by exclude(), excludeSubdetector(), and isExcluded().

bool HcalTopology::excludeHF_
private

Definition at line 93 of file HcalTopology.h.

Referenced by exclude(), excludeSubdetector(), and isExcluded().

bool HcalTopology::excludeHO_
private

Definition at line 93 of file HcalTopology.h.

Referenced by exclude(), excludeSubdetector(), and isExcluded().

std::vector<HcalDetId> HcalTopology::exclusionList_
private

Definition at line 92 of file HcalTopology.h.

Referenced by exclude(), and isExcluded().

const int HcalTopology::firstHBRing_
private

Definition at line 98 of file HcalTopology.h.

Referenced by firstHBRing().

const int HcalTopology::firstHEDoublePhiRing_
private

Definition at line 107 of file HcalTopology.h.

Referenced by firstHEDoublePhiRing().

const int HcalTopology::firstHERing_
private

Definition at line 100 of file HcalTopology.h.

Referenced by firstHERing().

const int HcalTopology::firstHETripleDepthRing_
private

Definition at line 109 of file HcalTopology.h.

Referenced by firstHETripleDepthRing().

const int HcalTopology::firstHFQuadPhiRing_
private

Definition at line 108 of file HcalTopology.h.

Referenced by firstHFQuadPhiRing().

const int HcalTopology::firstHFRing_
private

Definition at line 102 of file HcalTopology.h.

Referenced by firstHFRing().

const int HcalTopology::firstHORing_
private

Definition at line 104 of file HcalTopology.h.

Referenced by firstHORing().

bool HcalTopology::h2mode_
private

Definition at line 95 of file HcalTopology.h.

Referenced by validRaw().

const int HcalTopology::lastHBRing_
private

Definition at line 99 of file HcalTopology.h.

Referenced by lastHBRing().

const int HcalTopology::lastHERing_
private

Definition at line 101 of file HcalTopology.h.

Referenced by lastHERing().

const int HcalTopology::lastHFRing_
private

Definition at line 103 of file HcalTopology.h.

Referenced by lastHFRing().

const int HcalTopology::lastHORing_
private

Definition at line 105 of file HcalTopology.h.

Referenced by lastHORing().

const int HcalTopology::singlePhiBins_
private

Definition at line 110 of file HcalTopology.h.

Referenced by nPhiBins(), and singlePhiBins().