CMS 3D CMS Logo

HGCalShowerShape.h
Go to the documentation of this file.
1 #ifndef __L1Trigger_L1THGCal_HGCalShowerShape_h__
2 #define __L1Trigger_L1THGCal_HGCalShowerShape_h__
3 #include <vector>
4 #include <functional>
5 #include <cmath>
11 
13 public:
15 
17 
19 
21 
22  int firstLayer(const l1t::HGCalMulticluster& c3d) const;
23  int lastLayer(const l1t::HGCalMulticluster& c3d) const;
24  int maxLayer(const l1t::HGCalMulticluster& c3d) const;
25  int showerLength(const l1t::HGCalMulticluster& c3d) const {
26  return lastLayer(c3d) - firstLayer(c3d) + 1;
27  } //in number of layers
28  // Maximum number of consecutive layers in the cluster
29  int coreShowerLength(const l1t::HGCalMulticluster& c3d, const HGCalTriggerGeometryBase& triggerGeometry) const;
30 
31  float eMax(const l1t::HGCalMulticluster& c3d) const;
32 
33  float sigmaZZ(const l1t::HGCalMulticluster& c3d) const;
34 
35  float sigmaEtaEtaTot(const l1t::HGCalMulticluster& c3d) const;
36  float sigmaEtaEtaTot(const l1t::HGCalCluster& c2d) const;
37  float sigmaEtaEtaMax(const l1t::HGCalMulticluster& c3d) const;
38 
39  float sigmaPhiPhiTot(const l1t::HGCalMulticluster& c3d) const;
40  float sigmaPhiPhiTot(const l1t::HGCalCluster& c2d) const;
41  float sigmaPhiPhiMax(const l1t::HGCalMulticluster& c3d) const;
42 
43  float sigmaRRTot(const l1t::HGCalMulticluster& c3d) const;
44  float sigmaRRTot(const l1t::HGCalCluster& c2d) const;
45  float sigmaRRMax(const l1t::HGCalMulticluster& c3d) const;
46  float sigmaRRMean(const l1t::HGCalMulticluster& c3d, float radius = 5.) const;
47 
49 
50 private:
51  float meanX(const std::vector<pair<float, float>>& energy_X_tc) const;
52  // Compute energy-weighted RMS of any variable X in the cluster
53  // Delta(a,b) functor as template argument. Default is (a-b)
54  template <typename Delta = std::minus<float>>
55  float sigmaXX(const std::vector<pair<float, float>>& energy_X_tc, const float X_cluster) const {
56  Delta delta;
57  float Etot = 0;
58  float deltaX2_sum = 0;
59  for (const auto& energy_X : energy_X_tc) {
60  deltaX2_sum += energy_X.first * pow(delta(energy_X.second, X_cluster), 2);
61  Etot += energy_X.first;
62  }
63  float X_MSE = 0;
64  if (Etot > 0)
65  X_MSE = deltaX2_sum / Etot;
66  float X_RMS = sqrt(X_MSE);
67  return X_RMS;
68  }
69  // Special case of delta for phi
70  template <class T>
71  struct DeltaPhi {
72  T operator()(const T& x, const T& y) const { return deltaPhi(x, y); }
73  };
74  float sigmaPhiPhi(const std::vector<pair<float, float>>& energy_phi_tc, const float phi_cluster) const {
75  return sigmaXX<DeltaPhi<float>>(energy_phi_tc, phi_cluster);
76  }
77 
79 };
80 
81 #endif
float sigmaRRMax(const l1t::HGCalMulticluster &c3d) const
dbl * delta
Definition: mlp_gen.cc:36
T operator()(const T &x, const T &y) const
void eventSetup(const edm::EventSetup &es)
void eventSetup(const edm::EventSetup &)
float sigmaXX(const std::vector< pair< float, float >> &energy_X_tc, const float X_cluster) const
float sigmaPhiPhi(const std::vector< pair< float, float >> &energy_phi_tc, const float phi_cluster) const
int coreShowerLength(const l1t::HGCalMulticluster &c3d, const HGCalTriggerGeometryBase &triggerGeometry) const
float sigmaRRTot(const l1t::HGCalMulticluster &c3d) const
HGCalTriggerTools triggerTools_
float sigmaPhiPhiTot(const l1t::HGCalMulticluster &c3d) const
int firstLayer(const l1t::HGCalMulticluster &c3d) const
int lastLayer(const l1t::HGCalMulticluster &c3d) const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
float sigmaRRMean(const l1t::HGCalMulticluster &c3d, float radius=5.) const
T sqrt(T t)
Definition: SSEVec.h:18
float sigmaEtaEtaMax(const l1t::HGCalMulticluster &c3d) const
math::XYZTLorentzVector LorentzVector
float meanX(const std::vector< pair< float, float >> &energy_X_tc) const
void fillShapes(l1t::HGCalMulticluster &, const HGCalTriggerGeometryBase &) const
int showerLength(const l1t::HGCalMulticluster &c3d) const
float sigmaZZ(const l1t::HGCalMulticluster &c3d) const
float sigmaPhiPhiMax(const l1t::HGCalMulticluster &c3d) const
int maxLayer(const l1t::HGCalMulticluster &c3d) const
long double T
float eMax(const l1t::HGCalMulticluster &c3d) const
float sigmaEtaEtaTot(const l1t::HGCalMulticluster &c3d) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40