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( void ) const;
148  int maxDepth(HcalSubdetector subdet) const;
149  double etaMax(HcalSubdetector subdet) const;
150  std::pair<double,double> etaRange(HcalSubdetector subdet, int ieta) const;
151 
153  unsigned int detId2denseIdHB(const DetId& id) const;
155  unsigned int detId2denseIdHE(const DetId& id) const;
157  unsigned int detId2denseIdHO(const DetId& id) const;
159  unsigned int detId2denseIdHF(const DetId& id) const;
161  unsigned int detId2denseIdHT(const DetId& id) const;
163  unsigned int detId2denseIdCALIB(const DetId& id) const;
164 
165  unsigned int getNumberOfShapes() const { return numberOfShapes_; }
166  bool isBH() const { return ((hcons_ == nullptr) ? false : hcons_->isBH()); }
167 
168  const HcalDDDRecConstants* dddConstants () const {return hcons_;}
169  bool withSpecialRBXHBHE() const {return hcons_->withSpecialRBXHBHE();}
170  HcalDetId mergedDepthDetId(const HcalDetId& id) const {return hcons_->mergedDepthDetId(id); }
171  bool getMergePositionFlag() const {return mergePosition_;}
172  void unmergeDepthDetId(const HcalDetId& id,
173  std::vector<HcalDetId>& ids) const {
174  hcons_->unmergeDepthDetId(id, ids);
175  }
176  // Returns the DetId of the front Id if it is a merged RecHit in "Plan 1"
177  HcalDetId idFront(const HcalDetId& id) const {return hcons_->idFront(id);}
178  HcalDetId idBack (const HcalDetId& id) const {return hcons_->idBack(id);}
179 
180 private:
182  int incAIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
184  int decAIEta(const HcalDetId& id, HcalDetId neighbors[2]) const;
185 
187  bool validDetIdPreLS1(const HcalDetId& id) const;
188  bool validRaw(const HcalDetId& id) const;
189  unsigned int detId2denseIdPreLS1 (const DetId& id) const;
190  bool isExcluded(const HcalDetId& id) const;
191 
194  std::vector<HcalDetId> exclusionList_;
196 
199 
204 
205  std::vector<HcalDDDRecConstants::HcalEtaBin> etaBinsHB_, etaBinsHE_;
207 
214  static const int minMaxDepth_ = 4;
215 
216  unsigned int HBSize_;
217  unsigned int HESize_;
218  unsigned int HOSize_;
219  unsigned int HFSize_;
220  unsigned int HTSize_;
221  unsigned int CALIBSize_;
222  unsigned int numberOfShapes_;
223 
224  std::vector<double> etaTable, etaTableHF, dPhiTable, dPhiTableHF;
225  std::vector<double> phioff;
226  std::vector<int> unitPhi, unitPhiHF;
227 
229 
230  // index is ring;
231  typedef std::map<unsigned, std::vector<int> > SegmentationMap;
232  SegmentationMap depthSegmentation_;
233  SegmentationMap depthSegmentationOne_;
234 
235  enum { kHBhalf = 1296 ,
236  kHEhalf = 1296 ,
237  kHOhalf = 1080 ,
238  kHFhalf = 864 ,
239  kHThalf = 2088,
240  kZDChalf = 11,
241  kCASTORhalf = 224,
242  kCALIBhalf = 693,
243  kHThalfPhase1 = 2520 ,
246  enum { kHBSizePreLS1 = 2*kHBhalf } ;
247  enum { kHESizePreLS1 = 2*kHEhalf } ;
248  enum { kHOSizePreLS1 = 2*kHOhalf } ;
249  enum { kHFSizePreLS1 = 2*kHFhalf } ;
250  enum { kHTSizePreLS1 = 2*kHThalf } ;
253 };
254 
255 
256 #endif
DetId denseId2detId(unsigned int) const override
return a linear packed id
int maxDepth(void) const
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:226
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:168
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:222
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:224
void excludeSubdetector(HcalSubdetector subdet)
std::vector< HcalDDDRecConstants::HcalEtaBin > etaBinsHB_
Definition: HcalTopology.h:205
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:226
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
static const int minMaxDepth_
Definition: HcalTopology.h:214
bool mergedDepthList29(int ieta, int iphi, int depth) const
void exclude(const HcalDetId &id)
HcalTopologyMode::TriggerMode triggerMode_
Definition: HcalTopology.h:198
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:217
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:220
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:205
HcalTopologyMode::TriggerMode triggerMode() const
Definition: HcalTopology.h:32
bool getMergePositionFlag() const
Definition: HcalTopology.h:171
HcalTopologyMode::Mode mode() const
Definition: HcalTopology.h:31
HcalDetId mergedDepthDetId(const HcalDetId &id) const
Definition: HcalTopology.h:170
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:221
std::pair< int, int > segmentBoundaries(const unsigned ring, const unsigned depth, const bool flag=false) const
unsigned int HFSize_
Definition: HcalTopology.h:219
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:165
HcalDetId idFront(const HcalDetId &id) const
std::vector< int > mergedDepthList29(HcalDetId id) const
Definition: HcalTopology.h:110
HcalTopologyMode::Mode mode_
Definition: HcalTopology.h:197
HcalTopology(const HcalDDDRecConstants *hcons, const bool mergePosition=false)
Definition: HcalTopology.cc:19
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:216
int doublePhiBins() const
Definition: HcalTopology.h:101
void unmergeDepthDetId(const HcalDetId &id, std::vector< HcalDetId > &ids) const
Definition: HcalTopology.h:172
int firstHORing() const
Definition: HcalTopology.h:93
std::vector< double > etaTableHF
Definition: HcalTopology.h:224
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:96
SegmentationMap depthSegmentation_
Definition: HcalTopology.h:232
SegmentationMap depthSegmentationOne_
Definition: HcalTopology.h:233
unsigned int HOSize_
Definition: HcalTopology.h:218
std::vector< double > etaTable
Definition: HcalTopology.h:224
HcalDetId idBack(const HcalDetId &id) const
bool validDetIdPreLS1(const HcalDetId &id) const
int firstHEQuadPhiRing_
Definition: HcalTopology.h:208
Definition: DetId.h:18
bool incrementDepth(HcalDetId &id) const
bool mergePosition_
Definition: HcalTopology.h:193
std::vector< double > phioff
Definition: HcalTopology.h:225
bool isBH() const
Definition: HcalTopology.h:166
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:224
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:178
std::vector< DetId > down(const DetId &id) const override
int firstHETripleDepthRing_
Definition: HcalTopology.h:209
unsigned int detId2denseIdHO(const DetId &id) const
return a linear packed id from HO
std::vector< HcalDetId > exclusionList_
Definition: HcalTopology.h:194
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:177
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:169
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:208
const HcalDDDRecConstants * hcons_
Definition: HcalTopology.h:192
std::map< unsigned, std::vector< int > > SegmentationMap
Definition: HcalTopology.h:231
int firstHFQuadPhiRing_
Definition: HcalTopology.h:208
int getPhiZOne(std::vector< std::pair< int, int > > &phiz) const
bool validHT(const HcalTrigTowerDetId &id) const