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
131 MatCorrType matCorr = MatCorrType::USEMatCorrLUT, track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
132
133 template <typename track_T>
134 GPUd() bool propagateToR(track_T& track, value_type r, bool bzOnly = false, value_type maxSnp = MAX_SIN_PHI, value_type maxStep = MAX_STEP,
135 MatCorrType matCorr = MatCorrType::USEMatCorrLUT, track::TrackLTIntegral* tofInfo = nullptr, int signCorr = 0) const;
136
137 GPUd() bool propagateToDCA(const o2::dataformats::VertexBase& vtx, o2::track::TrackParametrizationWithError<value_type>& track, value_type bZ,
139 o2::dataformats::DCA* dcaInfo = nullptr, track::TrackLTIntegral* tofInfo = nullptr,
140 int signCorr = 0, value_type maxD = 999.f) const;
141
142 GPUd() bool propagateToDCABxByBz(const o2::dataformats::VertexBase& vtx, o2::track::TrackParametrizationWithError<value_type>& track,
144 o2::dataformats::DCA* dcaInfo = nullptr, track::TrackLTIntegral* tofInfo = nullptr,
145 int signCorr = 0, value_type maxD = 999.f) const;
146
147 GPUd() bool propagateToDCA(const o2::math_utils::Point3D<value_type>& vtx, o2::track::TrackParametrization<value_type>& track, value_type bZ,
149 std::array<value_type, 2>* dca = nullptr, track::TrackLTIntegral* tofInfo = nullptr,
150 int signCorr = 0, value_type maxD = 999.f) const;
151
152 GPUd() bool propagateToDCABxByBz(const o2::math_utils::Point3D<value_type>& vtx, o2::track::TrackParametrization<value_type>& track,
154 std::array<value_type, 2>* dca = nullptr, track::TrackLTIntegral* tofInfo = nullptr,
155 int signCorr = 0, value_type maxD = 999.f) const;
156
159 PropagatorImpl& operator=(PropagatorImpl const&) = delete;
160 PropagatorImpl& operator=(PropagatorImpl&&) = delete;
161
162 // Bz at the origin
163 GPUd() void updateField();
164 GPUd() value_type getNominalBz() const { return mNominalBz; }
165 GPUd() void setTGeoFallBackAllowed(bool v) { mTGeoFallBackAllowed = v; }
166 GPUd() bool isTGeoFallBackAllowed() const { return mTGeoFallBackAllowed; }
167 GPUd() void setMatLUT(const o2::base::MatLayerCylSet* lut) { mMatLUT = lut; }
168 GPUd() const o2::base::MatLayerCylSet* getMatLUT() const { return mMatLUT; }
169 GPUd() void setGPUField(const o2::gpu::GPUTPCGMPolynomialField* field) { mGPUField = field; }
170 GPUd() const o2::gpu::GPUTPCGMPolynomialField* getGPUField() const { return mGPUField; }
171 GPUd() void setNominalBz(value_type bz) { mNominalBz = bz; }
172 GPUd() bool hasMagFieldSet() const { return mField != nullptr; }
173
174 GPUd() value_type estimateLTFast(o2::track::TrackLTIntegral& lt, const o2::track::TrackParametrization<value_type>& trc) const;
175 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;
176
177#ifndef GPUCA_GPUCODE
178 static PropagatorImpl* Instance(bool uninitialized = false)
179 {
180 static PropagatorImpl instance(uninitialized);
181 return &instance;
182 }
183 static int initFieldFromGRP(const o2::parameters::GRPMagField* grp, bool verbose = false);
184
185 static int initFieldFromGRP(const o2::parameters::GRPObject* grp, bool verbose = false);
186 static int initFieldFromGRP(const std::string grpFileName = "", bool verbose = false);
187#endif
188
189 GPUd() MatBudget getMatBudget(MatCorrType corrType, const o2::math_utils::Point3D<value_type>& p0, const o2::math_utils::Point3D<value_type>& p1) const;
190
191 GPUd() void getFieldXYZ(const math_utils::Point3D<float> xyz, float* bxyz) const;
192
193 GPUd() void getFieldXYZ(const math_utils::Point3D<double> xyz, double* bxyz) const;
194
195 GPUd() float getBz(const math_utils::Point3D<float> xyz) const;
196
197 GPUd() double getBz(const math_utils::Point3D<double> xyz) const;
198
199 private:
200#ifndef GPUCA_GPUCODE
201 PropagatorImpl(bool uninitialized = false);
202 ~PropagatorImpl() = default;
203#endif
204 static constexpr value_type Epsilon = 0.00001; // precision of propagation to X
205 template <typename T>
206 GPUd() void getFieldXYZImpl(const math_utils::Point3D<T> xyz, T* bxyz) const;
207 template <typename T>
208 GPUd() T getBzImpl(const math_utils::Point3D<T> xyz) const;
209
210 const o2::field::MagFieldFast* mFieldFast = nullptr;
211 o2::field::MagneticField* mField = nullptr;
212 value_type mNominalBz = 0;
213
214 bool mTGeoFallBackAllowed = true;
215 const o2::base::MatLayerCylSet* mMatLUT = nullptr; // externally set LUT
216 const o2::gpu::GPUTPCGMPolynomialField* mGPUField = nullptr; // externally set GPU Field
217
218 ClassDefNV(PropagatorImpl, 0);
219};
220
224
225} // namespace base
226} // namespace o2
227
228#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:172
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:166
const o2::math_utils::Point3D< value_type > const o2::math_utils::Point3D< value_type > &p1 const
Definition Propagator.h:189
GPUd() void setTGeoFallBackAllowed(bool v)
Definition Propagator.h:165
value_type value_type maxSnp
Definition Propagator.h:76
GPUd() void setMatLUT(const o2
Definition Propagator.h:167
static int initFieldFromGRP(const o2::parameters::GRPMagField *grp, bool verbose=false)
const o2::math_utils::Point3D< value_type > & p0
Definition Propagator.h:189
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:178
TrackPar_t value_type value_type bool value_type value_type int minSteps
Definition Propagator.h:130
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.