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  bool mergedDepth29(HcalDetId id) const {
108  return hcons_->mergedDepthList29(id.ieta(), id.iphi(), id.depth());
109  }
110  std::vector<int> mergedDepthList29(HcalDetId id) const {
111  return hcons_->mergedDepthList29(id.ieta(), id.iphi());
112  }
113 
115  int nPhiBins(int etaRing) const;
116  int nPhiBins(HcalSubdetector subdet, int etaRing) const;
117 
119  int etaRing(HcalSubdetector subdet, double eta) const;
120  int phiBin(HcalSubdetector subdet, int etaRing, double phi) const;
121 
124  void getDepthSegmentation(const unsigned ring,
125  std::vector<int> & readoutDepths,
126  const bool flag=false) const;
127  void setDepthSegmentation(const unsigned ring,
128  const std::vector<int> & readoutDepths,
129  const bool flag);
133  std::pair<int, int> segmentBoundaries(const unsigned ring,
134  const unsigned depth,
135  const bool flag=false) const;
136  int getPhiZOne(std::vector<std::pair<int,int> >& phiz) const {return hcons_->getPhiZOne(phiz);}
137 
138  unsigned int getHBSize() const {return HBSize_;}
139  unsigned int getHESize() const {return HESize_;}
140  unsigned int getHOSize() const {return HOSize_;}
141  unsigned int getHFSize() const {return HFSize_;}
142  unsigned int getHTSize() const {return HTSize_;}
143  unsigned int getCALIBSize() const {return CALIBSize_;}
144 
145  int maxDepthHB() const { return maxDepthHB_;}
146  int maxDepthHE() const { return maxDepthHE_;}
147  int maxDepth(HcalSubdetector subdet) const;
148  double etaMax(HcalSubdetector subdet) const;
149  std::pair<double,double> etaRange(HcalSubdetector subdet, int ieta) const;
150 
152  unsigned int detId2denseIdHB(const DetId& id) const;
154  unsigned int detId2denseIdHE(const DetId& id) const;
156  unsigned int detId2denseIdHO(const DetId& id) const;
158  unsigned int detId2denseIdHF(const DetId& id) const;
160  unsigned int detId2denseIdHT(const DetId& id) const;
162  unsigned int detId2denseIdCALIB(const DetId& id) const;
163 
164  unsigned int getNumberOfShapes() const { return numberOfShapes_; }
165  bool isBH() const { return ((hcons_ == nullptr) ? false : hcons_->isBH()); }
166 
167  const HcalDDDRecConstants* dddConstants () const {return hcons_;}
168  bool withSpecialRBXHBHE() const {return hcons_->withSpecialRBXHBHE();}
169  HcalDetId mergedDepthDetId(const HcalDetId& id) const {return hcons_->mergedDepthDetId(id); }
170  bool getMergePositionFlag() const {return mergePosition_;}
171  void unmergeDepthDetId(const HcalDetId& id,
172  std::vector<HcalDetId>& ids) const {
173  hcons_->unmergeDepthDetId(id, ids);
174  }
175  // Returns the DetId of the front Id if it is a merged RecHit in "Plan 1"
176  HcalDetId idFront(const HcalDetId& id) const {return hcons_->idFront(id);}
177  HcalDetId idBack (const HcalDetId& id) const {return hcons_->idBack(id);}
178 
179 private:
181  int incAIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
183  int decAIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
184 
186  bool validDetIdPreLS1(const HcalDetId& id) const;
187  bool validRaw(const HcalDetId& id) const;
188  unsigned int detId2denseIdPreLS1 (const DetId& id) const;
189  bool isExcluded(const HcalDetId& id) const;
190 
193  std::vector<HcalDetId> exclusionList_;
195 
198 
203 
204  std::vector<HcalDDDRecConstants::HcalEtaBin> etaBinsHB_, etaBinsHE_;
206 
213 
214  unsigned int HBSize_;
215  unsigned int HESize_;
216  unsigned int HOSize_;
217  unsigned int HFSize_;
218  unsigned int HTSize_;
219  unsigned int CALIBSize_;
220  unsigned int numberOfShapes_;
221 
222  std::vector<double> etaTable, etaTableHF, dPhiTable, dPhiTableHF;
223  std::vector<double> phioff;
224  std::vector<int> unitPhi, unitPhiHF;
225 
227 
228  // index is ring;
229  typedef std::map<unsigned, std::vector<int> > SegmentationMap;
230  SegmentationMap depthSegmentation_;
231  SegmentationMap depthSegmentationOne_;
232 
233  enum { kHBhalf = 1296 ,
234  kHEhalf = 1296 ,
235  kHOhalf = 1080 ,
236  kHFhalf = 864 ,
237  kHThalf = 2088,
238  kZDChalf = 11,
239  kCASTORhalf = 224,
240  kCALIBhalf = 693,
241  kHThalfPhase1 = 2520 ,
244  enum { kHBSizePreLS1 = 2*kHBhalf } ;
245  enum { kHESizePreLS1 = 2*kHEhalf } ;
246  enum { kHOSizePreLS1 = 2*kHOhalf } ;
247  enum { kHFSizePreLS1 = 2*kHFhalf } ;
248  enum { kHTSizePreLS1 = 2*kHThalf } ;
251 };
252 
253 
254 #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:143
unsigned int getHFSize() const
Definition: HcalTopology.h:141
std::vector< int > unitPhiHF
Definition: HcalTopology.h:224
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:167
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:220
unsigned int detId2denseIdPreLS1(const DetId &id) const
bool mergedDepth29(HcalDetId id) const
Definition: HcalTopology.h:107
unsigned int getHOSize() const
Definition: HcalTopology.h:140
std::vector< double > dPhiTableHF
Definition: HcalTopology.h:222
void excludeSubdetector(HcalSubdetector subdet)
std::vector< HcalDDDRecConstants::HcalEtaBin > etaBinsHB_
Definition: HcalTopology.h:204
int phiBin(HcalSubdetector subdet, int etaRing, double phi) const
int getPhiZOne(std::vector< std::pair< int, int > > &phiz) const
Definition: HcalTopology.h:136
std::vector< int > unitPhi
Definition: HcalTopology.h:224
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:146
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
bool mergedDepthList29(int ieta, int iphi, int depth) const
void exclude(const HcalDetId &id)
HcalTopologyMode::TriggerMode triggerMode_
Definition: HcalTopology.h:197
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:215
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:218
int zside(DetId const &)
bool decIPhi(const HcalDetId &id, HcalDetId &neighbor) const
bool validHcal(const HcalDetId &id) const
std::vector< HcalDDDRecConstants::HcalEtaBin > etaBinsHE_
Definition: HcalTopology.h:204
HcalTopologyMode::TriggerMode triggerMode() const
Definition: HcalTopology.h:32
bool getMergePositionFlag() const
Definition: HcalTopology.h:170
HcalTopologyMode::Mode mode() const
Definition: HcalTopology.h:31
HcalDetId mergedDepthDetId(const HcalDetId &id) const
Definition: HcalTopology.h:169
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:219
std::pair< int, int > segmentBoundaries(const unsigned ring, const unsigned depth, const bool flag=false) const
unsigned int HFSize_
Definition: HcalTopology.h:217
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:164
HcalDetId idFront(const HcalDetId &id) const
std::vector< int > mergedDepthList29(HcalDetId id) const
Definition: HcalTopology.h:110
int maxDepth(HcalSubdetector subdet) const
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:196
HcalTopology(const HcalDDDRecConstants *hcons, const bool mergePosition=false)
Definition: HcalTopology.cc:16
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:142
HcalSubdetector
Definition: HcalAssistant.h:31
unsigned int HBSize_
Definition: HcalTopology.h:214
int doublePhiBins() const
Definition: HcalTopology.h:101
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
Definition: HcalTopology.h:171
int firstHORing() const
Definition: HcalTopology.h:93
std::vector< double > etaTableHF
Definition: HcalTopology.h:222
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:96
SegmentationMap depthSegmentation_
Definition: HcalTopology.h:230
SegmentationMap depthSegmentationOne_
Definition: HcalTopology.h:231
unsigned int HOSize_
Definition: HcalTopology.h:216
std::vector< double > etaTable
Definition: HcalTopology.h:222
HcalDetId idBack(const HcalDetId &id) const
bool validDetIdPreLS1(const HcalDetId &id) const
int firstHEQuadPhiRing_
Definition: HcalTopology.h:207
Definition: DetId.h:18
bool incrementDepth(HcalDetId &id) const
bool mergePosition_
Definition: HcalTopology.h:192
std::vector< double > phioff
Definition: HcalTopology.h:223
bool isBH() const
Definition: HcalTopology.h:165
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:139
int maxDepthHB() const
Definition: HcalTopology.h:145
std::vector< double > dPhiTable
Definition: HcalTopology.h:222
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:177
std::vector< DetId > down(const DetId &id) const override
int firstHETripleDepthRing_
Definition: HcalTopology.h:208
unsigned int detId2denseIdHO(const DetId &id) const
return a linear packed id from HO
std::vector< HcalDetId > exclusionList_
Definition: HcalTopology.h:193
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:176
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:168
bool withSpecialRBXHBHE() const
unsigned int getHBSize() const
Definition: HcalTopology.h:138
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:207
const HcalDDDRecConstants * hcons_
Definition: HcalTopology.h:191
std::map< unsigned, std::vector< int > > SegmentationMap
Definition: HcalTopology.h:229
int firstHFQuadPhiRing_
Definition: HcalTopology.h:207
int getPhiZOne(std::vector< std::pair< int, int > > &phiz) const
bool validHT(const HcalTrigTowerDetId &id) const