ATLAS Offline Software
P4ImplIPtCotThPhiM.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 #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
18 #include "EventKernel/I4Momentum.h"
19 
20 // FourMom includes
23 
24 #include <memory>
25 // forward declare
26 class P4ImplIPtCotThPhiMCnv_p1; // for persistency
27 
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 
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 
94  // 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 
162 inline P4ImplIPtCotThPhiM::P4ImplIPtCotThPhiM( const double iPt,
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 
179 inline 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 
207 {}
208 
209 inline double P4ImplIPtCotThPhiM::m() const
210 {
211  return m_m;
212 }
213 
214 inline double P4ImplIPtCotThPhiM::phi() const
215 {
216  return m_phi;
217 }
218 
219 inline double P4ImplIPtCotThPhiM::iPt() const
220 {
221  return m_iPt;
222 }
223 
224 inline double P4ImplIPtCotThPhiM::cotTh() const
225 {
226  return m_cotTh;
227 }
228 
230 {
231  return m_error.get();
232 }
233 
234 // setters
235 
236 inline void P4ImplIPtCotThPhiM::setIPt( const double theIPt )
237 {
238  m_iPt = theIPt;
239 }
240 
241 inline void P4ImplIPtCotThPhiM::setCotTh( const double theCotTh )
242 {
243  m_cotTh = theCotTh;
244 }
245 
246 inline void P4ImplIPtCotThPhiM::setPhi( const double thePhi )
247 {
248  m_phi = thePhi;
249 }
250 
251 inline void P4ImplIPtCotThPhiM::setM( const double theM )
252 {
253  m_m=theM;
254 }
255 
256 inline 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 
264 inline void P4ImplIPtCotThPhiM::set4Mom( const I4Momentum * const theI4Mom )
265 {
266  this->set4Mom(*theI4Mom);
267 }
268 
269 inline 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
P4ImplIPtCotThPhiM::m_error
std::unique_ptr< ErrorType > m_error
error matrix pointer
Definition: P4ImplIPtCotThPhiM.h:140
ErrorMatrixPtCotThPhiM
Definition: ErrorMatrixPtCotThPhiM.h:12
P4ImplIPtCotThPhiM::errors
virtual const I4MomentumError * errors() const
Definition: P4ImplIPtCotThPhiM.h:229
I4Momentum
Definition: I4Momentum.h:31
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
P4ImplIPtCotThPhiM::m_phi
double m_phi
Phi.
Definition: P4ImplIPtCotThPhiM.h:132
P4ImplIPtCotThPhiM::setM
virtual void setM(const double theM)
set m data member
Definition: P4ImplIPtCotThPhiM.h:251
P4ImplIPtCotThPhiM::ErrorType
FourMomentumError< P4ImplIPtCotThPhiM > ErrorType
Definition: P4ImplIPtCotThPhiM.h:45
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
FourMomentumError.h
perp
Scalar perp() const
perp method - perpenticular length
Definition: AmgMatrixBasePlugin.h:44
P4BaseIPtCotThPhiM
Definition: P4BaseIPtCotThPhiM.h:33
P4ImplIPtCotThPhiM::setCotTh
virtual void setCotTh(const double theCotTh)
set cot(theta) data member
Definition: P4ImplIPtCotThPhiM.h:241
I4Momentum::P4IPTCOTTHPHIM
@ P4IPTCOTTHPHIM
Definition: I4Momentum.h:33
P4ImplIPtCotThPhiM::setPhi
virtual void setPhi(const double thePhi)
set phi data member
Definition: P4ImplIPtCotThPhiM.h:246
P4ImplIPtCotThPhiM::m_m
double m_m
mass
Definition: P4ImplIPtCotThPhiM.h:136
P4ImplIPtCotThPhiM::phi
double phi() const
Definition: P4ImplIPtCotThPhiM.h:214
P4ImplIPtCotThPhiM::set4Mom
virtual void set4Mom(const I4Momentum &theI4Mom)
set all 4-mom from another I4Momentum reference
Definition: P4ImplIPtCotThPhiM.h:256
I4Momentum.h
P4BaseIPtCotThPhiM::hlv
CLHEP::HepLorentzVector hlv() const
Definition: P4BaseIPtCotThPhiM.h:226
I4Momentum::Kind
Kind
Definition: I4Momentum.h:33
P4ImplIPtCotThPhiM::cotTh
double cotTh() const
Definition: P4ImplIPtCotThPhiM.h:224
I4Momentum::cotTh
virtual double cotTh() const =0
cottan theta
P4BaseIPtCotThPhiM.h
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
P4ImplIPtCotThPhiM
Definition: P4ImplIPtCotThPhiM.h:41
I4MomentumError
Definition: I4MomentumError.h:28
CLHEP
STD'S.
Definition: IAtRndmGenSvc.h:19
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
FourMomentumError
Definition: FourMomentumError.h:13
P4ImplIPtCotThPhiM::setErrors
void setErrors(const ErrorMatrixPtCotThPhiM &err)
set the errors
Definition: P4ImplIPtCotThPhiM.h:277
I4Momentum::phi
virtual double phi() const =0
phi in [-pi,pi[
P4ImplIPtCotThPhiM::kind
I4Momentum::Kind kind() const
Definition: P4ImplIPtCotThPhiM.h:89
P4ImplIPtCotThPhiM::~P4ImplIPtCotThPhiM
virtual ~P4ImplIPtCotThPhiM()
virtual destructor needed by Pool
Definition: P4ImplIPtCotThPhiM.h:206
P4ImplIPtCotThPhiM::m
double m() const
{@ a la I4Momentum -like interface
Definition: P4ImplIPtCotThPhiM.h:209
P4ImplIPtCotThPhiM::operator=
P4ImplIPtCotThPhiM & operator=(const P4ImplIPtCotThPhiM &rhs)
Assignment operator.
Definition: P4ImplIPtCotThPhiM.cxx:15
I4Momentum::m
virtual double m() const =0
mass
P4ImplIPtCotThPhiMCnv_p1
Definition: P4ImplIPtCotThPhiMCnv_p1.h:38
P4ImplIPtCotThPhiM::P4ImplIPtCotThPhiM
P4ImplIPtCotThPhiM()
Default constructor:
Definition: P4ImplIPtCotThPhiM.h:144
P4ImplIPtCotThPhiM::m_cotTh
double m_cotTh
cot(theta)
Definition: P4ImplIPtCotThPhiM.h:128
P4ImplIPtCotThPhiM::m_iPt
double m_iPt
inverse P_T
Definition: P4ImplIPtCotThPhiM.h:124
I4Momentum::iPt
virtual double iPt() const =0
inverse of transverse momentum
P4ImplIPtCotThPhiM::iPt
double iPt() const
Definition: P4ImplIPtCotThPhiM.h:219
P4ImplIPtCotThPhiM::setIPt
virtual void setIPt(const double theIPt)
set inverse pT data member
Definition: P4ImplIPtCotThPhiM.h:236