CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
25 
26 namespace edm {
27  class EventSetup;
28 }
29 
31 public:
34 
35  void setGeometry(const HGCalTriggerGeometryBase* const);
36  void eventSetup(const edm::EventSetup&); // Kept for backward compatibility: used in L1Trigger/L1CaloTrigger/test
37  GlobalPoint getTCPosition(const DetId& id) const;
38  unsigned layers(ForwardSubdetector type) const;
39  unsigned layers(DetId::Detector type) const;
40  unsigned layer(const DetId&) const;
41  unsigned layerWithOffset(const DetId&) const;
42  bool isEm(const DetId&) const;
43  bool isHad(const DetId& id) const { return !isEm(id); }
44  bool isSilicon(const DetId&) const;
45  bool isScintillator(const DetId& id) const { return !isSilicon(id); }
46  bool isNose(const DetId&) const;
47  int zside(const DetId&) const;
48  int thicknessIndex(const DetId&) const;
49 
50  unsigned lastLayerEE(bool nose = false) const { return (nose ? HFNoseDetId::HFNoseLayerEEmax : eeLayers_); }
51  unsigned lastLayerFH() const { return eeLayers_ + fhLayers_; }
52  unsigned lastLayerBH() const { return totalLayers_; }
53  unsigned lastLayerNose() const { return noseLayers_; }
54  unsigned lastLayer(bool nose = false) const { return nose ? noseLayers_ : totalLayers_; }
55 
56  // 4-vector helper functions using GlobalPoint
57  float getEta(const GlobalPoint& position, const float& vertex_z = 0.) const;
58  float getPhi(const GlobalPoint& position) const;
59  float getPt(const GlobalPoint& position, const float& hitEnergy, const float& vertex_z = 0.) const;
60 
61  // 4-vector helper functions using DetId
62  float getTCEta(const DetId& id, const float& vertex_z = 0.) const;
63  float getTCPhi(const DetId& id) const;
64  float getTCPt(const DetId& id, const float& hitEnergy, const float& vertex_z = 0.) const;
65 
66  inline const HGCalTriggerGeometryBase* getTriggerGeometry() const { return geom_; };
67 
68  float getLayerZ(const unsigned& layerWithOffset) const;
69  float getLayerZ(const int& subdet, const unsigned& layer) const;
70 
71  template <typename T>
72  std::vector<T> bxVectorToVector(const BXVector<T>& inputBXVector) {
73  std::vector<T> outputVector;
74  // loop over collection for a given bx and put the objects into a std::vector
75  outputVector.insert(outputVector.end(), inputBXVector.begin(0), inputBXVector.end(0));
76  return outputVector;
77  }
78 
79  DetId simToReco(const DetId&, const HGCalTopology&) const;
80  unsigned triggerLayer(const unsigned id) const { return geom_->triggerLayer(id); }
81 
82  static constexpr unsigned kScintillatorPseudoThicknessIndex_ = 3;
83 
88  };
89  SubDetectorType getSubDetectorType(const DetId& id) const;
90 
91 private:
93  unsigned eeLayers_;
94  unsigned fhLayers_;
95  unsigned bhLayers_;
96  unsigned noseLayers_;
97  unsigned totalLayers_;
98 };
99 
100 #endif
const_iterator end(int bx) const
bool isScintillator(const DetId &id) const
int thicknessIndex(const DetId &) const
float getTCEta(const DetId &id, const float &vertex_z=0.) const
unsigned layer(const DetId &) const
void eventSetup(const edm::EventSetup &)
const HGCalTriggerGeometryBase * geom_
virtual unsigned triggerLayer(const unsigned id) const =0
const HGCalTriggerGeometryBase * getTriggerGeometry() const
float getLayerZ(const unsigned &layerWithOffset) const
unsigned layerWithOffset(const DetId &) const
ForwardSubdetector
void setGeometry(const HGCalTriggerGeometryBase *const)
unsigned lastLayerNose() const
unsigned triggerLayer(const unsigned id) const
bool isHad(const DetId &id) const
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
int zside(const DetId &) const
unsigned lastLayer(bool nose=false) const
unsigned lastLayerEE(bool nose=false) const
bool isNose(const DetId &) const
unsigned lastLayerBH() const
float getTCPhi(const DetId &id) const
float getTCPt(const DetId &id, const float &hitEnergy, const float &vertex_z=0.) const
float getPhi(const GlobalPoint &position) const
Definition: DetId.h:17
unsigned layers(ForwardSubdetector type) const
bool isSilicon(const DetId &) const
Detector
Definition: DetId.h:24
static const int HFNoseLayerEEmax
Definition: HFNoseDetId.h:29
SubDetectorType getSubDetectorType(const DetId &id) const
bool isEm(const DetId &) const
float getPt(const GlobalPoint &position, const float &hitEnergy, const float &vertex_z=0.) const
static int position[264][3]
Definition: ReadPGInfo.cc:289
std::vector< T > bxVectorToVector(const BXVector< T > &inputBXVector)
GlobalPoint getTCPosition(const DetId &id) const
DetId simToReco(const DetId &, const HGCalTopology &) const
static constexpr unsigned kScintillatorPseudoThicknessIndex_
const_iterator begin(int bx) const
unsigned lastLayerFH() const