Skip to content

Commit 99548c4

Browse files
committed
Robust propagation to certain R
o2::base::Propagator got method propagateToR(track, r, bool bzOnly, maxSnp ...) which propagates the track (either TrackPar or TrackParCov) to requested radius (not X!) if it is reachable in any tracking frame. The rotations to avoid track snp goind outside of the allowed range are done automatically. Moved HelixHelper to ReconstructionDataFormats.
1 parent 429846d commit 99548c4

File tree

15 files changed

+268
-89
lines changed

15 files changed

+268
-89
lines changed

Common/DCAFitter/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ o2_add_library(DCAFitter
2222
O2::DetectorsBase)
2323

2424
o2_target_root_dictionary(DCAFitter
25-
HEADERS include/DCAFitter/HelixHelper.h
26-
include/DCAFitter/DCAFitterN.h
25+
HEADERS include/DCAFitter/DCAFitterN.h
2726
include/DCAFitter/FwdDCAFitterN.h)
2827

2928
if (OpenMP_CXX_FOUND)

Common/DCAFitter/include/DCAFitter/DCAFitterN.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef _ALICEO2_DCA_FITTERN_
1818
#define _ALICEO2_DCA_FITTERN_
1919

20-
#include "DCAFitter/HelixHelper.h"
20+
#include "ReconstructionDataFormats/HelixHelper.h"
2121
#include "DetectorsBase/Propagator.h"
2222
#include "MathUtils/Cartesian.h"
2323
#include "ReconstructionDataFormats/Track.h"

Common/DCAFitter/include/DCAFitter/FwdDCAFitterN.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "MathUtils/Cartesian.h"
2121
#include "ReconstructionDataFormats/TrackFwd.h"
2222
#include "ReconstructionDataFormats/Track.h"
23-
#include "DCAFitter/HelixHelper.h"
23+
#include "ReconstructionDataFormats/HelixHelper.h"
2424
#include <TRandom.h>
2525
#include "DetectorsBase/Propagator.h"
2626
#include "DetectorsBase/GeometryManager.h"

Common/DCAFitter/src/DCAFitterLinkDef.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
#pragma link C++ class o2::vertexing::DCAFitterN < 2, o2::track::TrackParCov> + ;
1919
#pragma link C++ class o2::vertexing::DCAFitterN < 3, o2::track::TrackParCov> + ;
2020

21-
#pragma link C++ class o2::track::TrackAuxPar + ;
22-
#pragma link C++ class o2::track::CrossInfo + ;
23-
2421
#pragma link C++ function o2::vertexing::DCAFitter2::process(const o2::track::TrackParCov&, const o2::track::TrackParCov&);
2522
#pragma link C++ function o2::vertexing::DCAFitter3::process(const o2::track::TrackParCov&, const o2::track::TrackParCov&, const o2::track::TrackParCov&);
2623

Common/Field/include/Field/MagFieldFast.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class MagFieldFast
5757
bool Field(const math_utils::Point3D<double> xyz, double bxyz[3]) const;
5858
bool GetBcomp(EDim comp, const double xyz[3], double& b) const;
5959
bool GetBcomp(EDim comp, const float xyz[3], float& b) const;
60-
bool GetBcomp(EDim comp, const math_utils::Point3D<float> xyz, double& b) const;
60+
bool GetBcomp(EDim comp, const math_utils::Point3D<double> xyz, double& b) const;
6161
bool GetBcomp(EDim comp, const math_utils::Point3D<float> xyz, float& b) const;
6262

6363
bool GetBx(const double xyz[3], double& bx) const { return GetBcomp(kX, xyz, bx); }
@@ -66,6 +66,8 @@ class MagFieldFast
6666
bool GetBy(const float xyz[3], float& by) const { return GetBcomp(kY, xyz, by); }
6767
bool GetBz(const double xyz[3], double& bz) const { return GetBcomp(kZ, xyz, bz); }
6868
bool GetBz(const float xyz[3], float& bz) const { return GetBcomp(kZ, xyz, bz); }
69+
bool GetBz(const math_utils::Point3D<double> xyz, double& bz) const { return GetBcomp(kZ, xyz, bz); }
70+
bool GetBz(const math_utils::Point3D<float> xyz, float& bz) const { return GetBcomp(kZ, xyz, bz); }
6971
void setFactorSol(float v = 1.f) { mFactorSol = v; }
7072
float getFactorSol() const { return mFactorSol; }
7173

Common/Field/src/MagFieldFast.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ bool MagFieldFast::GetBcomp(EDim comp, const double xyz[3], double& b) const
145145
}
146146

147147
//_______________________________________________________________________
148-
bool MagFieldFast::GetBcomp(EDim comp, const math_utils::Point3D<float> xyz, double& b) const
148+
bool MagFieldFast::GetBcomp(EDim comp, const math_utils::Point3D<double> xyz, double& b) const
149149
{
150150
// get field
151151
int zSeg, rSeg, quadrant;

DataFormats/Reconstruction/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ o2_target_root_dictionary(
7373
include/ReconstructionDataFormats/BCRange.h
7474
include/ReconstructionDataFormats/TrackHMP.h
7575
include/ReconstructionDataFormats/MatchInfoHMP.h
76+
include/ReconstructionDataFormats/HelixHelper.h
7677
)
7778

7879
o2_add_test(Vertex

Common/DCAFitter/include/DCAFitter/HelixHelper.h renamed to DataFormats/Reconstruction/include/ReconstructionDataFormats/HelixHelper.h

File renamed without changes.

DataFormats/Reconstruction/src/ReconstructionDataFormatsLinkDef.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,7 @@
117117
#pragma link C++ class o2::dataformats::StrangeTrack + ;
118118
#pragma link C++ class std::vector < o2::dataformats::StrangeTrack> + ;
119119

120+
#pragma link C++ class o2::track::TrackAuxPar + ;
121+
#pragma link C++ class o2::track::CrossInfo + ;
122+
120123
#endif

DataFormats/Reconstruction/src/TrackParametrization.cxx

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ GPUd() bool TrackParametrization<value_T>::getXatLabR(value_t r, value_t& x, val
651651
// DirOutward (==1) - go along the track (increasing mX)
652652
// DirInward (==-1) - go backward (decreasing mX)
653653
//
654-
const auto fy = mP[0], sn = mP[2];
654+
const double fy = mP[0], sn = mP[2];
655655
const value_t kEps = 1.e-6;
656656
//
657657
if (gpu::CAMath::Abs(getSnp()) > constants::math::Almost1) {
@@ -670,18 +670,18 @@ GPUd() bool TrackParametrization<value_T>::getXatLabR(value_t r, value_t& x, val
670670
if (r0 <= constants::math::Almost0) {
671671
return false; // the track is concentric to circle
672672
}
673-
value_t tR2r0 = 1.f, g = 0.f, tmp = 0.f;
673+
double tR2r0 = 1., g = 0., tmp = 0.;
674674
if (gpu::CAMath::Abs(circle.rC - r0) > kEps) {
675675
tR2r0 = circle.rC / r0;
676676
g = 0.5f * (r * r / (r0 * circle.rC) - tR2r0 - 1.f / tR2r0);
677677
tmp = 1.f + g * tR2r0;
678678
} else {
679679
tR2r0 = 1.0;
680-
g = 0.5f * r * r / (r0 * circle.rC) - 1.f;
681-
tmp = 0.5f * r * r / (r0 * r0);
680+
g = 0.5 * r * r / (r0 * circle.rC) - 1.;
681+
tmp = 0.5 * r * r / (r0 * r0);
682682
}
683-
value_t det = (1.f - g) * (1.f + g);
684-
if (det < 0.f) {
683+
auto det = (1. - g) * (1. + g);
684+
if (det < 0.) {
685685
return false; // does not reach raduis r
686686
}
687687
det = gpu::CAMath::Sqrt(det);
@@ -691,42 +691,44 @@ GPUd() bool TrackParametrization<value_T>::getXatLabR(value_t r, value_t& x, val
691691
// where s0 and c0 make direction for the circle center (=circle.xC/r0 and circle.yC/r0)
692692
//
693693
x = circle.xC * tmp;
694-
value_t y = circle.yC * tmp;
694+
auto y = circle.yC * tmp;
695695
if (gpu::CAMath::Abs(circle.yC) > constants::math::Almost0) { // when circle.yC==0 the x,y is unique
696-
value_t dfx = tR2r0 * gpu::CAMath::Abs(circle.yC) * det;
697-
value_t dfy = tR2r0 * circle.xC * (circle.yC > 0.f ? det : -det);
696+
auto dfx = tR2r0 * gpu::CAMath::Abs(circle.yC) * det;
697+
auto dfy = tR2r0 * circle.xC * (circle.yC > 0. ? det : -det);
698698
if (dir == DirAuto) { // chose the one which corresponds to smallest step
699-
value_t delta = (x - mX) * dfx - (y - fy) * dfy; // the choice of + in C will lead to smaller step if delta<0
700-
x += delta < 0.f ? dfx : -dfx;
699+
auto delta = (x - mX) * dfx - (y - fy) * dfy; // the choice of + in C will lead to smaller step if delta<0
700+
x += delta < 0. ? dfx : -dfx;
701701
} else if (dir == DirOutward) { // along track direction: x must be > mX
702702
x -= dfx; // try the smallest step (dfx is positive)
703-
value_t dfeps = mX - x; // handle special case of very small step
703+
auto dfeps = mX - x; // handle special case of very small step
704704
if (dfeps < -kEps) {
705705
return true;
706706
}
707707
if (gpu::CAMath::Abs(dfeps) < kEps && gpu::CAMath::Abs(mX * mX + fy * fy - r * r) < kEps) { // are we already in right r?
708-
return mX;
708+
x = mX;
709+
return true;
709710
}
710711
x += dfx + dfx;
711-
value_t dxm = x - mX;
712-
if (dxm > 0.f) {
712+
auto dxm = x - mX;
713+
if (dxm > 0.) {
713714
return true;
714715
} else if (dxm < -kEps) {
715716
return false;
716717
}
717718
x = mX; // don't move
718719
} else { // backward: x must be < mX
719720
x += dfx; // try the smallest step (dfx is positive)
720-
value_t dfeps = x - mX; // handle special case of very small step
721+
auto dfeps = x - mX; // handle special case of very small step
721722
if (dfeps < -kEps) {
722723
return true;
723724
}
724725
if (gpu::CAMath::Abs(dfeps) < kEps && gpu::CAMath::Abs(mX * mX + fy * fy - r * r) < kEps) { // are we already in right r?
725-
return mX;
726+
x = mX;
727+
return true;
726728
}
727729
x -= dfx + dfx;
728-
value_t dxm = x - mX;
729-
if (dxm < 0.f) {
730+
auto dxm = x - mX;
731+
if (dxm < 0.) {
730732
return true;
731733
}
732734
if (dxm > kEps) {
@@ -739,11 +741,11 @@ GPUd() bool TrackParametrization<value_T>::getXatLabR(value_t r, value_t& x, val
739741
return false;
740742
}
741743
}
742-
return x;
744+
return true;
743745
}
744746
// this is a straight track
745747
if (gpu::CAMath::Abs(sn) >= constants::math::Almost1) { // || to Y axis
746-
value_t det = (r - mX) * (r + mX);
748+
double det = (r - mX) * (r + mX);
747749
if (det < 0.f) {
748750
return false; // does not reach raduis r
749751
}
@@ -753,7 +755,7 @@ GPUd() bool TrackParametrization<value_T>::getXatLabR(value_t r, value_t& x, val
753755
}
754756
det = gpu::CAMath::Sqrt(det);
755757
if (dir == DirOutward) { // along the track direction
756-
if (sn > 0.f) {
758+
if (sn > 0.) {
757759
if (fy > det) {
758760
return false; // track is along Y axis and above the circle
759761
}
@@ -763,7 +765,7 @@ GPUd() bool TrackParametrization<value_T>::getXatLabR(value_t r, value_t& x, val
763765
}
764766
}
765767
} else if (dir == DirInward) { // against track direction
766-
if (sn > 0.f) {
768+
if (sn > 0.) {
767769
if (fy < -det) {
768770
return false; // track is along Y axis
769771
}
@@ -772,13 +774,13 @@ GPUd() bool TrackParametrization<value_T>::getXatLabR(value_t r, value_t& x, val
772774
}
773775
}
774776
} else if (gpu::CAMath::Abs(sn) <= constants::math::Almost0) { // || to X axis
775-
value_t det = (r - fy) * (r + fy);
776-
if (det < 0.f) {
777+
double det = (r - fy) * (r + fy);
778+
if (det < 0.) {
777779
return false; // does not reach raduis r
778780
}
779781
det = gpu::CAMath::Sqrt(det);
780782
if (dir == DirAuto) {
781-
x = mX > 0.f ? det : -det; // choose the solution requiring the smalest step
783+
x = mX > 0. ? det : -det; // choose the solution requiring the smalest step
782784
return true;
783785
} else if (dir == DirOutward) { // along the track direction
784786
if (mX > det) {
@@ -794,17 +796,17 @@ GPUd() bool TrackParametrization<value_T>::getXatLabR(value_t r, value_t& x, val
794796
}
795797
}
796798
} else { // general case of straight line
797-
value_t cs = gpu::CAMath::Sqrt((1.f - sn) * (1.f + sn));
798-
value_t xsyc = mX * sn - fy * cs;
799-
value_t det = (r - xsyc) * (r + xsyc);
800-
if (det < 0.f) {
799+
auto cs = gpu::CAMath::Sqrt((1. - sn) * (1. + sn));
800+
auto xsyc = mX * sn - fy * cs;
801+
auto det = (r - xsyc) * (r + xsyc);
802+
if (det < 0.) {
801803
return false; // does not reach raduis r
802804
}
803805
det = gpu::CAMath::Sqrt(det);
804-
value_t xcys = mX * cs + fy * sn;
805-
value_t t = -xcys;
806+
auto xcys = mX * cs + fy * sn;
807+
auto t = -xcys;
806808
if (dir == DirAuto) {
807-
t += t > 0.f ? -det : det; // chose the solution requiring the smalest step
809+
t += t > 0. ? -det : det; // chose the solution requiring the smalest step
808810
} else if (dir > 0) { // go in increasing mX direction. ( t+-det > 0)
809811
if (t >= -det) {
810812
t += det; // take minimal step giving t>0

0 commit comments

Comments
 (0)