CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  std::pair<int, int> getWafer(const DetId&) const;
55  std::pair<int, int> getCell(const DetId&) const;
56 
57  bool isHalfCell(const DetId&) const;
58 
59  bool isSilicon(const DetId&) const;
60  bool isScintillator(const DetId&) const;
61 
62  bool isOnlySilicon(const unsigned int layer) const;
63 
64  // 4-vector helper functions using GlobalPoint
65  float getEta(const GlobalPoint& position, const float& vertex_z = 0.) const;
66  float getPhi(const GlobalPoint& position) const;
67  float getPt(const GlobalPoint& position, const float& hitEnergy, const float& vertex_z = 0.) const;
68 
69  // 4-vector helper functions using DetId
70  float getEta(const DetId& id, const float& vertex_z = 0.) const;
71  float getPhi(const DetId& id) const;
72  float getPt(const DetId& id, const float& hitEnergy, const float& vertex_z = 0.) const;
73 
74  inline const CaloGeometry* getGeometry() const { return geom_; };
75  unsigned int lastLayerEE(bool nose = false) const { return (nose ? HFNoseDetId::HFNoseLayerEEmax : fhOffset_); }
76  unsigned int lastLayerFH() const { return fhLastLayer_; }
77  unsigned int firstLayerBH() const { return bhFirstLayer_; }
78  unsigned int lastLayerBH() const { return bhLastLayer_; }
79  unsigned int lastLayer(bool nose = false) const { return (nose ? noseLastLayer_ : bhLastLayer_); }
80  std::pair<uint32_t, uint32_t> firstAndLastLayer(DetId::Detector det, int subdet) const;
81  unsigned int maxNumberOfWafersPerLayer(bool nose = false) const {
83  }
84  inline int getScintMaxIphi() const { return bhMaxIphi_; }
85  inline int getGeometryType() const { return geometryType_; }
86  bool maskCell(const DetId& id, int corners = 3) const;
87 
88  private:
94  };
95 } // namespace hgcal
96 
97 #endif
bool isOnlySilicon(const unsigned int layer) const
Definition: RecHitTools.cc:435
bool isHalfCell(const DetId &) const
Definition: RecHitTools.cc:415
unsigned int bhFirstLayer_
Definition: RecHitTools.h:90
unsigned int fhLastLayer_
Definition: RecHitTools.h:90
int zside(const DetId &id) const
Definition: RecHitTools.cc:163
std::pair< uint32_t, uint32_t > firstAndLastLayer(DetId::Detector det, int subdet) const
Definition: RecHitTools.cc:476
unsigned int bhLastLayer_
Definition: RecHitTools.h:90
unsigned int maxNumberOfWafersNose_
Definition: RecHitTools.h:91
unsigned int fhOffset_
Definition: RecHitTools.h:90
std::pair< int, int > getWafer(const DetId &) const
Definition: RecHitTools.cc:379
unsigned int bhOffset_
Definition: RecHitTools.h:90
ForwardSubdetector
unsigned int lastLayerBH() const
Definition: RecHitTools.h:78
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:441
constexpr std::array< uint8_t, layerIndexSize > layer
float getPhi(const GlobalPoint &position) const
Definition: RecHitTools.cc:452
float getPt(const GlobalPoint &position, const float &hitEnergy, const float &vertex_z=0.) const
Definition: RecHitTools.cc:463
unsigned int maxNumberOfWafersPerLayer_
Definition: RecHitTools.h:91
bool isSilicon(const DetId &) const
Definition: RecHitTools.cc:428
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
Definition: RecHitTools.cc:119
std::float_t getRadiusToSide(const DetId &) const
Definition: RecHitTools.cc:235
const CaloGeometry * geom_
Definition: RecHitTools.h:89
unsigned int lastLayer(bool nose=false) const
Definition: RecHitTools.h:79
unsigned int getLayer(DetId::Detector type, bool nose=false) const
Definition: RecHitTools.cc:307
std::float_t getSiThickness(const DetId &) const
Definition: RecHitTools.cc:179
Definition: DetId.h:17
unsigned int eeOffset_
Definition: RecHitTools.h:90
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:365
int getSiThickIndex(const DetId &) const
Definition: RecHitTools.cc:205
std::pair< float, float > getScintDEtaDPhi(const DetId &) const
Definition: RecHitTools.cc:225
GlobalPoint getPositionLayer(int layer, bool nose=false) const
Definition: RecHitTools.cc:141
Detector
Definition: DetId.h:24
int getGeometryType() const
Definition: RecHitTools.h:85
unsigned int maxNumberOfWafersPerLayer(bool nose=false) const
Definition: RecHitTools.h:81
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:129
static const int HFNoseLayerEEmax
Definition: HFNoseDetId.h:29
unsigned int noseLastLayer_
Definition: RecHitTools.h:90
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
unsigned int firstLayerBH() const
Definition: RecHitTools.h:77
static int position[264][3]
Definition: ReadPGInfo.cc:289
unsigned int lastLayerEE(bool nose=false) const
Definition: RecHitTools.h:75
int getScintMaxIphi() const
Definition: RecHitTools.h:84
bool isScintillator(const DetId &) const
Definition: RecHitTools.cc:433
const CaloGeometry * getGeometry() const
Definition: RecHitTools.h:74
std::pair< int, int > getCell(const DetId &) const
Definition: RecHitTools.cc:397
unsigned int lastLayerFH() const
Definition: RecHitTools.h:76
bool maskCell(const DetId &id, int corners=3) const
Definition: RecHitTools.cc:488