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)) etaFromXYZ(float x, float y, float z) {
6  float t(z / std::sqrt(x * x + y * y));
7  return ::asinhf(t);
8 }
9 inline float __attribute__((always_inline)) __attribute__((pure)) etaFromRZ(float r, float z) {
10  float t(z / r);
11  return ::asinhf(t);
12 }
13 
16 class PtEtaPhiMass {
17 private:
18  float pt_, eta_, phi_, mass_;
19 
20 public:
21  // default constructor (unitialized)
23 
24  //positional constructor (still compatible with Root, c++03)
25  constexpr PtEtaPhiMass(float ipt, float ieta, float iphi, float imass)
26  : pt_(ipt), eta_(ieta), phi_(iphi), mass_(imass) {}
27 
29  constexpr float pt() const { return pt_; }
31  constexpr float eta() const { return eta_; }
33  constexpr float phi() const { return phi_; }
35  constexpr float mass() const { return mass_; }
36 };
37 
38 class RhoEtaPhi {
39 private:
40  float rho_, eta_, phi_;
41 
42 public:
43  // default constructor (unitialized)
44  RhoEtaPhi() {}
45 
46  //positional constructor (still compatible with Root, c++03)
47  RhoEtaPhi(float irho, float ieta, float iphi) : rho_(irho), eta_(ieta), phi_(iphi) {}
48 
50  float rho() const { return rho_; }
52  float eta() const { return eta_; }
54  float phi() const { return phi_; }
55 };
56 
57 #endif
constexpr float mass() const
mass
Definition: PtEtaPhiMass.h:35
float float float z
Definition: PtEtaPhiMass.h:5
float __attribute__((always_inline)) __attribute__((pure)) etaFromXYZ(float x
RhoEtaPhi(float irho, float ieta, float iphi)
Definition: PtEtaPhiMass.h:47
constexpr float eta() const
momentum pseudorapidity
Definition: PtEtaPhiMass.h:31
float float y
Definition: PtEtaPhiMass.h:5
T sqrt(T t)
Definition: SSEVec.h:19
float phi() const
momentum azimuthal angle
Definition: PtEtaPhiMass.h:54
float phi_
Definition: PtEtaPhiMass.h:40
constexpr PtEtaPhiMass(float ipt, float ieta, float iphi, float imass)
Definition: PtEtaPhiMass.h:25
constexpr float phi() const
momentum azimuthal angle
Definition: PtEtaPhiMass.h:33
float eta() const
momentum pseudorapidity
Definition: PtEtaPhiMass.h:52
float eta_
Definition: PtEtaPhiMass.h:40
float x
float rho_
Definition: PtEtaPhiMass.h:40
constexpr float pt() const
transverse momentum
Definition: PtEtaPhiMass.h:29
float rho() const
transverse momentum
Definition: PtEtaPhiMass.h:50