ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
P4ImplPxPyPzE Class Reference

#include <P4ImplPxPyPzE.h>

Inheritance diagram for P4ImplPxPyPzE:
Collaboration diagram for P4ImplPxPyPzE:

Public Types

typedef FourMomentumError< P4ImplPxPyPzEErrorType
 

Public Member Functions

 P4ImplPxPyPzE ()
 Default constructor: More...
 
 P4ImplPxPyPzE (const P4ImplPxPyPzE &rhs)
 Copy constructor: More...
 
P4ImplPxPyPzEoperator= (const P4ImplPxPyPzE &rhs)
 Assignment operator: More...
 
 P4ImplPxPyPzE (const double px, const double py, const double pz, const double e)
 constructor with all data members More...
 
 P4ImplPxPyPzE (const CLHEP::HepLorentzVector &hlv)
 constructor from hlv to allow conversion from hlv More...
 
 P4ImplPxPyPzE (const I4Momentum &theI4M)
 constructor from any I4Momentum reference More...
 
 P4ImplPxPyPzE (const I4Momentum *const theI4M)
 constructor from any I4Momentum pointer More...
 
virtual ~P4ImplPxPyPzE ()
 Destructor: More...
 
double px () const
 {@ a la I4Momentum -like interface More...
 
double py () const
 get py data member More...
 
double pz () const
 get pz data member More...
 
double e () const
 get energy data member More...
 
virtual const I4MomentumErrorerrors () const
 
I4Momentum::Kind kind () const
 
void setPx (const double thePx)
 set Px data member More...
 
void setPy (const double thePy)
 set Py data member More...
 
void setPz (const double thePz)
 set Pz data member More...
 
void setE (const double theE)
 set energy data member More...
 
void set4Mom (const I4Momentum &theI4Mom)
 set all 4-mom from another I4Momentum reference
More...
 
void set4Mom (const I4Momentum *const theI4Mom)
 set all 4-mom from another I4Momentum pointer
More...
 
void set4Mom (const CLHEP::HepLorentzVector &theHlv)
 set all 4-mom from CLHEP::HepLorentzVector
More...
 
void setErrors (const ErrorMatrixPxPyPzE &err)
 set the errors More...
 
double m () const
 
double m2 () const
 
double p () const
 
double p2 () const
 
double eta () const
 
double rapidity () const
 
double phi () 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
 
std::ostream & dump (std::ostream &out) const
 Print I4Momentum content. More...
 

Private Attributes

double m_px
 
double m_py
 
double m_pz
 
double m_e
 
std::unique_ptr< ErrorTypem_error
 

Friends

class P4ImplPxPyPzECnv_p1
 

Detailed Description

Definition at line 31 of file P4ImplPxPyPzE.h.

Member Typedef Documentation

◆ ErrorType

Definition at line 43 of file P4ImplPxPyPzE.h.

Constructor & Destructor Documentation

◆ P4ImplPxPyPzE() [1/6]

P4ImplPxPyPzE::P4ImplPxPyPzE ( )
inline

Default constructor:

Definition at line 139 of file P4ImplPxPyPzE.h.

139  :
140  P4BasePxPyPzE( ),
141  m_px ( 0.*CLHEP::GeV ),
142  m_py ( 0.*CLHEP::GeV ),
143  m_pz ( 0.*CLHEP::GeV ),
144  m_e ( 0.*CLHEP::GeV ),
145  m_error(nullptr)
146 {}

◆ P4ImplPxPyPzE() [2/6]

P4ImplPxPyPzE::P4ImplPxPyPzE ( const P4ImplPxPyPzE rhs)
inline

Copy constructor:

Definition at line 148 of file P4ImplPxPyPzE.h.

148  :
149  P4BasePxPyPzE( ),
150  m_px ( rhs.m_px ),
151  m_py ( rhs.m_py ),
152  m_pz ( rhs.m_pz ),
153  m_e ( rhs.m_e ),
154  m_error(nullptr)
155 {}

◆ P4ImplPxPyPzE() [3/6]

P4ImplPxPyPzE::P4ImplPxPyPzE ( const double  px,
const double  py,
const double  pz,
const double  e 
)
inline

constructor with all data members

Definition at line 157 of file P4ImplPxPyPzE.h.

160  :
161  P4BasePxPyPzE( ),
162  m_px( px ),
163  m_py( py ),
164  m_pz( pz ),
165  m_e ( e ),
166  m_error(nullptr)
167 {}

◆ P4ImplPxPyPzE() [4/6]

P4ImplPxPyPzE::P4ImplPxPyPzE ( const CLHEP::HepLorentzVector &  hlv)
inline

constructor from hlv to allow conversion from hlv

Definition at line 169 of file P4ImplPxPyPzE.h.

169  :
170  P4BasePxPyPzE( ),
171  m_px( hlv.px() ),
172  m_py( hlv.py() ),
173  m_pz( hlv.pz() ),
174  m_e ( hlv.e() ),
175  m_error(nullptr)
176 {}

◆ P4ImplPxPyPzE() [5/6]

P4ImplPxPyPzE::P4ImplPxPyPzE ( const I4Momentum theI4M)
inlineexplicit

constructor from any I4Momentum reference

Definition at line 178 of file P4ImplPxPyPzE.h.

178  :
179  P4BasePxPyPzE( ),
180  m_px ( i4Mom.px() ),
181  m_py ( i4Mom.py() ),
182  m_pz ( i4Mom.pz() ),
183  m_e ( i4Mom.e() ),
184  m_error(nullptr)
185 {}

◆ P4ImplPxPyPzE() [6/6]

P4ImplPxPyPzE::P4ImplPxPyPzE ( const I4Momentum *const  theI4M)
inlineexplicit

constructor from any I4Momentum pointer

Definition at line 187 of file P4ImplPxPyPzE.h.

187  :
188  P4BasePxPyPzE( ),
189  m_px ( i4Mom->px() ),
190  m_py ( i4Mom->py() ),
191  m_pz ( i4Mom->pz() ),
192  m_e ( i4Mom->e() ),
193  m_error(nullptr)
194 {}

◆ ~P4ImplPxPyPzE()

P4ImplPxPyPzE::~P4ImplPxPyPzE ( )
inlinevirtual

Destructor:

Definition at line 196 of file P4ImplPxPyPzE.h.

197 {}

Member Function Documentation

◆ cosPhi()

double P4BasePxPyPzE::cosPhi ( ) const
inlineinherited

Definition at line 138 of file P4BasePxPyPzE.h.

139 {
140  if ( this->px() == 0 && this->py() ==0 )
141  return 0;
142  return this->px()/this->pt();
143 }

◆ cosTh()

double P4BasePxPyPzE::cosTh ( ) const
inlineinherited

Definition at line 195 of file P4BasePxPyPzE.h.

196 {
197  if ( this->p() == 0 ) return 0;
198  return this->pz()/this->p();
199 }

◆ cotTh()

double P4BasePxPyPzE::cotTh ( ) const
inlineinherited

Definition at line 213 of file P4BasePxPyPzE.h.

214 {
215  if ( this->pt() == 0 ) return 0;
216  return this->pz()/this->pt();
217 }

◆ dump()

std::ostream & P4BasePxPyPzE::dump ( std::ostream &  out) const
inlineinherited

Print I4Momentum content.

Definition at line 224 of file P4BasePxPyPzE.h.

225 {
226  std::stringstream s;
227  s << "[px,py,pz,e] ="
228  << std::right << std::scientific << std::setprecision(8)
229  << std::setw(16) << this->px()
230  << std::setw(16) << this->py()
231  << std::setw(16) << this->pz()
232  << std::setw(16) << this->e();
233 
234  out << s.str();
235  return out;
236 }

◆ e()

double P4ImplPxPyPzE::e ( ) const
inlinevirtual

get energy data member

Implements P4BasePxPyPzE.

Definition at line 214 of file P4ImplPxPyPzE.h.

215 {
216  return m_e;
217 }

◆ errors()

const I4MomentumError * P4ImplPxPyPzE::errors ( ) const
inlinevirtual

Definition at line 219 of file P4ImplPxPyPzE.h.

220 {
221  // check if the pointer is empty before dereferencing
222  return m_error.get();
223 }

◆ et()

double P4BasePxPyPzE::et ( ) const
inlineinherited

Definition at line 162 of file P4BasePxPyPzE.h.

163 {
164  if ( this->e() == 0 )
165  return 0;
166  return this->e()*this->sinTh();
167 }

◆ eta()

double P4BasePxPyPzE::eta ( ) const
inlineinherited

Definition at line 123 of file P4BasePxPyPzE.h.

124 {
125  const double px=this->px();
126  const double py=this->py();
127  const double pz=this->pz();
128  // FIXME: should we use a more underflow-friendly formula:
129  // sqrt(a**2 + b**2)
130  // => y.sqrt(1+(x/y)**2) where y=max(|a|,|b|) and x=min(|a|,|b|)
131  const double p =std::sqrt (px*px + py*py + pz*pz);
132  if (p==0.0) return 0.0;
133  if (p==+pz) return +std::numeric_limits<double>::infinity();
134  if (p==-pz) return -std::numeric_limits<double>::infinity();
135  return 0.5*log((p+pz)/(p-pz));
136 }

◆ hlv()

CLHEP::HepLorentzVector P4BasePxPyPzE::hlv ( ) const
inlineinherited

Definition at line 219 of file P4BasePxPyPzE.h.

220 {
221  return CLHEP::HepLorentzVector(this->px(),this->py(),this->pz(),this->e());
222 }

◆ iPt()

double P4BasePxPyPzE::iPt ( ) const
inlineinherited

Definition at line 177 of file P4BasePxPyPzE.h.

178 {
179  const double pt = this->pt();
180  if ( pt == 0 )
181  return std::numeric_limits<double>::infinity();
182  return 1./pt;
183 }

◆ kind()

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

Definition at line 92 of file P4ImplPxPyPzE.h.

92 { return I4Momentum::P4PXPYPZE; };

◆ m()

double P4BasePxPyPzE::m ( ) const
inlineinherited

Definition at line 92 of file P4BasePxPyPzE.h.

93 {
94  const double m2 = this->m2();
95  return m2 < 0. ? -std::sqrt(-m2) : std::sqrt(m2);
96 }

◆ m2()

double P4BasePxPyPzE::m2 ( ) const
inlineinherited

Definition at line 98 of file P4BasePxPyPzE.h.

99 {
100  const double px = this->px();
101  const double py = this->py();
102  const double pz = this->pz();
103  const double e = this->e();
104 
105  const double m2 = e*e - ( px*px + py*py + pz*pz );
106  return m2;
107 }

◆ operator=()

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

Assignment operator:

Definition at line 14 of file P4ImplPxPyPzE.cxx.

15 {
16  if ( this != &rhs ) {
17  m_px = rhs.m_px;
18  m_py = rhs.m_py;
19  m_pz = rhs.m_pz;
20  m_e = rhs.m_e;
21  }
22  return *this;
23 }

◆ p()

double P4BasePxPyPzE::p ( ) const
inlineinherited

Definition at line 109 of file P4BasePxPyPzE.h.

110 {
111  return std::sqrt( this->p2() );
112 }

◆ p2()

double P4BasePxPyPzE::p2 ( ) const
inlineinherited

Definition at line 114 of file P4BasePxPyPzE.h.

115 {
116  const double px = this->px();
117  const double py = this->py();
118  const double pz = this->pz();
119 
120  return px*px + py*py + pz*pz;
121 }

◆ phi()

double P4BasePxPyPzE::phi ( ) const
inlineinherited

Definition at line 152 of file P4BasePxPyPzE.h.

153 {
154  const double px=this->px();
155  const double py=this->py();
156  // return px == 0.0 && py == 0.0 ? 0.0 : std::atan2(py,px);
157  // AFAIK, atan2 is doing exactly this
158  return std::atan2(py,px);
159 }

◆ pt()

double P4BasePxPyPzE::pt ( ) const
inlineinherited

Definition at line 169 of file P4BasePxPyPzE.h.

170 {
171  const double px=this->px();
172  const double py=this->py();
173 
174  return std::sqrt(px*px + py*py);
175 }

◆ px()

double P4ImplPxPyPzE::px ( ) const
inlinevirtual

{@ a la I4Momentum -like interface

get px data member

Implements P4BasePxPyPzE.

Definition at line 199 of file P4ImplPxPyPzE.h.

200 {
201  return m_px;
202 }

◆ py()

double P4ImplPxPyPzE::py ( ) const
inlinevirtual

get py data member

Implements P4BasePxPyPzE.

Definition at line 204 of file P4ImplPxPyPzE.h.

205 {
206  return m_py;
207 }

◆ pz()

double P4ImplPxPyPzE::pz ( ) const
inlinevirtual

get pz data member

Implements P4BasePxPyPzE.

Definition at line 209 of file P4ImplPxPyPzE.h.

210 {
211  return m_pz;
212 }

◆ rapidity()

double P4BasePxPyPzE::rapidity ( ) const
inlineinherited

Definition at line 185 of file P4BasePxPyPzE.h.

186 {
187  const double e =this->e();
188  const double pz=this->pz();
189  if (e==0.0) return 0.0;
190  if (e==+pz) return +std::numeric_limits<double>::infinity();
191  if (e==-pz) return -std::numeric_limits<double>::infinity();
192  return 0.5*std::log((e+pz)/(e-pz));
193 }

◆ set4Mom() [1/3]

void P4ImplPxPyPzE::set4Mom ( const CLHEP::HepLorentzVector &  theHlv)
inline

set all 4-mom from CLHEP::HepLorentzVector

Definition at line 259 of file P4ImplPxPyPzE.h.

260 {
261  m_px = hlv.px();
262  m_py = hlv.py();
263  m_pz = hlv.pz();
264  m_e = hlv.e();
265 }

◆ set4Mom() [2/3]

void P4ImplPxPyPzE::set4Mom ( const I4Momentum theI4Mom)
inline

set all 4-mom from another I4Momentum reference

Definition at line 245 of file P4ImplPxPyPzE.h.

246 {
247  m_px = i4Mom.px();
248  m_py = i4Mom.py();
249  m_pz = i4Mom.pz();
250  m_e = i4Mom.e();
251 }

◆ set4Mom() [3/3]

void P4ImplPxPyPzE::set4Mom ( const I4Momentum *const  theI4Mom)
inline

set all 4-mom from another I4Momentum pointer

Definition at line 253 of file P4ImplPxPyPzE.h.

254 {
255  this->set4Mom(*i4Mom);
256 }

◆ setE()

void P4ImplPxPyPzE::setE ( const double  theE)
inline

set energy data member

Definition at line 240 of file P4ImplPxPyPzE.h.

241 {
242  m_e = e;
243 }

◆ setErrors()

void P4ImplPxPyPzE::setErrors ( const ErrorMatrixPxPyPzE err)
inline

set the errors

Definition at line 267 of file P4ImplPxPyPzE.h.

268 {
269  m_error = std::make_unique< ErrorType>( err, *this);
270 }

◆ setPx()

void P4ImplPxPyPzE::setPx ( const double  thePx)
inline

set Px data member

Definition at line 225 of file P4ImplPxPyPzE.h.

226 {
227  m_px = px;
228 }

◆ setPy()

void P4ImplPxPyPzE::setPy ( const double  thePy)
inline

set Py data member

Definition at line 230 of file P4ImplPxPyPzE.h.

231 {
232  m_py = py;
233 }

◆ setPz()

void P4ImplPxPyPzE::setPz ( const double  thePz)
inline

set Pz data member

Definition at line 235 of file P4ImplPxPyPzE.h.

236 {
237  m_pz = pz;
238 }

◆ sinPhi()

double P4BasePxPyPzE::sinPhi ( ) const
inlineinherited

Definition at line 145 of file P4BasePxPyPzE.h.

146 {
147  if ( this->px() == 0 && this->py() ==0 )
148  return 0;
149  return this->py()/this->pt();
150 }

◆ sinTh()

double P4BasePxPyPzE::sinTh ( ) const
inlineinherited

Definition at line 201 of file P4BasePxPyPzE.h.

202 {
203  if ( this->p() == 0 ) return 0;
204  return this->pt()/this->p();
205 }

◆ tanTh()

double P4BasePxPyPzE::tanTh ( ) const
inlineinherited

Definition at line 207 of file P4BasePxPyPzE.h.

208 {
209  if ( this->pz() == 0 ) return 0;
210  return this->pt()/this->pz();
211 }

Friends And Related Function Documentation

◆ P4ImplPxPyPzECnv_p1

friend class P4ImplPxPyPzECnv_p1
friend

Definition at line 36 of file P4ImplPxPyPzE.h.

Member Data Documentation

◆ m_e

double P4ImplPxPyPzE::m_e
private

Definition at line 130 of file P4ImplPxPyPzE.h.

◆ m_error

std::unique_ptr< ErrorType> P4ImplPxPyPzE::m_error
private

Definition at line 131 of file P4ImplPxPyPzE.h.

◆ m_px

double P4ImplPxPyPzE::m_px
private

Definition at line 127 of file P4ImplPxPyPzE.h.

◆ m_py

double P4ImplPxPyPzE::m_py
private

Definition at line 128 of file P4ImplPxPyPzE.h.

◆ m_pz

double P4ImplPxPyPzE::m_pz
private

Definition at line 129 of file P4ImplPxPyPzE.h.


The documentation for this class was generated from the following files:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
P4ImplPxPyPzE::m_pz
double m_pz
Definition: P4ImplPxPyPzE.h:129
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
P4ImplPxPyPzE::m_error
std::unique_ptr< ErrorType > m_error
Definition: P4ImplPxPyPzE.h:131
P4ImplPxPyPzE::py
double py() const
get py data member
Definition: P4ImplPxPyPzE.h:204
P4BasePxPyPzE::hlv
CLHEP::HepLorentzVector hlv() const
Definition: P4BasePxPyPzE.h:219
P4BasePxPyPzE::p
double p() const
Definition: P4BasePxPyPzE.h:109
P4BasePxPyPzE::pz
virtual double pz() const =0
P4ImplPxPyPzE::m_px
double m_px
Definition: P4ImplPxPyPzE.h:127
P4BasePxPyPzE::sinTh
double sinTh() const
Definition: P4BasePxPyPzE.h:201
P4ImplPxPyPzE::px
double px() const
{@ a la I4Momentum -like interface
Definition: P4ImplPxPyPzE.h:199
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:193
P4ImplPxPyPzE::m_e
double m_e
Definition: P4ImplPxPyPzE.h:130
P4BasePxPyPzE::p2
double p2() const
Definition: P4BasePxPyPzE.h:114
P4ImplPxPyPzE::m_py
double m_py
Definition: P4ImplPxPyPzE.h:128
P4BasePxPyPzE::pt
double pt() const
Definition: P4BasePxPyPzE.h:169
P4ImplPxPyPzE::e
double e() const
get energy data member
Definition: P4ImplPxPyPzE.h:214
P4BasePxPyPzE
Definition: P4BasePxPyPzE.h:28
P4BasePxPyPzE::m2
double m2() const
Definition: P4BasePxPyPzE.h:98
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
P4ImplPxPyPzE::set4Mom
void set4Mom(const I4Momentum &theI4Mom)
set all 4-mom from another I4Momentum reference
Definition: P4ImplPxPyPzE.h:245
P4BasePxPyPzE::py
virtual double py() const =0
P4ImplPxPyPzE::pz
double pz() const
get pz data member
Definition: P4ImplPxPyPzE.h:209
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
P4BasePxPyPzE::e
virtual double e() const =0
P4BasePxPyPzE::px
virtual double px() const =0
{@ a la I4Momentum -like interface
I4Momentum::P4PXPYPZE
@ P4PXPYPZE
Definition: I4Momentum.h:33