66 float xDist = trcB.
xC - trcA.xC, yDist = trcB.yC - trcA.yC;
67 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) {
78 }
else if (dist + trcB.rC < trcA.rC) {
86 float r2r = trcA.rC + trcB.rC;
87 float r1_r = trcA.rC / r2r;
88 float r2_r = trcB.rC / r2r;
89 xDCA[0] = r2_r * trcA.xC + r1_r * trcB.xC;
90 yDCA[0] = r2_r * trcA.yC + r1_r * trcB.yC;
92 }
else if (o2::gpu::GPUCommonMath::Sqrt(xDist) < o2::gpu::GPUCommonMath::Sqrt(yDist)) {
95 float a = (trcA.rC * trcA.rC - trcB.rC * trcB.rC + dist2) / (2. * yDist),
b = -xDist / yDist, ab =
a *
b,
bb =
b *
b;
96 float det = ab * ab - (1. +
bb) * (
a *
a - trcA.rC * trcA.rC);
98 det = o2::gpu::GPUCommonMath::Sqrt(det);
99 xDCA[0] = (-ab + det) / (1. +
b *
b);
102 xDCA[1] = (-ab - det) / (1. +
b *
b);
110 float a = (trcA.rC * trcA.rC - trcB.rC * trcB.rC + dist2) / (2. * xDist),
b = -yDist / xDist, ab =
a *
b,
bb =
b *
b;
111 float det = ab * ab - (1. +
bb) * (
a *
a - trcA.rC * trcA.rC);
113 det = o2::gpu::GPUCommonMath::Sqrt(det);
114 yDCA[0] = (-ab + det) / (1. +
bb);
117 yDCA[1] = (-ab - det) / (1. +
bb);
134 float r2r = trcA.rC + o2::gpu::GPUCommonMath::Sqrt(rBSign);
135 float r1_r = trcA.rC / r2r;
136 float r2_r = o2::gpu::GPUCommonMath::Sqrt(rBSign) / r2r;
137 xDCA[0] = r2_r * trcA.xC + r1_r * (xDist + trcA.xC);
138 yDCA[0] = r2_r * trcA.yC + r1_r * (yDist + trcA.yC);
146 auto t2d = (dist + trcA.rC - rBSign) / dist;
147 xDCA[0] = trcA.xC + 0.5 * (xDist * t2d);
148 yDCA[0] = trcA.yC + 0.5 * (yDist * t2d);
153 template <
typename T>
171 float dx =
trax1.
xC - trax0.xC;
172 float dy =
trax1.
yC - trax0.yC;
173 float dz =
tr1.getZ() -
tr0.getZ();
174 auto csp0i2 = 1. /
tr0.getCsp2();
175 auto csp0i = o2::gpu::GPUCommonMath::Sqrt(csp0i2);
176 auto tgp0 =
tr0.getSnp() * csp0i;
177 float kx0 = trax0.c - trax0.s * tgp0;
178 float ky0 = trax0.s + trax0.c * tgp0;
179 float kz0 =
tr0.getTgl() * csp0i;
180 auto csp1i2 = 1. /
tr1.getCsp2();
181 auto csp1i = o2::gpu::GPUCommonMath::Sqrt(csp1i2);
182 auto tgp1 =
tr1.getSnp() * o2::gpu::GPUCommonMath::Sqrt(csp1i2);
185 float kz1 =
tr1.getTgl() * csp1i;
194 float a00 = (1.f +
tr0.getTgl() *
tr0.getTgl()) * csp0i2, a11 = (1.f +
tr1.getTgl() *
tr1.getTgl()) * csp1i2, a01 = -(kx0 * kx1 + ky0 * ky1 + kz0 * kz1);
195 float b0 = dx * kx0 + dy * ky0 + dz * kz0,
b1 = -(dx * kx1 + dy * ky1 + dz * kz1);
196 float det = a00 * a11 - a01 * a01, det0 = b0 * a11 -
b1 * a01, det1 = a00 *
b1 - a01 * b0;
198 auto detI = 1. / det;
199 auto t0 = det0 * detI;
200 auto t1 = det1 * detI;
201 float addx0 = kx0 *
t0, addy0 = ky0 *
t0, addx1 = kx1 *
t1, addy1 = ky1 *
t1;
207 xDCA[0] = (trax0.xC + addx0 +
trax1.
xC + addx1) * 0.5;
208 yDCA[0] = (trax0.yC + addy0 +
trax1.
yC + addy1) * 0.5;
214 template <
typename T>
232 const auto& traxH = trax0.rC >
trax1.
rC ? trax0 :
trax1;
237 float dx = traxL.
xC - traxH.xC;
238 float dy = traxL.yC - traxH.yC;
240 auto cspi2 = 1. / trcL.getCsp2();
241 auto cspi = o2::gpu::GPUCommonMath::Sqrt(cspi2);
242 auto tgp = trcL.getSnp() * cspi;
243 float kx = traxL.c - traxL.s * tgp;
244 float ky = traxL.s + traxL.c * tgp;
245 double dk = dx * kx + dy * ky;
246 double det = dk * dk - cspi2 * (dx * dx + dy * dy - traxH.rC * traxH.rC);
248 det = o2::gpu::GPUCommonMath::Sqrt(det);
249 float t0 = (-dk + det) * cspi2;
250 float t1 = (-dk - det) * cspi2;
251 xDCA[0] = traxL.xC + kx *
t0;
252 yDCA[0] = traxL.yC + ky *
t0;
253 xDCA[1] = traxL.xC + kx *
t1;
254 yDCA[1] = traxL.yC + ky *
t1;
258 float t = -dk * cspi2;
259 float xL = traxL.xC + kx * t,
yL = traxL.yC + ky * t;
260 float dxc =
xL - traxH.xC, dyc =
yL - traxH.yC, dist = o2::gpu::GPUCommonMath::Sqrt(dxc * dxc + dyc * dyc);
264 float drcf = traxH.rC / dist;
265 float xH = traxH.xC + dxc * drcf, yH = traxH.yC + dyc * drcf;
266 xDCA[0] = (
xL + xH) * 0.5;
267 yDCA[0] = (
yL + yH) * 0.5;
273 template <
typename T>
291 template <typename T>