CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
float phi() const
momentum azimuthal angle
Definition: PtEtaPhiMass.h:54
float rho() const
transverse momentum
Definition: PtEtaPhiMass.h:50
constexpr float eta() const
momentum pseudorapidity
Definition: PtEtaPhiMass.h:31
constexpr float phi() const
momentum azimuthal angle
Definition: PtEtaPhiMass.h:33
constexpr float pt() const
transverse momentum
Definition: PtEtaPhiMass.h:29
RhoEtaPhi(float irho, float ieta, float iphi)
Definition: PtEtaPhiMass.h:47
float float float z
T sqrt(T t)
Definition: SSEVec.h:19
float __attribute__((vector_size(8))) cms_float32x2_t
Definition: ExtVec.h:12
float phi_
Definition: PtEtaPhiMass.h:40
constexpr PtEtaPhiMass(float ipt, float ieta, float iphi, float imass)
Definition: PtEtaPhiMass.h:25
float eta_
Definition: PtEtaPhiMass.h:40
float x
float eta() const
momentum pseudorapidity
Definition: PtEtaPhiMass.h:52
float rho_
Definition: PtEtaPhiMass.h:40
constexpr float mass() const
mass
Definition: PtEtaPhiMass.h:35