CMS 3D CMS Logo

HcalTopology.h
Go to the documentation of this file.
1 #ifndef GEOMETRY_CALOTOPOLOGY_HCALTOPOLOGY_H
2 #define GEOMETRY_CALOTOPOLOGY_HCALTOPOLOGY_H 1
3 
4 #include <vector>
5 #include <map>
11 
26 public:
27 
28  HcalTopology(const HcalDDDRecConstants* hcons, const bool mergePosition=false);
30 
31  HcalTopologyMode::Mode mode() const {return mode_;}
34  void exclude(const HcalDetId& id);
38  int exclude(HcalSubdetector subdet, int ieta1, int ieta2, int iphi1, int iphi2, int depth1=1, int depth2=4);
39 
40  static std::string producerTag() { return "HCAL" ; }
41 
43  unsigned int detId2denseId(const DetId& id) const override;
45  DetId denseId2detId(unsigned int /*denseid*/) const override;
47  unsigned int ncells() const override;
49  int topoVersion() const override;
50 
52  bool valid(const DetId& id) const override;
54  bool validHcal(const HcalDetId& id) const;
55  bool validDetId(HcalSubdetector subdet, int ieta, int iphi, int depth) const;
56  bool validHT(const HcalTrigTowerDetId& id) const;
58  bool validHcal(const HcalDetId& id, const unsigned int flag) const;
62  std::vector<DetId> east(const DetId& id) const override;
64  std::vector<DetId> west(const DetId& id) const override;
66  std::vector<DetId> north(const DetId& id) const override;
68  std::vector<DetId> south(const DetId& id) const override;
70  std::vector<DetId> up(const DetId& id) const override;
72  std::vector<DetId> down(const DetId& id) const override;
73 
75  int incIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
77  int decIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
79  bool incIPhi(const HcalDetId& id, HcalDetId &neighbor) const;
81  bool decIPhi(const HcalDetId& id, HcalDetId &neighbor) const;
83  bool incrementDepth(HcalDetId& id) const;
85  bool decrementDepth(HcalDetId& id) const;
86 
87  int firstHBRing() const {return firstHBRing_;}
88  int lastHBRing() const {return lastHBRing_;}
89  int firstHERing() const {return firstHERing_;}
90  int lastHERing() const {return lastHERing_;}
91  int firstHFRing() const {return firstHFRing_;}
92  int lastHFRing() const {return lastHFRing_;}
93  int firstHORing() const {return firstHORing_;}
94  int lastHORing() const {return lastHORing_;}
95 
97  int firstHEQuadPhiRing() const {return firstHEQuadPhiRing_;}
100  int singlePhiBins() const {return singlePhiBins_;}
101  int doublePhiBins() const {return doublePhiBins_;}
102 
105  int iphi, int zside, int & nDepthBins,
106  int & startingBin) const;
107 
109  int nPhiBins(int etaRing) const;
110  int nPhiBins(HcalSubdetector subdet, int etaRing) const;
111 
113  int etaRing(HcalSubdetector subdet, double eta) const;
114  int phiBin(HcalSubdetector subdet, int etaRing, double phi) const;
115 
118  void getDepthSegmentation(const unsigned ring,
119  std::vector<int> & readoutDepths,
120  const bool flag=false) const;
121  void setDepthSegmentation(const unsigned ring,
122  const std::vector<int> & readoutDepths,
123  const bool flag);
127  std::pair<int, int> segmentBoundaries(const unsigned ring,
128  const unsigned depth,
129  const bool flag=false) const;
130  int getPhiZOne(std::vector<std::pair<int,int> >& phiz) const {return hcons_->getPhiZOne(phiz);}
131 
132  unsigned int getHBSize() const {return HBSize_;}
133  unsigned int getHESize() const {return HESize_;}
134  unsigned int getHOSize() const {return HOSize_;}
135  unsigned int getHFSize() const {return HFSize_;}
136  unsigned int getHTSize() const {return HTSize_;}
137  unsigned int getCALIBSize() const {return CALIBSize_;}
138 
139  int maxDepthHB() const { return maxDepthHB_;}
140  int maxDepthHE() const { return maxDepthHE_;}
141  int maxDepth(HcalSubdetector subdet) const;
142  double etaMax(HcalSubdetector subdet) const;
143  std::pair<double,double> etaRange(HcalSubdetector subdet, int ieta) const;
144 
146  unsigned int detId2denseIdHB(const DetId& id) const;
148  unsigned int detId2denseIdHE(const DetId& id) const;
150  unsigned int detId2denseIdHO(const DetId& id) const;
152  unsigned int detId2denseIdHF(const DetId& id) const;
154  unsigned int detId2denseIdHT(const DetId& id) const;
156  unsigned int detId2denseIdCALIB(const DetId& id) const;
157 
158  unsigned int getNumberOfShapes() const { return numberOfShapes_; }
159  bool isBH() const { return ((hcons_ == nullptr) ? false : hcons_->isBH()); }
160 
161  const HcalDDDRecConstants* dddConstants () const {return hcons_;}
162  bool withSpecialRBXHBHE() const {return hcons_->withSpecialRBXHBHE();}
163  HcalDetId mergedDepthDetId(const HcalDetId& id) const {return hcons_->mergedDepthDetId(id); }
164  bool getMergePositionFlag() const {return mergePosition_;}
165  void unmergeDepthDetId(const HcalDetId& id,
166  std::vector<HcalDetId>& ids) const {
167  hcons_->unmergeDepthDetId(id, ids);
168  }
169  // Returns the DetId of the front Id if it is a merged RecHit in "Plan 1"
170  HcalDetId idFront(const HcalDetId& id) const {return hcons_->idFront(id);}
171  HcalDetId idBack (const HcalDetId& id) const {return hcons_->idBack(id);}
172 
173 private:
175  int incAIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
177  int decAIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
178 
180  bool validDetIdPreLS1(const HcalDetId& id) const;
181  bool validRaw(const HcalDetId& id) const;
182  unsigned int detId2denseIdPreLS1 (const DetId& id) const;
183  bool isExcluded(const HcalDetId& id) const;
184 
187  std::vector<HcalDetId> exclusionList_;
189 
192 
197 
198  std::vector<HcalDDDRecConstants::HcalEtaBin> etaBinsHB_, etaBinsHE_;
200 
207 
208  unsigned int HBSize_;
209  unsigned int HESize_;
210  unsigned int HOSize_;
211  unsigned int HFSize_;
212  unsigned int HTSize_;
213  unsigned int CALIBSize_;
214  unsigned int numberOfShapes_;
215 
216  std::vector<double> etaTable, etaTableHF, dPhiTable, dPhiTableHF;
217  std::vector<double> phioff;
218  std::vector<int> unitPhi, unitPhiHF;
219 
221 
222  // index is ring;
223  typedef std::map<unsigned, std::vector<int> > SegmentationMap;
224  SegmentationMap depthSegmentation_;
225  SegmentationMap depthSegmentationOne_;
226 
227  enum { kHBhalf = 1296 ,
228  kHEhalf = 1296 ,
229  kHOhalf = 1080 ,
230  kHFhalf = 864 ,
231  kHThalf = 2088,
232  kZDChalf = 11,
233  kCASTORhalf = 224,
234  kCALIBhalf = 693,
235  kHThalfPhase1 = 2520 ,
238  enum { kHBSizePreLS1 = 2*kHBhalf } ;
239  enum { kHESizePreLS1 = 2*kHEhalf } ;
240  enum { kHOSizePreLS1 = 2*kHOhalf } ;
241  enum { kHFSizePreLS1 = 2*kHFhalf } ;
242  enum { kHTSizePreLS1 = 2*kHThalf } ;
245 };
246 
247 
248 #endif
DetId denseId2detId(unsigned int) const override
return a linear packed id
int firstHFRing() const
Definition: HcalTopology.h:91
unsigned int getCALIBSize() const
Definition: HcalTopology.h:137
unsigned int getHFSize() const
Definition: HcalTopology.h:135
std::vector< int > unitPhiHF
Definition: HcalTopology.h:218
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:161
void getDepthSegmentation(const unsigned ring, std::vector< int > &readoutDepths, const bool flag=false) const
int topoVersion() const override
return a version which identifies the given topology
int decIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
unsigned int numberOfShapes_
Definition: HcalTopology.h:214
unsigned int detId2denseIdPreLS1(const DetId &id) const
unsigned int getHOSize() const
Definition: HcalTopology.h:134
std::vector< double > dPhiTableHF
Definition: HcalTopology.h:216
void excludeSubdetector(HcalSubdetector subdet)
std::vector< HcalDDDRecConstants::HcalEtaBin > etaBinsHB_
Definition: HcalTopology.h:198
int phiBin(HcalSubdetector subdet, int etaRing, double phi) const
int getPhiZOne(std::vector< std::pair< int, int > > &phiz) const
Definition: HcalTopology.h:130
std::vector< int > unitPhi
Definition: HcalTopology.h:218
bool valid(const DetId &id) const override
std::vector< DetId > up(const DetId &id) const override
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
HcalDetId mergedDepthDetId(const HcalDetId &id) const
int maxDepthHE() const
Definition: HcalTopology.h:140
bool validDetId(HcalSubdetector subdet, int ieta, int iphi, int depth) const
unsigned int detId2denseIdHT(const DetId &id) const
return a linear packed id from HT
unsigned int detId2denseIdHF(const DetId &id) const
return a linear packed id from HF
void exclude(const HcalDetId &id)
HcalTopologyMode::TriggerMode triggerMode_
Definition: HcalTopology.h:191
int nPhiBins(int etaRing) const
how many phi segments in this ring
int firstHBRing() const
Definition: HcalTopology.h:87
int incIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
bool decrementDepth(HcalDetId &id) const
unsigned int HESize_
Definition: HcalTopology.h:209
int lastHBRing() const
Definition: HcalTopology.h:88
unsigned int detId2denseIdHB(const DetId &id) const
return a linear packed id from HB
unsigned int HTSize_
Definition: HcalTopology.h:212
bool decIPhi(const HcalDetId &id, HcalDetId &neighbor) const
bool validHcal(const HcalDetId &id) const
std::vector< HcalDDDRecConstants::HcalEtaBin > etaBinsHE_
Definition: HcalTopology.h:198
HcalTopologyMode::TriggerMode triggerMode() const
Definition: HcalTopology.h:32
bool getMergePositionFlag() const
Definition: HcalTopology.h:164
HcalTopologyMode::Mode mode() const
Definition: HcalTopology.h:31
HcalDetId mergedDepthDetId(const HcalDetId &id) const
Definition: HcalTopology.h:163
int singlePhiBins() const
Definition: HcalTopology.h:100
bool isExcluded(const HcalDetId &id) const
void depthBinInformation(HcalSubdetector subdet, int etaRing, int iphi, int zside, int &nDepthBins, int &startingBin) const
finds the number of depth bins and which is the number to start with
unsigned int CALIBSize_
Definition: HcalTopology.h:213
std::pair< int, int > segmentBoundaries(const unsigned ring, const unsigned depth, const bool flag=false) const
unsigned int HFSize_
Definition: HcalTopology.h:211
bool incIPhi(const HcalDetId &id, HcalDetId &neighbor) const
bool validRaw(const HcalDetId &id) const
std::vector< DetId > south(const DetId &id) const override
int decAIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
unsigned int getNumberOfShapes() const
Definition: HcalTopology.h:158
HcalDetId idFront(const HcalDetId &id) const
int maxDepth(HcalSubdetector subdet) const
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:190
HcalTopology(const HcalDDDRecConstants *hcons, const bool mergePosition=false)
Definition: HcalTopology.cc:17
int etaRing(HcalSubdetector subdet, double eta) const
eta and phi index from eta, phi values
int firstHETripleDepthRing() const
Definition: HcalTopology.h:99
static std::string producerTag()
Definition: HcalTopology.h:40
int lastHFRing() const
Definition: HcalTopology.h:92
unsigned int getHTSize() const
Definition: HcalTopology.h:136
HcalSubdetector
Definition: HcalAssistant.h:31
unsigned int HBSize_
Definition: HcalTopology.h:208
int doublePhiBins() const
Definition: HcalTopology.h:101
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
Definition: HcalTopology.h:165
int firstHORing() const
Definition: HcalTopology.h:93
std::vector< double > etaTableHF
Definition: HcalTopology.h:216
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:96
SegmentationMap depthSegmentation_
Definition: HcalTopology.h:224
SegmentationMap depthSegmentationOne_
Definition: HcalTopology.h:225
unsigned int HOSize_
Definition: HcalTopology.h:210
std::vector< double > etaTable
Definition: HcalTopology.h:216
HcalDetId idBack(const HcalDetId &id) const
bool validDetIdPreLS1(const HcalDetId &id) const
int firstHEQuadPhiRing_
Definition: HcalTopology.h:201
Definition: DetId.h:18
bool incrementDepth(HcalDetId &id) const
bool mergePosition_
Definition: HcalTopology.h:186
std::vector< double > phioff
Definition: HcalTopology.h:217
bool isBH() const
Definition: HcalTopology.h:159
int firstHERing() const
Definition: HcalTopology.h:89
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
int firstHFQuadPhiRing() const
Definition: HcalTopology.h:98
unsigned int getHESize() const
Definition: HcalTopology.h:133
int maxDepthHB() const
Definition: HcalTopology.h:139
std::vector< double > dPhiTable
Definition: HcalTopology.h:216
std::vector< DetId > west(const DetId &id) const override
std::vector< DetId > north(const DetId &id) const override
std::pair< double, double > etaRange(HcalSubdetector subdet, int ieta) const
HcalDetId idBack(const HcalDetId &id) const
Definition: HcalTopology.h:171
std::vector< DetId > down(const DetId &id) const override
int firstHETripleDepthRing_
Definition: HcalTopology.h:202
unsigned int detId2denseIdHO(const DetId &id) const
return a linear packed id from HO
std::vector< HcalDetId > exclusionList_
Definition: HcalTopology.h:187
unsigned int ncells() const override
return a count of valid cells (for dense indexing use)
unsigned int detId2denseIdHE(const DetId &id) const
return a linear packed id from HE
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
int firstHEQuadPhiRing() const
Definition: HcalTopology.h:97
void setDepthSegmentation(const unsigned ring, const std::vector< int > &readoutDepths, const bool flag)
bool withSpecialRBXHBHE() const
Definition: HcalTopology.h:162
bool withSpecialRBXHBHE() const
unsigned int getHBSize() const
Definition: HcalTopology.h:132
int incAIEta(const HcalDetId &id, HcalDetId neighbors[2]) const
unsigned int detId2denseIdCALIB(const DetId &id) const
return a linear packed id from CALIB
int lastHORing() const
Definition: HcalTopology.h:94
std::vector< DetId > east(const DetId &id) const override
double etaMax(HcalSubdetector subdet) const
int lastHERing() const
Definition: HcalTopology.h:90
int firstHEDoublePhiRing_
Definition: HcalTopology.h:201
const HcalDDDRecConstants * hcons_
Definition: HcalTopology.h:185
std::map< unsigned, std::vector< int > > SegmentationMap
Definition: HcalTopology.h:223
int firstHFQuadPhiRing_
Definition: HcalTopology.h:201
int getPhiZOne(std::vector< std::pair< int, int > > &phiz) const
bool validHT(const HcalTrigTowerDetId &id) const