ATLAS Offline Software
Loading...
Searching...
No Matches
HLT::MET::SignedKinematics Class Reference

Class to describe the kinematics of an object that can have negative energies. More...

#include <SignedKinematics.h>

Collaboration diagram for HLT::MET::SignedKinematics:

Public Member Functions

 SignedKinematics ()
 SignedKinematics (double px, double py, double pz, double energy)
 Constructor from px, py, pz and E.
 SignedKinematics (const TLorentzVector &tlv)
 Construct from a TLorentzVector.
 SignedKinematics (const xAOD::IParticle &particle)
 Construct from an IParticle.
int sign () const
 The sign of the kinematics.
double eta () const
 Direction.
double phi () const
double sinPhi () const
 Provide accessors for sin and cos phi.
double cosPhi () const
double sinhEta () const
 Provide accessors for sinh and cosh eta.
double coshEta () const
double p () const
 Momentum values (signed) momentum.
double absP () const
 unsigned momentum
double p2 () const
double pt () const
 (signed) pt
double absPt () const
 unsigned pt
double pt2 () const
double px () const
double py () const
double pz () const
double energy () const
 Energy values (signed) energy.
double absEnergy () const
 unsigned energy
double energy2 () const
double et () const
 (signed) et
double absEt () const
 Unsigned et.
double et2 () const
double ex () const
double ey () const
double ez () const
double m2 () const
 The squared mass. There is no guarantee that this will be > 0.
 operator ROOT::Math::PxPyPzEVector () const
SignedKinematicsoperator+= (const SignedKinematics &other)
 Add another SignedKinematics to this.
SignedKinematicsoperator-= (const SignedKinematics &other)
 Subtract a SignedKinematics from this (exact opposite of the above function.

Static Public Member Functions

static SignedKinematics fromEnergyEtaPhi (double energy, double eta, double phi)
 Factory function to construct from energy, eta, phi (massless)
static SignedKinematics fromEnergyEtaPhiM (double energy, double eta, double phi, double mass)
 Factory function to construct from energy eta, phi and m.
static SignedKinematics fromEtEtaPhi (double et, double eta, double phi)
 Factory function to construct from et, eta, phi (massless)
static SignedKinematics fromEtEtaPhiM (double et, double eta, double phi, double mass)
 Factory function to construct from et eta, phi and m.

Private Attributes

ROOT::Math::PxPyPzEVector m_p4
 The actual kinematics.

Detailed Description

Class to describe the kinematics of an object that can have negative energies.

This class is used instead of TLorentzVector anywhere that there could be a negative energy. This is to get complete control of the behaviour in that case as TLorentzVector behaves oddly.

Algebraic operators are provided but it's worth noting that negative-energy objects behaviour a little oddly (they are not valid four-momenta after all). This should only really affect the mass.

The sign of the vector is defined as sign(E) where E is the scalar sum of all constituents energies

Definition at line 42 of file SignedKinematics.h.

Constructor & Destructor Documentation

◆ SignedKinematics() [1/4]

HLT::MET::SignedKinematics::SignedKinematics ( )

Definition at line 11 of file SignedKinematics.cxx.

11{}

◆ SignedKinematics() [2/4]

HLT::MET::SignedKinematics::SignedKinematics ( double px,
double py,
double pz,
double energy )

Constructor from px, py, pz and E.

Definition at line 12 of file SignedKinematics.cxx.

13 :
14 m_p4(px, py, pz, energy)
15 {}
double energy() const
Energy values (signed) energy.
ROOT::Math::PxPyPzEVector m_p4
The actual kinematics.

◆ SignedKinematics() [3/4]

HLT::MET::SignedKinematics::SignedKinematics ( const TLorentzVector & tlv)

Construct from a TLorentzVector.

Definition at line 17 of file SignedKinematics.cxx.

17 :
18 m_p4(tlv.Px(), tlv.Py(), tlv.Pz(), tlv.E() )
19 {}

◆ SignedKinematics() [4/4]

HLT::MET::SignedKinematics::SignedKinematics ( const xAOD::IParticle & particle)

Construct from an IParticle.

Definition at line 21 of file SignedKinematics.cxx.

21 :
23 particle.e(), particle.eta(), particle.phi(), particle.m() ) )
24 {}
static SignedKinematics fromEnergyEtaPhiM(double energy, double eta, double phi, double mass)
Factory function to construct from energy eta, phi and m.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

Member Function Documentation

◆ absEnergy()

double HLT::MET::SignedKinematics::absEnergy ( ) const

unsigned energy

Definition at line 134 of file SignedKinematics.cxx.

134 {
135 return abs(energy() );
136 }

◆ absEt()

double HLT::MET::SignedKinematics::absEt ( ) const

Unsigned et.

Definition at line 143 of file SignedKinematics.cxx.

143 {
144 return abs(et() );
145 }
double et() const
(signed) et

◆ absP()

double HLT::MET::SignedKinematics::absP ( ) const

unsigned momentum

Definition at line 106 of file SignedKinematics.cxx.

106 {
107 return sqrt(p2() );
108 }

◆ absPt()

double HLT::MET::SignedKinematics::absPt ( ) const

unsigned pt

Definition at line 115 of file SignedKinematics.cxx.

115 {
116 return sqrt(pt2() );
117 }

◆ coshEta()

double HLT::MET::SignedKinematics::coshEta ( ) const

Definition at line 92 of file SignedKinematics.cxx.

92 {
93 double thePt2 = pt2();
94 // if pt is 0 then the value is not determined.
95 // Take eta = 0
96 if (thePt2 == 0)
97 return 1;
98 // Otherwise, calculate sinh^2 eta, then use
99 // cosh eta = sqrt(1 + sinh^2 eta)
100 return sqrt(1 + pz()*pz() / thePt2);
101 }

◆ cosPhi()

double HLT::MET::SignedKinematics::cosPhi ( ) const

Definition at line 79 of file SignedKinematics.cxx.

79 {
80 double thePt = pt();
81 // if pt() is 0 then the value is not determined.
82 // Take phi = 0
83 return (thePt == 0 ? 1 : px() / thePt );
84 }
double pt() const
(signed) pt

◆ energy()

double HLT::MET::SignedKinematics::energy ( ) const

Energy values (signed) energy.

Definition at line 131 of file SignedKinematics.cxx.

131 {
132 return m_p4.E();
133 }

◆ energy2()

double HLT::MET::SignedKinematics::energy2 ( ) const

Definition at line 137 of file SignedKinematics.cxx.

137 {
138 return energy()*energy();
139 }

◆ et()

double HLT::MET::SignedKinematics::et ( ) const

(signed) et

Definition at line 140 of file SignedKinematics.cxx.

140 {
141 return energy() / coshEta();
142 }

◆ et2()

double HLT::MET::SignedKinematics::et2 ( ) const

Definition at line 146 of file SignedKinematics.cxx.

146 {
147 return et()*et();
148 }

◆ eta()

double HLT::MET::SignedKinematics::eta ( ) const

Direction.

Definition at line 62 of file SignedKinematics.cxx.

62 {
63 return sign() * m_p4.Eta();
64 }
int sign() const
The sign of the kinematics.

◆ ex()

double HLT::MET::SignedKinematics::ex ( ) const

Definition at line 149 of file SignedKinematics.cxx.

149 {
150 return et() * cosPhi();
151 }

◆ ey()

double HLT::MET::SignedKinematics::ey ( ) const

Definition at line 152 of file SignedKinematics.cxx.

152 {
153 return et() * sinPhi();
154 }
double sinPhi() const
Provide accessors for sin and cos phi.

◆ ez()

double HLT::MET::SignedKinematics::ez ( ) const

Definition at line 155 of file SignedKinematics.cxx.

155 {
156 return et() * sinhEta();
157 }
double sinhEta() const
Provide accessors for sinh and cosh eta.

◆ fromEnergyEtaPhi()

SignedKinematics HLT::MET::SignedKinematics::fromEnergyEtaPhi ( double energy,
double eta,
double phi )
static

Factory function to construct from energy, eta, phi (massless)

Definition at line 26 of file SignedKinematics.cxx.

28 {
29 return fromEnergyEtaPhiM(energy, eta, phi, 0.);
30 }
double eta() const
Direction.

◆ fromEnergyEtaPhiM()

SignedKinematics HLT::MET::SignedKinematics::fromEnergyEtaPhiM ( double energy,
double eta,
double phi,
double mass )
static

Factory function to construct from energy eta, phi and m.

Definition at line 32 of file SignedKinematics.cxx.

34 {
35 double p = energy;
36 if (mass != 0) {
37 int sgn = (p > 0) - (p < 0);
38 p = sgn * sqrt(p*p - mass*mass);
39 }
40 double pt = p/std::cosh(eta);
41 double pz = pt*std::sinh(eta);
42 return SignedKinematics(
43 pt*std::cos(phi), pt*std::sin(phi), pz, energy);
44 }
double p() const
Momentum values (signed) momentum.

◆ fromEtEtaPhi()

SignedKinematics HLT::MET::SignedKinematics::fromEtEtaPhi ( double et,
double eta,
double phi )
static

Factory function to construct from et, eta, phi (massless)

Definition at line 46 of file SignedKinematics.cxx.

48 {
49 return fromEtEtaPhiM(et, eta, phi, 0.);
50 }
static SignedKinematics fromEtEtaPhiM(double et, double eta, double phi, double mass)
Factory function to construct from et eta, phi and m.

◆ fromEtEtaPhiM()

SignedKinematics HLT::MET::SignedKinematics::fromEtEtaPhiM ( double et,
double eta,
double phi,
double mass )
static

Factory function to construct from et eta, phi and m.

Definition at line 52 of file SignedKinematics.cxx.

54 {
55 return fromEnergyEtaPhiM(et*std::cosh(eta), eta, phi, mass);
56 }

◆ m2()

double HLT::MET::SignedKinematics::m2 ( ) const

The squared mass. There is no guarantee that this will be > 0.

Definition at line 159 of file SignedKinematics.cxx.

159 {
160 return energy2() - p2();
161 }

◆ operator ROOT::Math::PxPyPzEVector()

HLT::MET::SignedKinematics::operator ROOT::Math::PxPyPzEVector ( ) const
explicit

Definition at line 163 of file SignedKinematics.cxx.

163 {
164 return m_p4;
165 }

◆ operator+=()

SignedKinematics & HLT::MET::SignedKinematics::operator+= ( const SignedKinematics & other)

Add another SignedKinematics to this.

Definition at line 167 of file SignedKinematics.cxx.

168 {
169 m_p4.SetPx(px()+other.px() );
170 m_p4.SetPy(py()+other.py() );
171 m_p4.SetPz(pz()+other.pz() );
172 m_p4.SetE(energy()+other.energy() );
173 return *this;
174 }

◆ operator-=()

SignedKinematics & HLT::MET::SignedKinematics::operator-= ( const SignedKinematics & other)

Subtract a SignedKinematics from this (exact opposite of the above function.

Definition at line 175 of file SignedKinematics.cxx.

176 {
177 m_p4.SetPx(px()-other.px() );
178 m_p4.SetPy(py()-other.py() );
179 m_p4.SetPz(pz()-other.pz() );
180 m_p4.SetE(energy()-other.energy() );
181 return *this;
182 }

◆ p()

double HLT::MET::SignedKinematics::p ( ) const

Momentum values (signed) momentum.

Definition at line 103 of file SignedKinematics.cxx.

103 {
104 return sign() * absP();
105 }
double absP() const
unsigned momentum

◆ p2()

double HLT::MET::SignedKinematics::p2 ( ) const

Definition at line 109 of file SignedKinematics.cxx.

109 {
110 return pt2() + pz()*pz();
111 }

◆ phi()

double HLT::MET::SignedKinematics::phi ( ) const

Definition at line 66 of file SignedKinematics.cxx.

66 {
67 double val = m_p4.Phi();
68 if (sign() < 0)
69 val += TMath::Pi();
70 return TVector2::Phi_0_2pi(val);
71 }

◆ pt()

double HLT::MET::SignedKinematics::pt ( ) const

(signed) pt

Definition at line 112 of file SignedKinematics.cxx.

112 {
113 return sign() * absPt();
114 }
double absPt() const
unsigned pt

◆ pt2()

double HLT::MET::SignedKinematics::pt2 ( ) const

Definition at line 118 of file SignedKinematics.cxx.

118 {
119 return px()*px() + py()*py();
120 }

◆ px()

double HLT::MET::SignedKinematics::px ( ) const

Definition at line 121 of file SignedKinematics.cxx.

121 {
122 return m_p4.Px();
123 }

◆ py()

double HLT::MET::SignedKinematics::py ( ) const

Definition at line 124 of file SignedKinematics.cxx.

124 {
125 return m_p4.Py();
126 }

◆ pz()

double HLT::MET::SignedKinematics::pz ( ) const

Definition at line 127 of file SignedKinematics.cxx.

127 {
128 return m_p4.Pz();
129 }

◆ sign()

int HLT::MET::SignedKinematics::sign ( ) const

The sign of the kinematics.

Definition at line 58 of file SignedKinematics.cxx.

58 {
59 return (energy() > 0) - (energy() < 0);
60 }

◆ sinhEta()

double HLT::MET::SignedKinematics::sinhEta ( ) const

Provide accessors for sinh and cosh eta.

Definition at line 86 of file SignedKinematics.cxx.

86 {
87 double thePt = pt();
88 // if pt is 0 then the value is not determined.
89 // Take eta = 0
90 return (thePt == 0 ? 0 : pz() / thePt );
91 }

◆ sinPhi()

double HLT::MET::SignedKinematics::sinPhi ( ) const

Provide accessors for sin and cos phi.

Definition at line 73 of file SignedKinematics.cxx.

73 {
74 double thePt = pt();
75 // if pt() is 0 then the value is not determined.
76 // For this phi = 0
77 return (thePt == 0 ? 0 : py() / thePt );
78 }

Member Data Documentation

◆ m_p4

ROOT::Math::PxPyPzEVector HLT::MET::SignedKinematics::m_p4
private

The actual kinematics.

Definition at line 119 of file SignedKinematics.h.


The documentation for this class was generated from the following files: