Skip to content

Commit d623bb0

Browse files
committed
misc fixes in propagator
1 parent d9239bd commit d623bb0

4 files changed

Lines changed: 39 additions & 8 deletions

File tree

Detectors/Base/include/DetectorsBase/MatCell.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ struct MatBudget : MatCell {
5656
length *= scale;
5757
}
5858

59+
GPUd() float getXRho() const
60+
{
61+
return meanRho * length;
62+
}
63+
64+
GPUd() float getXRho(int signCorr) const
65+
{
66+
return meanRho * (signCorr < 0 ? -length : length);
67+
}
68+
5969
ClassDefNV(MatBudget, 1);
6070
};
6171

Detectors/Base/include/DetectorsBase/Propagator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ class Propagator
125125
#endif
126126

127127
GPUd() MatBudget getMatBudget(MatCorrType corrType, const o2::math_utils::Point3D<float>& p0, const o2::math_utils::Point3D<float>& p1) const;
128-
GPUd() void getFiedXYZ(const math_utils::Point3D<float> xyz, float* bxyz) const;
128+
GPUd() void getFieldXYZ(const math_utils::Point3D<float> xyz, float* bxyz) const;
129+
GPUd() void getFieldXYZ(const math_utils::Point3D<double> xyz, double* bxyz) const;
129130

130131
private:
131132
#ifndef GPUCA_GPUCODE

Detectors/Base/src/Propagator.cxx

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ GPUd() bool Propagator::PropagateToXBxByBz(o2::track::TrackParCov& track, float
137137
}
138138
auto x = track.getX() + step;
139139
auto xyz0 = track.getXYZGlo();
140-
getFiedXYZ(xyz0, &b[0]);
140+
getFieldXYZ(xyz0, &b[0]);
141141

142142
if (!track.propagateTo(x, b)) {
143143
return false;
@@ -148,7 +148,7 @@ GPUd() bool Propagator::PropagateToXBxByBz(o2::track::TrackParCov& track, float
148148
if (matCorr != MatCorrType::USEMatCorrNONE) {
149149
auto xyz1 = track.getXYZGlo();
150150
auto mb = getMatBudget(matCorr, xyz0, xyz1);
151-
if (!track.correctForMaterial(mb.meanX2X0, ((signCorr < 0) ? -mb.length : mb.length) * mb.meanRho)) {
151+
if (!track.correctForMaterial(mb.meanX2X0, mb.getXRho(signCorr))) {
152152
return false;
153153
}
154154

@@ -197,7 +197,7 @@ GPUd() bool Propagator::PropagateToXBxByBz(o2::track::TrackPar& track, float xTo
197197
}
198198
auto x = track.getX() + step;
199199
auto xyz0 = track.getXYZGlo();
200-
getFiedXYZ(xyz0, &b[0]);
200+
getFieldXYZ(xyz0, &b[0]);
201201

202202
if (!track.propagateParamTo(x, b)) {
203203
return false;
@@ -266,7 +266,7 @@ GPUd() bool Propagator::propagateToX(o2::track::TrackParCov& track, float xToGo,
266266
auto xyz1 = track.getXYZGlo();
267267
auto mb = getMatBudget(matCorr, xyz0, xyz1);
268268
//
269-
if (!track.correctForMaterial(mb.meanX2X0, ((signCorr < 0) ? -mb.length : mb.length) * mb.meanRho)) {
269+
if (!track.correctForMaterial(mb.meanX2X0, mb.getXRho(signCorr))) {
270270
return false;
271271
}
272272

@@ -325,7 +325,7 @@ GPUd() bool Propagator::propagateToX(o2::track::TrackPar& track, float xToGo, fl
325325
auto xyz1 = track.getXYZGlo();
326326
auto mb = getMatBudget(matCorr, xyz0, xyz1);
327327
//
328-
if (!track.correctForELoss(((signCorr < 0) ? -mb.length : mb.length) * mb.meanRho)) {
328+
if (!track.correctForELoss(mb.getXRho(signCorr))) {
329329
return false;
330330
}
331331

@@ -533,7 +533,7 @@ GPUd() MatBudget Propagator::getMatBudget(Propagator::MatCorrType corrType, cons
533533
return mMatLUT->getMatBudget(p0.X(), p0.Y(), p0.Z(), p1.X(), p1.Y(), p1.Z());
534534
}
535535

536-
GPUd() void Propagator::getFiedXYZ(const math_utils::Point3D<float> xyz, float* bxyz) const
536+
GPUd() void Propagator::getFieldXYZ(const math_utils::Point3D<float> xyz, float* bxyz) const
537537
{
538538
if (mGPUField) {
539539
#if defined(GPUCA_GPUCODE_DEVICE) && defined(GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM)
@@ -548,3 +548,23 @@ GPUd() void Propagator::getFiedXYZ(const math_utils::Point3D<float> xyz, float*
548548
#endif
549549
}
550550
}
551+
552+
GPUd() void Propagator::getFieldXYZ(const math_utils::Point3D<double> xyz, double* bxyz) const
553+
{
554+
if (mGPUField) {
555+
#if defined(GPUCA_GPUCODE_DEVICE) && defined(GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM)
556+
const auto* f = &GPUCA_CONSMEM.param.polynomialField; // Access directly from constant memory on GPU (copied here to avoid complicated header dependencies)
557+
#else
558+
const auto* f = mGPUField;
559+
#endif
560+
float bxyzF[3];
561+
f->GetField(xyz.X(), xyz.Y(), xyz.Z(), bxyzF);
562+
bxyz[0] = bxyzF[0];
563+
bxyz[1] = bxyzF[1];
564+
bxyz[2] = bxyzF[2];
565+
} else {
566+
#ifndef GPUCA_GPUCODE
567+
mField->Field(xyz, bxyz); // Must not call the host-only function in GPU compilation
568+
#endif
569+
}
570+
}

Detectors/GlobalTracking/src/MatchTPCITS.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ bool MatchTPCITS::refitTrackTPCITS(int iTPC, int& iITS)
14501450
if (mFieldON) { // circular arc = 2*R*asin(dXY/2R)
14511451
float b[3];
14521452
o2::math_utils::Point3D<float> posAv(0.5 * (posEnd.x() + posStart.x()), 0.5 * (posEnd.y() + posStart.y()), 0.5 * (posEnd.z() + posStart.z()));
1453-
propagator->getFiedXYZ(posAv, b);
1453+
propagator->getFieldXYZ(posAv, b);
14541454
float curvH = std::abs(0.5f * tracOut.getCurvature(b[2])), arcXY = 1. / curvH * std::asin(curvH * std::sqrt(d2XY));
14551455
d2XY = arcXY * arcXY;
14561456
}

0 commit comments

Comments
 (0)