Skip to content

Commit db05c58

Browse files
committed
Fix inconsistencies in the HelixHelper
1 parent 98f5ae0 commit db05c58

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Common/DCAFitter/include/DCAFitter/HelixHelper.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ struct CrossInfo {
6363
{
6464
const auto& trcA = trax0.rC > trax1.rC ? trax0 : trax1; // designate the largest circle as A
6565
const auto& trcB = trax0.rC > trax1.rC ? trax1 : trax0;
66+
nDCA = 0;
6667
float xDist = trcB.xC - trcA.xC, yDist = trcB.yC - trcA.yC;
6768
float dist2 = xDist * xDist + yDist * yDist, dist = o2::gpu::GPUCommonMath::Sqrt(dist2), rsum = trcA.rC + trcB.rC;
68-
if (o2::gpu::GPUCommonMath::Sqrt(dist) < 1e-12) {
69+
if (dist < 1e-12) {
6970
return nDCA; // circles are concentric?
7071
}
7172
if (dist > rsum) { // circles don't touch, chose a point in between
@@ -75,9 +76,13 @@ struct CrossInfo {
7576
return nDCA;
7677
}
7778
notTouchingXY(dist, xDist, yDist, trcA, trcB.rC, isCollinear);
78-
} else if (dist + trcB.rC < trcA.rC) { // the small circle is nestled into large one w/o touching
79-
// select the point of closest approach of 2 circles
80-
notTouchingXY(dist, xDist, yDist, trcA, -trcB.rC, isCollinear);
79+
} else if (auto dfr = dist + trcB.rC - trcA.rC; dfr < 0.) { // the small circle is nestled into large one w/o touching
80+
if (dfr > -maxDistXY) {
81+
// select the point of closest approach of 2 circles
82+
notTouchingXY(dist, xDist, yDist, trcA, -trcB.rC, isCollinear);
83+
} else {
84+
return nDCA;
85+
}
8186
} else { // 2 intersection points
8287
if (isCollinear) {
8388
/// collinear tracks, e.g. electrons from photon conversion
@@ -89,7 +94,7 @@ struct CrossInfo {
8994
xDCA[0] = r2_r * trcA.xC + r1_r * trcB.xC;
9095
yDCA[0] = r2_r * trcA.yC + r1_r * trcB.yC;
9196
nDCA = 1;
92-
} else if (o2::gpu::GPUCommonMath::Sqrt(xDist) < o2::gpu::GPUCommonMath::Sqrt(yDist)) {
97+
} else if (o2::gpu::GPUCommonMath::Abs(xDist) < o2::gpu::GPUCommonMath::Abs(yDist)) {
9398
// to simplify calculations, we move to new frame x->x+Xc0, y->y+Yc0, so that
9499
// the 1st one is centered in origin
95100
float a = (trcA.rC * trcA.rC - trcB.rC * trcB.rC + dist2) / (2. * yDist), b = -xDist / yDist, ab = a * b, bb = b * b;
@@ -167,7 +172,7 @@ struct CrossInfo {
167172
/// yL(t) = yL + t Ky; Ky = (sinAlp + cosAlp* snp/csp)
168173
/// zL(t) = zL + t Kz; Kz = tgl / csp
169174
/// Note that Kx^2 + Ky^2 + Kz^2 = (1+tgl^2) / csp^2
170-
175+
nDCA = 0;
171176
float dx = trax1.xC - trax0.xC; // for straight line TrackAuxPar stores lab coordinates at referene point!!!
172177
float dy = trax1.yC - trax0.yC; //
173178
float dz = tr1.getZ() - tr0.getZ();

0 commit comments

Comments
 (0)