test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static 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
 
double etaMax (HcalSubdetector subdet) const
 
std::pair< double, double > etaRange (HcalSubdetector subdet, int ieta) const
 
int etaRing (HcalSubdetector subdet, double eta) const
 eta and phi index from eta, phi values More...
 
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 firstHEQuadPhiRing () 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 (const HcalDDDRecConstants *hcons)
 
 HcalTopology (HcalTopologyMode::Mode mode, int maxDepthHB, int maxDepthHE, HcalTopologyMode::TriggerMode tmode=HcalTopologyMode::tm_LHC_RCT)
 
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 maxDepth (HcalSubdetector subdet) 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...
 
int nPhiBins (HcalSubdetector subdet, int etaRing) const
 
int phiBin (HcalSubdetector subdet, int etaRing, double phi) const
 
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 validDetId (HcalSubdetector subdet, int ieta, int iphi, int depth) const
 
bool validHcal (const HcalDetId &id) const
 
bool validHT (const HcalTrigTowerDetId &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...
 

Static Public Member Functions

static std::string producerTag ()
 

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  { kHTSizePhase1 = (kHTSizePreLS1+(2*12*36)) }
 
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_
 
int doublePhiBins_
 
std::vector< double > dPhiTable
 
std::vector< double > dPhiTableHF
 
std::vector
< HcalDDDRecConstants::HcalEtaBin
etaBinsHB_
 
std::vector
< HcalDDDRecConstants::HcalEtaBin
etaBinsHE_
 
int etaHE2HF_
 
int etaHF2HE_
 
std::vector< double > etaTable
 
std::vector< double > etaTableHF
 
bool excludeHB_
 
bool excludeHE_
 
bool excludeHF_
 
bool excludeHO_
 
std::vector< HcalDetIdexclusionList_
 
int firstHBRing_
 
int firstHEDoublePhiRing_
 
int firstHEQuadPhiRing_
 
int firstHERing_
 
int firstHETripleDepthRing_
 
int firstHFQuadPhiRing_
 
int firstHFRing_
 
int firstHORing_
 
unsigned int HBSize_
 
const HcalDDDRecConstantshcons_
 
unsigned int HESize_
 
unsigned int HFSize_
 
unsigned int HOSize_
 
unsigned int HTSize_
 
int lastHBRing_
 
int lastHERing_
 
int lastHFRing_
 
int lastHORing_
 
int maxDepthHB_
 
int maxDepthHE_
 
int maxDepthHF_
 
int maxEta_
 
HcalTopologyMode::Mode mode_
 
int nEtaHB_
 
int nEtaHE_
 
unsigned int numberOfShapes_
 
std::vector< double > phioff
 
int singlePhiBins_
 
int topoVersion_
 
HcalTopologyMode::TriggerMode triggerMode_
 
std::vector< int > unitPhi
 
std::vector< int > unitPhiHF
 

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.

Definition at line 25 of file HcalTopology.h.

Member Typedef Documentation

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

Definition at line 198 of file HcalTopology.h.

Member Enumeration Documentation

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

Definition at line 201 of file HcalTopology.h.

anonymous enum
private
Enumerator
kSizeForDenseIndexingPreLS1 

Definition at line 210 of file HcalTopology.h.

anonymous enum
private
Enumerator
kHBSizePreLS1 

Definition at line 211 of file HcalTopology.h.

anonymous enum
private
Enumerator
kHESizePreLS1 

Definition at line 212 of file HcalTopology.h.

anonymous enum
private
Enumerator
kHOSizePreLS1 

Definition at line 213 of file HcalTopology.h.

anonymous enum
private
Enumerator
kHFSizePreLS1 

Definition at line 214 of file HcalTopology.h.

anonymous enum
private
Enumerator
kHTSizePreLS1 

Definition at line 215 of file HcalTopology.h.

anonymous enum
private
Enumerator
kHTSizePhase1 

Definition at line 216 of file HcalTopology.h.

anonymous enum
private
Enumerator
kCALIBSizePreLS1 

Definition at line 217 of file HcalTopology.h.

Constructor & Destructor Documentation

HcalTopology::HcalTopology ( const HcalDDDRecConstants hcons)

Definition at line 17 of file HcalTopology.cc.

References gather_cfg::cout, dPhiTable, dPhiTableHF, eta, etaBinsHB_, etaBinsHE_, etaHE2HF_, etaHF2HE_, etaMax(), etaTable, etaTableHF, firstHBRing_, firstHEDoublePhiRing_, firstHEQuadPhiRing_, firstHERing_, firstHETripleDepthRing_, firstHFQuadPhiRing_, firstHFRing_, firstHORing_, HcalDDDRecConstants::getDepth(), HcalDDDRecConstants::getEtaBins(), HcalDDDRecConstants::getEtaRange(), HcalDDDRecConstants::getEtaTable(), HcalDDDRecConstants::getEtaTableHF(), HcalDDDRecConstants::getMaxDepth(), HcalDDDRecConstants::getNEta(), HcalDDDRecConstants::getPhiOffs(), HcalDDDRecConstants::getPhiTable(), HcalDDDRecConstants::getPhiTableHF(), HcalDDDRecConstants::getTopoMode(), HcalDDDRecConstants::getTriggerMode(), HBSize_, hcons_, HESize_, HFSize_, HOSize_, HTSize_, i, IPHI_MAX, relval_2017::k, kHBSizePreLS1, kHESizePreLS1, kHFSizePreLS1, kHOSizePreLS1, kHTSizePhase1, kHTSizePreLS1, lastHBRing_, lastHERing_, lastHFRing_, lastHORing_, HcalTopologyMode::LHC, M_PI, maxDepthHB_, maxDepthHE_, maxDepthHF_, maxEta_, mode_, HLT_25ns10e33_v2_cff::nEta, nEtaHB_, nEtaHE_, numberOfShapes_, phioff, relativeConstraints::ring, setDepthSegmentation(), HcalTopologyMode::SLHC, HcalTopologyMode::tm_LHC_RCT, topoVersion_, triggerMode_, csvLumiCalc::unit, unitPhi, unitPhiHF, and units().

Referenced by HcalTopologyIdealEP::produce().

17  :
18  hcons_(hcons),
19  excludeHB_(false), excludeHE_(false), excludeHO_(false), excludeHF_(false),
20  firstHBRing_(1),
21  firstHERing_(999), lastHERing_(0),
22  firstHFRing_(29), lastHFRing_(41),
23  firstHORing_(1), lastHORing_(15),
27 
35  nEtaHB_ = (int)(etaBinsHB_.size());
37  for (int i = 0; i < (int)(etaBinsHE_.size()); ++i) {
38  if (firstHERing_ > etaBinsHE_[i].ieta) firstHERing_ = etaBinsHE_[i].ieta;
39  if (lastHERing_ < etaBinsHE_[i].ieta) lastHERing_ = etaBinsHE_[i].ieta;
40  int unit = (int)((etaBinsHE_[i].dphi+0.01)/(5.0*CLHEP::deg));
41  if (unit == 2 && firstHEDoublePhiRing_ > etaBinsHE_[i].ieta)
43  if (unit == 4 && firstHEQuadPhiRing_ > etaBinsHE_[i].ieta)
45  if (etaBinsHE_[i].layer.size() > 2 && firstHETripleDepthRing_ > etaBinsHE_[i].ieta)
47  }
50  topoVersion_=0; //DL
51  HBSize_ = kHBSizePreLS1; // qie-per-fiber * fiber/rm * rm/rbx * rbx/barrel * barrel/hcal
52  HESize_ = kHESizePreLS1; // qie-per-fiber * fiber/rm * rm/rbx * rbx/endcap * endcap/hcal
53  HOSize_ = kHOSizePreLS1; // ieta * iphi * 2
54  HFSize_ = kHFSizePreLS1; // ieta * iphi * depth * 2
55  numberOfShapes_ = 87;
56  } else if (mode_==HcalTopologyMode::SLHC) { // need to know more eventually
57  topoVersion_=10;
58  HBSize_ = nEtaHB_*IPHI_MAX*maxDepthHB_*2;
60  HOSize_ = (lastHORing_-firstHORing_+1)*IPHI_MAX*2; // ieta * iphi * 2
61  HFSize_ = (lastHFRing_-firstHFRing_+1)*IPHI_MAX*maxDepthHF_*2; // ieta * iphi * depth * 2
62  numberOfShapes_ = 500;
63  }
67  } else {
69  }
70 
71 #ifdef DebugLog
72  std::cout << "Topo sizes " << HBSize_ << ":" << HESize_ << ":" << HOSize_
73  << ":" << HFSize_ << ":" << HTSize_ << " for mode " << mode_
74  << ":" << triggerMode_ << std::endl;
75 #endif
76 
77  //The transition between HE/HF in eta
83  std::pair<int,int> ietaHF = hcons_->getEtaRange(2);
84  double eta = etaBinsHE_[etaBinsHE_.size()-1].etaMax;
86  for (unsigned int i=1; i<etaTableHF.size(); ++i) {
87  if (eta < etaTableHF[i]) {
88  etaHE2HF_ = ietaHF.first + i - 1;
89  break;
90  }
91  }
92  eta = etaTableHF[0];
94  for (unsigned int i=0; i<etaBinsHE_.size(); ++i) {
95  if (eta < etaBinsHE_[i].etaMax) {
96  etaHF2HE_ = etaBinsHE_[i].ieta;
97  break;
98  }
99  }
100  const double fiveDegInRad = 2*M_PI/72;
101  for (unsigned int k=0; k<dPhiTable.size(); ++k) {
102  int units = (int)(dPhiTable[k]/fiveDegInRad+0.5);
103  unitPhi.push_back(units);
104  }
105  for (unsigned int k=0; k<dPhiTableHF.size(); ++k) {
106  int units = (int)(dPhiTableHF[k]/fiveDegInRad+0.5);
107  unitPhiHF.push_back(units);
108  }
109  int nEta = hcons_->getNEta();
110  for (int ring=1; ring<=nEta; ++ring) {
111  std::vector<int> segmentation = hcons_->getDepth(ring-1);
112  setDepthSegmentation(ring,segmentation);
113 #ifdef DebugLog
114  std::cout << "Set segmentation for ring " << ring << " with "
115  << segmentation.size() << " elements:";
116  for (unsigned int k=0; k<segmentation.size(); ++k)
117  std::cout << " " << segmentation[k];
118  std::cout << std::endl;
119 #endif
120  }
121 
122 #ifdef DebugLog
123  std::cout << "Constants in HcalTopology " << firstHBRing_ << ":"
124  << lastHBRing_ << " " << firstHERing_ << ":" << lastHERing_ << ":"
125  << firstHEDoublePhiRing_ << ":" << firstHEQuadPhiRing_ << ":"
126  << firstHETripleDepthRing_ << " " << firstHFRing_ << ":"
127  << lastHFRing_ << ":" << firstHFQuadPhiRing_ << " " << firstHORing_
128  << ":" << lastHORing_ << " " << maxDepthHB_ << ":" << maxDepthHE_
129  << " " << nEtaHB_ << ":" << nEtaHE_ << " " << etaHE2HF_ << ":"
130  << etaHF2HE_ << std::endl;
131 #endif
132 }
std::vector< int > unitPhiHF
Definition: HcalTopology.h:193
int i
Definition: DBlmapReader.cc:9
unsigned int numberOfShapes_
Definition: HcalTopology.h:189
std::vector< double > dPhiTableHF
Definition: HcalTopology.h:191
std::vector< HcalDDDRecConstants::HcalEtaBin > etaBinsHB_
Definition: HcalTopology.h:173
std::vector< int > unitPhi
Definition: HcalTopology.h:193
const std::vector< double > & getEtaTableHF() const
HcalTopologyMode::TriggerMode triggerMode_
Definition: HcalTopology.h:166
unsigned int HESize_
Definition: HcalTopology.h:184
unsigned int HTSize_
Definition: HcalTopology.h:187
std::vector< HcalDDDRecConstants::HcalEtaBin > etaBinsHE_
Definition: HcalTopology.h:173
const std::vector< double > & getPhiOffs() const
int getMaxDepth(const int type) const
unsigned int HFSize_
Definition: HcalTopology.h:186
string unit
Definition: csvLumiCalc.py:46
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:165
void setDepthSegmentation(unsigned ring, const std::vector< int > &readoutDepths)
unsigned int HBSize_
Definition: HcalTopology.h:183
std::vector< double > etaTableHF
Definition: HcalTopology.h:191
unsigned int HOSize_
Definition: HcalTopology.h:185
std::vector< double > etaTable
Definition: HcalTopology.h:191
#define M_PI
int firstHEQuadPhiRing_
Definition: HcalTopology.h:176
std::vector< double > phioff
Definition: HcalTopology.h:192
const std::vector< double > & getPhiTable() const
const std::vector< double > & getEtaTable() const
std::pair< int, int > getEtaRange(const int i) const
const std::vector< int > & getDepth(const unsigned int i) const
std::vector< double > dPhiTable
Definition: HcalTopology.h:191
TString units(TString variable, Char_t axis)
const std::vector< double > & getPhiTableHF() const
int firstHETripleDepthRing_
Definition: HcalTopology.h:177
tuple cout
Definition: gather_cfg.py:145
double etaMax(HcalSubdetector subdet) const
int firstHEDoublePhiRing_
Definition: HcalTopology.h:176
const HcalDDDRecConstants * hcons_
Definition: HcalTopology.h:161
static const int IPHI_MAX
Definition: HcalTopology.cc:13
int firstHFQuadPhiRing_
Definition: HcalTopology.h:176
std::vector< HcalEtaBin > getEtaBins(const int itype) const
HcalTopology::HcalTopology ( HcalTopologyMode::Mode  mode,
int  maxDepthHB,
int  maxDepthHE,
HcalTopologyMode::TriggerMode  tmode = HcalTopologyMode::tm_LHC_RCT 
)

Definition at line 134 of file HcalTopology.cc.

References firstHBRing_, firstHERing_, HBSize_, HESize_, HFSize_, HOSize_, HTSize_, IPHI_MAX, kHBSizePreLS1, kHESizePreLS1, kHFSizePreLS1, kHOSizePreLS1, kHTSizePhase1, kHTSizePreLS1, lastHBRing_, lastHERing_, HcalTopologyMode::LHC, maxDepthHF_, mode_, nEtaHB_, nEtaHE_, HcalTopologyMode::SLHC, HcalTopologyMode::tm_LHC_RCT, HcalTopologyMode::tm_LHC_RCT_and_1x1, topoVersion_, and triggerMode_.

134  :
135  hcons_(0),
136  excludeHB_(false), excludeHE_(false), excludeHO_(false), excludeHF_(false),
137  mode_(mode), triggerMode_(tmode),
138  firstHBRing_(1), lastHBRing_(16),
139  firstHERing_(16), lastHERing_(29),
140  firstHFRing_(29), lastHFRing_(41),
141  firstHORing_(1), lastHORing_(15),
147  etaHE2HF_(30), etaHF2HE_(29),
153  numberOfShapes_(( mode==HcalTopologyMode::SLHC ) ? 500 : 87 ) {
154 
156  topoVersion_=0; //DL
157  HBSize_= kHBSizePreLS1; // qie-per-fiber * fiber/rm * rm/rbx * rbx/barrel * barrel/hcal
158  HESize_= kHESizePreLS1; // qie-per-fiber * fiber/rm * rm/rbx * rbx/endcap * endcap/hcal
159  HOSize_= kHOSizePreLS1; // ieta * iphi * 2
160  HFSize_= kHFSizePreLS1; // phi * eta * depth * pm
161  } else if (mode_==HcalTopologyMode::SLHC) { // need to know more eventually
163  HESize_= maxDepthHE*(29-16+1)*IPHI_MAX*2;
164  HOSize_= 15*IPHI_MAX*2; // ieta * iphi * 2
165  HFSize_= IPHI_MAX*13*maxDepthHF_*2; // phi * eta * depth * pm
166  topoVersion_=10;
167  }
174  } else {
176  }
177 
178  edm::LogWarning("CaloTopology") << "This is an incomplete constructor of HcalTopology - be warned that many functionalities will not be there - revert from this - get from EventSetup";
179 }
unsigned int numberOfShapes_
Definition: HcalTopology.h:189
int maxDepthHE() const
Definition: HcalTopology.h:129
HcalTopologyMode::TriggerMode triggerMode_
Definition: HcalTopology.h:166
unsigned int HESize_
Definition: HcalTopology.h:184
unsigned int HTSize_
Definition: HcalTopology.h:187
HcalTopologyMode::Mode mode() const
Definition: HcalTopology.h:31
unsigned int HFSize_
Definition: HcalTopology.h:186
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:165
unsigned int HBSize_
Definition: HcalTopology.h:183
unsigned int HOSize_
Definition: HcalTopology.h:185
int firstHEQuadPhiRing_
Definition: HcalTopology.h:176
int maxDepthHB() const
Definition: HcalTopology.h:128
int firstHETripleDepthRing_
Definition: HcalTopology.h:177
int firstHEDoublePhiRing_
Definition: HcalTopology.h:176
const HcalDDDRecConstants * hcons_
Definition: HcalTopology.h:161
static const int IPHI_MAX
Definition: HcalTopology.cc:13
int firstHFQuadPhiRing_
Definition: HcalTopology.h:176

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

References HLT_25ns10e33_v2_cff::depth, etaHF2HE_, firstHEDoublePhiRing(), firstHEQuadPhiRing(), firstHERing(), firstHFQuadPhiRing(), firstHFRing(), HcalBarrel, HcalEndcap, IPHI_MAX, gen::n, valid(), and ecaldqm::zside().

Referenced by decIEta(), and incIEta().

588  {
589  int n=1;
590  int aieta=id.ietaAbs();
591 
592  if (aieta==firstHEDoublePhiRing()) {
593  n=2;
594  neighbors[0]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi(),id.depth());
595  neighbors[1]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi()+1,id.depth());
596  } else if (aieta==firstHFQuadPhiRing()) {
597  n=2;
598  neighbors[0]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi(),id.depth());
599  if (id.iphi()==IPHI_MAX-1) neighbors[1]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),1,id.depth());
600  else neighbors[1]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi()+2,id.depth());
601  } else if (aieta==firstHEQuadPhiRing()) {
602  n=2;
603  neighbors[0]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi(),id.depth());
604  if (id.iphi()==IPHI_MAX-1) neighbors[1]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),1,id.depth());
605  else neighbors[1]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi()+2,id.depth());
606  } else if (aieta==1) {
607  neighbors[0]=HcalDetId(id.subdet(),-aieta*id.zside(),id.iphi(),id.depth());
608  } else if (aieta==firstHERing()) {
609  neighbors[0]=HcalDetId(HcalBarrel,(aieta-1)*id.zside(),id.iphi(),1);
610  } else if (aieta==firstHFRing()) {
611  neighbors[0]=HcalDetId(HcalEndcap,etaHF2HE_*id.zside(),id.iphi(),1);
612  } else
613  neighbors[0]=HcalDetId(id.subdet(),(aieta-1)*id.zside(),id.iphi(),id.depth());
614 
615  if (!valid(neighbors[0]) && n==2) {
616  if (!valid(neighbors[1])) n=0;
617  else {
618  n=1;
619  neighbors[0]=neighbors[1];
620  }
621  }
622  if (n==2 && !valid(neighbors[1])) n=1;
623  if (n==1 && !valid(neighbors[0])) n=0;
624 
625  return n;
626 }
int firstHFRing() const
Definition: HcalTopology.h:87
int zside(DetId const &)
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:92
int firstHERing() const
Definition: HcalTopology.h:85
virtual bool valid(const DetId &id) const
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:94
int firstHEQuadPhiRing() const
Definition: HcalTopology.h:93
static const int IPHI_MAX
Definition: HcalTopology.cc:13
int HcalTopology::decIEta ( const HcalDetId id,
HcalDetId  neighbors[2] 
) const

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

Definition at line 560 of file HcalTopology.cc.

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

Referenced by east().

560  {
561  if (id.zside()==1) return decAIEta(id,neighbors);
562  else return incAIEta(id,neighbors);
563 }
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 518 of file HcalTopology.cc.

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

Referenced by south().

518  {
519  bool ok=valid(id);
520  if (ok) {
521  switch (id.subdet()) {
522  case (HcalBarrel):
523  case (HcalOuter):
524  if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX,id.depth());
525  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-1,id.depth());
526  break;
527  case (HcalEndcap):
528  if (id.ietaAbs()>=firstHEQuadPhiRing()) {
529  if (id.iphi()==3) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth());
530  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-4,id.depth());
531  } else if (id.ietaAbs()>=firstHEDoublePhiRing()) {
532  if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth());
533  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-2,id.depth());
534  } else {
535  if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX,id.depth());
536  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-1,id.depth());
537  }
538  break;
539  case (HcalForward):
540  if (id.ietaAbs()>=firstHFQuadPhiRing()) {
541  if (id.iphi()==3) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth());
542  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-4,id.depth());
543  } else {
544  if (id.iphi()==1) neighbor=HcalDetId(id.subdet(),id.ieta(),IPHI_MAX-1,id.depth());
545  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()-2,id.depth());
546  }
547  if (!validRaw(neighbor)) ok = false;
548  break;
549  default: ok=false;
550  }
551  }
552  return ok;
553 }
bool validRaw(const HcalDetId &id) const
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:92
virtual bool valid(const DetId &id) const
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:94
int firstHEQuadPhiRing() const
Definition: HcalTopology.h:93
static const int IPHI_MAX
Definition: HcalTopology.cc:13
bool HcalTopology::decrementDepth ( HcalDetId id) const

Get the detector in front of this one

Definition at line 724 of file HcalTopology.cc.

References HcalDetId::depth(), HLT_25ns10e33_v2_cff::depth, depthBinInformation(), etaBinsHB_, etaBinsHE_, etaHF2HE_, etaRing(), firstHERing(), firstHFRing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, i, HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), lastHERing(), mode_, nEtaHB_, HcalTopologyMode::SLHC, HcalDetId::subdet(), and validRaw().

Referenced by down().

724  {
725  HcalSubdetector subdet = detId.subdet();
726  int ieta = detId.ieta();
727  int etaRing = detId.ietaAbs();
728  int depth = detId.depth();
729  int nDepthBins, startingBin;
730  depthBinInformation(subdet, etaRing, nDepthBins, startingBin);
731 
732  // see if the new depth bin exists
733  --depth;
734  if ((subdet == HcalOuter) ||
735  (subdet == HcalEndcap && etaRing == firstHERing())) {
736  subdet = HcalBarrel;
737  for (int i=0; i<nEtaHB_; ++i) {
738  if (etaRing == etaBinsHB_[i].ieta) {
739  depth = etaBinsHB_[i].depthStart+etaBinsHB_[i].layer.size()-1;
740  break;
741  }
742  }
743  } else if (subdet == HcalEndcap && etaRing == lastHERing() && depth == 2 &&
745  (ieta > 0) ? --ieta : ++ieta;
746  } else if (depth <= 0) {
747  if (subdet == HcalForward && etaRing == firstHFRing()) {
748  // overlap
749  subdet = HcalEndcap;
750  etaRing= etaHF2HE_;
751  ieta = (ieta > 0) ? etaRing : -etaRing;
752  for (unsigned int i=0; i<etaBinsHE_.size(); ++i) {
753  if (etaRing == etaBinsHE_[i].ieta) {
754  depth = etaBinsHE_[i].depthStart+etaBinsHE_[i].layer.size()-1;
755  break;
756  }
757  }
758  } else {
759  // no more chances
760  detId = HcalDetId();
761  return false;
762  }
763  }
764  detId = HcalDetId(subdet, ieta, detId.iphi(), depth);
765  return validRaw(detId);
766 }
int firstHFRing() const
Definition: HcalTopology.h:87
int i
Definition: DBlmapReader.cc:9
std::vector< HcalDDDRecConstants::HcalEtaBin > etaBinsHB_
Definition: HcalTopology.h:173
std::vector< HcalDDDRecConstants::HcalEtaBin > etaBinsHE_
Definition: HcalTopology.h:173
bool validRaw(const HcalDetId &id) const
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:165
int etaRing(HcalSubdetector subdet, double eta) const
eta and phi index from eta, phi values
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:85
int lastHERing() const
Definition: HcalTopology.h:86
DetId HcalTopology::denseId2detId ( unsigned int  denseid) const
virtual

return a linear packed id

Reimplemented from CaloSubdetectorTopology.

Definition at line 1125 of file HcalTopology.cc.

References gather_cfg::cout, TauDecayModes::dec, reco::dp, firstHBRing(), firstHERing(), HBSize_, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HESize_, HOSize_, recoMuon::in, IPHI_MAX, kHBhalf, kHEhalf, kHFhalf, kHOhalf, kSizeForDenseIndexingPreLS1, lastHBRing(), lastHERing(), maxDepthHB_, maxDepthHE_, maxDepthHF_, ncells(), nEtaHB_, nEtaHE_, DetId::rawId(), sd, and topoVersion_.

Referenced by HcalGeometry::localCorners().

1125  {
1126 
1128  int ie ( 0 ) ;
1129  int ip ( 0 ) ;
1130  int dp ( 0 ) ;
1131  int in ( denseid ) ;
1132  int iz ( 1 ) ;
1133  if (topoVersion_==0) { //DL// pre-LS1
1134  if (denseid < kSizeForDenseIndexingPreLS1) {
1135  if ( in > 2*( kHBhalf + kHEhalf + kHOhalf ) - 1 ) { // HF
1136  sd = HcalForward ;
1137  in -= 2*( kHBhalf + kHEhalf + kHOhalf ) ;
1138  iz = ( in<kHFhalf ? 1 : -1 ) ;
1139  in %= kHFhalf ;
1140  ip = 4*( in/48 ) ;
1141  in %= 48 ;
1142  ip += 1 + ( in>21 ? 2 : 0 ) ;
1143  if( 3 == ip%4 ) in -= 22 ;
1144  ie = 29 + in/2 ;
1145  dp = 1 + in%2 ;
1146  } else if ( in > 2*( kHBhalf + kHEhalf ) - 1 ) { // HO
1147  sd = HcalOuter ;
1148  in -= 2*( kHBhalf + kHEhalf ) ;
1149  iz = ( in<kHOhalf ? 1 : -1 ) ;
1150  in %= kHOhalf ;
1151  dp = 4 ;
1152  ip = 1 + in/15 ;
1153  ie = 1 + ( in - 15*( ip - 1 ) ) ;
1154  } else if ( in > 2*kHBhalf - 1 ) { // Endcap
1155  sd = HcalEndcap ;
1156  in -= 2*kHBhalf ;
1157  iz = ( in<kHEhalf ? 1 : -1 ) ;
1158  in %= kHEhalf ;
1159  ip = 2*( in/36 ) ;
1160  in %= 36 ;
1161  ip += 1 + in/28 ;
1162  if( 0 == ip%2 ) in %= 28 ;
1163  ie = 15 + ( in<2 ? 1 + in : 2 +
1164  ( in<20 ? 1 + ( in - 2 )/2 : 9 +
1165  ( in<26 ? 1 + ( in - 20 )/3 : 3 ) ) ) ;
1166  dp = ( in<1 ? 3 :
1167  ( in<2 ? 1 :
1168  ( in<20 ? 1 + ( in - 2 )%2 :
1169  ( in<26 ? 1 + ( in - 20 )%3 :
1170  ( 1 + ( in - 26 )%2 ) ) ) ) ) ;
1171  } else { // barrel
1172  iz = ( in<kHBhalf ? 1 : -1 ) ;
1173  in %= kHBhalf ;
1174  ip = in/18 + 1 ;
1175  in %= 18 ;
1176  if ( in < 14 ) {
1177  dp = 1 ;
1178  ie = in + 1 ;
1179  } else {
1180  in %= 14 ;
1181  dp = 1 + in%2 ;
1182  ie = 15 + in/2 ;
1183  }
1184  }
1185  }
1186  } else if (topoVersion_==10) {
1187  if (denseid < ncells()) {
1188  if (denseid >= (HBSize_+HESize_+HOSize_)) {
1189  sd = HcalForward ;
1190  in -= (HBSize_+HESize_+HOSize_);
1191  dp = (in%maxDepthHF_) + 1;
1192  ip = (in - dp + 1)%(maxDepthHF_*IPHI_MAX);
1193  ip = (ip/maxDepthHF_) + 1;
1194  ie = (in - dp + 1 - maxDepthHF_*(ip -1))/(IPHI_MAX*maxDepthHF_);
1195  if (ie > 12) {ie = 54 -ie; iz = -1;}
1196  else {ie += 29; iz = 1;}
1197  } else if (denseid >= (HBSize_+HESize_)) {
1198  sd = HcalOuter ;
1199  in -= (HBSize_+HESize_);
1200  dp = 4;
1201  ip = (in%IPHI_MAX) + 1;
1202  ie = (in - ip + 1)/IPHI_MAX;
1203  if (ie > 14) {ie = 30 -ie; iz = -1;}
1204  else {ie += 1; iz = 1;}
1205  } else if (denseid >= (HBSize_)) {
1206  sd = HcalEndcap ;
1207  in -= (HBSize_);
1208  dp = (in%maxDepthHE_)+1;
1209  ip = (in - dp + 1)%(maxDepthHE_*IPHI_MAX);
1210  ip = (ip/maxDepthHE_) + 1;
1211  ie = (in - dp + 1 - maxDepthHE_*(ip-1))/(IPHI_MAX*maxDepthHE_);
1212  if (ie >= nEtaHE_) {ie = lastHERing()+nEtaHE_ - ie; iz = -1;}
1213  else {ie = firstHERing() + ie; iz = 1;}
1214  } else {
1215  sd = HcalBarrel ;
1216  dp = (in%maxDepthHB_)+1;
1217  ip = (in - dp + 1)%(maxDepthHB_*IPHI_MAX);
1218  ip = (ip/maxDepthHB_) + 1;
1219  ie = (in - dp + 1 - maxDepthHB_*(ip-1))/(IPHI_MAX*maxDepthHB_);
1220  if (ie >= nEtaHB_) {ie = lastHBRing()+nEtaHB_ - ie; iz = -1;}
1221  else {ie = firstHBRing() + ie; iz = 1;}
1222  }
1223  }
1224  }
1225  HcalDetId hid(sd, iz*int(ie), ip, dp);
1226 #ifdef DebugLog
1227  std::cout << "Dens2Det " << topoVersion_ << " i/p " << std::hex << denseid
1228  << " : " << hid.rawId() << std::dec << " | " << hid << std::endl;
1229 #endif
1230  return hid;
1231 }
int firstHBRing() const
Definition: HcalTopology.h:83
unsigned int HESize_
Definition: HcalTopology.h:184
int lastHBRing() const
Definition: HcalTopology.h:84
HcalSubdetector
Definition: HcalAssistant.h:31
unsigned int HBSize_
Definition: HcalTopology.h:183
unsigned int HOSize_
Definition: HcalTopology.h:185
auto dp
Definition: deltaR.h:22
double sd
int firstHERing() const
Definition: HcalTopology.h:85
tuple cout
Definition: gather_cfg.py:145
virtual unsigned int ncells() const
return a count of valid cells (for dense indexing use)
int lastHERing() const
Definition: HcalTopology.h:86
static const int IPHI_MAX
Definition: HcalTopology.cc:13
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 629 of file HcalTopology.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, firstHERing(), firstHETripleDepthRing(), HcalDDDRecConstants::getDepthEta16(), HcalDDDRecConstants::getMaxDepth(), HcalTopologyMode::H2HE, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, hcons_, lastHBRing(), lastHERing(), maxDepthHF_, mode_, and HcalTopologyMode::SLHC.

Referenced by CaloTowerConstituentsMap::constituentsOf(), decrementDepth(), HcalTrigTowerGeometry::detIds(), incrementDepth(), and CaloTowersCreationAlgo::setGeometry().

630  {
631 
632  if(subdet == HcalBarrel) {
634  startingBin = 1;
635  if (etaRing==lastHBRing()) {
636  nDepthBins = hcons_->getDepthEta16(0);
637  } else {
638  nDepthBins = hcons_->getMaxDepth(0,etaRing);
639  }
640  } else {
641  if (etaRing<=14) {
642  nDepthBins = 1;
643  startingBin = 1;
644  } else {
645  nDepthBins = 2;
646  startingBin = 1;
647  }
648  }
649  } else if(subdet == HcalEndcap) {
651  if (etaRing==firstHERing()) {
652  startingBin = hcons_->getDepthEta16(1);
653  nDepthBins = hcons_->getMaxDepth(1,etaRing) - startingBin + 1;
654  } else {
655  nDepthBins = hcons_->getMaxDepth(1,etaRing);
656  startingBin = 1;
657  }
658  } else {
659  if (etaRing==firstHERing()) {
660  nDepthBins = 1;
661  startingBin = 3;
662  } else if (etaRing==17) {
663  nDepthBins = 1;
664  startingBin = 1;
665  } else if (etaRing==lastHERing()) {
666  nDepthBins = 2;
667  startingBin = 1;
668  } else {
669  nDepthBins = (etaRing >= firstHETripleDepthRing()) ? 3 : 2;
670  startingBin = 1;
671  }
672  }
673  } else if(subdet == HcalForward) {
674  nDepthBins = maxDepthHF_;
675  startingBin = 1;
676  } else if(subdet == HcalOuter) {
677  nDepthBins = 1;
678  startingBin = 4;
679  } else {
680  std::cerr << "Bad HCAL subdetector " << subdet << std::endl;
681  }
682 }
int getDepthEta16(int i) const
int lastHBRing() const
Definition: HcalTopology.h:84
int getMaxDepth(const int type) const
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:165
int etaRing(HcalSubdetector subdet, double eta) const
eta and phi index from eta, phi values
int firstHETripleDepthRing() const
Definition: HcalTopology.h:95
int firstHERing() const
Definition: HcalTopology.h:85
int lastHERing() const
Definition: HcalTopology.h:86
const HcalDDDRecConstants * hcons_
Definition: HcalTopology.h:161
unsigned int HcalTopology::detId2denseId ( const DetId id) const
virtual

return a linear packed id

Reimplemented from CaloSubdetectorTopology.

Definition at line 1089 of file HcalTopology.cc.

References gather_cfg::cout, TauDecayModes::dec, HcalDetId::depth(), detId2denseIdPreLS1(), firstHBRing(), firstHERing(), HBSize_, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HESize_, HOSize_, HcalDetId::ieta(), HcalDetId::iphi(), IPHI_MAX, lastHBRing(), lastHERing(), maxDepthHB_, maxDepthHE_, maxDepthHF_, nEtaHB_, nEtaHE_, HcalDetId::subdet(), and topoVersion_.

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

1089  {
1090  unsigned int retval(0);
1091  if (topoVersion_==0) { // pre-LS1
1092  retval = detId2denseIdPreLS1(id);
1093  } else if (topoVersion_==10) {
1094  HcalDetId hid(id);
1095  if (hid.subdet()==HcalBarrel) {
1096  retval = (hid.depth()-1)+maxDepthHB_*(hid.iphi()-1);
1097  if (hid.ieta()>0) retval+=maxDepthHB_*IPHI_MAX*(hid.ieta()-firstHBRing());
1098  else retval+=maxDepthHB_*IPHI_MAX*(hid.ieta()+lastHBRing()+nEtaHB_);
1099  } else if (hid.subdet()==HcalEndcap) {
1100  retval = HBSize_;
1101  retval+= (hid.depth()-1)+maxDepthHE_*(hid.iphi()-1);
1102  if (hid.ieta()>0) retval+=maxDepthHE_*IPHI_MAX*(hid.ieta()-firstHERing());
1103  else retval+=maxDepthHE_*IPHI_MAX*(hid.ieta()+lastHERing()+nEtaHE_);
1104  } else if (hid.subdet()==HcalOuter) {
1105  retval = HBSize_+HESize_;
1106  if (hid.ieta()>0) retval+=(hid.iphi()-1)+IPHI_MAX*(hid.ieta()-1);
1107  else retval+=(hid.iphi()-1)+IPHI_MAX*(30+hid.ieta());
1108  } else if (hid.subdet()==HcalForward) {
1109  retval = HBSize_+HESize_+HOSize_;
1110  retval+= (hid.depth()-1)+maxDepthHF_*(hid.iphi()-1);
1111  if (hid.ieta()>0) retval+=maxDepthHF_*IPHI_MAX*(hid.ieta()-29);
1112  else retval+=maxDepthHF_*IPHI_MAX*((41+13)+hid.ieta());
1113  } else {
1114  return 0xFFFFFFFu;
1115  }
1116  }
1117 #ifdef DebugLog
1118  std::cout << "DetId2Dense " << topoVersion_ << " ID " << std::hex
1119  << id.rawId() << std::dec << " | " << HcalDetId(id) << " : "
1120  << std::hex << retval << std::dec << std::endl;
1121 #endif
1122  return retval;
1123 }
unsigned int detId2denseIdPreLS1(const DetId &id) const
int firstHBRing() const
Definition: HcalTopology.h:83
unsigned int HESize_
Definition: HcalTopology.h:184
int lastHBRing() const
Definition: HcalTopology.h:84
unsigned int HBSize_
Definition: HcalTopology.h:183
unsigned int HOSize_
Definition: HcalTopology.h:185
int firstHERing() const
Definition: HcalTopology.h:85
tuple cout
Definition: gather_cfg.py:145
int lastHERing() const
Definition: HcalTopology.h:86
static const int IPHI_MAX
Definition: HcalTopology.cc:13
unsigned int HcalTopology::detId2denseIdCALIB ( const DetId id) const

return a linear packed id from CALIB

Definition at line 1031 of file HcalTopology.cc.

References funct::abs(), HcalCalibDetId::calibFlavor(), HcalCalibDetId::CalibrationBox, HcalCalibDetId::cboxChannel(), 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().

1031  {
1032  HcalCalibDetId tid(id);
1033  int channel = tid.cboxChannel();
1034  int ieta = tid.ieta();
1035  int iphi = tid.iphi();
1036  int zside = tid.zside();
1037  unsigned int index=0xFFFFFFFFu;
1038 
1039  if (tid.calibFlavor()==HcalCalibDetId::CalibrationBox) {
1040 
1041  HcalSubdetector subDet = tid.hcalSubdet();
1042 
1043  if (subDet==HcalBarrel) {
1044  //std::cout<<"CALIB_HB: ";
1045  //dphi = 4 (18 phi values), 3 channel types (0,1,2), eta = -1 or 1
1046  //total of 18*3*2=108 channels
1047  index = ((iphi+1)/4-1) + 18*channel + 27*(ieta+1);
1048  } else if (subDet==HcalEndcap) {
1049  //std::cout<<"CALIB_HE: ";
1050  //dphi = 4 (18 phi values), 6 channel types (0,1,3,4,5,6), eta = -1 or 1
1051  //total of 18*6*2=216 channels
1052  if (channel>2) channel-=1;
1053  index = ((iphi+1)/4-1) + 18*channel + 54*(ieta+1) + 108;
1054  } else if (subDet==HcalForward) {
1055  //std::cout<<"CALIB_HF: ";
1056  //dphi = 18 (4 phi values), 3 channel types (0,1,8), eta = -1 or 1
1057  if (channel==8) channel = 2;
1058  //total channels 4*3*2=24
1059  index = (iphi-1)/18 + 4*channel + 6*(ieta+1) + 324;
1060  } else if (subDet==HcalOuter) {
1061  //std::cout<<"CALIB_HO: ";
1062  //there are 5 special calib crosstalk channels, one in each ring
1063  if (channel==7) {
1064  index = (ieta+2) + 420;
1065  //for HOM/HOP dphi = 6 (12 phi values), 2 channel types (0,1), eta = -2,-1 or 1,2
1066  //for HO0/YB0 dphi = 12 (6 phi values), 2 channel types (0,1), eta = 0
1067  } else{
1068  if (ieta<0) index = ((iphi+1)/12-1) + 36*channel + 6*(ieta+2) + 348;
1069  else if (ieta>0) index = ((iphi+1)/12-1) + 36*channel + 6*(ieta+2) + 6 + 348;
1070  else index = ((iphi+1)/6-1) + 36*channel + 6*(ieta+2) + 348;
1071  }
1072  } else {
1073  edm::LogWarning("CaloTopology") << "HCAL Det Id not valid!";
1074  index = 0;
1075  }
1076 
1077  } else if (tid.calibFlavor()==HcalCalibDetId::HOCrosstalk) {
1078  //std::cout<<"HX: ";
1079  //for YB0/HO0 phi is grouped in 6 groups of 6 with dphi=2 but the transitions are 1 or 3
1080  // in such a way that the %36 operation yeilds unique values for every iphi
1081  if (abs(ieta)==4) index = ((iphi-1)%36) + (((zside+1)*36)/2) + 72 + 425; //ieta = 1 YB0/HO0;
1082  else index = (iphi-1) + (36*(zside+1)*2) + 425; //ieta = 0 for HO2M/HO1M ieta=2 for HO1P/HO2P;
1083  }
1084  //std::cout << " " << ieta << " " << zside << " " << iphi << " " << depth << " " << index << std::endl;
1085  return index;
1086 }
int zside(DetId const &)
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int HcalTopology::detId2denseIdHB ( const DetId id) const

return a linear packed id from HB

Definition at line 936 of file HcalTopology.cc.

References HcalDetId::depth(), reco::dp, firstHBRing(), HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), IPHI_MAX, kHBhalf, lastHBRing(), maxDepthHB_, nEtaHB_, topoVersion_, and HcalDetId::zside().

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

936  {
937  HcalDetId hid(id);
938  const int ip (hid.iphi() ) ;
939  const int ie (hid.ietaAbs() ) ;
940  const int dp (hid.depth() ) ;
941  const int zn (hid.zside() < 0 ? 1 : 0 ) ;
942  unsigned int retval = 0xFFFFFFFFu;
943  if (topoVersion_==0) {
944  retval=( ip - 1 )*18 + dp - 1 + ie - ( ie<16 ? 1 : 0 ) + zn*kHBhalf;
945  } else if (topoVersion_==10) {
946  retval=(dp-1)+maxDepthHB_*(ip-1);
947  if (hid.ieta()>0) retval+=maxDepthHB_*IPHI_MAX*(hid.ieta()-firstHBRing());
948  else retval+=maxDepthHB_*IPHI_MAX*(hid.ieta()+lastHBRing()+nEtaHB_);
949  }
950  return retval;
951 }
int firstHBRing() const
Definition: HcalTopology.h:83
int lastHBRing() const
Definition: HcalTopology.h:84
auto dp
Definition: deltaR.h:22
static const int IPHI_MAX
Definition: HcalTopology.cc:13
unsigned int HcalTopology::detId2denseIdHE ( const DetId id) const

return a linear packed id from HE

Definition at line 953 of file HcalTopology.cc.

References HcalDetId::depth(), reco::dp, firstHERing(), HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), IPHI_MAX, kHEhalf, lastHERing(), maxDepthHE_, nEtaHE_, topoVersion_, and HcalDetId::zside().

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

953  {
954  HcalDetId hid(id);
955  const int ip (hid.iphi() ) ;
956  const int ie (hid.ietaAbs() ) ;
957  const int dp (hid.depth() ) ;
958  const int zn (hid.zside() < 0 ? 1 : 0 ) ;
959  unsigned int retval = 0xFFFFFFFFu;
960  if (topoVersion_==0) {
961  retval=( ip - 1 )*8 + ( ip/2 )*20 +
962  ( ( ie==16 || ie==17 ) ? ie - 16 :
963  ( ( ie>=18 && ie<=20 ) ? 2 + 2*( ie - 18 ) + dp - 1 :
964  ( ( ie>=21 && ie<=26 ) ? 8 + 2*( ie - 21 ) + dp - 1 :
965  ( ( ie>=27 && ie<=28 ) ? 20 + 3*( ie - 27 ) + dp - 1 :
966  26 + 2*( ie - 29 ) + dp - 1 ) ) ) ) + zn*kHEhalf;
967  } else if (topoVersion_==10) {
968  retval=(dp-1)+maxDepthHE_*(ip-1);
969  if (hid.ieta()>0) retval+=maxDepthHE_*IPHI_MAX*(hid.ieta()-firstHERing());
970  else retval+=maxDepthHE_*IPHI_MAX*(hid.ieta()+lastHERing()+nEtaHE_);
971  }
972  return retval;
973 }
auto dp
Definition: deltaR.h:22
int firstHERing() const
Definition: HcalTopology.h:85
int lastHERing() const
Definition: HcalTopology.h:86
static const int IPHI_MAX
Definition: HcalTopology.cc:13
unsigned int HcalTopology::detId2denseIdHF ( const DetId id) const

return a linear packed id from HF

Definition at line 991 of file HcalTopology.cc.

References HcalDetId::depth(), reco::dp, HcalDetId::ieta(), HcalDetId::ietaAbs(), HcalDetId::iphi(), IPHI_MAX, kHFhalf, maxDepthHF_, topoVersion_, and HcalDetId::zside().

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

991  {
992  HcalDetId hid(id);
993  const int ip (hid.iphi() ) ;
994  const int ie (hid.ietaAbs() ) ;
995  const int dp (hid.depth() ) ;
996  const int zn (hid.zside() < 0 ? 1 : 0 ) ;
997 
998  unsigned int retval = 0xFFFFFFFFu;
999  if (topoVersion_==0) {
1000  retval = ( ( ip - 1 )/4 )*4 + ( ( ip - 1 )/2 )*22 +
1001  2*( ie - 29 ) + ( dp - 1 ) + zn*kHFhalf;
1002  } else if (topoVersion_==10) {
1003  retval=dp-1+2*(ip-1);
1004  if (hid.ieta()>0) retval+=maxDepthHF_*IPHI_MAX*(hid.ieta()-29);
1005  else retval+=maxDepthHF_*IPHI_MAX*((41+13)+hid.ieta());
1006  }
1007  return retval;
1008 }
auto dp
Definition: deltaR.h:22
static const int IPHI_MAX
Definition: HcalTopology.cc:13
unsigned int HcalTopology::detId2denseIdHO ( const DetId id) const

return a linear packed id from HO

Definition at line 975 of file HcalTopology.cc.

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

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

975  {
976  HcalDetId hid(id);
977  const int ip (hid.iphi() ) ;
978  const int ie (hid.ietaAbs() ) ;
979  const int zn (hid.zside() < 0 ? 1 : 0 ) ;
980 
981  unsigned int retval = 0xFFFFFFFFu;
982  if (topoVersion_==0) {
983  retval=( ip - 1 )*15 + ( ie - 1 ) + zn*kHOhalf;
984  } else if (topoVersion_==10) {
985  if (hid.ieta()>0) retval=(ip-1)+IPHI_MAX*(hid.ieta()-1);
986  else retval=(ip-1)+IPHI_MAX*(30+hid.ieta());
987  }
988  return retval;
989 }
static const int IPHI_MAX
Definition: HcalTopology.cc:13
unsigned int HcalTopology::detId2denseIdHT ( const DetId id) const

return a linear packed id from HT

Definition at line 1010 of file HcalTopology.cc.

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

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

1010  {
1011  HcalTrigTowerDetId tid(id);
1012  int zside = tid.zside();
1013  unsigned int ietaAbs = tid.ietaAbs();
1014  unsigned int iphi = tid.iphi();
1015  unsigned int ivers = tid.version();
1016 
1017  unsigned int index;
1018  if (ivers == 0) {
1019  if ((iphi-1)%4==0) index = (iphi-1)*32 + (ietaAbs-1) - (12*((iphi-1)/4));
1020  else index = (iphi-1)*28 + (ietaAbs-1) + (4*(((iphi-1)/4)+1));
1021  if (zside == -1) index += kHThalf;
1022  } else {
1023  index = kHTSizePreLS1;
1024  if (zside == -1) index += ((kHTSizePhase1-kHTSizePreLS1)/2);
1025  index += (36 * (ietaAbs - 30) + ((iphi - 1)/2));
1026  }
1027 
1028  return index;
1029 }
int zside(DetId const &)
unsigned int HcalTopology::detId2denseIdPreLS1 ( const DetId id) const
private

Definition at line 909 of file HcalTopology.cc.

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

Referenced by detId2denseId().

909  {
910 
911  HcalDetId hid(id);
912  const HcalSubdetector sd (hid.subdet() ) ;
913  const int ip (hid.iphi() ) ;
914  const int ie (hid.ietaAbs() ) ;
915  const int dp (hid.depth() ) ;
916  const int zn (hid.zside() < 0 ? 1 : 0 ) ;
917  unsigned int retval = ( ( sd == HcalBarrel ) ?
918  ( ip - 1 )*18 + dp - 1 + ie - ( ie<16 ? 1 : 0 ) + zn*kHBhalf :
919  ( ( sd == HcalEndcap ) ?
920  2*kHBhalf + ( ip - 1 )*8 + ( ip/2 )*20 +
921  ( ( ie==16 || ie==17 ) ? ie - 16 :
922  ( ( ie>=18 && ie<=20 ) ? 2 + 2*( ie - 18 ) + dp - 1 :
923  ( ( ie>=21 && ie<=26 ) ? 8 + 2*( ie - 21 ) + dp - 1 :
924  ( ( ie>=27 && ie<=28 ) ? 20 + 3*( ie - 27 ) + dp - 1 :
925  26 + 2*( ie - 29 ) + dp - 1 ) ) ) ) + zn*kHEhalf :
926  ( ( sd == HcalOuter ) ?
927  2*kHBhalf + 2*kHEhalf + ( ip - 1 )*15 + ( ie - 1 ) + zn*kHOhalf :
928  ( ( sd == HcalForward ) ?
929  2*kHBhalf + 2*kHEhalf + 2*kHOhalf +
930  ( ( ip - 1 )/4 )*4 + ( ( ip - 1 )/2 )*22 +
931  2*( ie - 29 ) + ( dp - 1 ) + zn*kHFhalf : 0xFFFFFFFFu ) ) ) ) ;
932  return retval;
933 }
HcalSubdetector
Definition: HcalAssistant.h:31
auto dp
Definition: deltaR.h:22
double sd
int HcalTopology::doublePhiBins ( ) const
inline

Definition at line 97 of file HcalTopology.h.

References doublePhiBins_.

97 {return doublePhiBins_;}
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 304 of file HcalTopology.cc.

References HcalDetId::changeForm(), decrementDepth(), neighbor(), and HcalDetId::oldFormat().

304  {
305  HcalDetId neighbor = id;
306  std::vector<DetId> vNeighborsDetId;
307  if (decrementDepth(neighbor)) {
308  if (neighbor.oldFormat()) neighbor.changeForm();
309  vNeighborsDetId.push_back(neighbor);
310  }
311  return vNeighborsDetId;
312 }
bool neighbor(int endcap, int sector, int SectIndex, int id, int sub, int station)
bool decrementDepth(HcalDetId &id) const
bool oldFormat() const
Definition: HcalDetId.h:50
void changeForm()
Definition: HcalDetId.cc:136
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 254 of file HcalTopology.cc.

References decIEta(), and i.

Referenced by spr::newHCALIdEW().

254  {
255  std::vector<DetId> vNeighborsDetId;
256  HcalDetId neighbors[2];
257  for (int i=0;i<decIEta(HcalDetId(id),neighbors);i++) {
258  if (neighbors[i].oldFormat()) neighbors[i].changeForm();
259  vNeighborsDetId.push_back(DetId(neighbors[i].rawId()));
260  }
261  return vNeighborsDetId;
262 }
int i
Definition: DBlmapReader.cc:9
int decIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
Definition: DetId.h:18
double HcalTopology::etaMax ( HcalSubdetector  subdet) const

Definition at line 877 of file HcalTopology.cc.

References eta, etaTable, etaTableHF, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, lastHBRing_, lastHERing_, lastHORing_, and nEtaHE_.

Referenced by HcalGeometry::getCells(), HcalGeometry::getClosestCell(), and HcalTopology().

877  {
878  double eta(0);
879  switch (subdet) {
880  case(HcalBarrel):
881  if (lastHBRing_ < (int)(etaTable.size())) eta=etaTable[lastHBRing_]; break;
882  case(HcalEndcap):
883  if (lastHERing_ < (int)(etaTable.size()) && nEtaHE_ > 0) eta=etaTable[lastHERing_]; break;
884  case(HcalOuter):
885  if (lastHORing_ < (int)(etaTable.size())) eta=etaTable[lastHORing_]; break;
886  case(HcalForward):
887  if (etaTableHF.size() > 0) eta=etaTableHF[etaTableHF.size()-1]; break;
888  default: eta=0;
889  }
890  return eta;
891 }
std::vector< double > etaTableHF
Definition: HcalTopology.h:191
std::vector< double > etaTable
Definition: HcalTopology.h:191
std::pair< double, double > HcalTopology::etaRange ( HcalSubdetector  subdet,
int  ieta 
) const

Definition at line 892 of file HcalTopology.cc.

References etaTable, etaTableHF, firstHFRing_, HcalForward, cuy::ii, lastHERing_, HcalTopologyMode::LHC, and mode_.

Referenced by HcalHF_PETalgorithm::HFSetFlagFromPET(), HcalHFStatusBitFromRecHits::hfSetFlagFromRecHits(), HcalHF_S9S1algorithm::HFSetFlagFromS9S1(), HcalBeamMonitor::processEvent(), HcalRecHitMonitor::processEvent_rechit(), HcalHotCellMonitor::processEvent_rechitenergy(), HcalHotCellMonitor::processHit_rechitNeighbors(), HcalTrigTowerGeometry::towerEtaBounds(), and HcaluLUTTPGCoder::update().

893  {
894  int ieta = (keta > 0) ? keta : -keta;
895  if (subdet == HcalForward) {
896  if (ieta >= firstHFRing_) {
897  unsigned int ii = (unsigned int)(ieta-firstHFRing_);
898  if (ii+1 < etaTableHF.size())
899  return std::pair<double,double>(etaTableHF[ii],etaTableHF[ii+1]);
900  }
901  } else {
902  int ietal = (mode_==HcalTopologyMode::LHC && ieta == lastHERing_-1) ? (ieta+1) : ieta;
903  if ((ietal < (int)(etaTable.size())) && (ieta > 0))
904  return std::pair<double,double>(etaTable[ieta-1],etaTable[ietal]);
905  }
906  return std::pair<double,double>(0,0);
907 }
int ii
Definition: cuy.py:588
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:165
std::vector< double > etaTableHF
Definition: HcalTopology.h:191
std::vector< double > etaTable
Definition: HcalTopology.h:191
int HcalTopology::etaRing ( HcalSubdetector  subdet,
double  eta 
) const

eta and phi index from eta, phi values

Definition at line 794 of file HcalTopology.cc.

References etaTable, etaTableHF, firstHBRing_, firstHFRing_, HcalForward, relval_2017::k, and lastHERing_.

Referenced by decrementDepth(), HcalGeometry::etaRing(), and incrementDepth().

794  {
795  int etaring = firstHBRing_;
796  if (bc == HcalForward) {
797  etaring = firstHFRing_;
798  for (unsigned int k=0; k<etaTableHF.size()-1; ++k) {
799  if (abseta < etaTableHF[k+1]) {
800  etaring += k;
801  break;
802  }
803  }
804  } else {
805  for (unsigned int k=0; k<etaTable.size()-1; ++k) {
806  if (abseta < etaTable[k+1]) {
807  etaring += k;
808  break;
809  }
810  }
811  if (abseta > etaTable[etaTable.size()-1]) etaring = lastHERing_;
812  }
813  return etaring;
814 }
std::vector< double > etaTableHF
Definition: HcalTopology.h:191
std::vector< double > etaTable
Definition: HcalTopology.h:191
void HcalTopology::exclude ( const HcalDetId id)

Add a cell to exclusion list

Definition at line 237 of file HcalTopology.cc.

References exclusionList_, and i.

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

237  {
238  std::vector<HcalDetId>::iterator i=std::lower_bound(exclusionList_.begin(),exclusionList_.end(),id);
239  if (i==exclusionList_.end() || *i!=id) {
240  exclusionList_.insert(i,id);
241  }
242 }
int i
Definition: DBlmapReader.cc:9
std::vector< HcalDetId > exclusionList_
Definition: HcalTopology.h:162
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 314 of file HcalTopology.cc.

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

314  {
315 
316  bool exed=false;
317  // first, check the full detector exclusions... (fast)
318  switch (subdet) {
319  case(HcalBarrel): exed=excludeHB_; break;
320  case(HcalEndcap): exed=excludeHE_; break;
321  case(HcalOuter): exed=excludeHO_; break;
322  case(HcalForward): exed=excludeHF_; break;
323  default: exed=false;
324  }
325  if (exed) return 0; // if the whole detector is excluded...
326 
327  int ieta_l=std::min(ieta1,ieta2);
328  int ieta_h=std::max(ieta1,ieta2);
329  int iphi_l=std::min(iphi1,iphi2);
330  int iphi_h=std::max(iphi1,iphi2);
331  int depth_l=std::min(depth1,depth2);
332  int depth_h=std::max(depth1,depth2);
333 
334  int n=0;
335  for (int ieta=ieta_l; ieta<=ieta_h; ieta++)
336  for (int iphi=iphi_l; iphi<=iphi_h; iphi++)
337  for (int depth=depth_l; depth<=depth_h; depth++) {
338  HcalDetId id(subdet,ieta,iphi,depth);
339  if (validRaw(id)) { // use 'validRaw' to include check validity in "uncut" detector
340  exclude(id);
341  n++;
342  }
343  }
344  return n;
345 }
void exclude(const HcalDetId &id)
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 244 of file HcalTopology.cc.

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

Referenced by HcalTopologyRestrictionParser::parse().

244  {
245  switch (subdet) {
246  case(HcalBarrel): excludeHB_=true; break;
247  case(HcalEndcap): excludeHE_=true; break;
248  case(HcalOuter): excludeHO_=true; break;
249  case(HcalForward): excludeHF_=true; break;
250  default: break;
251  }
252 }
int HcalTopology::firstHBRing ( ) const
inline
int HcalTopology::firstHEDoublePhiRing ( ) const
inline
int HcalTopology::firstHEQuadPhiRing ( ) 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 89 of file HcalTopology.h.

References firstHORing_.

Referenced by CaloTowerTopology::CaloTowerTopology(), and CaloTowerTopology::convertHcaltoCT().

89 {return firstHORing_;}
unsigned int HcalTopology::getCALIBSize ( ) const
inline

Definition at line 126 of file HcalTopology.h.

References CALIBSize_.

Referenced by HcalCondObjectContainerBase::sizeFor().

126 {return CALIBSize_;}
unsigned int CALIBSize_
Definition: HcalTopology.h:188
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 853 of file HcalTopology.cc.

References depthSegmentation_, Exception, and relativeConstraints::ring.

Referenced by HcalHardcodeGeometryLoader::load(), HcalHardcodeCalibrations::produceRespCorrs(), segmentBoundaries(), and CaloTowersCreationAlgo::setGeometry().

853  {
854  // if it doesn't exist, return the first entry with a lower index. So if we only
855  // have entries for 1 and 17, any input from 1-16 should return the entry for ring 1
856  SegmentationMap::const_iterator pos = depthSegmentation_.upper_bound(ring);
857  if (pos == depthSegmentation_.begin()) {
858  throw cms::Exception("HcalTopology") << "No depth segmentation found for ring" << ring;
859  }
860  --pos;
861  // pos now refers to the last element with key <= ring.
862  readoutDepths = pos->second;
863 }
SegmentationMap depthSegmentation_
Definition: HcalTopology.h:199
unsigned int HcalTopology::getHBSize ( ) const
inline

Definition at line 121 of file HcalTopology.h.

References HBSize_.

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

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

Definition at line 122 of file HcalTopology.h.

References HESize_.

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

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

Definition at line 124 of file HcalTopology.h.

References HFSize_.

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

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

Definition at line 123 of file HcalTopology.h.

References HOSize_.

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

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

Definition at line 125 of file HcalTopology.h.

References HTSize_.

Referenced by HcalCondObjectContainerBase::sizeFor().

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

Definition at line 147 of file HcalTopology.h.

References numberOfShapes_.

Referenced by HcalGeometry::numberOfShapes().

147 { return numberOfShapes_; }
unsigned int numberOfShapes_
Definition: HcalTopology.h:189
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 566 of file HcalTopology.cc.

References HLT_25ns10e33_v2_cff::depth, etaHE2HF_, firstHEDoublePhiRing(), firstHEQuadPhiRing(), firstHFQuadPhiRing(), HcalEndcap, HcalForward, lastHBRing(), lastHERing(), gen::n, valid(), and ecaldqm::zside().

Referenced by decIEta(), and incIEta().

566  {
567  int n=1;
568  int aieta=id.ietaAbs();
569 
570  if (aieta==firstHEDoublePhiRing()-1 && (id.iphi()%2)==0)
571  neighbors[0]=HcalDetId(id.subdet(),(aieta+1)*id.zside(),id.iphi()-1,id.depth());
572  else if (aieta==firstHFQuadPhiRing()-1 && ((id.iphi()+1)%4)!=0)
573  neighbors[0]=HcalDetId(id.subdet(),(aieta+1)*id.zside(),((id.iphi()==1)?(71):(id.iphi()-2)),id.depth());
574  else if (aieta==firstHEQuadPhiRing()-1 && ((id.iphi()+1)%4)!=0)
575  neighbors[0]=HcalDetId(id.subdet(),(aieta+1)*id.zside(),((id.iphi()==1)?(71):(id.iphi()-2)),id.depth());
576  else if (aieta==lastHBRing())
577  neighbors[0]=HcalDetId(HcalEndcap,(aieta+1)*id.zside(),id.iphi(),1);
578  else if (aieta==lastHERing())
579  neighbors[0]=HcalDetId(HcalForward,etaHE2HF_*id.zside(),id.iphi(),1);
580  else
581  neighbors[0]=HcalDetId(id.subdet(),(aieta+1)*id.zside(),id.iphi(),id.depth());
582 
583  if (!valid(neighbors[0])) n=0;
584  return n;
585 }
int lastHBRing() const
Definition: HcalTopology.h:84
int zside(DetId const &)
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:92
virtual bool valid(const DetId &id) const
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:94
int firstHEQuadPhiRing() const
Definition: HcalTopology.h:93
int lastHERing() const
Definition: HcalTopology.h:86
int HcalTopology::incIEta ( const HcalDetId id,
HcalDetId  neighbors[2] 
) const

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

Definition at line 555 of file HcalTopology.cc.

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

Referenced by west().

555  {
556  if (id.zside()==1) return incAIEta(id,neighbors);
557  else return decAIEta(id,neighbors);
558 }
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 480 of file HcalTopology.cc.

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

Referenced by north().

480  {
481  bool ok=valid(id);
482  if (ok) {
483  switch (id.subdet()) {
484  case (HcalBarrel):
485  case (HcalOuter):
486  if (id.iphi()==IPHI_MAX) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
487  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+1,id.depth());
488  break;
489  case (HcalEndcap):
490  if (id.ietaAbs()>=firstHEQuadPhiRing()) {
491  if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),3,id.depth());
492  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+4,id.depth());
493  } else if (id.ietaAbs()>=firstHEDoublePhiRing()) {
494  if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
495  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+2,id.depth());
496  } else {
497  if (id.iphi()==IPHI_MAX) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
498  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+1,id.depth());
499  }
500  break;
501  case (HcalForward):
502  if (id.ietaAbs()>=firstHFQuadPhiRing()) {
503  if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),3,id.depth());
504  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+4,id.depth());
505  } else {
506  if (id.iphi()==IPHI_MAX-1) neighbor=HcalDetId(id.subdet(),id.ieta(),1,id.depth());
507  else neighbor=HcalDetId(id.subdet(),id.ieta(),id.iphi()+2,id.depth());
508  }
509  if (!validRaw(neighbor)) ok = false;
510  break;
511  default: ok=false;
512  }
513  }
514  return ok;
515 }
bool validRaw(const HcalDetId &id) const
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:92
virtual bool valid(const DetId &id) const
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:94
int firstHEQuadPhiRing() const
Definition: HcalTopology.h:93
static const int IPHI_MAX
Definition: HcalTopology.cc:13
bool HcalTopology::incrementDepth ( HcalDetId id) const

Get the detector behind this one

Definition at line 684 of file HcalTopology.cc.

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

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

684  {
685 
686  HcalSubdetector subdet = detId.subdet();
687  int ieta = detId.ieta();
688  int etaRing = detId.ietaAbs();
689  int depth = detId.depth();
690  int nDepthBins, startingBin;
691  depthBinInformation(subdet, etaRing, nDepthBins, startingBin);
692 
693  // see if the new depth bin exists
694  ++depth;
695  if (depth > nDepthBins) {
696  // handle on a case-by-case basis
697  if (subdet == HcalBarrel && etaRing < lastHORing()) {
698  // HO
699  subdet = HcalOuter;
700  depth = 4;
701  } else if (subdet == HcalBarrel && etaRing == lastHBRing()) {
702  // overlap
703  subdet = HcalEndcap;
704  } else if (subdet == HcalEndcap && etaRing == lastHERing()-1 &&
706  // guard ring HF29 is behind HE 28
707  subdet = HcalForward;
708  (ieta > 0) ? ++ieta : --ieta;
709  depth = 1;
710  } else if (subdet == HcalEndcap && etaRing == lastHERing() &&
712  // split cells go to bigger granularity. Ring 29 -> 28
713  (ieta > 0) ? --ieta : ++ieta;
714  } else {
715  // no more chances
716  detId = HcalDetId();
717  return false;
718  }
719  }
720  detId = HcalDetId(subdet, ieta, detId.iphi(), depth);
721  return validRaw(detId);
722 }
int lastHBRing() const
Definition: HcalTopology.h:84
bool validRaw(const HcalDetId &id) const
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:165
int etaRing(HcalSubdetector subdet, double eta) const
eta and phi index from eta, phi values
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:90
int lastHERing() const
Definition: HcalTopology.h:86
bool HcalTopology::isExcluded ( const HcalDetId id) const
private

Definition at line 219 of file HcalTopology.cc.

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

Referenced by validHcal().

219  {
220  bool exed=false;
221  // first, check the full detector exclusions... (fast)
222  switch (id.subdet()) {
223  case(HcalBarrel): exed=excludeHB_; break;
224  case(HcalEndcap): exed=excludeHE_; break;
225  case(HcalOuter): exed=excludeHO_; break;
226  case(HcalForward): exed=excludeHF_; break;
227  default: exed=false;
228  }
229  // next, check the list (slower)
230  if (!exed && !exclusionList_.empty()) {
231  std::vector<HcalDetId>::const_iterator i=std::lower_bound(exclusionList_.begin(),exclusionList_.end(),id);
232  if (i!=exclusionList_.end() && *i==id) exed=true;
233  }
234  return exed;
235 }
int i
Definition: DBlmapReader.cc:9
std::vector< HcalDetId > exclusionList_
Definition: HcalTopology.h:162
int HcalTopology::lastHBRing ( ) const
inline
int HcalTopology::lastHERing ( ) const
inline
int HcalTopology::lastHFRing ( ) const
inline
int HcalTopology::lastHORing ( ) const
inline
int HcalTopology::maxDepth ( HcalSubdetector  subdet) const

Definition at line 787 of file HcalTopology.cc.

References HcalBarrel, HcalEndcap, HcalForward, maxDepthHB_, maxDepthHE_, and maxDepthHF_.

Referenced by HcalGeometry::getCells(), and HcaluLUTTPGCoder::HcaluLUTTPGCoder().

787  {
788  if (bc == HcalBarrel) return maxDepthHB_;
789  else if (bc == HcalEndcap) return maxDepthHE_;
790  else if (bc == HcalForward) return maxDepthHF_;
791  else return 4;
792 }
int HcalTopology::maxDepthHB ( ) const
inline

Definition at line 128 of file HcalTopology.h.

References maxDepthHB_.

Referenced by RecAnalyzerMinbias::beginRun().

128 { return maxDepthHB_;}
int HcalTopology::maxDepthHE ( ) const
inline

Definition at line 129 of file HcalTopology.h.

References maxDepthHE_.

Referenced by RecAnalyzerMinbias::beginRun().

129 { return maxDepthHE_;}
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 1233 of file HcalTopology.cc.

References HBSize_, HESize_, HFSize_, and HOSize_.

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

1233  {
1234  return HBSize_+HESize_+HOSize_+HFSize_;
1235 }
unsigned int HESize_
Definition: HcalTopology.h:184
unsigned int HFSize_
Definition: HcalTopology.h:186
unsigned int HBSize_
Definition: HcalTopology.h:183
unsigned int HOSize_
Definition: HcalTopology.h:185
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 274 of file HcalTopology.cc.

References HcalDetId::changeForm(), incIPhi(), neighbor(), HcalDetId::oldFormat(), and DetId::rawId().

Referenced by spr::newHCALIdNS().

274  {
275  std::vector<DetId> vNeighborsDetId;
277  if (incIPhi(HcalDetId(id),neighbor)) {
278  if (neighbor.oldFormat()) neighbor.changeForm();
279  vNeighborsDetId.push_back(DetId(neighbor.rawId()));
280  }
281  return vNeighborsDetId;
282 }
bool neighbor(int endcap, int sector, int SectIndex, int id, int sub, int station)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
bool incIPhi(const HcalDetId &id, HcalDetId &neighbor) const
bool oldFormat() const
Definition: HcalDetId.h:50
Definition: DetId.h:18
void changeForm()
Definition: HcalDetId.cc:136
int HcalTopology::nPhiBins ( int  etaRing) const

how many phi segments in this ring

Definition at line 768 of file HcalTopology.cc.

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

Referenced by CaloTowerHardcodeGeometryLoader::makeCell().

768  {
769  int lastPhiBin=singlePhiBins_;
770  if (etaRing>= firstHFQuadPhiRing()) lastPhiBin=doublePhiBins_/2;
771  else if (etaRing>= firstHEQuadPhiRing()) lastPhiBin=doublePhiBins_/2;
772  else if (etaRing>= firstHEDoublePhiRing()) lastPhiBin=doublePhiBins_;
773  return lastPhiBin;
774 }
int etaRing(HcalSubdetector subdet, double eta) const
eta and phi index from eta, phi values
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:92
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:94
int firstHEQuadPhiRing() const
Definition: HcalTopology.h:93
int HcalTopology::nPhiBins ( HcalSubdetector  subdet,
int  etaRing 
) const

Definition at line 776 of file HcalTopology.cc.

References dPhiTable, dPhiTableHF, firstHBRing_, firstHFRing_, HcalForward, and M_PI.

776  {
777  static const double twopi = M_PI+M_PI;
778  int lastPhiBin;
779  if (bc == HcalForward) {
780  lastPhiBin = (int)((twopi+0.001)/dPhiTableHF[etaRing-firstHFRing_]);
781  } else {
782  lastPhiBin = (int)((twopi+0.001)/dPhiTable[etaRing-firstHBRing_]);
783  }
784  return lastPhiBin;
785 }
std::vector< double > dPhiTableHF
Definition: HcalTopology.h:191
int etaRing(HcalSubdetector subdet, double eta) const
eta and phi index from eta, phi values
#define M_PI
std::vector< double > dPhiTable
Definition: HcalTopology.h:191
int HcalTopology::phiBin ( HcalSubdetector  subdet,
int  etaRing,
double  phi 
) const

Definition at line 816 of file HcalTopology.cc.

References dPhiTable, dPhiTableHF, firstHBRing_, firstHFRing_, HcalBarrel, HcalEndcap, HcalForward, cmsHarvester::index, M_PI, phioff, csvLumiCalc::unit, unitPhi, and unitPhiHF.

Referenced by HcalGeometry::phiBin().

816  {
817  static const double twopi = M_PI+M_PI;
818  //put phi in correct range (0->2pi)
819  int index(0);
820  if (bc == HcalBarrel) {
821  index = (etaring-firstHBRing_);
822  phi -= phioff[0];
823  } else if (bc == HcalEndcap) {
824  index = (etaring-firstHBRing_);
825  phi -= phioff[1];
826  } else if (bc == HcalForward) {
827  index = (etaring-firstHFRing_);
828  if (index < (int)(dPhiTableHF.size())) {
829  if (unitPhiHF[index] > 2) phi -= phioff[4];
830  else phi -= phioff[2];
831  }
832  }
833  if (phi<0.0) phi += twopi;
834  if (phi>twopi) phi -= twopi;
835  int phibin(1), unit(1);
836  if (bc == HcalForward) {
837  if (index < (int)(dPhiTableHF.size())) {
838  unit = unitPhiHF[index];
839  phibin = static_cast<int>(phi/dPhiTableHF[index])+1;
840  }
841  } else {
842  if (index < (int)(dPhiTable.size())) {
843  phibin = static_cast<int>(phi/dPhiTable[index])+1;
844  unit = unitPhi[index];
845  }
846  }
847  int iphi(phibin);
848  if (unit == 2) iphi = (phibin-1)*2+1;
849  else if (unit == 4) iphi = (phibin-1)*4+3;
850  return iphi;
851 }
std::vector< int > unitPhiHF
Definition: HcalTopology.h:193
std::vector< double > dPhiTableHF
Definition: HcalTopology.h:191
std::vector< int > unitPhi
Definition: HcalTopology.h:193
string unit
Definition: csvLumiCalc.py:46
#define M_PI
std::vector< double > phioff
Definition: HcalTopology.h:192
std::vector< double > dPhiTable
Definition: HcalTopology.h:191
static std::string HcalTopology::producerTag ( )
inlinestatic

Definition at line 40 of file HcalTopology.h.

40 { return "HCAL" ; }
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 869 of file HcalTopology.cc.

References HLT_25ns10e33_v2_cff::depth, and getDepthSegmentation().

869  {
870  std::vector<int> readoutDepths;
871  getDepthSegmentation(ring, readoutDepths);
872  int d1 = std::lower_bound(readoutDepths.begin(), readoutDepths.end(), depth) - readoutDepths.begin();
873  int d2 = std::upper_bound(readoutDepths.begin(), readoutDepths.end(), depth) - readoutDepths.begin();
874  return std::pair<int, int>(d1, d2);
875 }
void getDepthSegmentation(unsigned ring, std::vector< int > &readoutDepths) const
void HcalTopology::setDepthSegmentation ( unsigned  ring,
const std::vector< int > &  readoutDepths 
)

Definition at line 865 of file HcalTopology.cc.

References depthSegmentation_, and relativeConstraints::ring.

Referenced by HcalTopology().

865  {
866  depthSegmentation_[ring] = readoutDepths;
867 }
SegmentationMap depthSegmentation_
Definition: HcalTopology.h:199
int HcalTopology::singlePhiBins ( ) const
inline

Definition at line 96 of file HcalTopology.h.

References singlePhiBins_.

96 {return singlePhiBins_;}
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 284 of file HcalTopology.cc.

References HcalDetId::changeForm(), decIPhi(), neighbor(), HcalDetId::oldFormat(), and DetId::rawId().

Referenced by spr::newHCALIdNS().

284  {
285  std::vector<DetId> vNeighborsDetId;
287  if (decIPhi(HcalDetId(id),neighbor)) {
288  if (neighbor.oldFormat()) neighbor.changeForm();
289  vNeighborsDetId.push_back(DetId(neighbor.rawId()));
290  }
291  return vNeighborsDetId;
292 }
bool neighbor(int endcap, int sector, int SectIndex, int id, int sub, int station)
bool decIPhi(const HcalDetId &id, HcalDetId &neighbor) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
bool oldFormat() const
Definition: HcalDetId.h:50
Definition: DetId.h:18
void changeForm()
Definition: HcalDetId.cc:136
int HcalTopology::topoVersion ( ) const
virtual

return a version which identifies the given topology

Reimplemented from CaloSubdetectorTopology.

Definition at line 1237 of file HcalTopology.cc.

References topoVersion_.

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

1237  {
1238  return topoVersion_;
1239 }
HcalTopologyMode::TriggerMode HcalTopology::triggerMode ( ) const
inline

Definition at line 32 of file HcalTopology.h.

References triggerMode_.

32 { return triggerMode_; }
HcalTopologyMode::TriggerMode triggerMode_
Definition: HcalTopology.h:166
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 294 of file HcalTopology.cc.

References HcalDetId::changeForm(), incrementDepth(), neighbor(), and HcalDetId::oldFormat().

Referenced by spr::matrixHCALIdsDepth().

294  {
295  HcalDetId neighbor = id;
296  std::vector<DetId> vNeighborsDetId;
297  if (incrementDepth(neighbor)) {
298  if (neighbor.oldFormat()) neighbor.changeForm();
299  vNeighborsDetId.push_back(neighbor);
300  }
301  return vNeighborsDetId;
302 }
bool neighbor(int endcap, int sector, int SectIndex, int id, int sub, int station)
bool oldFormat() const
Definition: HcalDetId.h:50
bool incrementDepth(HcalDetId &id) const
void changeForm()
Definition: HcalDetId.cc:136
bool HcalTopology::valid ( const DetId id) const
virtual

Is this a valid cell id?

Reimplemented from CaloSubdetectorTopology.

Definition at line 181 of file HcalTopology.cc.

References assert(), DetId::Hcal, and validHcal().

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

181  {
182  assert(id.det()==DetId::Hcal);
183  return validHcal(id);
184 }
assert(m_qm.get())
bool validHcal(const HcalDetId &id) const
bool HcalTopology::validDetId ( HcalSubdetector  subdet,
int  ieta,
int  iphi,
int  depth 
) const
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 373 of file HcalTopology.cc.

References HLT_25ns10e33_v2_cff::depth, reco::dp, firstHERing(), firstHFQuadPhiRing(), firstHFRing(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, IPHI_MAX, lastHFRing(), and sd.

373  {
374  const HcalSubdetector sd (id.subdet());
375  const int ie (id.ietaAbs());
376  const int ip (id.iphi());
377  const int dp (id.depth());
378 
379  return ( ( ip >= 1 ) &&
380  ( ip <= IPHI_MAX ) &&
381  ( dp >= 1 ) &&
382  ( ie >= 1 ) &&
383  ( ( ( sd == HcalBarrel ) &&
384  ( ( ( ie <= 14 ) &&
385  ( dp == 1 ) ) ||
386  ( ( ( ie == 15 ) || ( ie == 16 ) ) &&
387  ( dp <= 2 ) ) ) ) ||
388  ( ( sd == HcalEndcap ) &&
389  ( ( ( ie == firstHERing() ) &&
390  ( dp == 3 ) ) ||
391  ( ( ie == 17 ) &&
392  ( dp == 1 ) ) ||
393  ( ( ie >= 18 ) &&
394  ( ie <= 20 ) &&
395  ( dp <= 2 ) ) ||
396  ( ( ie >= 21 ) &&
397  ( ie <= 26 ) &&
398  ( dp <= 2 ) &&
399  ( ip%2 == 1 ) ) ||
400  ( ( ie >= 27 ) &&
401  ( ie <= 28 ) &&
402  ( dp <= 3 ) &&
403  ( ip%2 == 1 ) ) ||
404  ( ( ie == 29 ) &&
405  ( dp <= 2 ) &&
406  ( ip%2 == 1 ) ) ) ) ||
407  ( ( sd == HcalOuter ) &&
408  ( ie <= 15 ) &&
409  ( dp == 4 ) ) ||
410  ( ( sd == HcalForward ) &&
411  ( dp <= 2 ) &&
412  ( ( ( ie >= firstHFRing() ) &&
413  ( ie < firstHFQuadPhiRing() ) &&
414  ( ip%2 == 1 ) ) ||
415  ( ( ie >= firstHFQuadPhiRing() ) &&
416  ( ie <= lastHFRing() ) &&
417  ( ip%4 == 3 ) ) ) ) ) ) ;
418 }
int firstHFRing() const
Definition: HcalTopology.h:87
int lastHFRing() const
Definition: HcalTopology.h:88
HcalSubdetector
Definition: HcalAssistant.h:31
auto dp
Definition: deltaR.h:22
double sd
int firstHERing() const
Definition: HcalTopology.h:85
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:94
static const int IPHI_MAX
Definition: HcalTopology.cc:13
bool HcalTopology::validHcal ( const HcalDetId id) const

Is this a valid cell id?

Definition at line 186 of file HcalTopology.cc.

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

Referenced by HcalDigitizer::accumulateCaloHits(), valid(), and validDetId().

186  {
187  // check the raw rules
188  bool ok=validRaw(id);
189 
190  ok=ok && !isExcluded(id);
191 
192  return ok;
193 }
bool isExcluded(const HcalDetId &id) const
bool validRaw(const HcalDetId &id) const
bool HcalTopology::validHT ( const HcalTrigTowerDetId id) const

Definition at line 201 of file HcalTopology.cc.

References HLT_25ns10e33_v2_cff::depth, IPHI_MAX, HcalTopologyMode::tm_LHC_1x1, HcalTopologyMode::tm_LHC_RCT, triggerMode_, and relval_steps::version.

Referenced by CaloTPGTranscoderULUT::HTvalid(), CaloTPGTranscoderULUT::loadHCALCompress(), and validRaw().

201  {
202 
203  if (id.iphi()<1 || id.iphi()>IPHI_MAX || id.ieta()==0) return false;
204  if (id.depth() != 0) return false;
205  if (id.version()==0) {
206  if ((triggerMode_==HcalTopologyMode::tm_LHC_1x1 && id.ietaAbs()>29) ||
207  (id.ietaAbs()>32)) return false;
208  int ietaMax = (triggerMode_==HcalTopologyMode::tm_LHC_1x1) ? 29 : 28;
209  if (id.ietaAbs()>ietaMax && ((id.iphi()%4)!=1)) return false;
210  } else {
211  if (triggerMode_==HcalTopologyMode::tm_LHC_RCT) return false;
212  if (id.ietaAbs()<30 || id.ietaAbs()>41) return false;
213  if (id.ietaAbs()>29 && ((id.iphi()%2)==0)) return false;
214  if (id.ietaAbs()>39 && ((id.iphi()%4)!=3)) return false;
215  }
216  return true;
217 }
HcalTopologyMode::TriggerMode triggerMode_
Definition: HcalTopology.h:166
static const int IPHI_MAX
Definition: HcalTopology.cc:13
bool HcalTopology::validRaw ( const HcalDetId id) const
private

Is this a valid cell id?

Definition at line 421 of file HcalTopology.cc.

References HLT_25ns10e33_v2_cff::depth, etaBinsHE_, firstHEDoublePhiRing(), firstHEQuadPhiRing(), firstHERing(), firstHETripleDepthRing(), firstHFQuadPhiRing(), firstHFRing(), HcalDDDRecConstants::getDepthEta16(), HcalDDDRecConstants::getMaxDepth(), HcalDDDRecConstants::getNoff(), HcalTopologyMode::H2, HcalTopologyMode::H2HE, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalTriggerTower, hcons_, i, IPHI_MAX, lastHBRing(), lastHERing(), lastHFRing(), lastHORing(), maxEta_, HcalDDDRecConstants::maxHFDepth(), mode_, convertSQLiteXML::ok, HcalTopologyMode::SLHC, and validHT().

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

421  {
422  bool ok=true;
423  int ieta=id.ieta();
424  int aieta=id.ietaAbs();
425  int depth=id.depth();
426  int iphi=id.iphi();
427  if ((ieta==0 || iphi<=0 || iphi>IPHI_MAX) || aieta>maxEta_) ok = false; // outer limits
428 
429  if (ok) {
430  HcalSubdetector subdet=id.subdet();
431  if (subdet==HcalBarrel) {
433  if ((aieta>lastHBRing()) || (depth>hcons_->getMaxDepth(0,aieta))) ok=false;
434  } else {
435  if (aieta>lastHBRing() || depth>2 || (aieta<=14 && depth>1)) ok=false;
436  }
437  } else if (subdet==HcalEndcap) {
439  if ((depth>hcons_->getMaxDepth(1,aieta)) ||
440  (aieta<firstHERing()) || (aieta>lastHERing()) ||
441  (aieta==firstHERing() && depth<hcons_->getDepthEta16(1))) {
442  ok = false;
443  } else {
444  for (unsigned int i=0; i<etaBinsHE_.size(); ++i) {
445  if (aieta == etaBinsHE_[i].ieta) {
446  if (aieta >= firstHEDoublePhiRing() && (iphi%2)==0) ok=false;
447  if (aieta >= firstHEQuadPhiRing() && (iphi%4)!=3) ok=false;
448  if (aieta+1 == hcons_->getNoff(1)) {
449  if (depth < 1) ok = false;
450  } else {
451  if (depth < etaBinsHE_[i].depthStart) ok = false;
452  }
453  break;
454  }
455  }
456  }
457  } else {
458  if (depth>hcons_->getMaxDepth(1,aieta) || aieta<firstHERing() || aieta>lastHERing() ||
459  (aieta==firstHERing() && depth!=hcons_->getDepthEta16(1)) ||
460  (aieta==17 && depth!=1 && mode_!=HcalTopologyMode::H2) || // special case at H2
461  (((aieta>=17 && aieta<firstHETripleDepthRing()) ||
462  aieta==lastHERing()) && depth>2) ||
463  (aieta>=firstHEDoublePhiRing() && (iphi%2)==0)) ok=false;
464  }
465  } else if (subdet==HcalOuter) {
466  if (aieta>lastHORing() || iphi>IPHI_MAX || depth!=4) ok=false;
467  } else if (subdet==HcalForward) {
468  if (aieta<firstHFRing() || aieta>lastHFRing() || ((iphi%2)==0) ||
469  (depth>hcons_->maxHFDepth(ieta,iphi)) ||
470  (aieta>=firstHFQuadPhiRing() && ((iphi+1)%4)!=0)) ok=false;
471  } else if (subdet==HcalTriggerTower) {
472  ok=validHT(HcalTrigTowerDetId(id.rawId()));
473  } else {
474  ok=false;
475  }
476  }
477  return ok;
478 }
int firstHFRing() const
Definition: HcalTopology.h:87
int i
Definition: DBlmapReader.cc:9
int getDepthEta16(int i) const
int lastHBRing() const
Definition: HcalTopology.h:84
std::vector< HcalDDDRecConstants::HcalEtaBin > etaBinsHE_
Definition: HcalTopology.h:173
int getNoff(const int i) const
int getMaxDepth(const int type) const
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:165
int firstHETripleDepthRing() const
Definition: HcalTopology.h:95
int lastHFRing() const
Definition: HcalTopology.h:88
HcalSubdetector
Definition: HcalAssistant.h:31
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:92
int firstHERing() const
Definition: HcalTopology.h:85
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:94
int firstHEQuadPhiRing() const
Definition: HcalTopology.h:93
int maxHFDepth(int ieta, int iphi) const
int lastHORing() const
Definition: HcalTopology.h:90
int lastHERing() const
Definition: HcalTopology.h:86
const HcalDDDRecConstants * hcons_
Definition: HcalTopology.h:161
static const int IPHI_MAX
Definition: HcalTopology.cc:13
bool validHT(const HcalTrigTowerDetId &id) const
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 264 of file HcalTopology.cc.

References i, and incIEta().

Referenced by spr::newHCALIdEW().

264  {
265  std::vector<DetId> vNeighborsDetId;
266  HcalDetId neighbors[2];
267  for (int i=0;i<incIEta(HcalDetId(id),neighbors);i++) {
268  if (neighbors[i].oldFormat()) neighbors[i].changeForm();
269  vNeighborsDetId.push_back(DetId(neighbors[i].rawId()));
270  }
271  return vNeighborsDetId;
272 }
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 188 of file HcalTopology.h.

Referenced by getCALIBSize().

SegmentationMap HcalTopology::depthSegmentation_
private

Definition at line 199 of file HcalTopology.h.

Referenced by getDepthSegmentation(), and setDepthSegmentation().

int HcalTopology::doublePhiBins_
private

Definition at line 178 of file HcalTopology.h.

Referenced by doublePhiBins(), and nPhiBins().

std::vector<double> HcalTopology::dPhiTable
private

Definition at line 191 of file HcalTopology.h.

Referenced by HcalTopology(), nPhiBins(), and phiBin().

std::vector<double> HcalTopology::dPhiTableHF
private

Definition at line 191 of file HcalTopology.h.

Referenced by HcalTopology(), nPhiBins(), and phiBin().

std::vector<HcalDDDRecConstants::HcalEtaBin> HcalTopology::etaBinsHB_
private

Definition at line 173 of file HcalTopology.h.

Referenced by decrementDepth(), and HcalTopology().

std::vector<HcalDDDRecConstants::HcalEtaBin> HcalTopology::etaBinsHE_
private

Definition at line 173 of file HcalTopology.h.

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

int HcalTopology::etaHE2HF_
private

Definition at line 180 of file HcalTopology.h.

Referenced by HcalTopology(), and incAIEta().

int HcalTopology::etaHF2HE_
private

Definition at line 180 of file HcalTopology.h.

Referenced by decAIEta(), decrementDepth(), and HcalTopology().

std::vector<double> HcalTopology::etaTable
private

Definition at line 191 of file HcalTopology.h.

Referenced by etaMax(), etaRange(), etaRing(), and HcalTopology().

std::vector<double> HcalTopology::etaTableHF
private

Definition at line 191 of file HcalTopology.h.

Referenced by etaMax(), etaRange(), etaRing(), and HcalTopology().

bool HcalTopology::excludeHB_
private

Definition at line 163 of file HcalTopology.h.

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

bool HcalTopology::excludeHE_
private

Definition at line 163 of file HcalTopology.h.

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

bool HcalTopology::excludeHF_
private

Definition at line 163 of file HcalTopology.h.

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

bool HcalTopology::excludeHO_
private

Definition at line 163 of file HcalTopology.h.

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

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

Definition at line 162 of file HcalTopology.h.

Referenced by exclude(), and isExcluded().

int HcalTopology::firstHBRing_
private

Definition at line 168 of file HcalTopology.h.

Referenced by etaRing(), firstHBRing(), HcalTopology(), nPhiBins(), and phiBin().

int HcalTopology::firstHEDoublePhiRing_
private

Definition at line 176 of file HcalTopology.h.

Referenced by firstHEDoublePhiRing(), and HcalTopology().

int HcalTopology::firstHEQuadPhiRing_
private

Definition at line 176 of file HcalTopology.h.

Referenced by firstHEQuadPhiRing(), and HcalTopology().

int HcalTopology::firstHERing_
private

Definition at line 169 of file HcalTopology.h.

Referenced by firstHERing(), and HcalTopology().

int HcalTopology::firstHETripleDepthRing_
private

Definition at line 177 of file HcalTopology.h.

Referenced by firstHETripleDepthRing(), and HcalTopology().

int HcalTopology::firstHFQuadPhiRing_
private

Definition at line 176 of file HcalTopology.h.

Referenced by firstHFQuadPhiRing(), and HcalTopology().

int HcalTopology::firstHFRing_
private

Definition at line 170 of file HcalTopology.h.

Referenced by etaRange(), etaRing(), firstHFRing(), HcalTopology(), nPhiBins(), and phiBin().

int HcalTopology::firstHORing_
private

Definition at line 171 of file HcalTopology.h.

Referenced by firstHORing(), and HcalTopology().

unsigned int HcalTopology::HBSize_
private

Definition at line 183 of file HcalTopology.h.

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

const HcalDDDRecConstants* HcalTopology::hcons_
private

Definition at line 161 of file HcalTopology.h.

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

unsigned int HcalTopology::HESize_
private

Definition at line 184 of file HcalTopology.h.

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

unsigned int HcalTopology::HFSize_
private

Definition at line 186 of file HcalTopology.h.

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

unsigned int HcalTopology::HOSize_
private

Definition at line 185 of file HcalTopology.h.

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

unsigned int HcalTopology::HTSize_
private

Definition at line 187 of file HcalTopology.h.

Referenced by getHTSize(), and HcalTopology().

int HcalTopology::lastHBRing_
private

Definition at line 168 of file HcalTopology.h.

Referenced by etaMax(), HcalTopology(), and lastHBRing().

int HcalTopology::lastHERing_
private

Definition at line 169 of file HcalTopology.h.

Referenced by etaMax(), etaRange(), etaRing(), HcalTopology(), and lastHERing().

int HcalTopology::lastHFRing_
private

Definition at line 170 of file HcalTopology.h.

Referenced by HcalTopology(), and lastHFRing().

int HcalTopology::lastHORing_
private

Definition at line 171 of file HcalTopology.h.

Referenced by etaMax(), HcalTopology(), and lastHORing().

int HcalTopology::maxDepthHB_
private
int HcalTopology::maxDepthHE_
private
int HcalTopology::maxDepthHF_
private
int HcalTopology::maxEta_
private

Definition at line 181 of file HcalTopology.h.

Referenced by HcalTopology(), and validRaw().

HcalTopologyMode::Mode HcalTopology::mode_
private
int HcalTopology::nEtaHB_
private
int HcalTopology::nEtaHE_
private

Definition at line 174 of file HcalTopology.h.

Referenced by denseId2detId(), detId2denseId(), detId2denseIdHE(), etaMax(), and HcalTopology().

unsigned int HcalTopology::numberOfShapes_
private

Definition at line 189 of file HcalTopology.h.

Referenced by getNumberOfShapes(), and HcalTopology().

std::vector<double> HcalTopology::phioff
private

Definition at line 192 of file HcalTopology.h.

Referenced by HcalTopology(), and phiBin().

int HcalTopology::singlePhiBins_
private

Definition at line 178 of file HcalTopology.h.

Referenced by nPhiBins(), and singlePhiBins().

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

Definition at line 166 of file HcalTopology.h.

Referenced by HcalTopology(), triggerMode(), and validHT().

std::vector<int> HcalTopology::unitPhi
private

Definition at line 193 of file HcalTopology.h.

Referenced by HcalTopology(), and phiBin().

std::vector<int> HcalTopology::unitPhiHF
private

Definition at line 193 of file HcalTopology.h.

Referenced by HcalTopology(), and phiBin().