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)
49  { (*this) += ClusterShapes(e,eta,phi,r);}
50 
51 
52  // ---
53  float SigmaEtaEta() const ;
54  float SigmaPhiPhi() const ;
55  float SigmaRR() const ;
56  // ----
57  float Phi() const ;
58  float R() const ;
59  float Eta() const ;
60  inline int N()const {return n_;}
61  // --
62  float SigmaEtaR()const ;
63  float SigmaEtaPhi() const ;
64  float SigmaRPhi() const ;
65  // --
66  float LogEoverE() const { return sum_logE_/sum_e_;}
67  float eD() const { return std::sqrt(sum_e2_)/sum_e_;}
68 
70  void operator+=(const ClusterShapes &);
71  ClusterShapes& operator=(const ClusterShapes &) = default;
72  };
73 
74 }; // end namespace
75 
76 #endif
77 
ClusterShapes(float e, float eta, float phi, float r)
Definition: ClusterShapes.h:43
float SigmaPhiPhi() const
float SigmaEtaR() const
delete x;
Definition: CaloConfig.h:22
void Init(float e, float eta, float phi, float r=0.)
float SigmaRR() const
float Eta() const
T x() const
Cartesian x coordinate.
float LogEoverE() const
Definition: ClusterShapes.h:66
float SigmaRPhi() const
T sqrt(T t)
Definition: SSEVec.h:18
ClusterShapes operator+(const ClusterShapes &)
Definition: ClusterShapes.cc:6
int N() const
Definition: ClusterShapes.h:60
float SigmaEtaEta() const
ClusterShapes & operator=(const ClusterShapes &)=default
float SigmaEtaPhi() const
float eD() const
Definition: ClusterShapes.h:67
float R() const
void Add(float e, float eta, float phi, float r=0.0)
Definition: ClusterShapes.h:48
void operator+=(const ClusterShapes &)
float Phi() const