Skip to content

Commit e82e459

Browse files
committed
Addapt ITS trackign to KF with external lin.ref
At the moment reseeding of lin.ref is not done, it is taken from the existing track seed
1 parent 580d11e commit e82e459

File tree

3 files changed

+66
-19
lines changed

3 files changed

+66
-19
lines changed

Detectors/ITSMFT/ITS/tracking/include/ITStracking/Configuration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ struct TrackingParameters {
6666
o2::base::PropagatorImpl<float>::MatCorrType CorrType = o2::base::PropagatorImpl<float>::MatCorrType::USEMatCorrNONE;
6767
float MaxChi2ClusterAttachment = 60.f;
6868
float MaxChi2NDF = 30.f;
69+
int reseedIfShorter = 7; // reseed for the final track with this and shorter length
6970
std::vector<float> MinPt = {0.f, 0.f, 0.f, 0.f};
7071
unsigned char StartLayerMask = 0x7F;
7172
bool FindShortTracks = false;

Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackerTraits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class TrackerTraits
9393

9494
private:
9595
track::TrackParCov buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3);
96-
bool fitTrack(TrackITSExt& track, int start, int end, int step, float chi2clcut = o2::constants::math::VeryBig, float chi2ndfcut = o2::constants::math::VeryBig, float maxQoverPt = o2::constants::math::VeryBig, int nCl = 0);
96+
bool fitTrack(TrackITSExt& track, int start, int end, int step, float chi2clcut = o2::constants::math::VeryBig, float chi2ndfcut = o2::constants::math::VeryBig, float maxQoverPt = o2::constants::math::VeryBig, int nCl = 0, o2::track::TrackPar* refLin = nullptr);
9797

9898
bool mApplySmoothing = false;
9999
std::shared_ptr<BoundedMemoryResource> mMemoryPool;

Detectors/ITSMFT/ITS/tracking/src/TrackerTraits.cxx

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -765,21 +765,57 @@ void TrackerTraits<nLayers>::findRoads(const int iteration)
765765
auto forSeed = [&](auto Tag, int iSeed, int offset = 0) {
766766
const auto& seed{trackSeeds[iSeed]};
767767
TrackITSExt temporaryTrack{seed};
768-
temporaryTrack.resetCovariance();
769768
temporaryTrack.setChi2(0);
770769
for (int iL{0}; iL < nLayers; ++iL) {
771770
temporaryTrack.setExternalClusterIndex(iL, seed.getCluster(iL), seed.getCluster(iL) != constants::UnusedIndex);
772771
}
773-
774-
bool fitSuccess = fitTrack(temporaryTrack, 0, mTrkParams[0].NLayers, 1, mTrkParams[0].MaxChi2ClusterAttachment, mTrkParams[0].MaxChi2NDF);
772+
o2::track::TrackPar linRef{seed};
773+
// do we want to reseed the track to get a stable reference?
774+
/*{
775+
int ncl = temporaryTrack.getNClusters();
776+
if (ncl <= mTrkParams[0].reseedIfShorter) {
777+
int lrMin = 999, lrMax = 0, lrMid = 0; // find midpoint
778+
if (ncl == mTrkParams[0].NLayers) {
779+
lrMin = 0;
780+
lrMax = mTrkParams[0].NLayers - 1;
781+
lrMid = (lrMin + lrMax) / 2;
782+
} else {
783+
for (int iL{0}; iL < nLayers; ++iL) {
784+
if (seed.getCluster(iL) != constants::UnusedIndex) {
785+
if (iL<lrMin) {
786+
lrMin = iL;
787+
}
788+
if (iL>lrMax) {
789+
lrMax = iL;
790+
}
791+
}
792+
}
793+
lrMid = lrMin+1;
794+
float midR = 0.5*(mTrkParams[0].LayerRadii[lrMax] + mTrkParams[0].LayerRadii[lrMin]), dstMidR = o2::gpu::GPUCommonMath::Abs(midR - mTrkParams[0].LayerRadii[lrMid]);
795+
// find the midpoint as closest to the midR
796+
for (int iL{lrMid+1}; iL < lrMax-1; ++iL) {
797+
auto dst = o2::gpu::GPUCommonMath::Abs(midR - mTrkParams[0].LayerRadii[iL]);
798+
if (dst < dstMidR) {
799+
lrMid = iL;
800+
dstMidR = dst;
801+
}
802+
}
803+
}
804+
}
805+
// RS TODO build seed: at the moment skip this: not sure how it will affect the GPU part)
806+
}*/
807+
temporaryTrack.resetCovariance();
808+
temporaryTrack.setCov(temporaryTrack.getQ2Pt() * temporaryTrack.getQ2Pt() * temporaryTrack.getCov()[14], 14);
809+
bool fitSuccess = fitTrack(temporaryTrack, 0, mTrkParams[0].NLayers, 1, mTrkParams[0].MaxChi2ClusterAttachment, mTrkParams[0].MaxChi2NDF, o2::constants::math::VeryBig, 0, &linRef);
775810
if (!fitSuccess) {
776811
return 0;
777812
}
778813

779814
temporaryTrack.getParamOut() = temporaryTrack.getParamIn();
780815
temporaryTrack.resetCovariance();
816+
temporaryTrack.setCov(temporaryTrack.getQ2Pt() * temporaryTrack.getQ2Pt() * temporaryTrack.getCov()[14], 14);
781817
temporaryTrack.setChi2(0);
782-
fitSuccess = fitTrack(temporaryTrack, mTrkParams[0].NLayers - 1, -1, -1, mTrkParams[0].MaxChi2ClusterAttachment, mTrkParams[0].MaxChi2NDF, 50.f);
818+
fitSuccess = fitTrack(temporaryTrack, mTrkParams[0].NLayers - 1, -1, -1, mTrkParams[0].MaxChi2ClusterAttachment, mTrkParams[0].MaxChi2NDF, 50.f, 0, &linRef);
783819
if (!fitSuccess || temporaryTrack.getPt() < mTrkParams[iteration].MinPt[mTrkParams[iteration].NLayers - temporaryTrack.getNClusters()]) {
784820
return 0;
785821
}
@@ -1045,7 +1081,7 @@ void TrackerTraits<nLayers>::findShortPrimaries()
10451081
}
10461082

10471083
template <int nLayers>
1048-
bool TrackerTraits<nLayers>::fitTrack(TrackITSExt& track, int start, int end, int step, float chi2clcut, float chi2ndfcut, float maxQoverPt, int nCl)
1084+
bool TrackerTraits<nLayers>::fitTrack(TrackITSExt& track, int start, int end, int step, float chi2clcut, float chi2ndfcut, float maxQoverPt, int nCl, o2::track::TrackPar* linRef)
10491085
{
10501086
auto propInstance = o2::base::Propagator::Instance();
10511087

@@ -1054,21 +1090,31 @@ bool TrackerTraits<nLayers>::fitTrack(TrackITSExt& track, int start, int end, in
10541090
continue;
10551091
}
10561092
const TrackingFrameInfo& trackingHit = mTimeFrame->getTrackingFrameInfoOnLayer(iLayer)[track.getClusterIndex(iLayer)];
1057-
1058-
if (!track.rotate(trackingHit.alphaTrackingFrame)) {
1059-
return false;
1060-
}
1061-
1062-
if (!propInstance->propagateToX(track, trackingHit.xTrackingFrame, getBz(), o2::base::PropagatorImpl<float>::MAX_SIN_PHI, o2::base::PropagatorImpl<float>::MAX_STEP, mTrkParams[0].CorrType)) {
1063-
return false;
1064-
}
1065-
1066-
if (mTrkParams[0].CorrType == o2::base::PropagatorF::MatCorrType::USEMatCorrNONE) {
1067-
if (!track.correctForMaterial(mTrkParams[0].LayerxX0[iLayer], mTrkParams[0].LayerxX0[iLayer] * constants::Radl * constants::Rho, true)) {
1068-
continue;
1093+
if (linRef) {
1094+
if (!track.rotate(trackingHit.alphaTrackingFrame, *linRef, getBz())) {
1095+
return false;
1096+
}
1097+
if (!propInstance->propagateToX(track, *linRef, trackingHit.xTrackingFrame, getBz(), o2::base::PropagatorImpl<float>::MAX_SIN_PHI, o2::base::PropagatorImpl<float>::MAX_STEP, mTrkParams[0].CorrType)) {
1098+
return false;
1099+
}
1100+
if (mTrkParams[0].CorrType == o2::base::PropagatorF::MatCorrType::USEMatCorrNONE) {
1101+
if (!track.correctForMaterial(*linRef, mTrkParams[0].LayerxX0[iLayer], mTrkParams[0].LayerxX0[iLayer] * constants::Radl * constants::Rho, true)) {
1102+
continue;
1103+
}
1104+
}
1105+
} else {
1106+
if (!track.rotate(trackingHit.alphaTrackingFrame)) {
1107+
return false;
1108+
}
1109+
if (!propInstance->propagateToX(track, trackingHit.xTrackingFrame, getBz(), o2::base::PropagatorImpl<float>::MAX_SIN_PHI, o2::base::PropagatorImpl<float>::MAX_STEP, mTrkParams[0].CorrType)) {
1110+
return false;
1111+
}
1112+
if (mTrkParams[0].CorrType == o2::base::PropagatorF::MatCorrType::USEMatCorrNONE) {
1113+
if (!track.correctForMaterial(mTrkParams[0].LayerxX0[iLayer], mTrkParams[0].LayerxX0[iLayer] * constants::Radl * constants::Rho, true)) {
1114+
continue;
1115+
}
10691116
}
10701117
}
1071-
10721118
auto predChi2{track.getPredictedChi2Quiet(trackingHit.positionTrackingFrame, trackingHit.covarianceTrackingFrame)};
10731119
if ((nCl >= 3 && predChi2 > chi2clcut) || predChi2 < 0.f) {
10741120
return false;

0 commit comments

Comments
 (0)