ATLAS Offline Software
Loading...
Searching...
No Matches
P4ImplPxPyPzE.h
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7// P4ImplPxPyPzE.h
8// Header file for class P4::Impl::PxPyPzE
9// Author: S.Binet<binet@cern.ch>
11#ifndef FOURMOM_P4IMPLPXPYPZE_H
12#define FOURMOM_P4IMPLPXPYPZE_H
13
14// STL includes
15
16// CLHEP includes
17#include "CLHEP/Vector/LorentzVector.h"
18#include "CLHEP/Units/SystemOfUnits.h"
19
20// EventKernel includes
22
23// FourMom includes
26
27#include <memory>
28// Forward declaration
29class P4ImplPxPyPzECnv_p1; //> for persistency
30
32{
34 // friends:
36 friend class P4ImplPxPyPzECnv_p1;
37
39 // Public methods:
41 public:
42
44
48
51 P4ImplPxPyPzE( const P4ImplPxPyPzE& rhs );
52
56
58 P4ImplPxPyPzE( const double px, const double py,
59 const double pz, const double e );
60
62 P4ImplPxPyPzE( const CLHEP::HepLorentzVector& hlv);
63
65 explicit P4ImplPxPyPzE( const I4Momentum& theI4M );
66
68 explicit P4ImplPxPyPzE( const I4Momentum* const theI4M );
69
72 virtual ~P4ImplPxPyPzE();
73
75 // Const methods:
77
80
82 double px() const;
84 double py() const;
86 double pz() const;
88 double e() const;
89
90 virtual const I4MomentumError* errors() const;
91
93
96
98 // Non-const methods:
100
102 void setPx(const double thePx );
103
105 void setPy(const double thePy );
106
108 void setPz(const double thePz );
109
111 void setE(const double theE );
112
114 void set4Mom (const I4Momentum & theI4Mom );
116 void set4Mom (const I4Momentum * const theI4Mom );
118 void set4Mom (const CLHEP::HepLorentzVector & theHlv );
120 void setErrors( const ErrorMatrixPxPyPzE& err);
121
123 // Protected data:
125 private:
126
127 double m_px;
128 double m_py;
129 double m_pz;
130 double m_e;
131 std::unique_ptr< ErrorType> m_error;
132
133};
134
136// Inline methods:
138
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{}
147
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{}
156
157inline P4ImplPxPyPzE::P4ImplPxPyPzE( const double px,
158 const double py,
159 const double pz,
160 const double e ) :
161 P4BasePxPyPzE( ),
162 m_px( px ),
163 m_py( py ),
164 m_pz( pz ),
165 m_e ( e ),
166 m_error(nullptr)
167{}
168
169inline P4ImplPxPyPzE::P4ImplPxPyPzE( const CLHEP::HepLorentzVector& hlv ) :
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{}
177
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{}
186
187inline P4ImplPxPyPzE::P4ImplPxPyPzE( const I4Momentum* const i4Mom ) :
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{}
195
198
199inline double P4ImplPxPyPzE::px() const
200{
201 return m_px;
202}
203
204inline double P4ImplPxPyPzE::py() const
205{
206 return m_py;
207}
208
209inline double P4ImplPxPyPzE::pz() const
210{
211 return m_pz;
212}
213
214inline double P4ImplPxPyPzE::e() const
215{
216 return m_e;
217}
218
220{
221 // check if the pointer is empty before dereferencing
222 return m_error.get();
223}
224
225inline void P4ImplPxPyPzE::setPx( const double px )
226{
227 m_px = px;
228}
229
230inline void P4ImplPxPyPzE::setPy( const double py )
231{
232 m_py = py;
233}
234
235inline void P4ImplPxPyPzE::setPz( const double pz )
236{
237 m_pz = pz;
238}
239
240inline void P4ImplPxPyPzE::setE( const double e )
241{
242 m_e = e;
243}
244
245inline void P4ImplPxPyPzE::set4Mom( const I4Momentum& i4Mom )
246{
247 m_px = i4Mom.px();
248 m_py = i4Mom.py();
249 m_pz = i4Mom.pz();
250 m_e = i4Mom.e();
251}
252
253inline void P4ImplPxPyPzE::set4Mom( const I4Momentum* const i4Mom )
254{
255 this->set4Mom(*i4Mom);
256}
257
258
259inline void P4ImplPxPyPzE::set4Mom( const CLHEP::HepLorentzVector& hlv )
260{
261 m_px = hlv.px();
262 m_py = hlv.py();
263 m_pz = hlv.pz();
264 m_e = hlv.e();
265}
266
268{
269 m_error = std::make_unique< ErrorType>( err, *this);
270}
271
272#endif //> FOURMOM_P4IMPLPXPYPZE_H
I4Momentum is an abstract base class providing 4-momentum behavior.
Definition I4Momentum.h:31
virtual double pz() const =0
z component of momentum
virtual double px() const =0
x component of momentum
virtual double e() const =0
energy
virtual double py() const =0
y component of momentum
CLHEP::HepLorentzVector hlv() const
double e() const
get energy data member
std::unique_ptr< ErrorType > m_error
void setPz(const double thePz)
set Pz data member
void set4Mom(const I4Momentum &theI4Mom)
set all 4-mom from another I4Momentum reference
double py() const
get py data member
void setPy(const double thePy)
set Py data member
friend class P4ImplPxPyPzECnv_p1
P4ImplPxPyPzE()
Default constructor:
void setErrors(const ErrorMatrixPxPyPzE &err)
set the errors
FourMomentumError< P4ImplPxPyPzE > ErrorType
double px() const
{@ a la I4Momentum -like interface
P4ImplPxPyPzE & operator=(const P4ImplPxPyPzE &rhs)
Assignment operator:
void setE(const double theE)
set energy data member
I4Momentum::Kind kind() const
double pz() const
get pz data member
virtual ~P4ImplPxPyPzE()
Destructor:
void setPx(const double thePx)
set Px data member
virtual const I4MomentumError * errors() const