CMS 3D CMS Logo

HGCalTriggerTools.h
Go to the documentation of this file.
1 #ifndef __L1Trigger_L1THGCal_HGCalTriggerTools_h__
2 #define __L1Trigger_L1THGCal_HGCalTriggerTools_h__
3 
15 #include <array>
16 #include <cmath>
17 #include <vector>
19 
27 
28 namespace edm {
29  class EventSetup;
30 }
31 
33 public:
36 
37  void setGeometry(const HGCalTriggerGeometryBase* const);
38  void eventSetup(const edm::EventSetup&,
39  const edm::ESGetToken<
41  CaloGeometryRecord>&); // Kept for backward compatibility: used in L1Trigger/L1CaloTrigger/test
42  GlobalPoint getTCPosition(const DetId& id) const;
43  unsigned layers(ForwardSubdetector type) const;
44  unsigned layers(DetId::Detector type) const;
45  unsigned layer(const DetId&) const;
46  unsigned layerWithOffset(const DetId&) const;
47  bool isEm(const DetId&) const;
48  bool isHad(const DetId& id) const { return !isEm(id); }
49  bool isSilicon(const DetId&) const;
50  bool isScintillator(const DetId& id) const { return !isSilicon(id); }
51  bool isNose(const DetId&) const;
52  int zside(const DetId&) const;
53  int thicknessIndex(const DetId&) const;
54 
55  unsigned lastLayerEE(bool nose = false) const { return (nose ? HFNoseDetId::HFNoseLayerEEmax : eeLayers_); }
56  unsigned lastLayerFH() const { return eeLayers_ + fhLayers_; }
57  unsigned lastLayerBH() const { return totalLayers_; }
58  unsigned lastLayerNose() const { return noseLayers_; }
59  unsigned lastLayer(bool nose = false) const { return nose ? noseLayers_ : totalLayers_; }
60 
61  // 4-vector helper functions using GlobalPoint
62  float getEta(const GlobalPoint& position, const float& vertex_z = 0.) const;
63  float getPhi(const GlobalPoint& position) const;
64  float getPt(const GlobalPoint& position, const float& hitEnergy, const float& vertex_z = 0.) const;
65 
66  // 4-vector helper functions using DetId
67  float getTCEta(const DetId& id, const float& vertex_z = 0.) const;
68  float getTCPhi(const DetId& id) const;
69  float getTCPt(const DetId& id, const float& hitEnergy, const float& vertex_z = 0.) const;
70 
71  inline const HGCalTriggerGeometryBase* getTriggerGeometry() const { return geom_; };
72 
73  float getLayerZ(const unsigned& layerWithOffset) const;
74  float getLayerZ(const int& subdet, const unsigned& layer) const;
75 
76  template <typename T>
77  std::vector<T> bxVectorToVector(const BXVector<T>& inputBXVector) {
78  std::vector<T> outputVector;
79  // loop over collection for a given bx and put the objects into a std::vector
80  outputVector.insert(outputVector.end(), inputBXVector.begin(0), inputBXVector.end(0));
81  return outputVector;
82  }
83 
84  DetId simToReco(const DetId&, const HGCalTopology&) const;
85  unsigned triggerLayer(const unsigned id) const { return geom_->triggerLayer(id); }
86 
87  static constexpr unsigned kScintillatorPseudoThicknessIndex_ = 3;
88 
93  };
94  SubDetectorType getSubDetectorType(const DetId& id) const;
95 
96 private:
98  unsigned eeLayers_;
99  unsigned fhLayers_;
100  unsigned bhLayers_;
101  unsigned noseLayers_;
102  unsigned totalLayers_;
103 };
104 
105 #endif
bool isScintillator(const DetId &id) const
void eventSetup(const edm::EventSetup &, const edm::ESGetToken< HGCalTriggerGeometryBase, CaloGeometryRecord > &)
bool isSilicon(const DetId &) const
const HGCalTriggerGeometryBase * geom_
float getTCEta(const DetId &id, const float &vertex_z=0.) const
virtual unsigned triggerLayer(const unsigned id) const =0
int thicknessIndex(const DetId &) const
const HGCalTriggerGeometryBase * getTriggerGeometry() const
bool isHad(const DetId &id) const
ForwardSubdetector
void setGeometry(const HGCalTriggerGeometryBase *const)
const_iterator begin(int bx) const
int zside(const DetId &) const
GlobalPoint getTCPosition(const DetId &id) const
SubDetectorType getSubDetectorType(const DetId &id) const
DetId simToReco(const DetId &, const HGCalTopology &) const
unsigned lastLayerBH() const
bool isNose(const DetId &) const
float getTCPhi(const DetId &id) const
bool isEm(const DetId &) const
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
float getTCPt(const DetId &id, const float &hitEnergy, const float &vertex_z=0.) const
unsigned lastLayer(bool nose=false) const
unsigned layerWithOffset(const DetId &) const
unsigned lastLayerFH() const
Definition: DetId.h:17
unsigned triggerLayer(const unsigned id) const
unsigned layers(ForwardSubdetector type) const
Detector
Definition: DetId.h:24
static const int HFNoseLayerEEmax
Definition: HFNoseDetId.h:29
unsigned layer(const DetId &) const
float getLayerZ(const unsigned &layerWithOffset) const
const_iterator end(int bx) const
float getPhi(const GlobalPoint &position) const
unsigned lastLayerEE(bool nose=false) const
HLT enums.
static int position[264][3]
Definition: ReadPGInfo.cc:289
std::vector< T > bxVectorToVector(const BXVector< T > &inputBXVector)
static constexpr unsigned kScintillatorPseudoThicknessIndex_
unsigned lastLayerNose() const
float getPt(const GlobalPoint &position, const float &hitEnergy, const float &vertex_z=0.) const