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 Types | 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
 
bool decrementDepth (HcalDetId &id) const
 
virtual DetId denseId2detId (unsigned int) const
 return a linear packed id More...
 
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...
 
virtual unsigned int detId2denseId (const DetId &id) const
 return a linear packed id More...
 
unsigned int detId2denseIdCALIB (const DetId &id) const
 return a linear packed id from CALIB More...
 
unsigned int detId2denseIdHB (const DetId &id) const
 return a linear packed id from HB More...
 
unsigned int detId2denseIdHE (const DetId &id) const
 return a linear packed id from HE More...
 
unsigned int detId2denseIdHF (const DetId &id) const
 return a linear packed id from HF More...
 
unsigned int detId2denseIdHO (const DetId &id) const
 return a linear packed id from HO More...
 
unsigned int detId2denseIdHT (const DetId &id) const
 return a linear packed id from HT 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
 
unsigned int getCALIBSize () const
 
void getDepthSegmentation (unsigned ring, std::vector< int > &readoutDepths) const
 
unsigned int getHBSize () const
 
unsigned int getHESize () const
 
unsigned int getHFSize () const
 
unsigned int getHOSize () const
 
unsigned int getHTSize () const
 
unsigned int getNumberOfShapes () const
 
 HcalTopology (HcalTopologyMode::Mode mode, int maxDepthHB, int maxDepthHE, HcalTopologyMode::TriggerMode tmode=HcalTopologyMode::tm_LHC_PreLS1)
 
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
 
int maxDepthHB () const
 
int maxDepthHE () const
 
HcalTopologyMode::Mode mode () const
 
virtual unsigned int ncells () const
 return a count of valid cells (for dense indexing use) More...
 
virtual std::vector< DetIdnorth (const DetId &id) const
 
int nPhiBins (int etaRing) const
 how many phi segments in this ring More...
 
std::pair< int, int > segmentBoundaries (unsigned ring, unsigned depth) const
 
void setDepthSegmentation (unsigned ring, const std::vector< int > &readoutDepths)
 
int singlePhiBins () const
 
virtual std::vector< DetIdsouth (const DetId &id) const
 
virtual int topoVersion () const
 return a version which identifies the given topology More...
 
HcalTopologyMode::TriggerMode triggerMode () const
 
virtual std::vector< DetIdup (const DetId &id) const
 
virtual bool valid (const DetId &id) const
 
bool validHcal (const HcalDetId &id) const
 
virtual std::vector< DetIdwest (const DetId &id) const
 
- Public Member Functions inherited from CaloSubdetectorTopology
 CaloSubdetectorTopology ()
 standard constructor More...
 
virtual bool denseIdConsistent (int topoVer) const
 return whether this topology is consistent with the numbering in the given topology 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 DetId goDown (const DetId &id) const
 
virtual DetId goEast (const DetId &id) const
 
virtual DetId goNorth (const DetId &id) const
 
virtual DetId goSouth (const DetId &id) const
 
virtual DetId goUp (const DetId &id) const
 
virtual DetId goWest (const DetId &id) const
 
virtual ~CaloSubdetectorTopology ()
 virtual destructor More...
 

Private Types

enum  {
  kHBhalf = 1296, kHEhalf = 1296, kHOhalf = 1080, kHFhalf = 864,
  kHThalf = 2088, kZDChalf = 11, kCASTORhalf = 224, kCALIBhalf = 693,
  kHcalhalf = kHBhalf + kHEhalf + kHOhalf + kHFhalf
}
 
enum  { kSizeForDenseIndexingPreLS1 = 2*kHcalhalf }
 
enum  { kHBSizePreLS1 = 2*kHBhalf }
 
enum  { kHESizePreLS1 = 2*kHEhalf }
 
enum  { kHOSizePreLS1 = 2*kHOhalf }
 
enum  { kHFSizePreLS1 = 2*kHFhalf }
 
enum  { kHTSizePreLS1 = 2*kHThalf }
 
enum  { kCALIBSizePreLS1 = 2*kCALIBhalf }
 
typedef std::map< unsigned,
std::vector< int > > 
SegmentationMap
 

Private Member Functions

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

Private Attributes

unsigned int CALIBSize_
 
SegmentationMap depthSegmentation_
 
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_
 
unsigned int HBSize_
 
unsigned int HESize_
 
unsigned int HFSize_
 
unsigned int HOSize_
 
unsigned int HTSize_
 
const int lastHBRing_
 
const int lastHERing_
 
const int lastHFRing_
 
const int lastHORing_
 
const int maxDepthHB_
 
const int maxDepthHE_
 
HcalTopologyMode::Mode mode_
 
const unsigned int numberOfShapes_
 
const int singlePhiBins_
 
int topoVersion_
 
HcalTopologyMode::TriggerMode triggerMode_
 

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

Revision:
1.17
Author
J. Mans - Minnesota

Definition at line 25 of file HcalTopology.h.

Member Typedef Documentation

typedef std::map<unsigned, std::vector<int> > HcalTopology::SegmentationMap
private

Definition at line 182 of file HcalTopology.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
kHBhalf 
kHEhalf 
kHOhalf 
kHFhalf 
kHThalf 
kZDChalf 
kCASTORhalf 
kCALIBhalf 
kHcalhalf 

Definition at line 185 of file HcalTopology.h.

anonymous enum
private
Enumerator
kSizeForDenseIndexingPreLS1 

Definition at line 194 of file HcalTopology.h.

anonymous enum
private
Enumerator
kHBSizePreLS1 

Definition at line 195 of file HcalTopology.h.

anonymous enum
private
Enumerator
kHESizePreLS1 

Definition at line 196 of file HcalTopology.h.

anonymous enum
private
Enumerator
kHOSizePreLS1 

Definition at line 197 of file HcalTopology.h.

anonymous enum
private
Enumerator
kHFSizePreLS1 

Definition at line 198 of file HcalTopology.h.

anonymous enum
private
Enumerator
kHTSizePreLS1 

Definition at line 199 of file HcalTopology.h.

anonymous enum
private
Enumerator
kCALIBSizePreLS1 

Definition at line 200 of file HcalTopology.h.

Constructor & Destructor Documentation

HcalTopology::HcalTopology ( HcalTopologyMode::Mode  mode,
int  maxDepthHB,
int  maxDepthHE,
HcalTopologyMode::TriggerMode  tmode = HcalTopologyMode::tm_LHC_PreLS1 
)

Definition at line 13 of file HcalTopology.cc.

References HBSize_, HESize_, HFSize_, HOSize_, kHBSizePreLS1, kHESizePreLS1, kHFSizePreLS1, kHOSizePreLS1, HcalTopologyMode::LHC, mode_, HcalTopologyMode::SLHC, and topoVersion_.

Referenced by HcalTopologyIdealEP::produce().

13  :
14  excludeHB_(false),
15  excludeHE_(false),
16  excludeHO_(false),
17  excludeHF_(false),
18  mode_(mode),
19  triggerMode_(tmode),
20  firstHBRing_(1),
21  lastHBRing_(16),
22  firstHERing_(16),
23  lastHERing_(29),
24  firstHFRing_(29),
25  lastHFRing_(41),
26  firstHORing_(1),
27  lastHORing_(15),
31  singlePhiBins_(72),
32  doublePhiBins_(36),
39  numberOfShapes_(( mode==HcalTopologyMode::SLHC ) ? 500 : 87 ) {
40 
42  topoVersion_=0; //DL
43  HBSize_= kHBSizePreLS1; // qie-per-fiber * fiber/rm * rm/rbx * rbx/barrel * barrel/hcal
44  HESize_= kHESizePreLS1; // qie-per-fiber * fiber/rm * rm/rbx * rbx/endcap * endcap/hcal
45  HOSize_= kHOSizePreLS1; // ieta * iphi * 2
46  HFSize_= kHFSizePreLS1; // phi * eta * depth * pm
47  } else if (mode_==HcalTopologyMode::SLHC) { // need to know more eventually
48  HBSize_= maxDepthHB*16*72*2;
49  HESize_= maxDepthHE*(29-16+1)*72*2;
50  HOSize_= 15*72*2; // ieta * iphi * 2
51  HFSize_= 72*13*2*2; // phi * eta * depth * pm
52 
53  topoVersion_=10;
54  }
55 
56 }
const int lastHBRing_
Definition: HcalTopology.h:155
int maxDepthHE() const
Definition: HcalTopology.h:119
HcalTopologyMode::TriggerMode triggerMode_
Definition: HcalTopology.h:151
const int firstHETripleDepthRing_
Definition: HcalTopology.h:165
unsigned int HESize_
Definition: HcalTopology.h:172
const int firstHFQuadPhiRing_
Definition: HcalTopology.h:164
HcalTopologyMode::Mode mode() const
Definition: HcalTopology.h:30
const int lastHERing_
Definition: HcalTopology.h:157
unsigned int HFSize_
Definition: HcalTopology.h:174
const int lastHORing_
Definition: HcalTopology.h:161
const int firstHBRing_
Definition: HcalTopology.h:154
const int maxDepthHE_
Definition: HcalTopology.h:169
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:150
unsigned int HBSize_
Definition: HcalTopology.h:171
const int firstHFRing_
Definition: HcalTopology.h:158
const int firstHEDoublePhiRing_
Definition: HcalTopology.h:163
unsigned int HOSize_
Definition: HcalTopology.h:173
const int firstHERing_
Definition: HcalTopology.h:156
int maxDepthHB() const
Definition: HcalTopology.h:118
const unsigned int numberOfShapes_
Definition: HcalTopology.h:177
const int firstHORing_
Definition: HcalTopology.h:160
const int lastHFRing_
Definition: HcalTopology.h:159
const int maxDepthHB_
Definition: HcalTopology.h:168
const int singlePhiBins_
Definition: HcalTopology.h:166
const int doublePhiBins_
Definition: HcalTopology.h:167

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 398 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHFQuadPhiRing(), HcalBarrel, HcalEndcap, IPHI_MAX, lastHBRing(), lastHERing(), n, valid(), and ecaldqm::zside().

Referenced by decIEta(), and incIEta().

398  {
399  int n=1;
400  int aieta=id.ietaAbs();
401 
402  if (aieta==firstHEDoublePhiRing()) {
403  n=2;
404  neighbors[0]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi(),id.depth());
405  neighbors[1]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi()+1,id.depth());
406  } else if (aieta==firstHFQuadPhiRing()) {
407  n=2;
408  neighbors[0]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi(),id.depth());
409  if (id.iphi()==IPHI_MAX-1) neighbors[1]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),1,id.depth());
410  else neighbors[1]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi()+2,id.depth());
411  } else if (aieta==1) {
412  neighbors[0]=HcalDetId(id.subdet(),-aieta*id.zside(),id.iphi(),id.depth());
413  } else if (aieta==lastHBRing()+1) {
414  neighbors[0]=HcalDetId(HcalBarrel,(aieta-1)*id.zside(),id.iphi(),id.depth());
415  } else if (aieta==lastHERing()+1) {
416  neighbors[0]=HcalDetId(HcalEndcap,(aieta-1)*id.zside(),id.iphi(),id.depth());
417  } else
418  neighbors[0]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi(),id.depth());
419 
420  if (!valid(neighbors[0]) && n==2) {
421  if (!valid(neighbors[1])) n=0;
422  else {
423  n=1;
424  neighbors[0]=neighbors[1];
425  }
426  }
427  if (n==2 && !valid(neighbors[1])) n=1;
428  if (n==1 && !valid(neighbors[0])) n=0;
429 
430  return n;
431 }
int lastHBRing() const
Definition: HcalTopology.h:80
int zside(DetId const &)
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:88
virtual bool valid(const DetId &id) const
Definition: HcalTopology.cc:58
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:89
int lastHERing() const
Definition: HcalTopology.h:82
static const int IPHI_MAX
Definition: HcalTopology.cc:11
int HcalTopology::decIEta ( const HcalDetId id,
HcalDetId  neighbors[2] 
) const

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

Definition at line 372 of file HcalTopology.cc.

References decAIEta(), incAIEta(), and ecaldqm::zside().

Referenced by east().

372  {
373  if (id.zside()==1) return decAIEta(id,neighbors);
374  else return incAIEta(id,neighbors);
375 }
int zside(DetId const &)
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 334 of file HcalTopology.cc.

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

Referenced by south().

334  {
335  bool ok=valid(id);
336  if (ok) {
337  switch (id.subdet()) {
338  case (HcalBarrel):
339  case (HcalOuter):
340  if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX,id.depth());
341  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-1,id.depth());
342  break;
343  case (HcalEndcap):
344  if (id.ietaAbs()>=firstHEDoublePhiRing()) {
345  if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth());
346  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-2,id.depth());
347  } else {
348  if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX,id.depth());
349  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-1,id.depth());
350  }
351  break;
352  case (HcalForward):
353  if (id.ietaAbs()>=firstHFQuadPhiRing()) {
354  if (id.iphi()==3) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth());
355  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-4,id.depth());
356  } else {
357  if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth());
358  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-2,id.depth());
359  }
360  break;
361  default: ok=false;
362  }
363  }
364  return ok;
365 }
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:88
virtual bool valid(const DetId &id) const
Definition: HcalTopology.cc:58
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:89
static const int IPHI_MAX
Definition: HcalTopology.cc:11
bool HcalTopology::decrementDepth ( HcalDetId id) const

Get the detector in front of this one

Definition at line 528 of file HcalTopology.cc.

References HcalDetId::depth(), depthBinInformation(), firstHERing(), firstHFRing(), HcalTopologyMode::H2HE, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), lastHERing(), maxDepthHB_, mode_, HcalTopologyMode::SLHC, HcalDetId::subdet(), and validRaw().

Referenced by down().

528  {
529  HcalSubdetector subdet = detId.subdet();
530  int ieta = detId.ieta();
531  int etaRing = detId.ietaAbs();
532  int depth = detId.depth();
533  int nDepthBins, startingBin;
534  depthBinInformation(subdet, etaRing, nDepthBins, startingBin);
535 
536  // see if the new depth bin exists
537  --depth;
538  if (subdet == HcalOuter) {
539  subdet = HcalBarrel;
541  depth = maxDepthHB_;
542  } else {
543  depth = (etaRing<=14) ? 1 : 2;
544  }
545  } else if (subdet == HcalEndcap && etaRing == firstHERing()) {
546  subdet = HcalBarrel;
547  depth = 2;
548  } else if (subdet == HcalEndcap && etaRing == lastHERing() && depth == 2 &&
550  (ieta > 0) ? --ieta : ++ieta;
551  } else if (depth <= 0) {
552  if (subdet == HcalForward && etaRing == firstHFRing()) {
553  // overlap
554  subdet = HcalEndcap;
555  etaRing= lastHERing()-1;
556  ieta = (ieta > 0) ? etaRing : -etaRing;
557  } else {
558  // no more chances
559  detId = HcalDetId();
560  return false;
561  }
562  }
563  detId = HcalDetId(subdet, ieta, detId.iphi(), depth);
564  return validRaw(detId);
565 }
int firstHFRing() const
Definition: HcalTopology.h:83
bool validRaw(const HcalDetId &id) const
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:150
HcalSubdetector
Definition: HcalAssistant.h:31
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 firstHERing() const
Definition: HcalTopology.h:81
const int maxDepthHB_
Definition: HcalTopology.h:168
int lastHERing() const
Definition: HcalTopology.h:82
DetId HcalTopology::denseId2detId ( unsigned int  denseid) const
virtual

return a linear packed id

Reimplemented from CaloSubdetectorTopology.

Definition at line 806 of file HcalTopology.cc.

References HBSize_, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HESize_, HOSize_, recoMuon::in, kHBhalf, kHEhalf, kHFhalf, kHOhalf, kSizeForDenseIndexingPreLS1, maxDepthHB_, maxDepthHE_, ncells(), sd, and topoVersion_.

Referenced by HcalGeometry::localCorners().

806  {
807 
809  int ie ( 0 ) ;
810  int ip ( 0 ) ;
811  int dp ( 0 ) ;
812  int in ( denseid ) ;
813  int iz ( 1 ) ;
814  if (topoVersion_==0) { //DL// pre-LS1
815  if (denseid < kSizeForDenseIndexingPreLS1) {
816  if ( in > 2*( kHBhalf + kHEhalf + kHOhalf ) - 1 ) { // HF
817  sd = HcalForward ;
818  in -= 2*( kHBhalf + kHEhalf + kHOhalf ) ;
819  iz = ( in<kHFhalf ? 1 : -1 ) ;
820  in %= kHFhalf ;
821  ip = 4*( in/48 ) ;
822  in %= 48 ;
823  ip += 1 + ( in>21 ? 2 : 0 ) ;
824  if( 3 == ip%4 ) in -= 22 ;
825  ie = 29 + in/2 ;
826  dp = 1 + in%2 ;
827  } else if ( in > 2*( kHBhalf + kHEhalf ) - 1 ) { // HO
828  sd = HcalOuter ;
829  in -= 2*( kHBhalf + kHEhalf ) ;
830  iz = ( in<kHOhalf ? 1 : -1 ) ;
831  in %= kHOhalf ;
832  dp = 4 ;
833  ip = 1 + in/15 ;
834  ie = 1 + ( in - 15*( ip - 1 ) ) ;
835  } else if ( in > 2*kHBhalf - 1 ) { // Endcap
836  sd = HcalEndcap ;
837  in -= 2*kHBhalf ;
838  iz = ( in<kHEhalf ? 1 : -1 ) ;
839  in %= kHEhalf ;
840  ip = 2*( in/36 ) ;
841  in %= 36 ;
842  ip += 1 + in/28 ;
843  if( 0 == ip%2 ) in %= 28 ;
844  ie = 15 + ( in<2 ? 1 + in : 2 +
845  ( in<20 ? 1 + ( in - 2 )/2 : 9 +
846  ( in<26 ? 1 + ( in - 20 )/3 : 3 ) ) ) ;
847  dp = ( in<1 ? 3 :
848  ( in<2 ? 1 :
849  ( in<20 ? 1 + ( in - 2 )%2 :
850  ( in<26 ? 1 + ( in - 20 )%3 :
851  ( 1 + ( in - 26 )%2 ) ) ) ) ) ;
852  } else { // barrel
853  iz = ( in<kHBhalf ? 1 : -1 ) ;
854  in %= kHBhalf ;
855  ip = in/18 + 1 ;
856  in %= 18 ;
857  if ( in < 14 ) {
858  dp = 1 ;
859  ie = in + 1 ;
860  } else {
861  in %= 14 ;
862  dp = 1 + in%2 ;
863  ie = 15 + in/2 ;
864  }
865  }
866  }
867  } else if (topoVersion_==10) {
868  if (denseid < ncells()) {
869  if (denseid >= (HBSize_+HESize_+HOSize_)) {
870  sd = HcalForward ;
871  in -= (HBSize_+HESize_+HOSize_);
872  dp = (in%2) + 1;
873  ip = (in - dp + 1)%144;
874  ip = (ip/2) + 1;
875  ie = (in - dp + 1 - 2*(ip -1))/144;
876  if (ie > 12) {ie = 54 -ie; iz = -1;}
877  else {ie += 29; iz = 1;}
878  } else if (denseid >= (HBSize_+HESize_)) {
879  sd = HcalOuter ;
880  in -= (HBSize_+HESize_);
881  dp = 4;
882  ip = (in%72) + 1;
883  ie = (in - ip + 1)/72;
884  if (ie > 14) {ie = 30 -ie; iz = -1;}
885  else {ie += 1; iz = 1;}
886  } else if (denseid >= (HBSize_)) {
887  sd = HcalEndcap ;
888  in -= (HBSize_);
889  dp = (in%maxDepthHE_)+1;
890  ip = (in - dp + 1)%(maxDepthHE_*72);
891  ip = (ip/maxDepthHE_) + 1;
892  ie = (in - dp + 1 - maxDepthHE_*(ip-1))/(72*maxDepthHE_);
893  if (ie > 13) {ie = 43 - ie; iz = -1;}
894  else {ie += 16; iz = 1;}
895  } else {
896  sd = HcalBarrel ;
897  dp = (in%maxDepthHB_)+1;
898  ip = (in - dp + 1)%(maxDepthHB_*72);
899  ip = (ip/maxDepthHB_) + 1;
900  ie = (in - dp + 1 - maxDepthHB_*(ip-1))/(72*maxDepthHB_);
901  if (ie > 15) {ie = 32 - ie; iz = -1;}
902  else {ie += 1; iz = 1;}
903  }
904  }
905  }
906  return HcalDetId( sd, iz*int(ie), ip, dp );
907 }
unsigned int HESize_
Definition: HcalTopology.h:172
const int maxDepthHE_
Definition: HcalTopology.h:169
HcalSubdetector
Definition: HcalAssistant.h:31
unsigned int HBSize_
Definition: HcalTopology.h:171
unsigned int HOSize_
Definition: HcalTopology.h:173
double sd
const int maxDepthHB_
Definition: HcalTopology.h:168
virtual unsigned int ncells() const
return a count of valid cells (for dense indexing use)
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 434 of file HcalTopology.cc.

References dtNoiseDBValidation_cfg::cerr, firstHERing(), firstHETripleDepthRing(), HcalTopologyMode::H2HE, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, lastHBRing(), lastHERing(), maxDepthHB_, maxDepthHE_, mode_, and HcalTopologyMode::SLHC.

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

435  {
436 
437  if(subdet == HcalBarrel) {
439  startingBin = 1;
440  if (etaRing==lastHBRing()) {
441  nDepthBins = 2;
442  } else {
443  nDepthBins = maxDepthHB_;
444  }
445  } else {
446  if (etaRing<=14) {
447  nDepthBins = 1;
448  startingBin = 1;
449  } else {
450  nDepthBins = 2;
451  startingBin = 1;
452  }
453  }
454  } else if(subdet == HcalEndcap) {
456  if (etaRing==firstHERing()) {
457  nDepthBins = maxDepthHE_ - 2;
458  startingBin = 3;
459  } else {
460  nDepthBins = maxDepthHE_;
461  startingBin = 1;
462  }
463  } else {
464  if (etaRing==firstHERing()) {
465  nDepthBins = 1;
466  startingBin = 3;
467  } else if (etaRing==17) {
468  nDepthBins = 1;
469  startingBin = 1;
470  } else if (etaRing==lastHERing()) {
471  nDepthBins = 2;
472  startingBin = 1;
473  } else {
474  nDepthBins = (etaRing >= firstHETripleDepthRing()) ? 3 : 2;
475  startingBin = 1;
476  }
477  }
478  } else if(subdet == HcalForward) {
479  nDepthBins = 2;
480  startingBin = 1;
481  } else if(subdet == HcalOuter) {
482  nDepthBins = 1;
483  startingBin = 4;
484  } else {
485  std::cerr << "Bad HCAL subdetector " << subdet << std::endl;
486  }
487 }
int lastHBRing() const
Definition: HcalTopology.h:80
const int maxDepthHE_
Definition: HcalTopology.h:169
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:150
int firstHETripleDepthRing() const
Definition: HcalTopology.h:90
int firstHERing() const
Definition: HcalTopology.h:81
const int maxDepthHB_
Definition: HcalTopology.h:168
int lastHERing() const
Definition: HcalTopology.h:82
unsigned int HcalTopology::detId2denseId ( const DetId id) const
virtual

return a linear packed id

Reimplemented from CaloSubdetectorTopology.

Definition at line 769 of file HcalTopology.cc.

References HcalDetId::depth(), detId2denseIdPreLS1(), HBSize_, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HESize_, HOSize_, HcalDetId::ieta(), HcalDetId::iphi(), maxDepthHB_, maxDepthHE_, HcalDetId::subdet(), and topoVersion_.

Referenced by HcalRecHitsMaker::createVectorOfSubdetectorCells(), HcalGeometry::getGeometry(), HcalGeometry::indexFor(), HcalRecHitsMaker::loadPCaloHits(), HcalDDDGeometry::newCell(), and HcalGeometry::newCell().

769  {
770  unsigned int retval(0);
771  if (topoVersion_==0) { // pre-LS1
772  retval = detId2denseIdPreLS1(id);
773  } else if (topoVersion_==10) {
774  HcalDetId hid(id);
775  if (hid.subdet()==HcalBarrel) {
776  retval=(hid.depth()-1)+maxDepthHB_*(hid.iphi()-1);
777  if (hid.ieta()>0) {
778  retval+=maxDepthHB_*72*(hid.ieta()-1);
779  } else {
780  retval+=maxDepthHB_*72*(32+hid.ieta());
781  }
782  } else if (hid.subdet()==HcalEndcap) {
783  retval=HBSize_;
784  retval+=(hid.depth()-1)+maxDepthHE_*(hid.iphi()-1);
785  if (hid.ieta()>0) {
786  retval+=maxDepthHE_*72*(hid.ieta()-16);
787  } else {
788  retval+=maxDepthHE_*72*((14+29)+hid.ieta());
789  }
790  } else if (hid.subdet()==HcalOuter) {
791  retval=HBSize_+HESize_;
792  if (hid.ieta()>0) retval+=(hid.iphi()-1)+72*(hid.ieta()-1);
793  else retval+=(hid.iphi()-1)+72*(30+hid.ieta());
794  } else if (hid.subdet()==HcalForward) {
795  retval=HBSize_+HESize_+HOSize_;
796  retval+=hid.depth()-1+2*(hid.iphi()-1);
797  if (hid.ieta()>0) retval+=2*72*(hid.ieta()-29);
798  else retval+=2*72*((41+13)+hid.ieta());
799  } else {
800  return 0xFFFFFFFu;
801  }
802  }
803  return retval;
804 }
unsigned int detId2denseIdPreLS1(const DetId &id) const
unsigned int HESize_
Definition: HcalTopology.h:172
const int maxDepthHE_
Definition: HcalTopology.h:169
unsigned int HBSize_
Definition: HcalTopology.h:171
unsigned int HOSize_
Definition: HcalTopology.h:173
const int maxDepthHB_
Definition: HcalTopology.h:168
unsigned int HcalTopology::detId2denseIdCALIB ( const DetId id) const

return a linear packed id from CALIB

Definition at line 710 of file HcalTopology.cc.

References funct::abs(), HcalCalibDetId::calibFlavor(), HcalCalibDetId::CalibrationBox, HcalCalibDetId::cboxChannel(), gather_cfg::cout, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalCalibDetId::hcalSubdet(), HcalCalibDetId::HOCrosstalk, HcalCalibDetId::ieta(), cmsHarvester::index, HcalCalibDetId::iphi(), HcalCalibDetId::zside(), and ecaldqm::zside().

Referenced by HcalLogicalMapGenerator::buildCALIBMap(), HcalLogicalMapGenerator::buildHOXMap(), HcalLogicalMap::checkHashIds(), HcalLogicalMap::getHcalFrontEndId(), and HcalCondObjectContainerBase::indexFor().

710  {
711  HcalCalibDetId tid(id);
712  int channel = tid.cboxChannel();
713  int ieta = tid.ieta();
714  int iphi = tid.iphi();
715  int zside = tid.zside();
716  unsigned int index=0xFFFFFFFFu;
717 
718  if (tid.calibFlavor()==HcalCalibDetId::CalibrationBox) {
719 
720  HcalSubdetector subDet = tid.hcalSubdet();
721 
722  if (subDet==HcalBarrel) {
723  //std::cout<<"CALIB_HB: ";
724  //dphi = 4 (18 phi values), 3 channel types (0,1,2), eta = -1 or 1
725  //total of 18*3*2=108 channels
726  index = ((iphi+1)/4-1) + 18*channel + 27*(ieta+1);
727  } else if (subDet==HcalEndcap) {
728  //std::cout<<"CALIB_HE: ";
729  //dphi = 4 (18 phi values), 6 channel types (0,1,3,4,5,6), eta = -1 or 1
730  //total of 18*6*2=216 channels
731  if (channel>2) channel-=1;
732  index = ((iphi+1)/4-1) + 18*channel + 54*(ieta+1) + 108;
733  } else if (subDet==HcalForward) {
734  //std::cout<<"CALIB_HF: ";
735  //dphi = 18 (4 phi values), 3 channel types (0,1,8), eta = -1 or 1
736  if (channel==8) channel = 2;
737  //total channels 4*3*2=24
738  index = (iphi-1)/18 + 4*channel + 6*(ieta+1) + 324;
739  } else if (subDet==HcalOuter) {
740  //std::cout<<"CALIB_HO: ";
741  //there are 5 special calib crosstalk channels, one in each ring
742  if (channel==7) {
743  channel = 2;
744  index = (ieta+2) + 420;
745  //for HOM/HOP dphi = 6 (12 phi values), 2 channel types (0,1), eta = -2,-1 or 1,2
746  //for HO0/YB0 dphi = 12 (6 phi values), 2 channel types (0,1), eta = 0
747  } else{
748  if (ieta<0) index = ((iphi+1)/12-1) + 36*channel + 6*(ieta+2) + 348;
749  else if (ieta>0) index = ((iphi+1)/12-1) + 36*channel + 6*(ieta+2) + 6 + 348;
750  else index = ((iphi+1)/6-1) + 36*channel + 6*(ieta+2) + 348;
751  }
752  } else {
753  std::cout << "HCAL Det Id not valid!" << std::endl;
754  index = 0;
755  }
756 
757  } else if (tid.calibFlavor()==HcalCalibDetId::HOCrosstalk) {
758  //std::cout<<"HX: ";
759  //for YB0/HO0 phi is grouped in 6 groups of 6 with dphi=2 but the transitions are 1 or 3
760  // in such a way that the %36 operation yeilds unique values for every iphi
761  if (abs(ieta)==4) index = ((iphi-1)%36) + (((zside+1)*36)/2) + 72 + 425; //ieta = 1 YB0/HO0;
762  else index = (iphi-1) + (36*(zside+1)*2) + 425; //ieta = 0 for HO2M/HO1M ieta=2 for HO1P/HO2P;
763  }
764  //std::cout << " " << ieta << " " << zside << " " << iphi << " " << depth << " " << index << std::endl;
765  return index;
766 }
int zside(DetId const &)
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
unsigned int HcalTopology::detId2denseIdHB ( const DetId id) const

return a linear packed id from HB

Definition at line 627 of file HcalTopology.cc.

References HcalDetId::depth(), HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), kHBhalf, maxDepthHB_, topoVersion_, and HcalDetId::zside().

Referenced by HcalLogicalMapGenerator::buildHBEFTMap(), HcalLogicalMap::checkHashIds(), HcalLogicalMap::getHcalFrontEndId(), and HcalCondObjectContainerBase::indexFor().

627  {
628  HcalDetId hid(id);
629  const int ip (hid.iphi() ) ;
630  const int ie (hid.ietaAbs() ) ;
631  const int dp (hid.depth() ) ;
632  const int zn (hid.zside() < 0 ? 1 : 0 ) ;
633  unsigned int retval = 0xFFFFFFFFu;
634  if (topoVersion_==0) {
635  retval=( ip - 1 )*18 + dp - 1 + ie - ( ie<16 ? 1 : 0 ) + zn*kHBhalf;
636  } else if (topoVersion_==10) {
637  retval=dp-1 + maxDepthHB_*(ip-1)+maxDepthHB_*72*(hid.ieta()-1+33*zn);
638  }
639  return retval;
640 }
const int maxDepthHB_
Definition: HcalTopology.h:168
unsigned int HcalTopology::detId2denseIdHE ( const DetId id) const

return a linear packed id from HE

Definition at line 642 of file HcalTopology.cc.

References HcalDetId::depth(), HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), kHEhalf, maxDepthHE_, topoVersion_, and HcalDetId::zside().

Referenced by HcalLogicalMapGenerator::buildHBEFTMap(), HcalLogicalMap::checkHashIds(), HcalLogicalMap::getHcalFrontEndId(), and HcalCondObjectContainerBase::indexFor().

642  {
643  HcalDetId hid(id);
644  const int ip (hid.iphi() ) ;
645  const int ie (hid.ietaAbs() ) ;
646  const int dp (hid.depth() ) ;
647  const int zn (hid.zside() < 0 ? 1 : 0 ) ;
648  unsigned int retval = 0xFFFFFFFFu;
649  if (topoVersion_==0) {
650  retval=( ip - 1 )*8 + ( ip/2 )*20 +
651  ( ( ie==16 || ie==17 ) ? ie - 16 :
652  ( ( ie>=18 && ie<=20 ) ? 2 + 2*( ie - 18 ) + dp - 1 :
653  ( ( ie>=21 && ie<=26 ) ? 8 + 2*( ie - 21 ) + dp - 1 :
654  ( ( ie>=27 && ie<=28 ) ? 20 + 3*( ie - 27 ) + dp - 1 :
655  26 + 2*( ie - 29 ) + dp - 1 ) ) ) ) + zn*kHEhalf;
656  } else if (topoVersion_==10) {
657  retval=(dp-1)+maxDepthHE_*(ip-1)+maxDepthHE_*72*(hid.ieta()-16+zn*(14+29+16));
658  }
659  return retval;
660 }
const int maxDepthHE_
Definition: HcalTopology.h:169
unsigned int HcalTopology::detId2denseIdHF ( const DetId id) const

return a linear packed id from HF

Definition at line 677 of file HcalTopology.cc.

References HcalDetId::depth(), HcalDetId::ietaAbs(), HcalDetId::iphi(), kHFhalf, topoVersion_, and HcalDetId::zside().

Referenced by HcalLogicalMapGenerator::buildHBEFTMap(), HcalLogicalMap::checkHashIds(), HcalLogicalMap::getHcalFrontEndId(), and HcalCondObjectContainerBase::indexFor().

677  {
678  HcalDetId hid(id);
679  const int ip (hid.iphi() ) ;
680  const int ie (hid.ietaAbs() ) ;
681  const int dp (hid.depth() ) ;
682  const int zn (hid.zside() < 0 ? 1 : 0 ) ;
683 
684  unsigned int retval = 0xFFFFFFFFu;
685  if (topoVersion_==0) {
686  retval = ( ( ip - 1 )/4 )*4 + ( ( ip - 1 )/2 )*22 +
687  2*( ie - 29 ) + ( dp - 1 ) + zn*kHFhalf;
688  } else if (topoVersion_==10) {
689  retval = ( ( ip - 1 )/4 )*4 + ( ( ip - 1 )/2 )*22 +
690  2*( ie - 29 ) + ( dp - 1 ) + zn*kHFhalf;
691  }
692  return retval;
693 }
unsigned int HcalTopology::detId2denseIdHO ( const DetId id) const

return a linear packed id from HO

Definition at line 662 of file HcalTopology.cc.

References HcalDetId::ietaAbs(), HcalDetId::iphi(), kHOhalf, topoVersion_, and HcalDetId::zside().

Referenced by HcalLogicalMapGenerator::buildHOXMap(), HcalLogicalMap::checkHashIds(), HcalLogicalMap::getHcalFrontEndId(), and HcalCondObjectContainerBase::indexFor().

662  {
663  HcalDetId hid(id);
664  const int ip (hid.iphi() ) ;
665  const int ie (hid.ietaAbs() ) ;
666  const int zn (hid.zside() < 0 ? 1 : 0 ) ;
667 
668  unsigned int retval = 0xFFFFFFFFu;
669  if (topoVersion_==0) {
670  retval=( ip - 1 )*15 + ( ie - 1 ) + zn*kHOhalf;
671  } else if (topoVersion_==10) {
672  retval=( ip - 1 )*15 + ( ie - 1 ) + zn*kHOhalf;
673  }
674  return retval;
675 }
unsigned int HcalTopology::detId2denseIdHT ( const DetId id) const

return a linear packed id from HT

Definition at line 695 of file HcalTopology.cc.

References HcalTrigTowerDetId::ietaAbs(), cmsHarvester::index, HcalTrigTowerDetId::iphi(), kHThalf, HcalTrigTowerDetId::zside(), and ecaldqm::zside().

Referenced by HcalLogicalMap::checkHashIds(), and HcalCondObjectContainerBase::indexFor().

695  {
696  HcalTrigTowerDetId tid(id);
697  int zside = tid.zside();
698  unsigned int ietaAbs = tid.ietaAbs();
699  unsigned int iphi = tid.iphi();
700 
701  unsigned int index;
702  if ((iphi-1)%4==0) index = (iphi-1)*32 + (ietaAbs-1) - (12*((iphi-1)/4));
703  else index = (iphi-1)*28 + (ietaAbs-1) + (4*(((iphi-1)/4)+1));
704 
705  if (zside == -1) index += kHThalf;
706 
707  return index;
708 }
int zside(DetId const &)
unsigned int HcalTopology::detId2denseIdPreLS1 ( const DetId id) const
private

Definition at line 600 of file HcalTopology.cc.

References HcalDetId::depth(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalDetId::ietaAbs(), HcalDetId::iphi(), kHBhalf, kHEhalf, kHFhalf, kHOhalf, sd, HcalDetId::subdet(), and HcalDetId::zside().

Referenced by detId2denseId().

600  {
601 
602  HcalDetId hid(id);
603  const HcalSubdetector sd (hid.subdet() ) ;
604  const int ip (hid.iphi() ) ;
605  const int ie (hid.ietaAbs() ) ;
606  const int dp (hid.depth() ) ;
607  const int zn (hid.zside() < 0 ? 1 : 0 ) ;
608  unsigned int retval = ( ( sd == HcalBarrel ) ?
609  ( ip - 1 )*18 + dp - 1 + ie - ( ie<16 ? 1 : 0 ) + zn*kHBhalf :
610  ( ( sd == HcalEndcap ) ?
611  2*kHBhalf + ( ip - 1 )*8 + ( ip/2 )*20 +
612  ( ( ie==16 || ie==17 ) ? ie - 16 :
613  ( ( ie>=18 && ie<=20 ) ? 2 + 2*( ie - 18 ) + dp - 1 :
614  ( ( ie>=21 && ie<=26 ) ? 8 + 2*( ie - 21 ) + dp - 1 :
615  ( ( ie>=27 && ie<=28 ) ? 20 + 3*( ie - 27 ) + dp - 1 :
616  26 + 2*( ie - 29 ) + dp - 1 ) ) ) ) + zn*kHEhalf :
617  ( ( sd == HcalOuter ) ?
618  2*kHBhalf + 2*kHEhalf + ( ip - 1 )*15 + ( ie - 1 ) + zn*kHOhalf :
619  ( ( sd == HcalForward ) ?
620  2*kHBhalf + 2*kHEhalf + 2*kHOhalf +
621  ( ( ip - 1 )/4 )*4 + ( ( ip - 1 )/2 )*22 +
622  2*( ie - 29 ) + ( dp - 1 ) + zn*kHFhalf : 0xFFFFFFFFu ) ) ) ) ;
623  return retval;
624 }
HcalSubdetector
Definition: HcalAssistant.h:31
double sd
int HcalTopology::doublePhiBins ( ) const
inline

Definition at line 92 of file HcalTopology.h.

References doublePhiBins_.

92 {return doublePhiBins_;}
const int doublePhiBins_
Definition: HcalTopology.h:167
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 148 of file HcalTopology.cc.

References decrementDepth().

148  {
149  HcalDetId neighbor = id;
150  std::vector<DetId> vNeighborsDetId;
151  if (decrementDepth(neighbor)) {
152  vNeighborsDetId.push_back(neighbor);
153  }
154  return vNeighborsDetId;
155 }
bool decrementDepth(HcalDetId &id) const
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 107 of file HcalTopology.cc.

References decIEta(), and i.

Referenced by spr::newHCALIdEW().

107  {
108  std::vector<DetId> vNeighborsDetId;
109  HcalDetId neighbors[2];
110  for (int i=0;i<decIEta(HcalDetId(id),neighbors);i++)
111  vNeighborsDetId.push_back(DetId(neighbors[i].rawId()));
112  return vNeighborsDetId;
113 }
int i
Definition: DBlmapReader.cc:9
int decIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
Definition: DetId.h:18
void HcalTopology::exclude ( const HcalDetId id)

Add a cell to exclusion list

Definition at line 90 of file HcalTopology.cc.

References exclusionList_, and i.

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

90  {
91  std::vector<HcalDetId>::iterator i=std::lower_bound(exclusionList_.begin(),exclusionList_.end(),id);
92  if (i==exclusionList_.end() || *i!=id) {
93  exclusionList_.insert(i,id);
94  }
95 }
int i
Definition: DBlmapReader.cc:9
std::vector< HcalDetId > exclusionList_
Definition: HcalTopology.h:147
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 157 of file HcalTopology.cc.

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

157  {
158 
159  bool exed=false;
160  // first, check the full detector exclusions... (fast)
161  switch (subdet) {
162  case(HcalBarrel): exed=excludeHB_; break;
163  case(HcalEndcap): exed=excludeHE_; break;
164  case(HcalOuter): exed=excludeHO_; break;
165  case(HcalForward): exed=excludeHF_; break;
166  default: exed=false;
167  }
168  if (exed) return 0; // if the whole detector is excluded...
169 
170  int ieta_l=std::min(ieta1,ieta2);
171  int ieta_h=std::max(ieta1,ieta2);
172  int iphi_l=std::min(iphi1,iphi2);
173  int iphi_h=std::max(iphi1,iphi2);
174  int depth_l=std::min(depth1,depth2);
175  int depth_h=std::max(depth1,depth2);
176 
177  int n=0;
178  for (int ieta=ieta_l; ieta<=ieta_h; ieta++)
179  for (int iphi=iphi_l; iphi<=iphi_h; iphi++)
180  for (int depth=depth_l; depth<=depth_h; depth++) {
181  HcalDetId id(subdet,ieta,iphi,depth);
182  if (validRaw(id)) { // use 'validRaw' to include check validity in "uncut" detector
183  exclude(id);
184  n++;
185  }
186  }
187  return n;
188 }
void exclude(const HcalDetId &id)
Definition: HcalTopology.cc:90
bool validRaw(const HcalDetId &id) const
T min(T a, T b)
Definition: MathUtil.h:58
void HcalTopology::excludeSubdetector ( HcalSubdetector  subdet)

Exclude an entire subdetector

Definition at line 97 of file HcalTopology.cc.

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

Referenced by HcalTopologyRestrictionParser::parse().

97  {
98  switch (subdet) {
99  case(HcalBarrel): excludeHB_=true; break;
100  case(HcalEndcap): excludeHE_=true; break;
101  case(HcalOuter): excludeHO_=true; break;
102  case(HcalForward): excludeHF_=true; break;
103  default: break;
104  }
105 }
int HcalTopology::firstHBRing ( ) const
inline

Definition at line 79 of file HcalTopology.h.

References firstHBRing_.

Referenced by HcalHardcodeGeometryLoader::load().

79 {return firstHBRing_;}
const int firstHBRing_
Definition: HcalTopology.h:154
int HcalTopology::firstHEDoublePhiRing ( ) const
inline
int HcalTopology::firstHERing ( ) const
inline
int HcalTopology::firstHETripleDepthRing ( ) const
inline
int HcalTopology::firstHFQuadPhiRing ( ) const
inline
int HcalTopology::firstHFRing ( ) const
inline
int HcalTopology::firstHORing ( ) const
inline

Definition at line 85 of file HcalTopology.h.

References firstHORing_.

Referenced by HcalHardcodeGeometryLoader::load().

85 {return firstHORing_;}
const int firstHORing_
Definition: HcalTopology.h:160
unsigned int HcalTopology::getCALIBSize ( ) const
inline

Definition at line 116 of file HcalTopology.h.

References CALIBSize_.

Referenced by HcalCondObjectContainerBase::sizeFor().

116 {return CALIBSize_;}
unsigned int CALIBSize_
Definition: HcalTopology.h:176
void HcalTopology::getDepthSegmentation ( unsigned  ring,
std::vector< int > &  readoutDepths 
) const

for each of the ~17 depth segments, specify which readout bin they belong to if the ring is not found, the first one with a lower ring will be returned.

Definition at line 574 of file HcalTopology.cc.

References depthSegmentation_, edm::hlt::Exception, and relativeConstraints::ring.

Referenced by segmentBoundaries().

575 {
576  // if it doesn't exist, return the first entry with a lower index. So if we only
577  // have entries for 1 and 17, any input from 1-16 should return the entry for ring 1
578  SegmentationMap::const_iterator pos = depthSegmentation_.upper_bound(ring);
579  if(pos == depthSegmentation_.begin()) {
580  throw cms::Exception("HcalTopology") << "No depth segmentation found for ring" << ring;
581  }
582  --pos;
583  // pos now refers to the last element with key <= ring.
584  readoutDepths = pos->second;
585 }
SegmentationMap depthSegmentation_
Definition: HcalTopology.h:183
unsigned int HcalTopology::getHBSize ( ) const
inline

Definition at line 111 of file HcalTopology.h.

References HBSize_.

Referenced by HcalGeometry::init(), and HcalCondObjectContainerBase::sizeFor().

111 {return HBSize_;}
unsigned int HBSize_
Definition: HcalTopology.h:171
unsigned int HcalTopology::getHESize ( ) const
inline

Definition at line 112 of file HcalTopology.h.

References HESize_.

Referenced by HcalGeometry::init(), and HcalCondObjectContainerBase::sizeFor().

112 {return HESize_;}
unsigned int HESize_
Definition: HcalTopology.h:172
unsigned int HcalTopology::getHFSize ( ) const
inline

Definition at line 114 of file HcalTopology.h.

References HFSize_.

Referenced by HcalGeometry::init(), and HcalCondObjectContainerBase::sizeFor().

114 {return HFSize_;}
unsigned int HFSize_
Definition: HcalTopology.h:174
unsigned int HcalTopology::getHOSize ( ) const
inline

Definition at line 113 of file HcalTopology.h.

References HOSize_.

Referenced by HcalGeometry::init(), and HcalCondObjectContainerBase::sizeFor().

113 {return HOSize_;}
unsigned int HOSize_
Definition: HcalTopology.h:173
unsigned int HcalTopology::getHTSize ( ) const
inline

Definition at line 115 of file HcalTopology.h.

References HTSize_.

Referenced by HcalCondObjectContainerBase::sizeFor().

115 {return HTSize_;}
unsigned int HTSize_
Definition: HcalTopology.h:175
unsigned int HcalTopology::getNumberOfShapes ( ) const
inline

Definition at line 134 of file HcalTopology.h.

References numberOfShapes_.

Referenced by HcalGeometry::numberOfShapes().

134 { return numberOfShapes_; }
const unsigned int numberOfShapes_
Definition: HcalTopology.h:177
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 378 of file HcalTopology.cc.

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

Referenced by decIEta(), and incIEta().

378  {
379  int n=1;
380  int aieta=id.ietaAbs();
381 
382  if (aieta==firstHEDoublePhiRing()-1 && (id.iphi()%2)==0)
383  neighbors[0]=HcalDetId(id.subdet(),(aieta+1)*id.zside(),id.iphi()-1,id.depth());
384  else if (aieta==firstHFQuadPhiRing()-1 && ((id.iphi()+1)%4)!=0)
385  neighbors[0]=HcalDetId(id.subdet(),(aieta+1)*id.zside(),((id.iphi()==1)?(71):(id.iphi()-2)),id.depth());
386  else if (aieta==lastHBRing())
387  neighbors[0]=HcalDetId(HcalEndcap,(aieta+1)*id.zside(),id.iphi(),1);
388  else if (aieta==lastHERing())
389  neighbors[0]=HcalDetId(HcalForward,(aieta+1)*id.zside(),id.iphi(),1);
390  else
391  neighbors[0]=HcalDetId(id.subdet(),(aieta+1)*id.zside(),id.iphi(),id.depth());
392 
393  if (!valid(neighbors[0])) n=0;
394  return n;
395 }
int lastHBRing() const
Definition: HcalTopology.h:80
int zside(DetId const &)
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:88
virtual bool valid(const DetId &id) const
Definition: HcalTopology.cc:58
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:89
int lastHERing() const
Definition: HcalTopology.h:82
int HcalTopology::incIEta ( const HcalDetId id,
HcalDetId  neighbors[2] 
) const

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

Definition at line 367 of file HcalTopology.cc.

References decAIEta(), incAIEta(), and ecaldqm::zside().

Referenced by west().

367  {
368  if (id.zside()==1) return incAIEta(id,neighbors);
369  else return decAIEta(id,neighbors);
370 }
int zside(DetId const &)
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 300 of file HcalTopology.cc.

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

Referenced by north().

300  {
301  bool ok=valid(id);
302  if (ok) {
303  switch (id.subdet()) {
304  case (HcalBarrel):
305  case (HcalOuter):
306  if (id.iphi()==IPHI_MAX) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
307  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+1,id.depth());
308  break;
309  case (HcalEndcap):
310  if (id.ietaAbs()>=firstHEDoublePhiRing()) {
311  if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
312  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+2,id.depth());
313  } else {
314  if (id.iphi()==IPHI_MAX) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
315  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+1,id.depth());
316  }
317  break;
318  case (HcalForward):
319  if (id.ietaAbs()>=firstHFQuadPhiRing()) {
320  if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),3,id.depth());
321  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+4,id.depth());
322  } else {
323  if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
324  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+2,id.depth());
325  }
326  break;
327  default: ok=false;
328  }
329  }
330  return ok;
331 }
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:88
virtual bool valid(const DetId &id) const
Definition: HcalTopology.cc:58
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:89
static const int IPHI_MAX
Definition: HcalTopology.cc:11
bool HcalTopology::incrementDepth ( HcalDetId id) const

Get the detector behind this one

Definition at line 490 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().

491 {
492  HcalSubdetector subdet = detId.subdet();
493  int ieta = detId.ieta();
494  int etaRing = detId.ietaAbs();
495  int depth = detId.depth();
496  int nDepthBins, startingBin;
497  depthBinInformation(subdet, etaRing, nDepthBins, startingBin);
498 
499  // see if the new depth bin exists
500  ++depth;
501  if(depth > nDepthBins) {
502  // handle on a case-by-case basis
503  if(subdet == HcalBarrel && etaRing < lastHORing()) {
504  // HO
505  subdet = HcalOuter;
506  depth = 4;
507  } else if(subdet == HcalBarrel && etaRing == lastHBRing()) {
508  // overlap
509  subdet = HcalEndcap;
510  } else if(subdet == HcalEndcap && etaRing == lastHERing()-1) {
511  // guard ring HF29 is behind HE 28
512  subdet = HcalForward;
513  (ieta > 0) ? ++ieta : --ieta;
514  depth = 1;
515  } else if(subdet == HcalEndcap && etaRing == lastHERing()) {
516  // split cells go to bigger granularity. Ring 29 -> 28
517  (ieta > 0) ? --ieta : ++ieta;
518  } else {
519  // no more chances
520  detId = HcalDetId();
521  return false;
522  }
523  }
524  detId = HcalDetId(subdet, ieta, detId.iphi(), depth);
525  return validRaw(detId);
526 }
int lastHBRing() const
Definition: HcalTopology.h:80
bool validRaw(const HcalDetId &id) const
HcalSubdetector
Definition: HcalAssistant.h:31
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:86
int lastHERing() const
Definition: HcalTopology.h:82
bool HcalTopology::isExcluded ( const HcalDetId id) const
private

Definition at line 72 of file HcalTopology.cc.

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

Referenced by validHcal().

72  {
73  bool exed=false;
74  // first, check the full detector exclusions... (fast)
75  switch (id.subdet()) {
76  case(HcalBarrel): exed=excludeHB_; break;
77  case(HcalEndcap): exed=excludeHE_; break;
78  case(HcalOuter): exed=excludeHO_; break;
79  case(HcalForward): exed=excludeHF_; break;
80  default: exed=false;
81  }
82  // next, check the list (slower)
83  if (!exed && !exclusionList_.empty()) {
84  std::vector<HcalDetId>::const_iterator i=std::lower_bound(exclusionList_.begin(),exclusionList_.end(),id);
85  if (i!=exclusionList_.end() && *i==id) exed=true;
86  }
87  return exed;
88 }
int i
Definition: DBlmapReader.cc:9
std::vector< HcalDetId > exclusionList_
Definition: HcalTopology.h:147
int HcalTopology::lastHBRing ( ) const
inline
int HcalTopology::lastHERing ( ) const
inline
int HcalTopology::lastHFRing ( ) const
inline
int HcalTopology::lastHORing ( ) const
inline
int HcalTopology::maxDepthHB ( ) const
inline

Definition at line 118 of file HcalTopology.h.

References maxDepthHB_.

Referenced by HcalTopologyIdealEP::produce().

118 { return maxDepthHB_;}
const int maxDepthHB_
Definition: HcalTopology.h:168
int HcalTopology::maxDepthHE ( ) const
inline

Definition at line 119 of file HcalTopology.h.

References maxDepthHE_.

Referenced by HcalTopologyIdealEP::produce().

119 { return maxDepthHE_;}
const int maxDepthHE_
Definition: HcalTopology.h:169
HcalTopologyMode::Mode HcalTopology::mode ( void  ) const
inline
unsigned int HcalTopology::ncells ( ) const
virtual

return a count of valid cells (for dense indexing use)

Reimplemented from CaloSubdetectorTopology.

Definition at line 909 of file HcalTopology.cc.

References HBSize_, HESize_, HFSize_, and HOSize_.

Referenced by denseId2detId(), HcalGeometry::getSummary(), HcalFlexiHardcodeGeometryLoader::load(), HcalHardcodeGeometryLoader::load(), and HcalGeometry::sizeForDenseIndex().

909  {
911 }
unsigned int HESize_
Definition: HcalTopology.h:172
unsigned int HFSize_
Definition: HcalTopology.h:174
unsigned int HBSize_
Definition: HcalTopology.h:171
unsigned int HOSize_
Definition: HcalTopology.h:173
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 123 of file HcalTopology.cc.

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

Referenced by spr::newHCALIdNS().

123  {
124  std::vector<DetId> vNeighborsDetId;
125  HcalDetId neighbor;
126  if (incIPhi(HcalDetId(id),neighbor))
127  vNeighborsDetId.push_back(DetId(neighbor.rawId()));
128  return vNeighborsDetId;
129 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
bool incIPhi(const HcalDetId &id, HcalDetId &neighbor) const
Definition: DetId.h:18
int HcalTopology::nPhiBins ( int  etaRing) const

how many phi segments in this ring

Definition at line 567 of file HcalTopology.cc.

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

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

567  {
568  int lastPhiBin=singlePhiBins_;
569  if (etaRing>= firstHFQuadPhiRing()) lastPhiBin=doublePhiBins_/2;
570  else if (etaRing>= firstHEDoublePhiRing()) lastPhiBin=doublePhiBins_;
571  return lastPhiBin;
572 }
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:88
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:89
const int singlePhiBins_
Definition: HcalTopology.h:166
const int doublePhiBins_
Definition: HcalTopology.h:167
std::pair< int, int > HcalTopology::segmentBoundaries ( unsigned  ring,
unsigned  depth 
) const

returns the boundaries of the depth segmentation, so that the first result is the first segment, and the second result is the first one of the next segment. Used for calculating physical bounds.

Definition at line 592 of file HcalTopology.cc.

References getDepthSegmentation().

592  {
593  std::vector<int> readoutDepths;
594  getDepthSegmentation(ring, readoutDepths);
595  int d1 = std::lower_bound(readoutDepths.begin(), readoutDepths.end(), depth) - readoutDepths.begin();
596  int d2 = std::upper_bound(readoutDepths.begin(), readoutDepths.end(), depth) - readoutDepths.begin();
597  return std::pair<int, int>(d1, d2);
598 }
void getDepthSegmentation(unsigned ring, std::vector< int > &readoutDepths) const
void HcalTopology::setDepthSegmentation ( unsigned  ring,
const std::vector< int > &  readoutDepths 
)

Definition at line 587 of file HcalTopology.cc.

References depthSegmentation_, and relativeConstraints::ring.

588 {
589  depthSegmentation_[ring] = readoutDepths;
590 }
SegmentationMap depthSegmentation_
Definition: HcalTopology.h:183
int HcalTopology::singlePhiBins ( ) const
inline

Definition at line 91 of file HcalTopology.h.

References singlePhiBins_.

91 {return singlePhiBins_;}
const int singlePhiBins_
Definition: HcalTopology.h:166
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 131 of file HcalTopology.cc.

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

Referenced by spr::newHCALIdNS().

131  {
132  std::vector<DetId> vNeighborsDetId;
133  HcalDetId neighbor;
134  if (decIPhi(HcalDetId(id),neighbor))
135  vNeighborsDetId.push_back(DetId(neighbor.rawId()));
136  return vNeighborsDetId;
137 }
bool decIPhi(const HcalDetId &id, HcalDetId &neighbor) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
Definition: DetId.h:18
int HcalTopology::topoVersion ( ) const
virtual

return a version which identifies the given topology

Reimplemented from CaloSubdetectorTopology.

Definition at line 913 of file HcalTopology.cc.

References topoVersion_.

Referenced by HcalCondObjectContainerBase::HcalCondObjectContainerBase(), and HcalCondObjectContainerBase::setTopo().

913  {
914  return topoVersion_;
915 }
HcalTopologyMode::TriggerMode HcalTopology::triggerMode ( ) const
inline

Definition at line 31 of file HcalTopology.h.

References triggerMode_.

31 { return triggerMode_; }
HcalTopologyMode::TriggerMode triggerMode_
Definition: HcalTopology.h:151
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 139 of file HcalTopology.cc.

References incrementDepth().

Referenced by spr::matrixHCALIdsDepth().

139  {
140  HcalDetId neighbor = id;
141  std::vector<DetId> vNeighborsDetId;
142  if(incrementDepth(neighbor)) {
143  vNeighborsDetId.push_back(neighbor);
144  }
145  return vNeighborsDetId;
146 }
bool incrementDepth(HcalDetId &id) const
bool HcalTopology::valid ( const DetId id) const
virtual

Is this a valid cell id?

Reimplemented from CaloSubdetectorTopology.

Definition at line 58 of file HcalTopology.cc.

References DetId::Hcal, and validHcal().

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

58  {
59  assert(id.det()==DetId::Hcal);
60  return validHcal(id);
61 }
bool validHcal(const HcalDetId &id) const
Definition: HcalTopology.cc:63
bool HcalTopology::validDetIdPreLS1 ( 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 depths

Definition at line 216 of file HcalTopology.cc.

References firstHERing(), firstHFQuadPhiRing(), firstHFRing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, IPHI_MAX, lastHFRing(), and sd.

216  {
217  const HcalSubdetector sd (id.subdet());
218  const int ie (id.ietaAbs());
219  const int ip (id.iphi());
220  const int dp (id.depth());
221 
222  return ( ( ip >= 1 ) &&
223  ( ip <= IPHI_MAX ) &&
224  ( dp >= 1 ) &&
225  ( ie >= 1 ) &&
226  ( ( ( sd == HcalBarrel ) &&
227  ( ( ( ie <= 14 ) &&
228  ( dp == 1 ) ) ||
229  ( ( ( ie == 15 ) || ( ie == 16 ) ) &&
230  ( dp <= 2 ) ) ) ) ||
231  ( ( sd == HcalEndcap ) &&
232  ( ( ( ie == firstHERing() ) &&
233  ( dp == 3 ) ) ||
234  ( ( ie == 17 ) &&
235  ( dp == 1 ) ) ||
236  ( ( ie >= 18 ) &&
237  ( ie <= 20 ) &&
238  ( dp <= 2 ) ) ||
239  ( ( ie >= 21 ) &&
240  ( ie <= 26 ) &&
241  ( dp <= 2 ) &&
242  ( ip%2 == 1 ) ) ||
243  ( ( ie >= 27 ) &&
244  ( ie <= 28 ) &&
245  ( dp <= 3 ) &&
246  ( ip%2 == 1 ) ) ||
247  ( ( ie == 29 ) &&
248  ( dp <= 2 ) &&
249  ( ip%2 == 1 ) ) ) ) ||
250  ( ( sd == HcalOuter ) &&
251  ( ie <= 15 ) &&
252  ( dp == 4 ) ) ||
253  ( ( sd == HcalForward ) &&
254  ( dp <= 2 ) &&
255  ( ( ( ie >= firstHFRing() ) &&
256  ( ie < firstHFQuadPhiRing() ) &&
257  ( ip%2 == 1 ) ) ||
258  ( ( ie >= firstHFQuadPhiRing() ) &&
259  ( ie <= lastHFRing() ) &&
260  ( ip%4 == 3 ) ) ) ) ) ) ;
261 }
int firstHFRing() const
Definition: HcalTopology.h:83
int lastHFRing() const
Definition: HcalTopology.h:84
HcalSubdetector
Definition: HcalAssistant.h:31
double sd
int firstHERing() const
Definition: HcalTopology.h:81
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:89
static const int IPHI_MAX
Definition: HcalTopology.cc:11
bool HcalTopology::validHcal ( const HcalDetId id) const

Is this a valid cell id?

Definition at line 63 of file HcalTopology.cc.

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

Referenced by valid().

63  {
64  // check the raw rules
65  bool ok=validRaw(id);
66 
67  ok=ok && !isExcluded(id);
68 
69  return ok;
70 }
bool isExcluded(const HcalDetId &id) const
Definition: HcalTopology.cc:72
bool validRaw(const HcalDetId &id) const
bool HcalTopology::validRaw ( const HcalDetId id) const
private

Is this a valid cell id?

Definition at line 264 of file HcalTopology.cc.

References firstHEDoublePhiRing(), firstHERing(), firstHETripleDepthRing(), firstHFQuadPhiRing(), firstHFRing(), HcalTopologyMode::H2, HcalTopologyMode::H2HE, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, IPHI_MAX, lastHBRing(), lastHERing(), lastHFRing(), lastHORing(), maxDepthHB_, maxDepthHE_, mode_, convertSQLiteXML::ok, and HcalTopologyMode::SLHC.

Referenced by decrementDepth(), exclude(), incrementDepth(), and validHcal().

264  {
265  bool ok=true;
266  int ieta=id.ieta();
267  int aieta=id.ietaAbs();
268  int depth=id.depth();
269  int iphi=id.iphi();
270  if ((ieta==0 || iphi<=0 || iphi>IPHI_MAX) || aieta>lastHFRing()) return false; // outer limits
271 
272  if (ok) {
273  HcalSubdetector subdet=id.subdet();
274  if (subdet==HcalBarrel) {
276  if ((aieta>lastHBRing() || depth>maxDepthHB_ || (aieta==lastHBRing() && depth > 2))) ok=false;
277  } else {
278  if (aieta>lastHBRing() || depth>2 || (aieta<=14 && depth>1)) ok=false;
279  }
280  } else if (subdet==HcalEndcap) {
282  if (depth>maxDepthHE_ || aieta<firstHERing() || aieta>lastHERing() || (aieta==firstHERing() && depth<3) || (aieta>=firstHEDoublePhiRing() && (iphi%2)==0)) ok=false;
283  } else {
284  if (depth>3 || aieta<firstHERing() || aieta>lastHERing() || (aieta==firstHERing() && depth!=3) || (aieta==17 && depth!=1 && mode_!=HcalTopologyMode::H2) || // special case at H2
285  (((aieta>=17 && aieta<firstHETripleDepthRing()) || aieta==lastHERing()) && depth>2) ||
286  (aieta>=firstHEDoublePhiRing() && (iphi%2)==0)) ok=false;
287  }
288  } else if (subdet==HcalOuter) {
289  if (aieta>lastHORing() || iphi>IPHI_MAX || depth!=4) ok=false;
290  } else if (subdet==HcalForward) {
291  if (aieta<firstHFRing() || aieta>lastHFRing() || ((iphi%2)==0) || (depth>2) || (aieta>=firstHFQuadPhiRing() && ((iphi+1)%4)!=0)) ok=false;
292  } else {
293  ok=false;
294  }
295  }
296  return ok;
297 }
int firstHFRing() const
Definition: HcalTopology.h:83
int lastHBRing() const
Definition: HcalTopology.h:80
const int maxDepthHE_
Definition: HcalTopology.h:169
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:150
int firstHETripleDepthRing() const
Definition: HcalTopology.h:90
int lastHFRing() const
Definition: HcalTopology.h:84
HcalSubdetector
Definition: HcalAssistant.h:31
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:88
int firstHERing() const
Definition: HcalTopology.h:81
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:89
const int maxDepthHB_
Definition: HcalTopology.h:168
int lastHORing() const
Definition: HcalTopology.h:86
int lastHERing() const
Definition: HcalTopology.h:82
static const int IPHI_MAX
Definition: HcalTopology.cc:11
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 115 of file HcalTopology.cc.

References i, and incIEta().

Referenced by spr::newHCALIdEW().

115  {
116  std::vector<DetId> vNeighborsDetId;
117  HcalDetId neighbors[2];
118  for (int i=0;i<incIEta(HcalDetId(id),neighbors);i++)
119  vNeighborsDetId.push_back(DetId(neighbors[i].rawId()));
120  return vNeighborsDetId;
121 }
int i
Definition: DBlmapReader.cc:9
int incIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
Definition: DetId.h:18

Member Data Documentation

unsigned int HcalTopology::CALIBSize_
private

Definition at line 176 of file HcalTopology.h.

Referenced by getCALIBSize().

SegmentationMap HcalTopology::depthSegmentation_
private

Definition at line 183 of file HcalTopology.h.

Referenced by getDepthSegmentation(), and setDepthSegmentation().

const int HcalTopology::doublePhiBins_
private

Definition at line 167 of file HcalTopology.h.

Referenced by doublePhiBins(), and nPhiBins().

bool HcalTopology::excludeHB_
private

Definition at line 148 of file HcalTopology.h.

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

bool HcalTopology::excludeHE_
private

Definition at line 148 of file HcalTopology.h.

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

bool HcalTopology::excludeHF_
private

Definition at line 148 of file HcalTopology.h.

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

bool HcalTopology::excludeHO_
private

Definition at line 148 of file HcalTopology.h.

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

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

Definition at line 147 of file HcalTopology.h.

Referenced by exclude(), and isExcluded().

const int HcalTopology::firstHBRing_
private

Definition at line 154 of file HcalTopology.h.

Referenced by firstHBRing().

const int HcalTopology::firstHEDoublePhiRing_
private

Definition at line 163 of file HcalTopology.h.

Referenced by firstHEDoublePhiRing().

const int HcalTopology::firstHERing_
private

Definition at line 156 of file HcalTopology.h.

Referenced by firstHERing().

const int HcalTopology::firstHETripleDepthRing_
private

Definition at line 165 of file HcalTopology.h.

Referenced by firstHETripleDepthRing().

const int HcalTopology::firstHFQuadPhiRing_
private

Definition at line 164 of file HcalTopology.h.

Referenced by firstHFQuadPhiRing().

const int HcalTopology::firstHFRing_
private

Definition at line 158 of file HcalTopology.h.

Referenced by firstHFRing().

const int HcalTopology::firstHORing_
private

Definition at line 160 of file HcalTopology.h.

Referenced by firstHORing().

unsigned int HcalTopology::HBSize_
private

Definition at line 171 of file HcalTopology.h.

Referenced by denseId2detId(), detId2denseId(), getHBSize(), HcalTopology(), and ncells().

unsigned int HcalTopology::HESize_
private

Definition at line 172 of file HcalTopology.h.

Referenced by denseId2detId(), detId2denseId(), getHESize(), HcalTopology(), and ncells().

unsigned int HcalTopology::HFSize_
private

Definition at line 174 of file HcalTopology.h.

Referenced by getHFSize(), HcalTopology(), and ncells().

unsigned int HcalTopology::HOSize_
private

Definition at line 173 of file HcalTopology.h.

Referenced by denseId2detId(), detId2denseId(), getHOSize(), HcalTopology(), and ncells().

unsigned int HcalTopology::HTSize_
private

Definition at line 175 of file HcalTopology.h.

Referenced by getHTSize().

const int HcalTopology::lastHBRing_
private

Definition at line 155 of file HcalTopology.h.

Referenced by lastHBRing().

const int HcalTopology::lastHERing_
private

Definition at line 157 of file HcalTopology.h.

Referenced by lastHERing().

const int HcalTopology::lastHFRing_
private

Definition at line 159 of file HcalTopology.h.

Referenced by lastHFRing().

const int HcalTopology::lastHORing_
private

Definition at line 161 of file HcalTopology.h.

Referenced by lastHORing().

const int HcalTopology::maxDepthHB_
private
const int HcalTopology::maxDepthHE_
private
HcalTopologyMode::Mode HcalTopology::mode_
private

Definition at line 150 of file HcalTopology.h.

Referenced by decrementDepth(), depthBinInformation(), HcalTopology(), mode(), and validRaw().

const unsigned int HcalTopology::numberOfShapes_
private

Definition at line 177 of file HcalTopology.h.

Referenced by getNumberOfShapes().

const int HcalTopology::singlePhiBins_
private

Definition at line 166 of file HcalTopology.h.

Referenced by nPhiBins(), and singlePhiBins().

int HcalTopology::topoVersion_
private
HcalTopologyMode::TriggerMode HcalTopology::triggerMode_
private

Definition at line 151 of file HcalTopology.h.

Referenced by triggerMode().