ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
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. More...
 
 SignedKinematics (const TLorentzVector &tlv)
 Construct from a TLorentzVector. More...
 
 SignedKinematics (const xAOD::IParticle &particle)
 Construct from an IParticle. More...
 
int sign () const
 The sign of the kinematics. More...
 
double eta () const
 Direction. More...
 
double phi () const
 
double sinPhi () const
 Provide accessors for sin and cos phi. More...
 
double cosPhi () const
 
double sinhEta () const
 Provide accessors for sinh and cosh eta. More...
 
double coshEta () const
 
double p () const
 Momentum values (signed) momentum. More...
 
double absP () const
 unsigned momentum More...
 
double p2 () const
 
double pt () const
 (signed) pt More...
 
double absPt () const
 unsigned pt More...
 
double pt2 () const
 
double px () const
 
double py () const
 
double pz () const
 
double energy () const
 Energy values (signed) energy. More...
 
double absEnergy () const
 unsigned energy More...
 
double energy2 () const
 
double et () const
 (signed) et More...
 
double absEt () const
 Unsigned et. More...
 
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. More...
 
 operator ROOT::Math::PxPyPzEVector () const
 
SignedKinematicsoperator+= (const SignedKinematics &other)
 Add another SignedKinematics to this. More...
 
SignedKinematicsoperator-= (const SignedKinematics &other)
 Subtract a SignedKinematics from this (exact opposite of the above function. More...
 

Static Public Member Functions

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

Private Attributes

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

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  {}

◆ 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  {}

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  }

◆ 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  }

◆ 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  }

◆ 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  }

◆ ez()

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

Definition at line 155 of file SignedKinematics.cxx.

155  {
156  return et() * sinhEta();
157  }

◆ 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  }

◆ 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(
44  }

◆ 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  }

◆ 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  }

◆ 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  }

◆ 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:
HLT::MET::SignedKinematics::cosPhi
double cosPhi() const
Definition: SignedKinematics.cxx:79
HLT::MET::SignedKinematics::px
double px() const
Definition: SignedKinematics.cxx:121
et
Extra patterns decribing particle interation process.
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
HLT::MET::SignedKinematics::sinPhi
double sinPhi() const
Provide accessors for sin and cos phi.
Definition: SignedKinematics.cxx:73
HLT::MET::SignedKinematics::coshEta
double coshEta() const
Definition: SignedKinematics.cxx:92
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
HLT::MET::SignedKinematics::pt
double pt() const
(signed) pt
Definition: SignedKinematics.cxx:112
dqt_zlumi_pandas.mass
mass
Definition: dqt_zlumi_pandas.py:170
HLT::MET::SignedKinematics::fromEtEtaPhiM
static SignedKinematics fromEtEtaPhiM(double et, double eta, double phi, double mass)
Factory function to construct from et eta, phi and m.
Definition: SignedKinematics.cxx:52
HLT::MET::SignedKinematics::absPt
double absPt() const
unsigned pt
Definition: SignedKinematics.cxx:115
HLT::MET::SignedKinematics::absP
double absP() const
unsigned momentum
Definition: SignedKinematics.cxx:106
HLT::MET::SignedKinematics::m_p4
ROOT::Math::PxPyPzEVector m_p4
The actual kinematics.
Definition: SignedKinematics.h:119
HLT::MET::SignedKinematics::sign
int sign() const
The sign of the kinematics.
Definition: SignedKinematics.cxx:58
HLT::MET::SignedKinematics::sinhEta
double sinhEta() const
Provide accessors for sinh and cosh eta.
Definition: SignedKinematics.cxx:86
HLT::MET::SignedKinematics::et
double et() const
(signed) et
Definition: SignedKinematics.cxx:140
HLT::MET::SignedKinematics::p
double p() const
Momentum values (signed) momentum.
Definition: SignedKinematics.cxx:103
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
HLT::MET::SignedKinematics::fromEnergyEtaPhiM
static SignedKinematics fromEnergyEtaPhiM(double energy, double eta, double phi, double mass)
Factory function to construct from energy eta, phi and m.
Definition: SignedKinematics.cxx:32
HLT::MET::SignedKinematics::pt2
double pt2() const
Definition: SignedKinematics.cxx:118
HLT::MET::SignedKinematics::phi
double phi() const
Definition: SignedKinematics.cxx:66
HLT::MET::SignedKinematics::energy
double energy() const
Energy values (signed) energy.
Definition: SignedKinematics.cxx:131
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
HLT::MET::SignedKinematics::pz
double pz() const
Definition: SignedKinematics.cxx:127
HLT::MET::SignedKinematics::SignedKinematics
SignedKinematics()
Definition: SignedKinematics.cxx:11
HLT::MET::SignedKinematics::p2
double p2() const
Definition: SignedKinematics.cxx:109
HLT::MET::SignedKinematics::energy2
double energy2() const
Definition: SignedKinematics.cxx:137
HLT::MET::SignedKinematics::eta
double eta() const
Direction.
Definition: SignedKinematics.cxx:62
HLT::MET::SignedKinematics::py
double py() const
Definition: SignedKinematics.cxx:124