CMS 3D CMS Logo

ClusterShapes.h
Go to the documentation of this file.
1 #ifndef DataFormats_L1HGCal_ClusterShapes_H
2 #define DataFormats_L1HGCal_ClusterShapes_H
3 #include <cmath>
4 
5 namespace l1t {
6  // this class is design to contain and compute
7  // efficiently the cluster shapes
8  // running only once on the cluster members.
9  class ClusterShapes {
10  private:
11  float sum_e_ = 0.0;
12  float sum_e2_ = 0.0;
13  float sum_logE_ = 0.0;
14  int n_ = 0.0;
15 
16  float emax_ = 0.0;
17 
18  float sum_w_ = 0.0; // just here for clarity
19  float sum_eta_ = 0.0;
20  float sum_r_ = 0.0;
21  // i will discriminate using the rms in -pi,pi or in 0,pi
22  float sum_phi_0_ = 0.0; // computed in -pi,pi
23  float sum_phi_1_ = 0.0; // computed in 0, 2pi
24 
25  float sum_eta2_ = 0.0;
26  float sum_r2_ = 0.0;
27  float sum_phi2_0_ = 0.0; //computed in -pi,pi
28  float sum_phi2_1_ = 0.0; //computed in 0,2pi
29 
30  // off diagonal element of the tensor
31  float sum_eta_r_ = 0.0;
32  float sum_r_phi_0_ = 0.0;
33  float sum_r_phi_1_ = 0.0;
34  float sum_eta_phi_0_ = 0.0;
35  float sum_eta_phi_1_ = 0.0;
36 
37  // caching of informations
38  mutable bool isPhi0_ = true;
39  mutable bool modified_ = false; // check wheneever i need
40 
41  public:
43  ClusterShapes(float e, float eta, float phi, float r) { Init(e, eta, phi, r); }
45  ClusterShapes(const ClusterShapes &x) = default;
46  //init an empty cluster
47  void Init(float e, float eta, float phi, float r = 0.);
48  inline void Add(float e, float eta, float phi, float r = 0.0) { (*this) += ClusterShapes(e, eta, phi, r); }
49 
50  // ---
51  float SigmaEtaEta() const;
52  float SigmaPhiPhi() const;
53  float SigmaRR() const;
54  // ----
55  float Phi() const;
56  float R() const;
57  float Eta() const;
58  inline int N() const { return n_; }
59  // --
60  float SigmaEtaR() const;
61  float SigmaEtaPhi() const;
62  float SigmaRPhi() const;
63  // --
64  float LogEoverE() const { return sum_logE_ / sum_e_; }
65  float eD() const { return std::sqrt(sum_e2_) / sum_e_; }
66 
68  void operator+=(const ClusterShapes &);
69  ClusterShapes &operator=(const ClusterShapes &) = default;
70  };
71 
72 }; // namespace l1t
73 
74 #endif
l1t::ClusterShapes::R
float R() const
Definition: ClusterShapes.cc:76
l1t::ClusterShapes::sum_eta_phi_0_
float sum_eta_phi_0_
Definition: ClusterShapes.h:34
l1t::ClusterShapes::n_
int n_
Definition: ClusterShapes.h:14
l1t::ClusterShapes::Eta
float Eta() const
Definition: ClusterShapes.cc:75
l1t::ClusterShapes::sum_r_phi_1_
float sum_r_phi_1_
Definition: ClusterShapes.h:33
l1t::ClusterShapes::sum_e2_
float sum_e2_
Definition: ClusterShapes.h:12
l1t::ClusterShapes::ClusterShapes
ClusterShapes(float e, float eta, float phi, float r)
Definition: ClusterShapes.h:43
l1t::ClusterShapes::modified_
bool modified_
Definition: ClusterShapes.h:39
l1t::ClusterShapes::SigmaPhiPhi
float SigmaPhiPhi() const
Definition: ClusterShapes.cc:82
l1t::ClusterShapes::isPhi0_
bool isPhi0_
Definition: ClusterShapes.h:38
l1t::ClusterShapes::SigmaEtaR
float SigmaEtaR() const
Definition: ClusterShapes.cc:106
l1t::ClusterShapes::Add
void Add(float e, float eta, float phi, float r=0.0)
Definition: ClusterShapes.h:48
l1t::ClusterShapes::sum_eta2_
float sum_eta2_
Definition: ClusterShapes.h:25
l1t::ClusterShapes::Phi
float Phi() const
Definition: ClusterShapes.cc:97
l1t::ClusterShapes::sum_phi2_1_
float sum_phi2_1_
Definition: ClusterShapes.h:28
l1t::ClusterShapes::LogEoverE
float LogEoverE() const
Definition: ClusterShapes.h:64
PVValHelper::eta
Definition: PVValidationHelpers.h:69
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
l1t::ClusterShapes::sum_eta_phi_1_
float sum_eta_phi_1_
Definition: ClusterShapes.h:35
l1t::ClusterShapes::Init
void Init(float e, float eta, float phi, float r=0.)
Definition: ClusterShapes.cc:43
l1t::ClusterShapes::sum_phi2_0_
float sum_phi2_0_
Definition: ClusterShapes.h:27
l1t::ClusterShapes::~ClusterShapes
~ClusterShapes()
Definition: ClusterShapes.h:44
l1t::ClusterShapes::eD
float eD() const
Definition: ClusterShapes.h:65
l1t::ClusterShapes::ClusterShapes
ClusterShapes()
Definition: ClusterShapes.h:42
l1t::ClusterShapes::SigmaRPhi
float SigmaRPhi() const
Definition: ClusterShapes.cc:117
l1t::ClusterShapes::sum_r_phi_0_
float sum_r_phi_0_
Definition: ClusterShapes.h:32
l1t::ClusterShapes::sum_e_
float sum_e_
Definition: ClusterShapes.h:11
l1t::ClusterShapes::N
int N() const
Definition: ClusterShapes.h:58
l1t::ClusterShapes::SigmaEtaEta
float SigmaEtaEta() const
Definition: ClusterShapes.cc:78
l1t
delete x;
Definition: CaloConfig.h:22
l1t::ClusterShapes::sum_eta_
float sum_eta_
Definition: ClusterShapes.h:19
l1t::ClusterShapes::operator+
ClusterShapes operator+(const ClusterShapes &)
Definition: ClusterShapes.cc:6
l1t::ClusterShapes::sum_logE_
float sum_logE_
Definition: ClusterShapes.h:13
l1t::ClusterShapes::sum_eta_r_
float sum_eta_r_
Definition: ClusterShapes.h:31
l1t::ClusterShapes::operator+=
void operator+=(const ClusterShapes &)
Definition: ClusterShapes.cc:12
l1t::ClusterShapes::sum_r2_
float sum_r2_
Definition: ClusterShapes.h:26
l1t::ClusterShapes::sum_phi_0_
float sum_phi_0_
Definition: ClusterShapes.h:22
alignCSCRings.r
r
Definition: alignCSCRings.py:93
l1t::ClusterShapes::sum_phi_1_
float sum_phi_1_
Definition: ClusterShapes.h:23
l1t::ClusterShapes::SigmaRR
float SigmaRR() const
Definition: ClusterShapes.cc:80
l1t::ClusterShapes::sum_r_
float sum_r_
Definition: ClusterShapes.h:20
l1t::ClusterShapes::operator=
ClusterShapes & operator=(const ClusterShapes &)=default
l1t::ClusterShapes::emax_
float emax_
Definition: ClusterShapes.h:16
l1t::ClusterShapes
Definition: ClusterShapes.h:9
l1t::ClusterShapes::SigmaEtaPhi
float SigmaEtaPhi() const
Definition: ClusterShapes.cc:108
l1t::ClusterShapes::sum_w_
float sum_w_
Definition: ClusterShapes.h:18
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37