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 
26 
27 namespace edm {
28  class Event;
29  class EventSetup;
30 } // namespace edm
31 
33 public:
34  HGCalTriggerTools() : geom_(nullptr), eeLayers_(0), fhLayers_(0), bhLayers_(0), totalLayers_(0) {}
36 
37  void eventSetup(const edm::EventSetup&);
38  GlobalPoint getTCPosition(const DetId& id) const;
39  unsigned layers(ForwardSubdetector type) const;
40  unsigned layers(DetId::Detector type) const;
41  unsigned layer(const DetId&) const;
42  unsigned layerWithOffset(const DetId&) const;
43  bool isEm(const DetId&) const;
44  bool isHad(const DetId& id) const { return !isEm(id); }
45  bool isSilicon(const DetId&) const;
46  bool isScintillator(const DetId& id) const { return !isSilicon(id); }
47  int zside(const DetId&) const;
48  // tc argument is needed because of the impossibility
49  // to know whether the ID is a TC or a sensor cell
50  // in the v8 geometry detid scheme
51  int thicknessIndex(const DetId&, bool tc = false) const;
52 
53  unsigned lastLayerEE() const { return eeLayers_; }
54  unsigned lastLayerFH() const { return eeLayers_ + fhLayers_; }
55  unsigned lastLayerBH() const { return totalLayers_; }
56 
57  // 4-vector helper functions using GlobalPoint
58  float getEta(const GlobalPoint& position, const float& vertex_z = 0.) const;
59  float getPhi(const GlobalPoint& position) const;
60  float getPt(const GlobalPoint& position, const float& hitEnergy, const float& vertex_z = 0.) const;
61 
62  // 4-vector helper functions using DetId
63  float getTCEta(const DetId& id, const float& vertex_z = 0.) const;
64  float getTCPhi(const DetId& id) const;
65  float getTCPt(const DetId& id, const float& hitEnergy, const float& vertex_z = 0.) const;
66 
67  inline const HGCalTriggerGeometryBase* getTriggerGeometry() const { return geom_; };
68 
69  float getLayerZ(const unsigned& layerWithOffset) const;
70  float getLayerZ(const int& subdet, const unsigned& layer) const;
71 
72  template <typename T>
73  std::vector<T> bxVectorToVector(const BXVector<T>& inputBXVector) {
74  std::vector<T> outputVector;
75  //loop over collection for a given bx and put the objects into a std::vector
76  outputVector.insert(outputVector.end(), inputBXVector.begin(0), inputBXVector.end(0));
77  return outputVector;
78  }
79 
80  DetId simToReco(const DetId&, const HGCalTopology&) const;
81  DetId simToReco(const DetId&, const HcalTopology&) const;
82  unsigned triggerLayer(const unsigned id) const { return geom_->triggerLayer(id); }
83 
84  static constexpr unsigned kScintillatorPseudoThicknessIndex_ = 3;
85 
86 private:
88  unsigned eeLayers_;
89  unsigned fhLayers_;
90  unsigned bhLayers_;
91  unsigned totalLayers_;
92 
93  int sensorCellThicknessV8(const DetId& id) const;
94 };
95 
96 #endif
const_iterator end(int bx) const
type
Definition: HCALResponse.h:21
bool isScintillator(const DetId &id) const
unsigned lastLayerEE() const
const HGCalTriggerGeometryBase * geom_
#define nullptr
const HGCalTriggerGeometryBase * getTriggerGeometry() const
int zside(DetId const &)
ForwardSubdetector
unsigned triggerLayer(const unsigned id) const
bool isHad(const DetId &id) const
unsigned lastLayerBH() const
Definition: DetId.h:17
Detector
Definition: DetId.h:24
HLT enums.
static int position[264][3]
Definition: ReadPGInfo.cc:289
std::vector< T > bxVectorToVector(const BXVector< T > &inputBXVector)
const_iterator begin(int bx) const
#define constexpr
unsigned lastLayerFH() const