Belle II Software development
Helix.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9//-----------------------------------------------------------------------------
10// Description : A class to represent a track helix parameter in Belle style
11//-----------------------------------------------------------------------------
12
13#ifndef TRGCDCHelix_FLAG_
14#define TRGCDCHelix_FLAG_
15
16#include <string>
17#include "CLHEP/Matrix/Vector.h"
18#include "CLHEP/Matrix/SymMatrix.h"
19#include "CLHEP/Vector/ThreeVector.h"
20#include "CLHEP/Vector/LorentzVector.h"
21#include "CLHEP/Geometry/Point3D.h"
22
23#ifdef TRGCDC_SHORT_NAMES
24#define TCHelix TRGCDCHelix
25#endif
26
27namespace Belle2 {
35
36 public:
39 const CLHEP::HepVector& a,
40 const CLHEP::HepSymMatrix& Ea);
41
44 const CLHEP::HepVector& a);
45
48 const CLHEP::Hep3Vector& momentum,
49 double charge);
50
52 TRGCDCHelix(const TRGCDCHelix&) = default;
53
55 virtual ~TRGCDCHelix();
56
57 public:// Selectors
58
60 const HepGeom::Point3D<double>& center(void) const;
61
63 const HepGeom::Point3D<double>& pivot(void) const;
64
66 double radius(void) const;
67
69 HepGeom::Point3D<double> x(double dPhi = 0.) const;
70
72 double* x(double dPhi, double p[3]) const;
73
75 HepGeom::Point3D<double> x(double dPhi, CLHEP::HepSymMatrix& Ex) const;
76
78 CLHEP::Hep3Vector direction(double dPhi = 0.) const;
79
81 CLHEP::Hep3Vector momentum(double dPhi = 0.) const;
82
84 CLHEP::Hep3Vector momentum(double dPhi, CLHEP::HepSymMatrix& Em) const;
85
87 CLHEP::HepLorentzVector momentum(double dPhi, double mass) const;
88
90 CLHEP::HepLorentzVector momentum(double dPhi, double mass, CLHEP::HepSymMatrix& Em) const;
91
93 CLHEP::HepLorentzVector momentum(double dPhi, double mass, HepGeom::Point3D<double>& x, CLHEP::HepSymMatrix& Emx) const;
94
95 public:// Parametrization dependent functions. Prepared for tracking codes. Users should not use them.
96
98 double dr(void) const;
99
101 double phi0(void) const;
102
104 double kappa(void) const;
105
107 double dz(void) const;
108
110 double tanl(void) const;
111
113 double curv(void) const;
114
116 double sinPhi0(void) const;
117
119 double cosPhi0(void) const;
120
122 const CLHEP::HepVector& a(void) const;
123
125 const CLHEP::HepSymMatrix& Ea(void) const;
126
127 public:// Modifiers
129 const CLHEP::HepVector& a(const CLHEP::HepVector& newA);
130
132 const CLHEP::HepSymMatrix& Ea(const CLHEP::HepSymMatrix& newdA);
133
136
139 const CLHEP::HepVector& a,
140 const CLHEP::HepSymMatrix& Ea);
141
143 void ignoreErrorMatrix(void);
144
146 double bFieldZ(void) const;
147
149 double bFieldZ(double);
150
152 static void set_limits(const CLHEP::HepVector& a_min,
153 const CLHEP::HepVector& a_max);
154
156 static bool set_exception(bool);
157
159 static bool set_print(bool);
160
161 private:
163 static CLHEP::HepVector ms_amin;
165 static CLHEP::HepVector ms_amax;
167 static bool ms_check_range;
169 static bool ms_print_debug;
172
173
174 public:// Operators
177
178 public:// Mathmatical functions
180 CLHEP::HepMatrix delApDelA(const CLHEP::HepVector& ap) const;
182 CLHEP::HepMatrix delXDelA(double phi) const;
184 CLHEP::HepMatrix delMDelA(double phi) const;
186 CLHEP::HepMatrix del4MDelA(double phi, double mass) const;
188 CLHEP::HepMatrix del4MXDelA(double phi, double mass) const;
189
190 private:
192 void updateCache(void);
194 void checkValid(void);
196 void debugPrint(void) const;
198 void debugTRGCDCHelix(void) const;
199
200 public:
202 static const double ConstantAlpha;
203
204 private:
210 double m_bField;
212 double m_alpha;
216 CLHEP::HepVector m_a;
218 CLHEP::HepSymMatrix m_Ea;
219
220 private: // caches
224 double m_cp;
226 double m_sp;
228 double m_pt;
230 double m_r;
232 double m_ac[5];
233
235 static const std::string invalidhelix;
236
237 };
238
239//-----------------------------------------------------------------------------
240
241 inline
244 {
245 return m_center;
246 }
247
248 inline
251 {
252 return m_pivot;
253 }
254
255 inline
256 double
258 {
259 return m_r;
260 }
261
262 inline
263 CLHEP::Hep3Vector
264 TRGCDCHelix::direction(double phi) const
265 {
266 return momentum(phi).unit();
267 }
268
269 inline
270 double
271 TRGCDCHelix::dr(void) const
272 {
273 return m_ac[0];
274 }
275
276 inline
277 double
279 {
280 return m_ac[1];
281 }
282
283 inline
284 double
286 {
287 return m_ac[2];
288 }
289
290 inline
291 double
292 TRGCDCHelix::dz(void) const
293 {
294 return m_ac[3];
295 }
296
297 inline
298 double
300 {
301 return m_ac[4];
302 }
303
304 inline
305 double
307 {
308 return m_r;
309 }
310
311 inline
312 const CLHEP::HepVector&
313 TRGCDCHelix::a(void) const
314 {
315 return m_a;
316 }
317
318 inline
319 const CLHEP::HepSymMatrix&
320 TRGCDCHelix::Ea(void) const
321 {
322 return m_Ea;
323 }
324
325 inline
326 const CLHEP::HepVector&
327 TRGCDCHelix::a(const CLHEP::HepVector& i)
328 {
329 if (i.num_row() == 5) {
330 m_a = i;
331 m_helixValid = false;
332 updateCache();
333 }
334 return m_a;
335 }
336
337 inline
338 const CLHEP::HepSymMatrix&
339 TRGCDCHelix::Ea(const CLHEP::HepSymMatrix& i)
340 {
341 return m_Ea = i;
342 }
343
344 inline
345 double
347 {
348 m_bField = a;
349 m_alpha = 10000. / 2.99792458 / m_bField;
350 updateCache();
351 return m_bField;
352 }
353
354 inline
355 double
357 {
358 return m_bField;
359 }
360
361 inline
362 double
364 {
365 return m_sp;
366 }
367
368 inline
369 double
371 {
372 return m_cp;
373 }
374
376} // namespace Belle2
377
378#endif /* TRGCDCHelix_FLAG_ */
TRGCDCHelix parameter class.
Definition: Helix.h:34
HepGeom::Point3D< double > m_center
caches
Definition: Helix.h:222
CLHEP::HepVector m_a
a HepVector parameter
Definition: Helix.h:216
void debugTRGCDCHelix(void) const
function not defined
CLHEP::HepSymMatrix m_Ea
Ea HepSymMatrix parameter.
Definition: Helix.h:218
HepGeom::Point3D< double > m_pivot
pivot
Definition: Helix.h:214
bool m_matrixValid
matrix validity
Definition: Helix.h:206
double m_ac[5]
caches
Definition: Helix.h:232
bool m_helixValid
helix validity
Definition: Helix.h:208
double m_cp
caches
Definition: Helix.h:224
double m_alpha
alpha parameter
Definition: Helix.h:212
TRGCDCHelix(const TRGCDCHelix &)=default
Default copy constructor.
double m_sp
caches
Definition: Helix.h:226
double m_bField
magnetic field
Definition: Helix.h:210
double m_r
caches
Definition: Helix.h:230
double m_pt
caches
Definition: Helix.h:228
void set(const HepGeom::Point3D< double > &pivot, const CLHEP::HepVector &a, const CLHEP::HepSymMatrix &Ea)
sets helix pivot position, parameters, and error matrix.
Definition: Helix.cc:396
static CLHEP::HepVector ms_amax
limits for helix parameters
Definition: Helix.h:165
static bool ms_print_debug
print debug info or not
Definition: Helix.h:169
TRGCDCHelix & operator=(const TRGCDCHelix &)
Copy operator.
Definition: Helix.cc:409
void checkValid(void)
check validity
Definition: Helix.cc:815
HepGeom::Point3D< double > x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
Definition: Helix.cc:135
static void set_limits(const CLHEP::HepVector &a_min, const CLHEP::HepVector &a_max)
set limits for helix parameters
Definition: Helix.cc:61
const HepGeom::Point3D< double > & center(void) const
returns position of helix center(z = 0.);
Definition: Helix.h:243
void ignoreErrorMatrix(void)
unsets error matrix. Error calculations will be ignored after this function call until an error matri...
Definition: Helix.cc:792
const CLHEP::HepSymMatrix & Ea(void) const
returns error matrix.
Definition: Helix.h:320
static bool set_exception(bool)
set to throw exception or not
Definition: Helix.cc:50
CLHEP::Hep3Vector direction(double dPhi=0.) const
returns direction vector after rotating angle dPhi in phi direction.
Definition: Helix.h:264
void updateCache(void)
update Caches
Definition: Helix.cc:436
double tanl(void) const
returns tanl.
Definition: Helix.h:299
double phi0(void) const
returns phi0.
Definition: Helix.h:278
double radius(void) const
returns radious of helix.
Definition: Helix.h:257
static bool ms_throw_exception
throw exception or not
Definition: Helix.h:171
const CLHEP::HepVector & a(void) const
returns helix parameters.
Definition: Helix.h:313
static bool ms_check_range
range in checked or not
Definition: Helix.h:167
CLHEP::HepMatrix del4MXDelA(double phi, double mass) const
Mathmatical functions.
Definition: Helix.cc:719
double dr(void) const
returns dr.
Definition: Helix.h:271
void debugPrint(void) const
print debug info
Definition: Helix.cc:799
CLHEP::HepMatrix delApDelA(const CLHEP::HepVector &ap) const
Mathmatical functions.
Definition: Helix.cc:509
double dz(void) const
returns dz.
Definition: Helix.h:292
static const double ConstantAlpha
Constant alpha for uniform field.
Definition: Helix.h:202
double bFieldZ(void) const
returns z componet of the magnetic field.
Definition: Helix.h:356
static const std::string invalidhelix
string of invalid helix
Definition: Helix.h:235
virtual ~TRGCDCHelix()
Destructor.
Definition: Helix.cc:130
static CLHEP::HepVector ms_amin
limits for helix parameters
Definition: Helix.h:163
CLHEP::HepMatrix delXDelA(double phi) const
Mathmatical functions.
Definition: Helix.cc:578
CLHEP::HepMatrix del4MDelA(double phi, double mass) const
Mathmatical functions.
Definition: Helix.cc:671
double cosPhi0(void) const
return cos(phi0).
Definition: Helix.h:370
CLHEP::HepMatrix delMDelA(double phi) const
Mathmatical functions.
Definition: Helix.cc:633
double kappa(void) const
returns kappa.
Definition: Helix.h:285
double curv(void) const
returns curvurture.
Definition: Helix.h:306
static bool set_print(bool)
set to print debug info or not
Definition: Helix.cc:55
double sinPhi0(void) const
returns sin(phi0).
Definition: Helix.h:363
CLHEP::Hep3Vector momentum(double dPhi=0.) const
returns momentum vector after rotating angle dPhi in phi direction.
Definition: Helix.cc:194
const HepGeom::Point3D< double > & pivot(void) const
returns pivot position.
Definition: Helix.h:250
Abstract base class for different kinds of events.