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