ATLAS Offline Software
P4Impl.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // P4Impl.h
8 // Header file for class P4Impl
9 // Author : Sebastien Binet
10 // Date : August 2006
12 #ifndef FOURMOM_P4IMPL_H
13 #define FOURMOM_P4IMPL_H
14 
19 // STL includes
20 
21 // Gaudi includes
22 
23 // DataModel includes
24 
25 // EventKernel includes
26 #include "EventKernel/I4Momentum.h"
27 
28 template< class P4Mom_t >
29 class P4Impl : virtual public I4Momentum,
30  public P4Mom_t
31 {
32 
34  // Public typedefs:
36  public:
37 
40  typedef P4Mom_t base_type;
41 
43  // Public methods:
45  public:
46 
49  P4Impl();
50 
53  explicit P4Impl( const P4Impl& rhs );
54 
57  P4Impl& operator=( const P4Impl& rhs );
58 
61  P4Impl( const double p1, const double p2, const double p3, const double p4 );
62  explicit P4Impl( const CLHEP::HepLorentzVector& theHlv );
63  explicit P4Impl( const P4Mom_t& rhs );
64  explicit P4Impl( const I4Momentum & rhs );
65  explicit P4Impl( const I4Momentum * const rhs );
66 
69  virtual ~P4Impl();
70 
72  // Const methods:
74 
77  const P4Mom_t& base() const;
78 
83  double px() const;
84 
86  double py() const;
87 
89  double pz() const;
90 
92  double m() const;
93 
95  double m2() const;
96 
98  double p() const;
99 
101  double p2() const;
102 
104  double eta() const;
105 
107  double rapidity() const;
108 
110  double phi() const;
111 
113  double sinPhi() const;
114 
116  double cosPhi() const;
117 
119  double e() const;
120 
122  double et() const;
123 
125  double pt() const;
126 
128  double iPt() const;
129 
131  double cosTh() const;
132 
134  double sinTh() const;
135 
137  double tanTh() const;
138 
140  double cotTh() const;
141 
143  CLHEP::HepLorentzVector hlv() const;
144 
145  virtual const I4MomentumError* errors() const;
146 
149 
150 
152  virtual void set4Mom (const I4Momentum * const theI4Mom ) ;
153 
155  virtual void set4Mom (const I4Momentum & theI4Mom) ;
156 
158  virtual void set4Mom (const CLHEP::HepLorentzVector & theHlv ) ;
159 
160 
162  std::ostream& dump( std::ostream& out ) const;
163 
167  // Non-const methods:
170 
173  P4Mom_t& base();
174 
176  // Protected data:
178  protected:
179 
180 };
181 
185 
186 template< class P4Mom_t>
187 inline
189  I4Momentum ( ),
190  P4Mom_t ( )
191 {}
192 
193 template< class P4Mom_t>
194 inline
196  I4Momentum ( ),
197  P4Mom_t ( rhs.base() )
198 {}
199 
200 template< class P4Mom_t>
201 inline
202 P4Impl<P4Mom_t>::P4Impl( const CLHEP::HepLorentzVector& theHlv ) :
203  I4Momentum ( ),
204  P4Mom_t ( theHlv )
205 {}
206 
207 template< class P4Mom_t>
208 inline
209 P4Impl<P4Mom_t>::P4Impl( const P4Mom_t& rhs ) :
210  I4Momentum ( ),
211  P4Mom_t ( rhs )
212 {}
213 
214 template< class P4Mom_t>
215 inline
217  I4Momentum ( ),
218  P4Mom_t ( )
219 {
220  P4Mom_t::set4Mom(theI4M);
221 }
222 
223 template< class P4Mom_t>
224 inline
225 P4Impl<P4Mom_t>::P4Impl( const I4Momentum * const theI4M ) :
226  I4Momentum ( ),
227  P4Mom_t ( theI4M )
228 {}
229 
230 template< class P4Mom_t>
233 {
234  if ( this != &rhs ) {
235  I4Momentum::operator=( rhs );
236  P4Mom_t::operator=( rhs );
237  }
238  return *this;
239 }
240 
241 template< class P4Mom_t >
242 inline
243 P4Impl<P4Mom_t>::P4Impl( const double p1, const double p2,
244  const double p3, const double p4 ) :
245  I4Momentum( ),
246  P4Mom_t ( p1, p2, p3, p4 )
247 {}
248 
249 template< class P4Mom_t>
250 inline
252 {}
253 
254 template< class P4Mom_t>
255 inline const P4Mom_t& P4Impl<P4Mom_t>::base() const
256 {
257  return *this;
258 }
259 
260 template< class P4Mom_t>
261 inline double P4Impl<P4Mom_t>::px() const
262 {
263  return P4Mom_t::px();
264 }
265 
266 template< class P4Mom_t>
267 inline double P4Impl<P4Mom_t>::py() const
268 {
269  return P4Mom_t::py();
270 }
271 
272 template< class P4Mom_t>
273 inline double P4Impl<P4Mom_t>::pz() const
274 {
275  return P4Mom_t::pz();
276 }
277 
278 template< class P4Mom_t>
279 inline double P4Impl<P4Mom_t>::m() const
280 {
281  return P4Mom_t::m();
282 }
283 
284 template< class P4Mom_t>
285 inline double P4Impl<P4Mom_t>::m2() const
286 {
287  return P4Mom_t::m2();
288 }
289 
290 template< class P4Mom_t>
291 inline double P4Impl<P4Mom_t>::p() const
292 {
293  return P4Mom_t::p();
294 }
295 
296 template< class P4Mom_t>
297 inline double P4Impl<P4Mom_t>::p2() const
298 {
299  return P4Mom_t::p2();
300 }
301 
302 template< class P4Mom_t>
303 inline double P4Impl<P4Mom_t>::eta() const
304 {
305  return P4Mom_t::eta();
306 }
307 
308 template< class P4Mom_t>
309 inline double P4Impl<P4Mom_t>::rapidity() const
310 {
311  return P4Mom_t::rapidity();
312 }
313 
314 template< class P4Mom_t>
315 inline double P4Impl<P4Mom_t>::phi() const
316 {
317  return P4Mom_t::phi();
318 }
319 
320 template< class P4Mom_t>
321 inline double P4Impl<P4Mom_t>::cosPhi() const
322 {
323  return P4Mom_t::cosPhi();
324 }
325 
326 template< class P4Mom_t>
327 inline double P4Impl<P4Mom_t>::sinPhi() const
328 {
329  return P4Mom_t::sinPhi();
330 }
331 
332 template< class P4Mom_t>
333 inline double P4Impl<P4Mom_t>::e() const
334 {
335  return P4Mom_t::e();
336 }
337 
338 template< class P4Mom_t>
339 inline double P4Impl<P4Mom_t>::et() const
340 {
341  return P4Mom_t::et();
342 }
343 
344 template< class P4Mom_t>
345 inline double P4Impl<P4Mom_t>::pt() const
346 {
347  return P4Mom_t::pt();
348 }
349 
350 template< class P4Mom_t>
351 inline double P4Impl<P4Mom_t>::iPt() const
352 {
353  return P4Mom_t::iPt();
354 }
355 
356 template< class P4Mom_t>
357 inline double P4Impl<P4Mom_t>::cosTh() const
358 {
359  return P4Mom_t::cosTh();
360 }
361 
362 template< class P4Mom_t>
363 inline double P4Impl<P4Mom_t>::sinTh() const
364 {
365  return P4Mom_t::sinTh();
366 }
367 
368 template< class P4Mom_t>
369 inline double P4Impl<P4Mom_t>::tanTh() const
370 {
371  return P4Mom_t::tanTh();
372 }
373 
374 template< class P4Mom_t>
375 inline double P4Impl<P4Mom_t>::cotTh() const
376 {
377  return P4Mom_t::cotTh();
378 }
379 
380 template< class P4Mom_t>
381 inline CLHEP::HepLorentzVector P4Impl<P4Mom_t>::hlv() const
382 {
383  return P4Mom_t::hlv();
384 }
385 
386 template< class P4Mom_t>
388 {
389  return P4Mom_t::errors();
390 }
391 
392 template< class P4Mom_t>
394 {
395  return P4Mom_t::kind();
396 }
397 
398 
399 template< class P4Mom_t>
400 inline void P4Impl<P4Mom_t>::set4Mom (const I4Momentum * const theI4Mom )
401 {
402  return P4Mom_t::set4Mom(theI4Mom);
403 }
404 
405 template< class P4Mom_t>
406 inline void P4Impl<P4Mom_t>::set4Mom (const I4Momentum & theI4Mom )
407 {
408  return
409  P4Mom_t::set4Mom(theI4Mom);
410 }
411 
412 template< class P4Mom_t>
413 inline void P4Impl<P4Mom_t>::set4Mom (const CLHEP::HepLorentzVector & theHlv )
414 {
415  return P4Mom_t::set4Mom(theHlv);
416 }
417 
418 
419 
420 
421 
422 
423 template< class P4Mom_t>
424 inline std::ostream& P4Impl<P4Mom_t>::dump( std::ostream& out ) const
425 {
426  return P4Mom_t::dump( out );
427 }
428 
429 // non-const methods
430 template< class P4Mom_t>
431 inline P4Mom_t& P4Impl<P4Mom_t>::base()
432 {
433  return *this;
434 }
435 
436 
437 #endif //> FOURMOM_P4IMPL_H
P4Impl::p
double p() const
momentum magnitude
Definition: P4Impl.h:291
P4Impl::p2
double p2() const
square of momentum magnitude
Definition: P4Impl.h:297
P4Impl::pt
double pt() const
transverse momentum
Definition: P4Impl.h:345
base
std::string base
Definition: hcg.cxx:78
P4Impl::m2
double m2() const
mass squared
Definition: P4Impl.h:285
I4Momentum
Definition: I4Momentum.h:31
test_pyathena.px
px
Definition: test_pyathena.py:18
python.SystemOfUnits.m2
int m2
Definition: SystemOfUnits.py:92
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
P4Impl::set4Mom
virtual void set4Mom(const I4Momentum &theI4Mom)
set 4Momentum (will throw exception if cannot be implemented)
Definition: P4Impl.h:406
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
P4Impl::sinTh
double sinTh() const
sinus theta
Definition: P4Impl.h:363
P4Impl::e
double e() const
energy
Definition: P4Impl.h:333
P4Impl::hlv
CLHEP::HepLorentzVector hlv() const
CLHEP HepLorentzVector.
Definition: P4Impl.h:381
P4Impl::tanTh
double tanTh() const
tan theta
Definition: P4Impl.h:369
P4Impl::dump
std::ostream & dump(std::ostream &out) const
Print I4Momentum content.
Definition: P4Impl.h:424
test_pyathena.pt
pt
Definition: test_pyathena.py:11
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
P4Impl::base
P4Mom_t & base()
access to underlying base type
Definition: P4Impl.h:431
P4Impl::base
const P4Mom_t & base() const
access to underlying base type
Definition: P4Impl.h:255
P4Impl::set4Mom
virtual void set4Mom(const CLHEP::HepLorentzVector &theHlv)
set 4Momentum (will throw exception if cannot be implemented)
Definition: P4Impl.h:413
P4Impl::cotTh
double cotTh() const
cottan theta
Definition: P4Impl.h:375
I4Momentum.h
I4Momentum::Kind
Kind
Definition: I4Momentum.h:33
P4Impl::P4Impl
P4Impl(const double p1, const double p2, const double p3, const double p4)
Constructor with arguments.
Definition: P4Impl.h:243
ParticleJetTools::p3
Amg::Vector3D p3(const xAOD::TruthVertex *p)
Definition: ParticleJetLabelCommon.cxx:55
P4Impl::P4Impl
P4Impl(const CLHEP::HepLorentzVector &theHlv)
Definition: P4Impl.h:202
P4Impl::P4Impl
P4Impl(const P4Impl &rhs)
Copy constructor.
Definition: P4Impl.h:195
P4Impl::px
double px() const
x component of momentum
Definition: P4Impl.h:261
P4Impl::errors
virtual const I4MomentumError * errors() const
Access to errors, if available; returns 0 if no errors.
Definition: P4Impl.h:387
P4Impl::kind
I4Momentum::Kind kind() const
kind (what type of P4XYZ) of underlying class
Definition: P4Impl.h:393
I4MomentumError
Definition: I4MomentumError.h:28
P4Impl::base_type
P4Mom_t base_type
publish the type of the base class (ie: 'traits-itize' it)
Definition: P4Impl.h:40
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
P4Impl::phi
double phi() const
phi in [-pi,pi[
Definition: P4Impl.h:315
P4Impl::cosTh
double cosTh() const
cosinus theta
Definition: P4Impl.h:357
P4Impl::cosPhi
double cosPhi() const
cos(phi)
Definition: P4Impl.h:321
P4Impl::pz
double pz() const
z component of momentum
Definition: P4Impl.h:273
mergePhysValFiles.errors
list errors
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:43
P4Impl::rapidity
double rapidity() const
rapidity
Definition: P4Impl.h:309
Amg::py
@ py
Definition: GeoPrimitives.h:39
P4Impl::py
double py() const
y component of momentum
Definition: P4Impl.h:267
P4Impl::P4Impl
P4Impl(const I4Momentum &rhs)
Definition: P4Impl.h:216
P4Impl
Definition: P4Impl.h:31
P4Impl::et
double et() const
transverse energy defined to be e*sin(theta)
Definition: P4Impl.h:339
P4Impl::eta
double eta() const
pseudo rapidity
Definition: P4Impl.h:303
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
P4Impl::iPt
double iPt() const
inverse of transverse momentum
Definition: P4Impl.h:351
P4Impl::sinPhi
double sinPhi() const
sin(phi)
Definition: P4Impl.h:327
P4Impl::operator=
P4Impl & operator=(const P4Impl &rhs)
Assignment operator.
Definition: P4Impl.h:232
P4Impl::P4Impl
P4Impl(const I4Momentum *const rhs)
Definition: P4Impl.h:225
P4Impl::set4Mom
virtual void set4Mom(const I4Momentum *const theI4Mom)
set 4Momentum (will throw exception if cannot be implemented)
Definition: P4Impl.h:400
FourMomUtils::dump
std::ostream & dump(std::ostream &out, const I4MomIter iBeg, const I4MomIter iEnd)
Helper to stream out a range of I4Momentum objects.
Definition: P4Dumper.h:24
P4Impl::P4Impl
P4Impl(const P4Mom_t &rhs)
Definition: P4Impl.h:209
P4Impl::~P4Impl
virtual ~P4Impl()
Default constructor:
Definition: P4Impl.h:251
P4Impl::P4Impl
P4Impl()
Default constructor.
Definition: P4Impl.h:188
P4Impl::m
double m() const
mass
Definition: P4Impl.h:279