ATLAS Offline Software
Loading...
Searching...
No Matches
P4Impl.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// 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
18
19// STL includes
20
21// Gaudi includes
22
23// DataModel includes
24
25// EventKernel includes
27
28template< class P4Mom_t >
29class 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
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
81
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
166
168 // Non-const methods:
170
173 P4Mom_t& base();
174
176 // Protected data:
178 protected:
179
180};
181
185
186template< class P4Mom_t>
187inline
189 I4Momentum ( ),
190 P4Mom_t ( )
191{}
192
193template< class P4Mom_t>
194inline
196 I4Momentum ( ),
197 P4Mom_t ( rhs.base() )
198{}
199
200template< class P4Mom_t>
201inline
202P4Impl<P4Mom_t>::P4Impl( const CLHEP::HepLorentzVector& theHlv ) :
203 I4Momentum ( ),
204 P4Mom_t ( theHlv )
205{}
206
207template< class P4Mom_t>
208inline
209P4Impl<P4Mom_t>::P4Impl( const P4Mom_t& rhs ) :
210 I4Momentum ( ),
211 P4Mom_t ( rhs )
212{}
213
214template< class P4Mom_t>
215inline
217 I4Momentum ( ),
218 P4Mom_t ( )
219{
220 P4Mom_t::set4Mom(theI4M);
221}
222
223template< class P4Mom_t>
224inline
225P4Impl<P4Mom_t>::P4Impl( const I4Momentum * const theI4M ) :
226 I4Momentum ( ),
227 P4Mom_t ( theI4M )
228{}
229
230template< class P4Mom_t>
233{
234 if ( this != &rhs ) {
235 I4Momentum::operator=( rhs );
236 P4Mom_t::operator=( rhs );
237 }
238 return *this;
239}
240
241template< class P4Mom_t >
242inline
243P4Impl<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
249template< class P4Mom_t>
250inline
253
254template< class P4Mom_t>
255inline const P4Mom_t& P4Impl<P4Mom_t>::base() const
256{
257 return *this;
258}
259
260template< class P4Mom_t>
261inline double P4Impl<P4Mom_t>::px() const
262{
263 return P4Mom_t::px();
264}
265
266template< class P4Mom_t>
267inline double P4Impl<P4Mom_t>::py() const
268{
269 return P4Mom_t::py();
270}
271
272template< class P4Mom_t>
273inline double P4Impl<P4Mom_t>::pz() const
274{
275 return P4Mom_t::pz();
276}
277
278template< class P4Mom_t>
279inline double P4Impl<P4Mom_t>::m() const
280{
281 return P4Mom_t::m();
282}
283
284template< class P4Mom_t>
285inline double P4Impl<P4Mom_t>::m2() const
286{
287 return P4Mom_t::m2();
288}
289
290template< class P4Mom_t>
291inline double P4Impl<P4Mom_t>::p() const
292{
293 return P4Mom_t::p();
294}
295
296template< class P4Mom_t>
297inline double P4Impl<P4Mom_t>::p2() const
298{
299 return P4Mom_t::p2();
300}
301
302template< class P4Mom_t>
303inline double P4Impl<P4Mom_t>::eta() const
304{
305 return P4Mom_t::eta();
306}
307
308template< class P4Mom_t>
309inline double P4Impl<P4Mom_t>::rapidity() const
310{
311 return P4Mom_t::rapidity();
312}
313
314template< class P4Mom_t>
315inline double P4Impl<P4Mom_t>::phi() const
316{
317 return P4Mom_t::phi();
318}
319
320template< class P4Mom_t>
321inline double P4Impl<P4Mom_t>::cosPhi() const
322{
323 return P4Mom_t::cosPhi();
324}
325
326template< class P4Mom_t>
327inline double P4Impl<P4Mom_t>::sinPhi() const
328{
329 return P4Mom_t::sinPhi();
330}
331
332template< class P4Mom_t>
333inline double P4Impl<P4Mom_t>::e() const
334{
335 return P4Mom_t::e();
336}
337
338template< class P4Mom_t>
339inline double P4Impl<P4Mom_t>::et() const
340{
341 return P4Mom_t::et();
342}
343
344template< class P4Mom_t>
345inline double P4Impl<P4Mom_t>::pt() const
346{
347 return P4Mom_t::pt();
348}
349
350template< class P4Mom_t>
351inline double P4Impl<P4Mom_t>::iPt() const
352{
353 return P4Mom_t::iPt();
354}
355
356template< class P4Mom_t>
357inline double P4Impl<P4Mom_t>::cosTh() const
358{
359 return P4Mom_t::cosTh();
360}
361
362template< class P4Mom_t>
363inline double P4Impl<P4Mom_t>::sinTh() const
364{
365 return P4Mom_t::sinTh();
366}
367
368template< class P4Mom_t>
369inline double P4Impl<P4Mom_t>::tanTh() const
370{
371 return P4Mom_t::tanTh();
372}
373
374template< class P4Mom_t>
375inline double P4Impl<P4Mom_t>::cotTh() const
376{
377 return P4Mom_t::cotTh();
378}
379
380template< class P4Mom_t>
381inline CLHEP::HepLorentzVector P4Impl<P4Mom_t>::hlv() const
382{
383 return P4Mom_t::hlv();
384}
385
386template< class P4Mom_t>
388{
389 return P4Mom_t::errors();
390}
391
392template< class P4Mom_t>
394{
395 return P4Mom_t::kind();
396}
397
398
399template< class P4Mom_t>
400inline void P4Impl<P4Mom_t>::set4Mom (const I4Momentum * const theI4Mom )
401{
402 return P4Mom_t::set4Mom(theI4Mom);
403}
404
405template< class P4Mom_t>
406inline void P4Impl<P4Mom_t>::set4Mom (const I4Momentum & theI4Mom )
407{
408 return
409 P4Mom_t::set4Mom(theI4Mom);
410}
411
412template< class P4Mom_t>
413inline void P4Impl<P4Mom_t>::set4Mom (const CLHEP::HepLorentzVector & theHlv )
414{
415 return P4Mom_t::set4Mom(theHlv);
416}
417
418
419
420
421
422
423template< class P4Mom_t>
424inline std::ostream& P4Impl<P4Mom_t>::dump( std::ostream& out ) const
425{
426 return P4Mom_t::dump( out );
427}
428
429// non-const methods
430template< class P4Mom_t>
431inline P4Mom_t& P4Impl<P4Mom_t>::base()
432{
433 return *this;
434}
435
436
437#endif //> FOURMOM_P4IMPL_H
I4Momentum is an abstract base class providing 4-momentum behavior.
Definition I4Momentum.h:31
hub for various interface implementations of I4Momentum
Definition P4Impl.h:31
P4Impl & operator=(const P4Impl &rhs)
Assignment operator.
Definition P4Impl.h:232
virtual void set4Mom(const I4Momentum *const theI4Mom)
set 4Momentum (will throw exception if cannot be implemented)
Definition P4Impl.h:400
double e() const
energy
Definition P4Impl.h:333
double sinPhi() const
sin(phi)
Definition P4Impl.h:327
double rapidity() const
rapidity
Definition P4Impl.h:309
I4Momentum::Kind kind() const
kind (what type of P4XYZ) of underlying class
Definition P4Impl.h:393
double p() const
momentum magnitude
Definition P4Impl.h:291
virtual const I4MomentumError * errors() const
Access to errors, if available; returns 0 if no errors.
Definition P4Impl.h:387
P4Mom_t base_type
publish the type of the base class (ie: 'traits-itize' it)
Definition P4Impl.h:40
double cosTh() const
cosinus theta
Definition P4Impl.h:357
double phi() const
phi in [-pi,pi[
Definition P4Impl.h:315
double eta() const
pseudo rapidity
Definition P4Impl.h:303
double iPt() const
inverse of transverse momentum
Definition P4Impl.h:351
double sinTh() const
sinus theta
Definition P4Impl.h:363
virtual ~P4Impl()
Default constructor:
Definition P4Impl.h:251
double p2() const
Definition P4Impl.h:297
double m() const
mass
Definition P4Impl.h:279
double cotTh() const
cottan theta
Definition P4Impl.h:375
double cosPhi() const
cos(phi)
Definition P4Impl.h:321
double m2() const
mass squared
Definition P4Impl.h:285
double py() const
y component of momentum
Definition P4Impl.h:267
P4Impl()
Default constructor.
Definition P4Impl.h:188
const P4Mom_t & base() const
access to underlying base type
Definition P4Impl.h:255
double et() const
transverse energy defined to be e*sin(theta)
Definition P4Impl.h:339
double px() const
x component of momentum
Definition P4Impl.h:261
CLHEP::HepLorentzVector hlv() const
CLHEP HepLorentzVector.
Definition P4Impl.h:381
double pt() const
transverse momentum
Definition P4Impl.h:345
double pz() const
z component of momentum
Definition P4Impl.h:273
std::ostream & dump(std::ostream &out) const
Print I4Momentum content.
Definition P4Impl.h:424
double tanTh() const
tan theta
Definition P4Impl.h:369