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 
18 
20 
22 
23  int firstLayer(const l1t::HGCalMulticluster& c3d) const;
24  int lastLayer(const l1t::HGCalMulticluster& c3d) const;
25  int maxLayer(const l1t::HGCalMulticluster& c3d) const;
26  int showerLength(const l1t::HGCalMulticluster& c3d) const {
27  return lastLayer(c3d) - firstLayer(c3d) + 1;
28  } //in number of layers
29  // Maximum number of consecutive layers in the cluster
30  int coreShowerLength(const l1t::HGCalMulticluster& c3d, const HGCalTriggerGeometryBase& triggerGeometry) const;
31  float percentileLayer(const l1t::HGCalMulticluster& c3d,
32  const HGCalTriggerGeometryBase& triggerGeometry,
33  float quantile = 0.5) const;
34 
35  float percentileTriggerCells(const l1t::HGCalMulticluster& c3d, float quantile = 0.5) const;
36 
37  float eMax(const l1t::HGCalMulticluster& c3d) const;
38 
39  float meanZ(const l1t::HGCalMulticluster& c3d) const;
40  float sigmaZZ(const l1t::HGCalMulticluster& c3d) const;
41 
42  float sigmaEtaEtaTot(const l1t::HGCalMulticluster& c3d) const;
43  float sigmaEtaEtaTot(const l1t::HGCalCluster& c2d) const;
44  float sigmaEtaEtaMax(const l1t::HGCalMulticluster& c3d) const;
45 
46  float sigmaPhiPhiTot(const l1t::HGCalMulticluster& c3d) const;
47  float sigmaPhiPhiTot(const l1t::HGCalCluster& c2d) const;
48  float sigmaPhiPhiMax(const l1t::HGCalMulticluster& c3d) const;
49 
50  float sigmaRRTot(const l1t::HGCalMulticluster& c3d) const;
51  float sigmaRRTot(const l1t::HGCalCluster& c2d) const;
52  float sigmaRRMax(const l1t::HGCalMulticluster& c3d) const;
53  float sigmaRRMean(const l1t::HGCalMulticluster& c3d, float radius = 5.) const;
54 
56 
57 private:
58  float meanX(const std::vector<pair<float, float>>& energy_X_tc) const;
59  // Compute energy-weighted RMS of any variable X in the cluster
60  // Delta(a,b) functor as template argument. Default is (a-b)
61  template <typename Delta = std::minus<float>>
62  float sigmaXX(const std::vector<pair<float, float>>& energy_X_tc, const float X_cluster) const {
63  Delta delta;
64  float Etot = 0;
65  float deltaX2_sum = 0;
66  for (const auto& energy_X : energy_X_tc) {
67  deltaX2_sum += energy_X.first * pow(delta(energy_X.second, X_cluster), 2);
68  Etot += energy_X.first;
69  }
70  float X_MSE = 0;
71  if (Etot > 0)
72  X_MSE = deltaX2_sum / Etot;
73  float X_RMS = sqrt(X_MSE);
74  return X_RMS;
75  }
76  // Special case of delta for phi
77  template <class T>
78  struct DeltaPhi {
79  T operator()(const T& x, const T& y) const { return deltaPhi(x, y); }
80  };
81  float sigmaPhiPhi(const std::vector<pair<float, float>>& energy_phi_tc, const float phi_cluster) const {
82  return sigmaXX<DeltaPhi<float>>(energy_phi_tc, phi_cluster);
83  }
84  template <typename T, typename Tref>
85  bool pass(const T& obj, const Tref& ref) const {
86  bool pass_threshold = (obj.mipPt() > threshold_);
87  GlobalPoint proj(Basic3DVector<float>(obj.position()) / std::abs(obj.position().z()));
88  bool pass_distance = ((proj - ref.centreProj()).mag() < distance_);
89  return pass_threshold && pass_distance;
90  }
91 
93  double threshold_ = 0.;
94  double distance_ = 1.;
95 };
96 
97 #endif
HGCalTriggerTools.h
HGCalTriggerGeometryBase
Definition: HGCalTriggerGeometryBase.h:19
HGCalShowerShape::fillShapes
void fillShapes(l1t::HGCalMulticluster &, const HGCalTriggerGeometryBase &) const
Definition: HGCalShowerShape.cc:515
DDAxes::y
l1t::HGCalCluster
Definition: HGCalCluster.h:11
HGCalTriggerTools::eventSetup
void eventSetup(const edm::EventSetup &)
Definition: HGCalTriggerTools.cc:35
HGCalShowerShape::pass
bool pass(const T &obj, const Tref &ref) const
Definition: HGCalShowerShape.h:85
HGCalShowerShape
Definition: HGCalShowerShape.h:12
HGCalShowerShape::sigmaRRMax
float sigmaRRMax(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.cc:313
DDAxes::x
HGCalShowerShape::~HGCalShowerShape
~HGCalShowerShape()
Definition: HGCalShowerShape.h:19
HGCalShowerShape::maxLayer
int maxLayer(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.cc:46
HGCalShowerShape::sigmaRRTot
float sigmaRRTot(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.cc:222
HGCalShowerShape::threshold_
double threshold_
Definition: HGCalShowerShape.h:93
l1t::HGCalMulticluster
Definition: HGCalMulticluster.h:13
HGCalMulticluster.h
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
HGCalTriggerGeometryBase.h
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HGCalShowerShape::sigmaPhiPhiTot
float sigmaPhiPhiTot(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.cc:202
HGCalShowerShape::sigmaRRMean
float sigmaRRMean(const l1t::HGCalMulticluster &c3d, float radius=5.) const
Definition: HGCalShowerShape.cc:347
HGCalShowerShape::sigmaEtaEtaMax
float sigmaEtaEtaMax(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.cc:247
HGCalShowerShape::DeltaPhi::operator()
T operator()(const T &x, const T &y) const
Definition: HGCalShowerShape.h:79
HGCalShowerShape::sigmaXX
float sigmaXX(const std::vector< pair< float, float >> &energy_X_tc, const float X_cluster) const
Definition: HGCalShowerShape.h:62
HGCalShowerShape::meanZ
float meanZ(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.cc:423
HGCalShowerShape::firstLayer
int firstLayer(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.cc:30
Point3DBase< float, GlobalTag >
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
HGCalShowerShape::DeltaPhi
Definition: HGCalShowerShape.h:78
SusyPostProcessor_cff.quantile
quantile
Definition: SusyPostProcessor_cff.py:7
amptDefault_cfi.proj
proj
Definition: amptDefault_cfi.py:13
edm::ParameterSet
Definition: ParameterSet.h:36
HGCalShowerShape::sigmaPhiPhi
float sigmaPhiPhi(const std::vector< pair< float, float >> &energy_phi_tc, const float phi_cluster) const
Definition: HGCalShowerShape.h:81
HGCalShowerShape::meanX
float meanX(const std::vector< pair< float, float >> &energy_X_tc) const
Definition: HGCalShowerShape.cc:15
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
LorentzVector.h
HGCalShowerShape::eventSetup
void eventSetup(const edm::EventSetup &es)
Definition: HGCalShowerShape.h:21
edm::EventSetup
Definition: EventSetup.h:57
HGCalShowerShape::triggerTools_
HGCalTriggerTools triggerTools_
Definition: HGCalShowerShape.h:92
HGCalShowerShape::percentileTriggerCells
float percentileTriggerCells(const l1t::HGCalMulticluster &c3d, float quantile=0.5) const
Definition: HGCalShowerShape.cc:150
HGCalShowerShape::lastLayer
int lastLayer(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.cc:65
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
HGCalShowerShape::percentileLayer
float percentileLayer(const l1t::HGCalMulticluster &c3d, const HGCalTriggerGeometryBase &triggerGeometry, float quantile=0.5) const
Definition: HGCalShowerShape.cc:112
T
long double T
Definition: Basic3DVectorLD.h:48
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
HGCalShowerShape::eMax
float eMax(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.cc:401
HGCalShowerShape::sigmaZZ
float sigmaZZ(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.cc:441
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
HGCalShowerShape::showerLength
int showerLength(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.h:26
HGCalTriggerTools
Definition: HGCalTriggerTools.h:32
HGCalShowerShape::sigmaEtaEtaTot
float sigmaEtaEtaTot(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.cc:182
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGCalShowerShape::distance_
double distance_
Definition: HGCalShowerShape.h:94
Basic3DVector< float >
deltaPhi.h
HGCalShowerShape::coreShowerLength
int coreShowerLength(const l1t::HGCalMulticluster &c3d, const HGCalTriggerGeometryBase &triggerGeometry) const
Definition: HGCalShowerShape.cc:81
HGCalShowerShape::LorentzVector
math::XYZTLorentzVector LorentzVector
Definition: HGCalShowerShape.h:14
HGCalShowerShape::HGCalShowerShape
HGCalShowerShape()
Definition: HGCalShowerShape.h:16
HGCalShowerShape::sigmaPhiPhiMax
float sigmaPhiPhiMax(const l1t::HGCalMulticluster &c3d) const
Definition: HGCalShowerShape.cc:280