ATLAS Offline Software
Loading...
Searching...
No Matches
P4ImplIPtCotThPhiM.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#ifndef FOURMOM_P4IMPLIPTCOTTHPHIM_H
8#define FOURMOM_P4IMPLIPTCOTTHPHIM_H
9
10// STL includes
11#include <cmath>
12
13// CLHEP includes
14#include "CLHEP/Vector/LorentzVector.h"
15#include "CLHEP/Units/SystemOfUnits.h"
16
17// EventKernel includes
19
20// FourMom includes
23
24#include <memory>
25// forward declare
26class P4ImplIPtCotThPhiMCnv_p1; // for persistency
27
39
41{
43 public:
44
46
50
53 explicit P4ImplIPtCotThPhiM( const P4ImplIPtCotThPhiM& rhs );
54
58
60 P4ImplIPtCotThPhiM( const double iPt, const double cotTh,
61 const double phi, const double m );
62
64 explicit P4ImplIPtCotThPhiM( const CLHEP::HepLorentzVector& hlv );
65
67 explicit P4ImplIPtCotThPhiM( const I4Momentum& theI4M );
68
70 explicit P4ImplIPtCotThPhiM( const I4Momentum* const theI4M );
71
73 virtual ~P4ImplIPtCotThPhiM();
74
76 // Const methods:
78
81
82 double m() const;
83 double phi() const;
84 double iPt() const;
85 double cotTh() const;
86
87 virtual const I4MomentumError* errors() const;
88
90
93
95 // Non-const methods:
97
99 virtual void setIPt( const double theIPt );
101 virtual void setCotTh( const double theCotTh );
103 virtual void setPhi( const double thePhi );
105 virtual void setM( const double theM );
106
108 void setErrors( const ErrorMatrixPtCotThPhiM& err);
109
111 virtual void set4Mom( const I4Momentum & theI4Mom );
113 virtual void set4Mom( const I4Momentum * const theI4Mom );
115 virtual void set4Mom( const CLHEP::HepLorentzVector & theHlv );
116
118 // Private data:
120 private:
121
124 double m_iPt;
125
128 double m_cotTh;
129
132 double m_phi;
133
136 double m_m;
137
140 std::unique_ptr< ErrorType> m_error;
141
142};
143
146 m_iPt ( 0./CLHEP::GeV ),
147 m_cotTh ( 0. ),
148 m_phi ( 0. ),
149 m_m ( 0.*CLHEP::GeV ),
150 m_error(nullptr)
151{}
152
155 m_iPt ( rhs.m_iPt ),
156 m_cotTh ( rhs.m_cotTh ),
157 m_phi ( rhs.m_phi ),
158 m_m ( rhs.m_m ),
159 m_error(nullptr)
160{}
161
163 const double cotTh,
164 const double phi,
165 const double m ) :
167 m_iPt ( std::fabs(iPt) ), //inverse Pt is unsigned. std::fabs for safety
168 m_cotTh( cotTh ),
169 m_phi ( phi ),
170 m_m ( m ),
171 m_error(nullptr)
172{
173 // could enforce phi range convention there
174 // const double twopi =2.*M_PI;
175 // const double threepi=3.*M_PI;
176 // m_phi=fmod(phi+threepi,twopi)-M_PI;
177}
178
179inline P4ImplIPtCotThPhiM::P4ImplIPtCotThPhiM( const CLHEP::HepLorentzVector& hlv ) :
181 m_iPt ( 1./hlv.perp() ),
182 m_cotTh ( hlv.pz() / hlv.perp() ),
183 m_phi ( hlv.phi() ),
184 m_m ( hlv.m() ),
185 m_error(nullptr)
186{}
187
190 m_iPt ( p4.iPt() ),
191 m_cotTh( p4.cotTh() ),
192 m_phi ( p4.phi() ),
193 m_m ( p4.m() ),
194 m_error(nullptr)
195{}
196
199 m_iPt ( p4->iPt() ),
200 m_cotTh( p4->cotTh() ),
201 m_phi ( p4->phi() ),
202 m_m ( p4->m() ),
203 m_error(nullptr)
204{}
205
208
209inline double P4ImplIPtCotThPhiM::m() const
210{
211 return m_m;
212}
213
214inline double P4ImplIPtCotThPhiM::phi() const
215{
216 return m_phi;
217}
218
219inline double P4ImplIPtCotThPhiM::iPt() const
220{
221 return m_iPt;
222}
223
224inline double P4ImplIPtCotThPhiM::cotTh() const
225{
226 return m_cotTh;
227}
228
230{
231 return m_error.get();
232}
233
234// setters
235
236inline void P4ImplIPtCotThPhiM::setIPt( const double theIPt )
237{
238 m_iPt = theIPt;
239}
240
241inline void P4ImplIPtCotThPhiM::setCotTh( const double theCotTh )
242{
243 m_cotTh = theCotTh;
244}
245
246inline void P4ImplIPtCotThPhiM::setPhi( const double thePhi )
247{
248 m_phi = thePhi;
249}
250
251inline void P4ImplIPtCotThPhiM::setM( const double theM )
252{
253 m_m=theM;
254}
255
256inline void P4ImplIPtCotThPhiM::set4Mom( const I4Momentum & theI4Mom )
257{
258 m_iPt = theI4Mom.iPt();
259 m_cotTh = theI4Mom.cotTh();
260 m_phi = theI4Mom.phi();
261 m_m = theI4Mom.m();
262}
263
264inline void P4ImplIPtCotThPhiM::set4Mom( const I4Momentum * const theI4Mom )
265{
266 this->set4Mom(*theI4Mom);
267}
268
269inline void P4ImplIPtCotThPhiM::set4Mom( const CLHEP::HepLorentzVector & hlv )
270{
271 m_iPt = 1./hlv.perp();
272 m_cotTh = hlv.pz()*m_iPt;
273 m_phi = hlv.phi();
274 m_m = hlv.m();
275}
276
278{
279 m_error = std::make_unique< ErrorType>(err, *this);
280}
281
282
283#endif // FOURMOM_P4IMPLIPTCOTTHPHIM_H
Scalar perp() const
perp method - perpendicular length
I4Momentum is an abstract base class providing 4-momentum behavior.
Definition I4Momentum.h:31
virtual double cotTh() const =0
cottan theta
virtual double m() const =0
mass
virtual double phi() const =0
phi in [-pi,pi[
virtual double iPt() const =0
inverse of transverse momentum
P4BaseIPtCotThPhiM is a base class for classes with 4-momentum behavior, for which 1/Pt,...
CLHEP::HepLorentzVector hlv() const
virtual void set4Mom(const I4Momentum &theI4Mom)
set all 4-mom from another I4Momentum reference
virtual void setPhi(const double thePhi)
set phi data member
friend class P4ImplIPtCotThPhiMCnv_p1
virtual void setCotTh(const double theCotTh)
set cot(theta) data member
virtual const I4MomentumError * errors() const
virtual ~P4ImplIPtCotThPhiM()
virtual destructor needed by Pool
double m_iPt
inverse P_T
double m() const
{@ a la I4Momentum -like interface
std::unique_ptr< ErrorType > m_error
error matrix pointer
P4ImplIPtCotThPhiM()
Default constructor:
P4ImplIPtCotThPhiM & operator=(const P4ImplIPtCotThPhiM &rhs)
Assignment operator.
void setErrors(const ErrorMatrixPtCotThPhiM &err)
set the errors
FourMomentumError< P4ImplIPtCotThPhiM > ErrorType
virtual void setM(const double theM)
set m data member
double m_cotTh
cot(theta)
I4Momentum::Kind kind() const
virtual void setIPt(const double theIPt)
set inverse pT data member
STL namespace.