Project
Loading...
Searching...
No Matches
Propagator.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
15
16#ifndef ALICEO2_BASE_PROPAGATOR_
17#define ALICEO2_BASE_PROPAGATOR_
18
19#include "GPUCommonRtypes.h"
25
26#ifndef GPUCA_GPUCODE
27#include <array>
28#include <string>
29#endif
30
31namespace o2
32{
33namespace parameters
34{
35class GRPObject;
36class GRPMagField;
37} // namespace parameters
38
39namespace dataformats
40{
41class VertexBase;
42}
43
44namespace field
45{
46class MagFieldFast;
47class MagneticField;
48} // namespace field
49
50namespace gpu
51{
52class GPUTPCGMPolynomialField;
53}
54
55namespace base
56{
57
58template <typename value_T>
60{
61 public:
62 using value_type = value_T;
65
66 enum class MatCorrType : int {
67 USEMatCorrNONE, // flag to not use material corrections
68 USEMatCorrTGeo, // flag to use TGeo for material queries
70 }; // flag to use LUT for material queries (user must provide a pointer
71
72 static constexpr float MAX_SIN_PHI = 0.85f;
73 static constexpr float MAX_STEP = 2.0f;
74
75 GPUd() bool PropagateToXBxByBz(TrackParCov_t& track, value_type x,
77 track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
78
79 GPUd() bool PropagateToXBxByBz(TrackParCov_t& track, TrackPar_t& linRef, value_type x,
81 track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
82
83 GPUd() bool PropagateToXBxByBz(TrackPar_t& track, value_type x,
85 track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
86
87 GPUd() bool propagateToX(TrackParCov_t& track, value_type x, value_type bZ,
89 track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
90
91 GPUd() bool propagateToX(TrackParCov_t& track, TrackPar_t& linRef, value_type x, value_type bZ,
93 track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
94
95 GPUd() bool propagateToX(TrackPar_t& track, value_type x, value_type bZ,
97 track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
98
99 template <typename track_T>
100 GPUd() bool propagateTo(track_T& track, value_type x, bool bzOnly = false, value_type maxSnp = MAX_SIN_PHI, value_type maxStep = MAX_STEP,
101 MatCorrType matCorr = MatCorrType::USEMatCorrLUT, track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const
102 {
103 return bzOnly ? propagateToX(track, x, getBz(track.getXYZGlo()), maxSnp, maxStep, matCorr, tofInfo, signCorr) : PropagateToXBxByBz(track, x, maxSnp, maxStep, matCorr, tofInfo, signCorr);
104 }
105
106 GPUd() bool propagateToX(TrackParCov_t& track, TrackPar_t* linRef, value_type x, value_type bZ,
108 track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const
109 {
110 return linRef ? propagateToX(track, *linRef, x, bZ, maxSnp, maxStep, matCorr, tofInfo, signCorr) : propagateToX(track, x, bZ, maxSnp, maxStep, matCorr, tofInfo, signCorr);
111 }
112
113 GPUd() bool PropagateToXBxByBz(TrackParCov_t& track, TrackPar_t* linRef, value_type x,
115 track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const
116 {
117 return linRef ? PropagateToXBxByBz(track, *linRef, x, maxSnp, maxStep, matCorr, tofInfo, signCorr) : PropagateToXBxByBz(track, x, maxSnp, maxStep, matCorr, tofInfo, signCorr);
118 }
119
121 MatCorrType matCorr = MatCorrType::USEMatCorrLUT, track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const
122 {
123 return bzOnly ? propagateToX(track, linRef, x, getBz(track.getXYZGlo()), maxSnp, maxStep, matCorr, tofInfo, signCorr) : PropagateToXBxByBz(track, linRef, x, maxSnp, maxStep, matCorr, tofInfo, signCorr);
124 }
125
126 template <typename track_T>
127 GPUd() bool propagateToAlphaX(track_T& track, value_type alpha, value_type x, bool bzOnly = false, value_type maxSnp = MAX_SIN_PHI, value_type maxStep = MAX_STEP, int minSteps = 1,
128 MatCorrType matCorr = MatCorrType::USEMatCorrLUT, track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
129
130 template <typename track_T>
131 GPUd() bool propagateToR(track_T& track, value_type r, bool bzOnly = false, value_type maxSnp = MAX_SIN_PHI, value_type maxStep = MAX_STEP,
132 MatCorrType matCorr = MatCorrType::USEMatCorrLUT, track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
133
134 GPUd() bool propagateToDCA(const o2::dataformats::VertexBase& vtx, o2::track::TrackParametrizationWithError<value_type>& track, value_type bZ,
136 o2::dataformats::DCA* dcaInfo = nullptr, track::TrackLTIntegral* tofInfo = nullptr,
137 int signCorr = 0, value_type maxD = 999.f) const;
138
139 GPUd() bool propagateToDCABxByBz(const o2::dataformats::VertexBase& vtx, o2::track::TrackParametrizationWithError<value_type>& track,
141 o2::dataformats::DCA* dcaInfo = nullptr, track::TrackLTIntegral* tofInfo = nullptr,
142 int signCorr = 0, value_type maxD = 999.f) const;
143
144 GPUd() bool propagateToDCA(const o2::math_utils::Point3D<value_type>& vtx, o2::track::TrackParametrization<value_type>& track, value_type bZ,
146 std::array<value_type, 2>* dca = nullptr, track::TrackLTIntegral* tofInfo = nullptr,
147 int signCorr = 0, value_type maxD = 999.f) const;
148
149 GPUd() bool propagateToDCABxByBz(const o2::math_utils::Point3D<value_type>& vtx, o2::track::TrackParametrization<value_type>& track,
151 std::array<value_type, 2>* dca = nullptr, track::TrackLTIntegral* tofInfo = nullptr,
152 int signCorr = 0, value_type maxD = 999.f) const;
153
156 PropagatorImpl& operator=(PropagatorImpl const&) = delete;
157 PropagatorImpl& operator=(PropagatorImpl&&) = delete;
158
159 // Bz at the origin
160 GPUd() void updateField();
161 GPUd() value_type getNominalBz() const { return mNominalBz; }
162 GPUd() void setTGeoFallBackAllowed(bool v) { mTGeoFallBackAllowed = v; }
163 GPUd() bool isTGeoFallBackAllowed() const { return mTGeoFallBackAllowed; }
164 GPUd() void setMatLUT(const o2::base::MatLayerCylSet* lut) { mMatLUT = lut; }
165 GPUd() const o2::base::MatLayerCylSet* getMatLUT() const { return mMatLUT; }
166 GPUd() void setGPUField(const o2::gpu::GPUTPCGMPolynomialField* field) { mGPUField = field; }
167 GPUd() const o2::gpu::GPUTPCGMPolynomialField* getGPUField() const { return mGPUField; }
168 GPUd() void setNominalBz(value_type bz) { mNominalBz = bz; }
169 GPUd() bool hasMagFieldSet() const { return mField != nullptr; }
170
171 GPUd() value_type estimateLTFast(o2::track::TrackLTIntegral& lt, const o2::track::TrackParametrization<value_type>& trc) const;
172 GPUd() float estimateLTIncrement(const o2::track::TrackParametrization<value_type>& trc, const o2::math_utils::Point3D<value_type>& postStart, const o2::math_utils::Point3D<value_type>& posEnd) const;
173
174#ifndef GPUCA_GPUCODE
175 static PropagatorImpl* Instance(bool uninitialized = false)
176 {
177 static PropagatorImpl instance(uninitialized);
178 return &instance;
179 }
180 static int initFieldFromGRP(const o2::parameters::GRPMagField* grp, bool verbose = false);
181
182 static int initFieldFromGRP(const o2::parameters::GRPObject* grp, bool verbose = false);
183 static int initFieldFromGRP(const std::string grpFileName = "", bool verbose = false);
184#endif
185
186 GPUd() MatBudget getMatBudget(MatCorrType corrType, const o2::math_utils::Point3D<value_type>& p0, const o2::math_utils::Point3D<value_type>& p1) const;
187
188 GPUd() void getFieldXYZ(const math_utils::Point3D<float> xyz, float* bxyz) const;
189
190 GPUd() void getFieldXYZ(const math_utils::Point3D<double> xyz, double* bxyz) const;
191
192 GPUd() float getBz(const math_utils::Point3D<float> xyz) const;
193
194 GPUd() double getBz(const math_utils::Point3D<double> xyz) const;
195
196 private:
197#ifndef GPUCA_GPUCODE
198 PropagatorImpl(bool uninitialized = false);
199 ~PropagatorImpl() = default;
200#endif
201 static constexpr value_type Epsilon = 0.00001; // precision of propagation to X
202 template <typename T>
203 GPUd() void getFieldXYZImpl(const math_utils::Point3D<T> xyz, T* bxyz) const;
204 template <typename T>
205 GPUd() T getBzImpl(const math_utils::Point3D<T> xyz) const;
206
207 const o2::field::MagFieldFast* mFieldFast = nullptr;
208 o2::field::MagneticField* mField = nullptr;
209 value_type mNominalBz = 0;
210
211 bool mTGeoFallBackAllowed = true;
212 const o2::base::MatLayerCylSet* mMatLUT = nullptr; // externally set LUT
213 const o2::gpu::GPUTPCGMPolynomialField* mGPUField = nullptr; // externally set GPU Field
214
215 ClassDefNV(PropagatorImpl, 0);
216};
217
221
222} // namespace base
223} // namespace o2
224
225#endif
Base track model for the Barrel, params only, w/o covariance.
constexpr int p1()
constexpr to accelerate the coordinates changing
Declarations for the wrapper for the set of cylindrical material layers.
Header to collect physics constants.
Track Length and TOF integral.
GPUd() bool hasMagFieldSet() const
Definition Propagator.h:169
GPUd() void updateField()
value_type value_type value_type MatCorrType track::TrackLTIntegral * tofInfo
Definition Propagator.h:77
value_type value_type value_type MatCorrType track::TrackLTIntegral int signCorr
Definition Propagator.h:77
track::TrackParametrizationWithError< value_type > TrackParCov_t
Definition Propagator.h:64
track::TrackParametrization< value_type > TrackPar_t
Definition Propagator.h:63
static constexpr float MAX_SIN_PHI
Definition Propagator.h:72
value_type value_type bZ
Definition Propagator.h:87
value_type bool bzOnly
Definition Propagator.h:100
static constexpr float MAX_STEP
Definition Propagator.h:73
GPUd() bool isTGeoFallBackAllowed() const
Definition Propagator.h:163
const o2::math_utils::Point3D< value_type > const o2::math_utils::Point3D< value_type > &p1 const
Definition Propagator.h:186
GPUd() void setTGeoFallBackAllowed(bool v)
Definition Propagator.h:162
value_type value_type maxSnp
Definition Propagator.h:76
GPUd() void setMatLUT(const o2
Definition Propagator.h:164
static int initFieldFromGRP(const o2::parameters::GRPMagField *grp, bool verbose=false)
const o2::math_utils::Point3D< value_type > & p0
Definition Propagator.h:186
value_type value_type value_type maxStep
Definition Propagator.h:76
GPUd() bool PropagateToXBxByBz(TrackParCov_t &track
value_type value_type value_type MatCorrType matCorr
Definition Propagator.h:76
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
Definition Propagator.h:175
GLfloat GLfloat GLfloat alpha
Definition glcorearb.h:279
GLint GLenum GLint x
Definition glcorearb.h:403
const GLdouble * v
Definition glcorearb.h:832
GLenum array
Definition glcorearb.h:4274
GLdouble f
Definition glcorearb.h:310
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLboolean r
Definition glcorearb.h:1233
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.