ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
TruthParticleMomentum Class Reference

#include <TruthParticleMomentum.h>

Collaboration diagram for TruthParticleMomentum:

Public Member Functions

 TruthParticleMomentum ()
 Default constructor: More...
 
 TruthParticleMomentum (const TruthParticleMomentum &rhs)
 Copy constructor: More...
 
TruthParticleMomentumoperator= (const TruthParticleMomentum &rhs)
 Assignment operator: More...
 
 TruthParticleMomentum (const HepMC::FourVector &hlv)
 Constructor with parameters: More...
 
virtual ~TruthParticleMomentum ()
 Destructor: More...
 
double px () const
 {@ a la I4Momentum -like interface More...
 
double py () const
 
double pz () const
 
double m () const
 
double m2 () const
 
double p () const
 
double p2 () const
 
double rapidity () const
 
double eta () const
 
double phi () const
 
double e () const
 
double et () const
 
double pt () const
 
double iPt () const
 
double sinPhi () const
 
double cosPhi () const
 
double tanTh () const
 
double cotTh () const
 
double cosTh () const
 
double sinTh () const
 
CLHEP::HepLorentzVector hlv () const
 
const I4MomentumErrorerrors () const
 
I4Momentum::Kind kind () const
 
std::ostream & dump (std::ostream &out) const
 Print I4Momentum content. More...
 
virtual void set4Mom (const I4Momentum *const theI4Mom)
 set 4Momentum (will throw exception if cannot be implemented) More...
 
virtual void set4Mom (const I4Momentum &theI4Mom)
 set 4Momentum (will throw exception if cannot be implemented) More...
 
virtual void set4Mom (const CLHEP::HepLorentzVector &theHlv)
 set 4Momentum (will throw exception if cannot be implemented) More...
 
void set4Mom (const HepMC::FourVector &hlv)
 reset the proxied CLHEP HepLorentzVector More...
 

Private Attributes

const HepMC::FourVector * m_hlv
 The CLHEP::LorentzVector we are proxying (from the HepMC::GenParticle which is also being proxied) More...
 

Detailed Description

Definition at line 27 of file TruthParticleMomentum.h.

Constructor & Destructor Documentation

◆ TruthParticleMomentum() [1/3]

TruthParticleMomentum::TruthParticleMomentum ( )

Default constructor:

Definition at line 28 of file TruthParticleMomentum.cxx.

28  :
29  m_hlv( 0 )
30 {}

◆ TruthParticleMomentum() [2/3]

TruthParticleMomentum::TruthParticleMomentum ( const TruthParticleMomentum rhs)

Copy constructor:

Definition at line 32 of file TruthParticleMomentum.cxx.

32  :
33  m_hlv( rhs.m_hlv )
34 {}

◆ TruthParticleMomentum() [3/3]

TruthParticleMomentum::TruthParticleMomentum ( const HepMC::FourVector &  hlv)

Constructor with parameters:

Definition at line 46 of file TruthParticleMomentum.cxx.

46  :
47  m_hlv( &hlv )
48 {}

◆ ~TruthParticleMomentum()

TruthParticleMomentum::~TruthParticleMomentum ( )
virtual

Destructor:

Definition at line 50 of file TruthParticleMomentum.cxx.

51 {}

Member Function Documentation

◆ cosPhi()

double TruthParticleMomentum::cosPhi ( ) const
inline

Definition at line 239 of file TruthParticleMomentum.h.

240 {
241  return this->px()/this->pt();
242 }

◆ cosTh()

double TruthParticleMomentum::cosTh ( ) const
inline

Definition at line 254 of file TruthParticleMomentum.h.

255 {
256  return this->pz()/this->p();
257 }

◆ cotTh()

double TruthParticleMomentum::cotTh ( ) const
inline

Definition at line 264 of file TruthParticleMomentum.h.

265 {
266  return this->pz()/this->pt();
267 }

◆ dump()

std::ostream & TruthParticleMomentum::dump ( std::ostream &  out) const

Print I4Momentum content.

Definition at line 57 of file TruthParticleMomentum.cxx.

58 {
59  std::stringstream buf;
60  buf << "[px,py,pz,e] ="
61  << std::right << std::scientific << std::setprecision(8)
62  << std::setw(16) << this->px()
63  << std::setw(16) << this->py()
64  << std::setw(16) << this->pz()
65  << std::setw(16) << this->e();
66  return out << buf.str();
67 }

◆ e()

double TruthParticleMomentum::e ( ) const
inline

Definition at line 212 of file TruthParticleMomentum.h.

213 {
214  return m_hlv ? m_hlv->e() : 0.*CLHEP::GeV;
215 }

◆ errors()

const I4MomentumError* TruthParticleMomentum::errors ( ) const
inline

Definition at line 85 of file TruthParticleMomentum.h.

85 {return 0;}

◆ et()

double TruthParticleMomentum::et ( ) const
inline

Definition at line 217 of file TruthParticleMomentum.h.

218 {
219  //to be improved
220  const double theE = this->e();
221  const double theSinTh = this->sinTh();
222 
223  return theE*theSinTh;
224 }

◆ eta()

double TruthParticleMomentum::eta ( ) const
inline

Definition at line 189 of file TruthParticleMomentum.h.

190 {
191  const double px=this->px();
192  const double py=this->py();
193  const double pz=this->pz();
194  // FIXME: should we use a more underflow-friendly formula:
195  // sqrt(a**2 + b**2)
196  // => y.sqrt(1+(x/y)**2) where y=max(|a|,|b|) and x=min(|a|,|b|)
197  const double p =std::sqrt (px*px + py*py + pz*pz);
198  if (p==0.0) return 0.0;
199  if (p==+pz) return +std::numeric_limits<double>::infinity();
200  if (p==-pz) return -std::numeric_limits<double>::infinity();
201  return 0.5*log((p+pz)/(p-pz));
202 }

◆ hlv()

CLHEP::HepLorentzVector TruthParticleMomentum::hlv ( ) const
inline

Definition at line 269 of file TruthParticleMomentum.h.

270 {
271  return CLHEP::HepLorentzVector(m_hlv->px(), m_hlv->py(),
272  m_hlv->pz(), m_hlv->e() );
273 }

◆ iPt()

double TruthParticleMomentum::iPt ( ) const
inline

Definition at line 234 of file TruthParticleMomentum.h.

235 {
236  return 1./this->pt();
237 }

◆ kind()

I4Momentum::Kind TruthParticleMomentum::kind ( ) const
inline

Definition at line 88 of file TruthParticleMomentum.h.

88 { return I4Momentum::P4PXPYPZE; };

◆ m()

double TruthParticleMomentum::m ( ) const
inline

Definition at line 143 of file TruthParticleMomentum.h.

144 {
145  const double m2 = this->m2();
146  return m2 < 0. ? -std::sqrt(-m2) : std::sqrt(m2);
147 }

◆ m2()

double TruthParticleMomentum::m2 ( ) const
inline

Definition at line 149 of file TruthParticleMomentum.h.

150 {
151  const double thePx = this->px();
152  const double thePy = this->py();
153  const double thePz = this->pz();
154  const double theE = this->e();
155 
156  const double theM2=
157  theE*theE - ( thePx*thePx +
158  thePy*thePy +
159  thePz*thePz );
160 
161  return theM2;
162 
163 }

◆ operator=()

TruthParticleMomentum & TruthParticleMomentum::operator= ( const TruthParticleMomentum rhs)

Assignment operator:

Definition at line 38 of file TruthParticleMomentum.cxx.

39 {
40  if ( this != &rhs ) {
41  m_hlv = rhs.m_hlv;
42  }
43  return *this;
44 }

◆ p()

double TruthParticleMomentum::p ( ) const
inline

Definition at line 165 of file TruthParticleMomentum.h.

166 {
167  return std::sqrt( this->p2() );
168 }

◆ p2()

double TruthParticleMomentum::p2 ( ) const
inline

Definition at line 170 of file TruthParticleMomentum.h.

171 {
172  const double px = this->px();
173  const double py = this->py();
174  const double pz = this->pz();
175 
176  return px*px + py*py + pz*pz;
177 }

◆ phi()

double TruthParticleMomentum::phi ( ) const
inline

Definition at line 204 of file TruthParticleMomentum.h.

205 {
206  const double thePx = this->px();
207  const double thePy = this->py();
208  return thePx == 0.0 && thePy == 0.0 ? 0.0 : std::atan2(thePy,thePx);
209 }

◆ pt()

double TruthParticleMomentum::pt ( ) const
inline

Definition at line 226 of file TruthParticleMomentum.h.

227 {
228  const double thePx = this->px();
229  const double thePy = this->py();
230 
231  return std::sqrt(thePx*thePx+thePy*thePy);
232 }

◆ px()

double TruthParticleMomentum::px ( ) const
inline

{@ a la I4Momentum -like interface

Definition at line 128 of file TruthParticleMomentum.h.

129 {
130  return m_hlv ? m_hlv->px() : 0.*CLHEP::GeV;
131 }

◆ py()

double TruthParticleMomentum::py ( ) const
inline

Definition at line 133 of file TruthParticleMomentum.h.

134 {
135  return m_hlv ? m_hlv->py() : 0.*CLHEP::GeV;
136 }

◆ pz()

double TruthParticleMomentum::pz ( ) const
inline

Definition at line 138 of file TruthParticleMomentum.h.

139 {
140  return m_hlv ? m_hlv->pz() : 0.*CLHEP::GeV;
141 }

◆ rapidity()

double TruthParticleMomentum::rapidity ( ) const
inline

Definition at line 179 of file TruthParticleMomentum.h.

180 {
181  const double e =this->e();
182  const double pz=this->pz();
183  if (e==0.0) return 0.0;
184  if (e==+pz) return +std::numeric_limits<double>::infinity();
185  if (e==-pz) return -std::numeric_limits<double>::infinity();
186  return 0.5*std::log((e+pz)/(e-pz));
187 }

◆ set4Mom() [1/4]

void TruthParticleMomentum::set4Mom ( const CLHEP::HepLorentzVector &  theHlv)
inlinevirtual

set 4Momentum (will throw exception if cannot be implemented)

Definition at line 291 of file TruthParticleMomentum.h.

292 {
293  std::cout << " FATAL ERROR : TruthParticleMomentum::set4Mom called. Cannot change 4mom " << std::endl ;
294  std::abort();
295 }

◆ set4Mom() [2/4]

void TruthParticleMomentum::set4Mom ( const HepMC::FourVector &  hlv)
inline

reset the proxied CLHEP HepLorentzVector

Definition at line 299 of file TruthParticleMomentum.h.

300 {
301  m_hlv = &hlv;
302 }

◆ set4Mom() [3/4]

void TruthParticleMomentum::set4Mom ( const I4Momentum theI4Mom)
inlinevirtual

set 4Momentum (will throw exception if cannot be implemented)

Definition at line 275 of file TruthParticleMomentum.h.

276 {
277  std::cout << " FATAL ERROR : TruthParticleMomentum::set4Mom called. Cannot change 4mom " << std::endl ;
278  std::abort();
279 
280 
281 }

◆ set4Mom() [4/4]

void TruthParticleMomentum::set4Mom ( const I4Momentum *const  theI4Mom)
inlinevirtual

set 4Momentum (will throw exception if cannot be implemented)

Definition at line 283 of file TruthParticleMomentum.h.

284 {
285  std::cout << " FATAL ERROR : TruthParticleMomentum::set4Mom called. Cannot change 4mom " << std::endl ;
286  std::abort();
287 
288 
289 }

◆ sinPhi()

double TruthParticleMomentum::sinPhi ( ) const
inline

Definition at line 244 of file TruthParticleMomentum.h.

245 {
246  return this->py()/this->pt();
247 }

◆ sinTh()

double TruthParticleMomentum::sinTh ( ) const
inline

Definition at line 259 of file TruthParticleMomentum.h.

260 {
261  return this->pt()/this->p();
262 }

◆ tanTh()

double TruthParticleMomentum::tanTh ( ) const
inline

Definition at line 249 of file TruthParticleMomentum.h.

250 {
251  return this->pt()/this->pz();
252 }

Member Data Documentation

◆ m_hlv

const HepMC::FourVector* TruthParticleMomentum::m_hlv
private

The CLHEP::LorentzVector we are proxying (from the HepMC::GenParticle which is also being proxied)

Definition at line 121 of file TruthParticleMomentum.h.


The documentation for this class was generated from the following files:
TruthParticleMomentum::hlv
CLHEP::HepLorentzVector hlv() const
Definition: TruthParticleMomentum.h:269
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
TruthParticleMomentum::px
double px() const
{@ a la I4Momentum -like interface
Definition: TruthParticleMomentum.h:128
TruthParticleMomentum::py
double py() const
Definition: TruthParticleMomentum.h:133
TruthParticleMomentum::p
double p() const
Definition: TruthParticleMomentum.h:165
python.DecayParser.buf
buf
print ("=> [%s]"cmd)
Definition: DecayParser.py:27
TruthParticleMomentum::m_hlv
const HepMC::FourVector * m_hlv
The CLHEP::LorentzVector we are proxying (from the HepMC::GenParticle which is also being proxied)
Definition: TruthParticleMomentum.h:121
TruthParticleMomentum::pt
double pt() const
Definition: TruthParticleMomentum.h:226
TruthParticleMomentum::e
double e() const
Definition: TruthParticleMomentum.h:212
TruthParticleMomentum::m2
double m2() const
Definition: TruthParticleMomentum.h:149
TruthParticleMomentum::p2
double p2() const
Definition: TruthParticleMomentum.h:170
TruthParticleMomentum::sinTh
double sinTh() const
Definition: TruthParticleMomentum.h:259
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TruthParticleMomentum::pz
double pz() const
Definition: TruthParticleMomentum.h:138
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
I4Momentum::P4PXPYPZE
@ P4PXPYPZE
Definition: I4Momentum.h:33