|
10 | 10 |
|
11 | 11 | #include "DetectorsBase/Propagator.h" |
12 | 12 | #include "GPUCommonLogger.h" |
13 | | -#include "Field/MagFieldFast.h" |
| 13 | +#include "GPUTPCGMPolynomialField.h" |
14 | 14 | #include "MathUtils/Utils.h" |
15 | 15 | #include "ReconstructionDataFormats/Vertex.h" |
16 | 16 |
|
17 | 17 | using namespace o2::base; |
18 | 18 |
|
19 | | -#ifndef GPUCA_STANDALONE |
| 19 | +#if !defined(GPUCA_GPUCODE) |
| 20 | +#include "Field/MagFieldFast.h" // Don't use this on the GPU |
| 21 | +#endif |
| 22 | + |
| 23 | +#if !defined(GPUCA_STANDALONE) && !defined(GPUCA_GPUCODE) |
20 | 24 | #include "Field/MagneticField.h" |
21 | 25 | #include "DataFormatsParameters/GRPObject.h" |
22 | 26 | #include "DetectorsBase/GeometryManager.h" |
@@ -125,7 +129,7 @@ GPUd() bool Propagator::PropagateToXBxByBz(o2::track::TrackParCov& track, float |
125 | 129 | } |
126 | 130 | auto x = track.getX() + step; |
127 | 131 | auto xyz0 = track.getXYZGlo(); |
128 | | - mField->Field(xyz0, &b[0]); |
| 132 | + getFiedXYZ(xyz0, &b[0]); |
129 | 133 |
|
130 | 134 | if (!track.propagateTo(x, b)) { |
131 | 135 | return false; |
@@ -184,7 +188,7 @@ GPUd() bool Propagator::PropagateToXBxByBz(o2::track::TrackPar& track, float xTo |
184 | 188 | } |
185 | 189 | auto x = track.getX() + step; |
186 | 190 | auto xyz0 = track.getXYZGlo(); |
187 | | - mField->Field(xyz0, &b[0]); |
| 191 | + getFiedXYZ(xyz0, &b[0]); |
188 | 192 |
|
189 | 193 | if (!track.propagateParamTo(x, b)) { |
190 | 194 | return false; |
@@ -516,3 +520,19 @@ GPUd() MatBudget Propagator::getMatBudget(Propagator::MatCorrType corrType, cons |
516 | 520 | #endif |
517 | 521 | return mMatLUT->getMatBudget(p0.X(), p0.Y(), p0.Z(), p1.X(), p1.Y(), p1.Z()); |
518 | 522 | } |
| 523 | + |
| 524 | +GPUd() void Propagator::getFiedXYZ(const math_utils::Point3D<float> xyz, float* bxyz) const |
| 525 | +{ |
| 526 | + if (mGPUField) { |
| 527 | +#if defined(GPUCA_GPUCODE_DEVICE) && defined(GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM) |
| 528 | + const auto* f = &GPUCA_CONSMEM.param.polynomialField; // Access directly from constant memory on GPU (copied here to avoid complicated header dependencies) |
| 529 | +#else |
| 530 | + const auto* f = mGPUField; |
| 531 | +#endif |
| 532 | + f->GetField(xyz.X(), xyz.Y(), xyz.Z(), bxyz); |
| 533 | + } else { |
| 534 | +#ifndef GPUCA_GPUCODE |
| 535 | + mField->Field(xyz, bxyz); // Must not call the host-only function in GPU compilation |
| 536 | +#endif |
| 537 | + } |
| 538 | +} |
0 commit comments