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
float Phi() const
ClusterShapes(float e, float eta, float phi, float r)
Definition: ClusterShapes.h:43
float SigmaRR() const
float R() const
float SigmaPhiPhi() const
delete x;
Definition: CaloConfig.h:22
void Init(float e, float eta, float phi, float r=0.)
float LogEoverE() const
Definition: ClusterShapes.h:64
float SigmaEtaEta() const
T sqrt(T t)
Definition: SSEVec.h:19
ClusterShapes operator+(const ClusterShapes &)
Definition: ClusterShapes.cc:6
ClusterShapes & operator=(const ClusterShapes &)=default
float SigmaRPhi() const
float eD() const
Definition: ClusterShapes.h:65
void Add(float e, float eta, float phi, float r=0.0)
Definition: ClusterShapes.h:48
void operator+=(const ClusterShapes &)
float SigmaEtaPhi() const
float SigmaEtaR() const
float Eta() const