Project
Loading...
Searching...
No Matches
TrackParametrization.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
17/*
18 24/09/2020: Added new data member for abs. charge. This is needed for uniform treatment of tracks with non-standard
19 charge: 0 (for V0s) and e.g. 2 for hypernuclei.
20 In the aliroot AliExternalTrackParam this was treated by derived classes using virtual methods, which we don't use in O2.
21 The meaning of mP[kQ2Pt] remains exactly the same, except for q=0 case: in this case the mP[kQ2Pt] is just an alias to
22 1/pT, regardless of its sign, and the getCurvature() will 0 (because mAbsCharge is 0).
23 The methods returning lab momentum or its combination account for eventual q>1.
24 */
25
26#ifndef INCLUDE_RECONSTRUCTIONDATAFORMATS_TRACKPARAMETRIZATION_H_
27#define INCLUDE_RECONSTRUCTIONDATAFORMATS_TRACKPARAMETRIZATION_H_
28
29#include "GPUCommonDef.h"
30#include "GPUCommonRtypes.h"
31#include "GPUCommonMath.h"
32#include "GPUCommonArray.h"
33#include "GPUROOTCartesianFwd.h"
34
35#ifndef GPUCA_GPUCODE_DEVICE
36#include <algorithm>
37#include <cfloat>
38#include <cmath>
39#include <cstring>
40#include <iosfwd>
41#include <type_traits>
42#endif
43
44#ifndef GPUCA_ALIGPUCODE // Used only by functions that are hidden on the GPU
46#include <string>
47#endif
48
50#include "MathUtils/Utils.h"
53
55
56namespace o2
57{
58template <typename T>
59class BaseCluster;
60
61namespace dataformats
62{
63class VertexBase;
64class DCA;
65} // namespace dataformats
66
67namespace track
68{
69// aliases for track elements
70enum ParLabels : int { kY,
92
93enum DirType : int { DirInward = -1,
96
97constexpr int kNParams = 5, kCovMatSize = 15, kLabCovMatSize = 21;
98
99constexpr float kCY2max = 100 * 100, // SigmaY<=100cm
100 kCZ2max = 100 * 100, // SigmaZ<=100cm
101 kCSnp2max = 1 * 1, // SigmaSin<=1
102 kCTgl2max = 1 * 1, // SigmaTan<=1
103 kC1Pt2max = 100 * 100, // Sigma1/Pt<=100 1/GeV
104 kMostProbablePt = 0.6f, // Most Probable Pt (GeV), for running with Bz=0
105 kCalcdEdxAuto = -999.f; // value indicating request for dedx calculation
106
107// access to covariance matrix by row and column
108GPUconstexpr() int CovarMap[kNParams][kNParams] = {{0, 1, 3, 6, 10},
109 {1, 2, 4, 7, 11},
110 {3, 4, 5, 8, 12},
111 {6, 7, 8, 9, 13},
112 {10, 11, 12, 13, 14}};
113
114// access to covariance matrix diagonal elements
115GPUconstexpr() int DiagMap[kNParams] = {0, 2, 5, 9, 14};
116
118constexpr float MaxPT = 100000.; // do not allow pTs exceeding this value (to avoid NANs)
119constexpr float MinPTInv = 1. / MaxPT; // do not allow q/pTs less this value (to avoid NANs)
120constexpr float ELoss2EKinThreshInv = 1. / 0.025; // do not allow E.Loss correction step with dE/Ekin above the inverse of this value
121constexpr int MaxELossIter = 50; // max number of iteration for the ELoss to account for BB dependence on beta*gamma
122// uncomment this to enable correction for BB dependence on beta*gamma via BB derivative
123// #define _BB_NONCONST_CORR_
124
125template <typename value_T = float>
127{ // track parameterization, kinematics only.
128
129 public:
130 using value_t = value_T;
134
135 struct yzerr_t { // 2 measurement with error
138 };
139
140#ifndef GPUCA_GPUCODE_DEVICE
141 static_assert(std::is_floating_point_v<value_t>);
142#endif
143
152
153 GPUd() void set(value_t x, value_t alpha, const params_t& par, int charge = 1, const PID pid = PID::Pion);
154 GPUd() void set(value_t x, value_t alpha, const value_t* par, int charge = 1, const PID pid = PID::Pion);
155 GPUd() const value_t* getParams() const;
156 GPUd() value_t getParam(int i) const;
158 GPUd() value_t getAlpha() const;
161 GPUd() value_t getSnp() const;
162 GPUd() value_t getTgl() const;
163 GPUhd() value_t getQ2Pt() const;
164 GPUd() value_t getCharge2Pt() const;
165 GPUd() int getAbsCharge() const;
166 GPUd() PID getPID() const;
167 GPUd() void setPID(const PID pid, bool passCharge = false);
168
170 GPUd() value_t getCsp2() const;
171 GPUd() value_t getCsp() const;
172
173 GPUd() void setX(value_t v);
174 GPUd() void setParam(value_t v, int i);
175 GPUd() void setAlpha(value_t v);
176 GPUd() void setY(value_t v);
177 GPUd() void setZ(value_t v);
178 GPUd() void setSnp(value_t v);
179 GPUd() void setTgl(value_t v);
180 GPUd() void setQ2Pt(value_t v);
181 GPUd() void setAbsCharge(int q);
182
183 // derived getters
184 GPUd() bool getXatLabR(value_t r, value_t& x, value_t bz, DirType dir = DirAuto) const;
185 GPUd() void getCircleParamsLoc(value_t bz, o2::math_utils::CircleXY<value_t>& circle) const;
186 GPUd() void getCircleParams(value_t bz, o2::math_utils::CircleXY<value_t>& circle, value_t& sna, value_t& csa) const;
187 GPUd() void getLineParams(o2::math_utils::IntervalXY<value_t>& line, value_t& sna, value_t& csa) const;
188 GPUd() value_t getCurvature(value_t b) const;
189 GPUd() int getCharge() const;
190 GPUd() int getSign() const;
191 GPUd() value_t getPhi() const;
192 GPUd() value_t getPhiPos() const;
193
194 GPUd() value_t getQ2P2() const;
195 GPUd() value_t getPtInv() const;
196 GPUd() value_t getP2Inv() const;
197 GPUd() value_t getP2() const;
198 GPUd() value_t getPInv() const;
200 GPUd() value_t getPt() const;
201 GPUd() value_t getE2() const;
203 GPUdi() static value_t getdEdxBB(value_t betagamma) { return BetheBlochSolid(betagamma); }
204 GPUdi() static value_t getdEdxBBOpt(value_t betagamma) { return BetheBlochSolidOpt(betagamma); }
205 GPUdi() static value_t getBetheBlochSolidDerivativeApprox(value_T dedx, value_T bg) { return BetheBlochSolidDerivative(dedx, bg); }
206
207 GPUd() value_t getTheta() const;
208 GPUd() value_t getEta() const;
209 GPUd() math_utils::Point3D<value_t> getXYZGlo() const;
210 GPUd() void getXYZGlo(dim3_t& xyz) const;
211 GPUd() bool getPxPyPzGlo(dim3_t& pxyz) const;
212 GPUd() bool getPosDirGlo(gpu::gpustd::array<value_t, 9>& posdirp) const;
213
214 // methods for track params estimate at other point
215 GPUd() bool getYZAt(value_t xk, value_t b, value_t& y, value_t& z) const;
222 GPUd() value_t getDCAYtoMV(value_t b, value_t xmv = 0.f, value_t ymv = 0.f, value_t zmv = 0.f) const;
223 GPUd() value_t getDCAZtoMV(value_t b, value_t xmv = 0.f, value_t ymv = 0.f, value_t zmv = 0.f) const;
224 GPUd() math_utils::Point3D<value_t> getXYZGloAt(value_t xk, value_t b, bool& ok) const;
225
226 // parameters manipulation
227 GPUd() bool correctForELoss(value_t xrho, bool anglecorr = false);
228 GPUd() bool rotateParam(value_t alpha);
229 GPUd() bool propagateParamTo(value_t xk, value_t b);
230 GPUd() bool propagateParamTo(value_t xk, const dim3_t& b);
231 GPUd() void invertParam();
232 GPUd() bool propagateParamToDCA(const math_utils::Point3D<value_t>& vtx, value_t b, dim2_t* dca = nullptr, value_t maxD = 999.f);
233 // aliases
234 GPUd() bool rotate(value_t alpha) { return rotateParam(alpha); }
235 GPUd() bool propagateTo(value_t xk, value_t b) { return propagateParamTo(xk, b); }
236 GPUd() bool propagateTo(value_t xk, const dim3_t& b) { return propagateParamTo(xk, b); }
237 GPUd() void invert() { invertParam(); }
238 GPUd() bool propagateToDCA(const math_utils::Point3D<value_t>& vtx, value_t b, dim2_t* dca = nullptr, value_t maxD = 999.f) { return propagateParamToDCA(vtx, b, dca, maxD); }
239
241 GPUd() void invalidate();
242
243 GPUhd() uint16_t getUserField() const;
244 GPUhd() void setUserField(uint16_t v);
245
246 GPUd() void printParam() const;
247 GPUd() void printParamHexadecimal();
248#ifndef GPUCA_ALIGPUCODE
249 std::string asString() const;
250 std::string asStringHexadecimal();
251#endif
252
253 GPUd() void updateParam(value_t delta, int i);
254 GPUd() void updateParams(const params_t& delta);
255 GPUd() void updateParams(const value_t* delta);
256
257 GPUd() yzerr_t getVertexInTrackFrame(const o2::dataformats::VertexBase& vtx) const;
258
259 private:
260 //
261 static constexpr value_t InvalidX = -99999.f;
262 value_t mX = 0.f;
263 value_t mAlpha = 0.f;
264 value_t mP[kNParams] = {0.f};
265 char mAbsCharge = 1;
266 PID mPID{PID::Pion};
267 uint16_t mUserField = 0;
268
269 ClassDefNV(TrackParametrization, 3);
270};
271
272//____________________________________________________________
273template <typename value_T>
274GPUdi() TrackParametrization<value_T>::TrackParametrization(value_t x, value_t alpha, const params_t& par, int charge, const PID pid)
275 : mX{x}, mAlpha{alpha}, mAbsCharge{char(gpu::CAMath::Abs(charge))}, mPID{pid}
276{
277 // explicit constructor
278 for (int i = 0; i < kNParams; i++) {
279 mP[i] = par[i];
280 }
281}
282
283//____________________________________________________________
284template <typename value_T>
285GPUdi() void TrackParametrization<value_T>::set(value_t x, value_t alpha, const params_t& par, int charge, const PID pid)
286{
287 set(x, alpha, par.data(), charge, pid);
288}
289
290//____________________________________________________________
291template <typename value_T>
292GPUdi() void TrackParametrization<value_T>::set(value_t x, value_t alpha, const value_t* par, int charge, const PID pid)
293{
294 mX = x;
295 mAlpha = alpha;
296 mAbsCharge = char(gpu::CAMath::Abs(charge));
297 for (int i = 0; i < kNParams; i++) {
298 mP[i] = par[i];
299 }
300 mPID = pid;
301}
302
303//____________________________________________________________
304template <typename value_T>
305GPUdi() auto TrackParametrization<value_T>::getParams() const -> const value_t*
306{
307 return mP;
308}
309
310//____________________________________________________________
311template <typename value_T>
312GPUdi() auto TrackParametrization<value_T>::getParam(int i) const -> value_t
313{
314 return mP[i];
315}
316
317//____________________________________________________________
318template <typename value_T>
319GPUdi() auto TrackParametrization<value_T>::getX() const -> value_t
320{
321 return mX;
322}
323
324//____________________________________________________________
325template <typename value_T>
326GPUdi() auto TrackParametrization<value_T>::getAlpha() const -> value_t
327{
328 return mAlpha;
329}
330
331//____________________________________________________________
332template <typename value_T>
333GPUdi() auto TrackParametrization<value_T>::getY() const -> value_t
334{
335 return mP[kY];
336}
337
338//____________________________________________________________
339template <typename value_T>
340GPUdi() auto TrackParametrization<value_T>::getZ() const -> value_t
341{
342 return mP[kZ];
343}
344
345//____________________________________________________________
346template <typename value_T>
347GPUdi() auto TrackParametrization<value_T>::getSnp() const -> value_t
348{
349 return mP[kSnp];
350}
351
352//____________________________________________________________
353template <typename value_T>
354GPUdi() auto TrackParametrization<value_T>::getTgl() const -> value_t
355{
356 return mP[kTgl];
357}
358
359//____________________________________________________________
360template <typename value_T>
361GPUhdi() auto TrackParametrization<value_T>::getQ2Pt() const -> value_t
362{
363 return mP[kQ2Pt];
364}
365
366//____________________________________________________________
367template <typename value_T>
368GPUdi() auto TrackParametrization<value_T>::getCharge2Pt() const -> value_t
369{
370 return mAbsCharge ? mP[kQ2Pt] : 0.f;
371}
372
373//____________________________________________________________
374template <typename value_T>
375GPUdi() int TrackParametrization<value_T>::getAbsCharge() const
376{
377 return mAbsCharge;
378}
379
380//____________________________________________________________
381template <typename value_T>
382GPUdi() PID TrackParametrization<value_T>::getPID() const
383{
384 return mPID;
385}
386
387//____________________________________________________________
388template <typename value_T>
389GPUdi() void TrackParametrization<value_T>::setPID(const PID pid, bool passCharge)
390{
391 mPID = pid;
392 if (passCharge) {
393 setAbsCharge(pid.getCharge()); // If needed, user should change the charge via corr. setter
394 }
395}
396
397//____________________________________________________________
398template <typename value_T>
399GPUdi() auto TrackParametrization<value_T>::getCsp2() const -> value_t
400{
401 const value_t csp2 = (1.f - mP[kSnp]) * (1.f + mP[kSnp]);
403}
404
405//____________________________________________________________
406template <typename value_T>
407GPUdi() auto TrackParametrization<value_T>::getCsp() const -> value_t
408{
409 return gpu::CAMath::Sqrt(getCsp2());
410}
411
412//____________________________________________________________
413template <typename value_T>
414GPUdi() void TrackParametrization<value_T>::setX(value_t v)
415{
416 mX = v;
417}
418
419//____________________________________________________________
420template <typename value_T>
421GPUdi() void TrackParametrization<value_T>::setParam(value_t v, int i)
422{
423 mP[i] = v;
424}
425
426//____________________________________________________________
427template <typename value_T>
428GPUdi() void TrackParametrization<value_T>::setAlpha(value_t v)
429{
430 mAlpha = v;
431}
432
433//____________________________________________________________
434template <typename value_T>
435GPUdi() void TrackParametrization<value_T>::setY(value_t v)
436{
437 mP[kY] = v;
438}
439
440//____________________________________________________________
441template <typename value_T>
442GPUdi() void TrackParametrization<value_T>::setZ(value_t v)
443{
444 mP[kZ] = v;
445}
446
447//____________________________________________________________
448template <typename value_T>
449GPUdi() void TrackParametrization<value_T>::setSnp(value_t v)
450{
451 mP[kSnp] = v;
452}
453
454//____________________________________________________________
455template <typename value_T>
456GPUdi() void TrackParametrization<value_T>::setTgl(value_t v)
457{
458 mP[kTgl] = v;
459}
460
461//____________________________________________________________
462template <typename value_T>
463GPUdi() void TrackParametrization<value_T>::setQ2Pt(value_t v)
464{
465 mP[kQ2Pt] = v;
466}
467
468//____________________________________________________________
469template <typename value_T>
470GPUdi() void TrackParametrization<value_T>::setAbsCharge(int q)
471{
472 mAbsCharge = gpu::CAMath::Abs(q);
473}
474
475//_______________________________________________________
476template <typename value_T>
477GPUdi() void TrackParametrization<value_T>::getCircleParamsLoc(value_t bz, o2::math_utils::CircleXY<value_t>& c) const
478{
479 // get circle params in track local frame, for straight line just set to local coordinates
480 c.rC = getCurvature(bz);
481 // treat as straight track if sagitta between the vertex and middle of TPC is below 0.01 cm
482 constexpr value_t MinSagitta = 0.01f, TPCMidR = 160.f, MinCurv = 8 * MinSagitta / (TPCMidR * TPCMidR);
483 if (gpu::CAMath::Abs(c.rC) > MinCurv) {
484 c.rC = 1.f / getCurvature(bz);
485 value_t sn = getSnp(), cs = gpu::CAMath::Sqrt((1.f - sn) * (1.f + sn));
486 c.xC = getX() - sn * c.rC; // center in tracking
487 c.yC = getY() + cs * c.rC; // frame. Note: r is signed!!!
488 c.rC = gpu::CAMath::Abs(c.rC);
489 } else {
490 c.rC = 0.f; // signal straight line
491 c.xC = getX();
492 c.yC = getY();
493 }
494}
495
496//_______________________________________________________
497template <typename value_T>
498GPUdi() void TrackParametrization<value_T>::getCircleParams(value_t bz, o2::math_utils::CircleXY<value_t>& c, value_t& sna, value_t& csa) const
499{
500 // get circle params in loc and lab frame, for straight line just set to global coordinates
501 getCircleParamsLoc(bz, c);
502 o2::math_utils::detail::sincos(getAlpha(), sna, csa);
503 o2::math_utils::detail::rotateZ<value_t>(c.xC, c.yC, c.xC, c.yC, sna, csa); // center in global frame
504}
505
506//_______________________________________________________
507template <typename value_T>
508GPUdi() void TrackParametrization<value_T>::getLineParams(o2::math_utils::IntervalXY<value_t>& ln, value_t& sna, value_t& csa) const
509{
510 // get line parameterization as { x = x0 + xSlp*t, y = y0 + ySlp*t }
511 o2::math_utils::detail::sincos(getAlpha(), sna, csa);
512 o2::math_utils::detail::rotateZ<value_t>(getX(), getY(), ln.getX0(), ln.getY0(), sna, csa); // reference point in global frame
513 value_t snp = getSnp(), csp = gpu::CAMath::Sqrt((1.f - snp) * (1.f + snp));
514 ln.setDX(csp * csa - snp * sna);
515 ln.setDY(snp * csa + csp * sna);
516}
517
518//____________________________________________________________
519template <typename value_T>
520GPUdi() auto TrackParametrization<value_T>::getCurvature(value_t b) const -> value_t
521{
522 return mAbsCharge ? mP[kQ2Pt] * b * o2::constants::math::B2C : 0.;
523}
524
525//____________________________________________________________
526template <typename value_T>
527GPUdi() int TrackParametrization<value_T>::getCharge() const
528{
529 return getSign() > 0 ? mAbsCharge : -mAbsCharge;
530}
531
532//____________________________________________________________
533template <typename value_T>
534GPUdi() int TrackParametrization<value_T>::getSign() const
535{
536 return mAbsCharge ? (mP[kQ2Pt] > 0.f ? 1 : -1) : 0;
537}
538
539//_______________________________________________________
540template <typename value_T>
541GPUdi() auto TrackParametrization<value_T>::getPhi() const -> value_t
542{
543 // track pt direction phi (in 0:2pi range)
544 value_t phi = gpu::CAMath::ASin(getSnp()) + getAlpha();
545 math_utils::detail::bringTo02Pi<value_t>(phi);
546 return phi;
547}
548
549//_______________________________________________________
550template <typename value_T>
551GPUdi() auto TrackParametrization<value_T>::getPhiPos() const -> value_t
552{
553 // angle of track position (in -pi:pi range)
554 value_t phi = gpu::CAMath::ATan2(getY(), getX()) + getAlpha();
555 math_utils::detail::bringTo02Pi<value_t>(phi);
556 return phi;
557}
558
559//____________________________________________________________
560template <typename value_T>
561GPUdi() auto TrackParametrization<value_T>::getQ2P2() const -> value_t
562{
563 // return the (q/p)^2
564 value_t q2pt2 = mP[kQ2Pt] * mP[kQ2Pt];
565 if (q2pt2 < MinPTInv * MinPTInv) {
566 q2pt2 = MinPTInv * MinPTInv;
567 }
568 return q2pt2 / (1.f + getTgl() * getTgl());
569}
570
571//____________________________________________________________
572template <typename value_T>
573GPUdi() auto TrackParametrization<value_T>::getPtInv() const -> value_t
574{
575 // return the inverted track pT
576 value_t ptInv = gpu::CAMath::Abs(mP[kQ2Pt]);
577 if (ptInv < MinPTInv) {
578 ptInv = MinPTInv;
579 }
580 return (mAbsCharge > 1) ? ptInv / mAbsCharge : ptInv;
581}
582
583//____________________________________________________________
584template <typename value_T>
585GPUdi() auto TrackParametrization<value_T>::getP2Inv() const -> value_t
586{
587 // return the inverted track momentum^2
588 value_t p2 = getPtInv();
589 return p2 * p2 / (1.f + getTgl() * getTgl());
590}
591
592//____________________________________________________________
593template <typename value_T>
594GPUdi() auto TrackParametrization<value_T>::getP2() const -> value_t
595{
596 // return the track momentum^2
597 return 1.f / getP2Inv(); // getP2Inv is protected against being 0, full charge accounted
598}
599
600//____________________________________________________________
601template <typename value_T>
602GPUdi() auto TrackParametrization<value_T>::getPInv() const -> value_t
603{
604 // return the inverted track momentum
605 return getPtInv() / gpu::CAMath::Sqrt(1.f + getTgl() * getTgl()); // getPtInv() is protected against being 0, full charge accounted
606}
607
608//____________________________________________________________
609template <typename value_T>
610GPUdi() auto TrackParametrization<value_T>::getP() const -> value_t
611{
612 // return the track momentum
613 return 1.f / getPInv(); // getPInv is already protected against being 0
614}
615
616//____________________________________________________________
617template <typename value_T>
618GPUdi() auto TrackParametrization<value_T>::getE2() const -> value_t
619{
620 // return the track energy^2
621 return getP2() + getPID().getMass2();
622}
623
624//____________________________________________________________
625template <typename value_T>
626GPUdi() auto TrackParametrization<value_T>::getE() const -> value_t
627{
628 // return the track energy
629 return gpu::CAMath::Sqrt(getE2());
630}
631
632//____________________________________________________________
633template <typename value_T>
634GPUdi() auto TrackParametrization<value_T>::getPt() const -> value_t
635{
636 // return the track transverse momentum
637 return 1.f / getPtInv(); // getPtInv is already protected against being 0
638}
639
640//____________________________________________________________
641template <typename value_T>
642GPUdi() auto TrackParametrization<value_T>::getTheta() const -> value_t
643{
644 return constants::math::PIHalf - gpu::CAMath::ATan(mP[3]);
645}
646
647//____________________________________________________________
648template <typename value_T>
649GPUdi() auto TrackParametrization<value_T>::getEta() const -> value_t
650{
651 return -gpu::CAMath::Log(gpu::CAMath::Tan(0.5f * getTheta()));
652}
653
654//_______________________________________________________
655template <typename value_T>
656GPUdi() auto TrackParametrization<value_T>::getXYZGlo() const -> math_utils::Point3D<value_t>
657{
658#ifndef GPUCA_ALIGPUCODE
659 return math_utils::Rotation2D<value_t>(getAlpha())(math_utils::Point3D<value_t>(getX(), getY(), getZ()));
660#else // mockup on GPU without ROOT
661 float sina, cosa;
662 gpu::CAMath::SinCos(getAlpha(), sina, cosa);
663 return math_utils::Point3D<value_t>(cosa * getX() - sina * getY(), cosa * getY() + sina * getX(), getZ());
664#endif
665}
666
667//_______________________________________________________
668template <typename value_T>
669GPUdi() void TrackParametrization<value_T>::getXYZGlo(dim3_t& xyz) const
670{
671 // track coordinates in lab frame
672 xyz[0] = getX();
673 xyz[1] = getY();
674 xyz[2] = getZ();
675 math_utils::detail::rotateZ<value_t>(xyz, getAlpha());
676}
677
678//_______________________________________________________
679template <typename value_T>
680GPUdi() auto TrackParametrization<value_T>::getXYZGloAt(value_t xk, value_t b, bool& ok) const -> math_utils::Point3D<value_t>
681{
682 //----------------------------------------------------------------
683 // estimate global X,Y,Z in global frame at given X
684 //----------------------------------------------------------------
685 value_t y = 0.f, z = 0.f;
686 ok = getYZAt(xk, b, y, z);
687 if (ok) {
688#ifndef GPUCA_ALIGPUCODE
689 return math_utils::Rotation2D<value_t>(getAlpha())(math_utils::Point3D<value_t>(xk, y, z));
690#else // mockup on GPU without ROOT
691 float sina, cosa;
692 gpu::CAMath::SinCos(getAlpha(), sina, cosa);
693 return math_utils::Point3D<value_t>(cosa * xk - sina * y, cosa * y + sina * xk, z);
694#endif
695 } else {
696 return math_utils::Point3D<value_t>();
697 }
698}
699
700//____________________________________________________________
701template <typename value_T>
702GPUdi() bool TrackParametrization<value_T>::isValid() const
703{
704 return mX != InvalidX;
705}
706
707//____________________________________________________________
708template <typename value_T>
709GPUdi() void TrackParametrization<value_T>::invalidate()
710{
711 mX = InvalidX;
712}
713
714template <typename value_T>
715GPUhdi() uint16_t TrackParametrization<value_T>::getUserField() const
716{
717 return mUserField;
718}
719
720template <typename value_T>
721GPUhdi() void TrackParametrization<value_T>::setUserField(uint16_t v)
722{
723 mUserField = v;
724}
725
726//____________________________________________________________
727template <typename value_T>
728GPUdi() void TrackParametrization<value_T>::updateParam(value_t delta, int i)
729{
730 mP[i] += delta;
731}
732
733//____________________________________________________________
734template <typename value_T>
735GPUdi() void TrackParametrization<value_T>::updateParams(const params_t& delta)
736{
737 updateParams(delta.data());
738}
739
740//____________________________________________________________
741template <typename value_T>
742GPUdi() void TrackParametrization<value_T>::updateParams(const value_t* delta)
743{
744 for (int i = kNParams; i--;) {
745 mP[i] += delta[i];
746 }
747 // make sure that snp is in the valid range
748 if (mP[kSnp] > constants::math::Almost1) {
750 } else if (mP[kSnp] < -constants::math::Almost1) {
752 }
753}
754
755} // namespace track
756} // namespace o2
757
758#endif /* INCLUDE_RECONSTRUCTIONDATAFORMATS_TRACKPARAMETRIZATION_H_ */
General auxilliary methods.
particle ids, masses, names class definition
int16_t charge
Definition RawEventData.h:5
int32_t i
#define GPUhdDefault()
constexpr int p2()
useful math constants
Declarations of 2D primitives.
uint16_t pid
Definition RawData.h:2
uint32_t c
Definition RawData.h:2
static constexpr ID Pion
Definition PID.h:96
gpu::gpustd::array< value_t, kNParams > params_t
o2::math_utils::CircleXY< value_t > &circle const
o2::math_utils::CircleXY< value_t > & circle
GPUd() TrackParametrization(value_t x
value_t const params_t int charge
GPUdi() static value_t getdEdxBB(value_t betagamma)
GPUd() value_t getTheta() const
GPUd() bool propagateTo(value_t xk
value_t const params_t int const PID pid
std::string asString() const
GPUdDefault() TrackParametrization()=default
gpu::gpustd::array< value_t, 2 > dim2_t
GPUd() bool propagateToDCA(const math_utils
GPUdi() static value_t getdEdxBBOpt(value_t betagamma)
o2::math_utils::CircleXY< value_t > value_t & sna
GPUhd() value_t getQ2Pt() const
gpu::gpustd::array< value_t, 3 > dim3_t
GPUd() void updateParam(value_t delta
GPUd() bool isValid() const
GLfloat GLfloat GLfloat alpha
Definition glcorearb.h:279
GLint GLenum GLint x
Definition glcorearb.h:403
GLenum src
Definition glcorearb.h:1767
const GLdouble * v
Definition glcorearb.h:832
GLenum array
Definition glcorearb.h:4274
GLdouble f
Definition glcorearb.h:310
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLboolean r
Definition glcorearb.h:1233
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
GLboolean invert
Definition glcorearb.h:543
void set(T *h, size_t v)
Definition PageParser.h:107
constexpr float Almost0
constexpr float B2C
constexpr float PIHalf
constexpr float VeryBig
constexpr float Almost1
Node par(int index)
Parameters.
std::array< T, N > array
o2::dataformats::DCA DCA
double * getX(double *xyDxy, int N)
double * getY(double *xyDxy, int N)
constexpr float kCTgl2max
GPUhdi() uint16_t TrackParametrization< value_T >
constexpr float HugeF
GPUdi() TrackParametrization< value_T >
constexpr int kCovMatSize
constexpr float kCSnp2max
constexpr int kNParams
GPUconstexpr() int CovarMap[kNParams][kNParams]
constexpr int kLabCovMatSize
const value_T x
Definition TrackUtils.h:136
constexpr float kCY2max
constexpr float kCalcdEdxAuto
constexpr float kMostProbablePt
constexpr float MaxPT
constexpr float MinPTInv
constexpr float kC1Pt2max
constexpr float kCZ2max
constexpr int MaxELossIter
constexpr float ELoss2EKinThreshInv
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
bool isValid(std::string alias)