CMS 3D CMS Logo

PtEtaPhiMass.h
Go to the documentation of this file.
1 #ifndef DataFormats_Math_PtEtaPhiMass_h
2 #define DataFormats_Math_PtEtaPhiMass_h
3 
4 #include<cmath>
5 inline float __attribute__((always_inline)) __attribute__ ((pure))
6 etaFromXYZ(float x, float y, float z) { float t(z/std::sqrt(x*x+y*y)); return ::asinhf(t);}
7 inline float __attribute__((always_inline)) __attribute__ ((pure))
8 etaFromRZ(float r, float z) { float t(z/r); return ::asinhf(t);}
9 
10 
11 
14 class PtEtaPhiMass {
15 private:
16  float pt_, eta_, phi_, mass_;
17 public:
18  // default constructor (unitialized)
20 
21  //positional constructor (still compatible with Root, c++03)
22  constexpr PtEtaPhiMass(float ipt, float ieta, float iphi, float imass):
23  pt_(ipt), eta_(ieta), phi_(iphi), mass_(imass){}
24 
26  constexpr float pt() const { return pt_;}
28  constexpr float eta() const { return eta_; }
30  constexpr float phi() const { return phi_; }
32  constexpr float mass() const { return mass_; }
33 
34 };
35 
36 
37 class RhoEtaPhi {
38 private:
39  float rho_, eta_, phi_;
40 public:
41  // default constructor (unitialized)
42  RhoEtaPhi() {}
43 
44  //positional constructor (still compatible with Root, c++03)
45  RhoEtaPhi(float irho, float ieta, float iphi):
46  rho_(irho), eta_(ieta), phi_(iphi) {}
47 
49  float rho() const { return rho_;}
51  float eta() const { return eta_; }
53  float phi() const { return phi_; }
54 };
55 
56 
57 #endif
float phi() const
momentum azimuthal angle
Definition: PtEtaPhiMass.h:53
float rho() const
transverse momentum
Definition: PtEtaPhiMass.h:49
constexpr float eta() const
momentum pseudorapidity
Definition: PtEtaPhiMass.h:28
constexpr float phi() const
momentum azimuthal angle
Definition: PtEtaPhiMass.h:30
float float float z
Definition: PtEtaPhiMass.h:6
float __attribute__((always_inline)) __attribute__((pure)) etaFromXYZ(float x
constexpr float pt() const
transverse momentum
Definition: PtEtaPhiMass.h:26
RhoEtaPhi(float irho, float ieta, float iphi)
Definition: PtEtaPhiMass.h:45
float float y
Definition: PtEtaPhiMass.h:6
T sqrt(T t)
Definition: SSEVec.h:18
constexpr PtEtaPhiMass(float ipt, float ieta, float iphi, float imass)
Definition: PtEtaPhiMass.h:22
float eta() const
momentum pseudorapidity
Definition: PtEtaPhiMass.h:51
float rho_
Definition: PtEtaPhiMass.h:39
#define constexpr
constexpr float mass() const
mass
Definition: PtEtaPhiMass.h:32