CMS 3D CMS Logo

RecHitTools.h
Go to the documentation of this file.
1 #ifndef __RecoLocalCalo_HGCalRecAlgos_RecHitTools_h__
2 #define __RecoLocalCalo_HGCalRecAlgos_RecHitTools_h__
3 
4 #include <array>
5 #include <cmath>
12 
13 class CaloGeometry;
15 class DetId;
16 
17 namespace edm {
18  class Event;
19  class EventSetup;
20 } // namespace edm
21 
22 namespace hgcal {
23  class RecHitTools {
24  public:
26  : geom_(nullptr),
27  eeOffset_(0),
28  fhOffset_(0),
29  bhFirstLayer_(0),
30  bhOffset_(0),
31  fhLastLayer_(0),
32  noseLastLayer_(0),
33  geometryType_(0) {}
35 
36  void setGeometry(CaloGeometry const&);
38 
39  GlobalPoint getPosition(const DetId& id) const;
40  GlobalPoint getPositionLayer(int layer, bool nose = false) const;
41  // zside returns +/- 1
42  int zside(const DetId& id) const;
43 
44  std::float_t getSiThickness(const DetId&) const;
45  std::float_t getRadiusToSide(const DetId&) const;
46  int getSiThickIndex(const DetId&) const;
47 
48  std::pair<float, float> getScintDEtaDPhi(const DetId&) const;
49 
50  unsigned int getLayer(DetId::Detector type, bool nose = false) const;
51  unsigned int getLayer(ForwardSubdetector type) const;
52  unsigned int getLayer(const DetId&) const;
53  unsigned int getLayerWithOffset(const DetId&) const;
54  int getCellType(const DetId& id) const;
55  std::pair<int, int> getWafer(const DetId&) const;
56  std::pair<int, int> getCell(const DetId&) const;
57 
58  bool isHalfCell(const DetId&) const;
59 
60  bool isSilicon(const DetId&) const;
61  bool isScintillator(const DetId&) const;
62 
63  bool isOnlySilicon(const unsigned int layer) const;
64 
65  // 4-vector helper functions using GlobalPoint
66  float getEta(const GlobalPoint& position, const float& vertex_z = 0.) const;
67  float getPhi(const GlobalPoint& position) const;
68  float getPt(const GlobalPoint& position, const float& hitEnergy, const float& vertex_z = 0.) const;
69 
70  // 4-vector helper functions using DetId
71  float getEta(const DetId& id, const float& vertex_z = 0.) const;
72  float getPhi(const DetId& id) const;
73  float getPt(const DetId& id, const float& hitEnergy, const float& vertex_z = 0.) const;
74 
75  inline const CaloGeometry* getGeometry() const { return geom_; };
76  unsigned int lastLayerEE(bool nose = false) const { return (nose ? HFNoseDetId::HFNoseLayerEEmax : fhOffset_); }
77  unsigned int lastLayerFH() const { return fhLastLayer_; }
78  unsigned int firstLayerBH() const { return bhFirstLayer_; }
79  unsigned int lastLayerBH() const { return bhLastLayer_; }
80  unsigned int lastLayer(bool nose = false) const { return (nose ? noseLastLayer_ : bhLastLayer_); }
81  std::pair<uint32_t, uint32_t> firstAndLastLayer(DetId::Detector det, int subdet) const;
82  unsigned int maxNumberOfWafersPerLayer(bool nose = false) const {
84  }
85  inline int getScintMaxIphi() const { return bhMaxIphi_; }
86  inline int getGeometryType() const { return geometryType_; }
87  bool maskCell(const DetId& id, int corners = 3) const;
88 
89  private:
95  };
96 } // namespace hgcal
97 
98 #endif
bool isHalfCell(const DetId &) const
Definition: RecHitTools.cc:431
std::pair< int, int > getWafer(const DetId &) const
Definition: RecHitTools.cc:395
unsigned int bhFirstLayer_
Definition: RecHitTools.h:91
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
Definition: RecHitTools.cc:130
unsigned int fhLastLayer_
Definition: RecHitTools.h:91
unsigned int getLayer(DetId::Detector type, bool nose=false) const
Definition: RecHitTools.cc:318
float getPhi(const GlobalPoint &position) const
Definition: RecHitTools.cc:502
unsigned int bhLastLayer_
Definition: RecHitTools.h:91
bool maskCell(const DetId &id, int corners=3) const
Definition: RecHitTools.cc:538
unsigned int maxNumberOfWafersNose_
Definition: RecHitTools.h:92
int getCellType(const DetId &id) const
Definition: RecHitTools.cc:444
std::float_t getRadiusToSide(const DetId &) const
Definition: RecHitTools.cc:246
unsigned int fhOffset_
Definition: RecHitTools.h:91
std::pair< float, float > getScintDEtaDPhi(const DetId &) const
Definition: RecHitTools.cc:236
unsigned int bhOffset_
Definition: RecHitTools.h:91
ForwardSubdetector
unsigned int firstLayerBH() const
Definition: RecHitTools.h:78
int getGeometryType() const
Definition: RecHitTools.h:86
int zside(const DetId &id) const
Definition: RecHitTools.cc:174
unsigned int maxNumberOfWafersPerLayer(bool nose=false) const
Definition: RecHitTools.h:82
unsigned int maxNumberOfWafersPerLayer_
Definition: RecHitTools.h:92
unsigned int lastLayerFH() const
Definition: RecHitTools.h:77
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:140
const CaloGeometry * geom_
Definition: RecHitTools.h:90
bool isSilicon(const DetId &) const
Definition: RecHitTools.cc:478
bool isOnlySilicon(const unsigned int layer) const
Definition: RecHitTools.cc:485
const CaloGeometry * getGeometry() const
Definition: RecHitTools.h:75
std::pair< uint32_t, uint32_t > firstAndLastLayer(DetId::Detector det, int subdet) const
Definition: RecHitTools.cc:526
Definition: DetId.h:17
unsigned int eeOffset_
Definition: RecHitTools.h:91
int getScintMaxIphi() const
Definition: RecHitTools.h:85
Detector
Definition: DetId.h:24
std::pair< int, int > getCell(const DetId &) const
Definition: RecHitTools.cc:413
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:491
GlobalPoint getPositionLayer(int layer, bool nose=false) const
Definition: RecHitTools.cc:152
static const int HFNoseLayerEEmax
Definition: HFNoseDetId.h:29
unsigned int lastLayerBH() const
Definition: RecHitTools.h:79
unsigned int noseLastLayer_
Definition: RecHitTools.h:91
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:79
bool isScintillator(const DetId &) const
Definition: RecHitTools.cc:483
HLT enums.
static int position[264][3]
Definition: ReadPGInfo.cc:289
int getSiThickIndex(const DetId &) const
Definition: RecHitTools.cc:216
float getPt(const GlobalPoint &position, const float &hitEnergy, const float &vertex_z=0.) const
Definition: RecHitTools.cc:513
unsigned int lastLayerEE(bool nose=false) const
Definition: RecHitTools.h:76
std::float_t getSiThickness(const DetId &) const
Definition: RecHitTools.cc:190
unsigned int lastLayer(bool nose=false) const
Definition: RecHitTools.h:80
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:381