diff --git a/Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyConfig.h b/Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyConfig.h index e67abe6de3315..ed78ba2a710ec 100644 --- a/Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyConfig.h +++ b/Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyConfig.h @@ -34,6 +34,7 @@ struct TrackMCStudyConfig : o2::conf::ConfigurableParamHelper::MatCorrType CorrType = o2::base::PropagatorImpl::MatCorrType::USEMatCorrNONE; float MaxChi2ClusterAttachment = 60.f; float MaxChi2NDF = 30.f; - int reseedIfShorter = 7; // reseed for the final track with this and shorter length + int reseedIfShorter = 6; // reseed for the final fit track with the length shorter than this std::vector MinPt = {0.f, 0.f, 0.f, 0.f}; unsigned char StartLayerMask = 0x7F; + bool shiftRefToCluster = true; // TrackFit: after update shift the linearization reference to cluster bool FindShortTracks = false; bool PerPrimaryVertexProcessing = false; bool SaveTimeBenchmarks = false; diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackerTraits.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackerTraits.h index 4d98b96abcd9d..f582b5ef3aec5 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackerTraits.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackerTraits.h @@ -93,6 +93,7 @@ class TrackerTraits private: track::TrackParCov buildTrackSeed(const Cluster& cluster1, const Cluster& cluster2, const TrackingFrameInfo& tf3); + TrackITSExt seedTrackForRefit(const CellSeedN& seed); 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); bool mApplySmoothing = false; diff --git a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingConfigParam.h b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingConfigParam.h index 6c4ecc5ab424d..2a3506f17fa2f 100644 --- a/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingConfigParam.h +++ b/Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingConfigParam.h @@ -96,7 +96,8 @@ struct TrackerParamConfig : public o2::conf::ConfigurableParamHelper TrackingMode::getTrackingParameters(TrackingMode int lslot = tc.MaxTrackLength - ilg; p.MinPt[lslot] *= bFactor; } - + p.reseedIfShorter = tc.reseedIfShorter; + p.shiftRefToCluster = tc.shiftRefToCluster; p.createArtefactLabels = tc.createArtefactLabels; p.PrintMemory = tc.printMemory; diff --git a/Detectors/ITSMFT/ITS/tracking/src/TrackerTraits.cxx b/Detectors/ITSMFT/ITS/tracking/src/TrackerTraits.cxx index 76615bb0c5d06..5c5eb47216051 100644 --- a/Detectors/ITSMFT/ITS/tracking/src/TrackerTraits.cxx +++ b/Detectors/ITSMFT/ITS/tracking/src/TrackerTraits.cxx @@ -763,55 +763,15 @@ void TrackerTraits::findRoads(const int iteration) bounded_vector tracks(mMemoryPool.get()); mTaskArena->execute([&] { auto forSeed = [&](auto Tag, int iSeed, int offset = 0) { - const auto& seed{trackSeeds[iSeed]}; - TrackITSExt temporaryTrack{seed}; - temporaryTrack.setChi2(0); - for (int iL{0}; iL < nLayers; ++iL) { - temporaryTrack.setExternalClusterIndex(iL, seed.getCluster(iL), seed.getCluster(iL) != constants::UnusedIndex); - } - o2::track::TrackPar linRef{seed}; - // do we want to reseed the track to get a stable reference? - /*{ - int ncl = temporaryTrack.getNClusters(); - if (ncl <= mTrkParams[0].reseedIfShorter) { - int lrMin = 999, lrMax = 0, lrMid = 0; // find midpoint - if (ncl == mTrkParams[0].NLayers) { - lrMin = 0; - lrMax = mTrkParams[0].NLayers - 1; - lrMid = (lrMin + lrMax) / 2; - } else { - for (int iL{0}; iL < nLayers; ++iL) { - if (seed.getCluster(iL) != constants::UnusedIndex) { - if (iLlrMax) { - lrMax = iL; - } - } - } - lrMid = lrMin+1; - float midR = 0.5*(mTrkParams[0].LayerRadii[lrMax] + mTrkParams[0].LayerRadii[lrMin]), dstMidR = o2::gpu::GPUCommonMath::Abs(midR - mTrkParams[0].LayerRadii[lrMid]); - // find the midpoint as closest to the midR - for (int iL{lrMid+1}; iL < lrMax-1; ++iL) { - auto dst = o2::gpu::GPUCommonMath::Abs(midR - mTrkParams[0].LayerRadii[iL]); - if (dst < dstMidR) { - lrMid = iL; - dstMidR = dst; - } - } - } - } - // RS TODO build seed: at the moment skip this: not sure how it will affect the GPU part) - }*/ - temporaryTrack.resetCovariance(); - temporaryTrack.setCov(temporaryTrack.getQ2Pt() * temporaryTrack.getQ2Pt() * temporaryTrack.getCov()[14], 14); + TrackITSExt temporaryTrack = seedTrackForRefit(trackSeeds[iSeed]); + o2::track::TrackPar linRef{temporaryTrack}; + o2::track::TrackParCov savTr = temporaryTrack; // REMOVE bool fitSuccess = fitTrack(temporaryTrack, 0, mTrkParams[0].NLayers, 1, mTrkParams[0].MaxChi2ClusterAttachment, mTrkParams[0].MaxChi2NDF, o2::constants::math::VeryBig, 0, &linRef); if (!fitSuccess) { return 0; } - temporaryTrack.getParamOut() = temporaryTrack.getParamIn(); + linRef = temporaryTrack.getParamOut(); // use refitted track as lin.reference temporaryTrack.resetCovariance(); temporaryTrack.setCov(temporaryTrack.getQ2Pt() * temporaryTrack.getQ2Pt() * temporaryTrack.getCov()[14], 14); temporaryTrack.setChi2(0); @@ -819,7 +779,6 @@ void TrackerTraits::findRoads(const int iteration) if (!fitSuccess || temporaryTrack.getPt() < mTrkParams[iteration].MinPt[mTrkParams[iteration].NLayers - temporaryTrack.getNClusters()]) { return 0; } - if constexpr (decltype(Tag)::value == PassMode::OnePass::value) { tracks.push_back(temporaryTrack); } else if constexpr (decltype(Tag)::value == PassMode::TwoPassCount::value) { @@ -1123,6 +1082,10 @@ bool TrackerTraits::fitTrack(TrackITSExt& track, int start, int end, in if (!track.o2::track::TrackParCov::update(trackingHit.positionTrackingFrame, trackingHit.covarianceTrackingFrame)) { return false; } + if (linRef && mTrkParams[0].shiftRefToCluster) { // displace the reference to the last updated cluster + linRef->setY(trackingHit.positionTrackingFrame[0]); + linRef->setZ(trackingHit.positionTrackingFrame[1]); + } nCl++; } return std::abs(track.getQ2Pt()) < maxQoverPt && track.getChi2() < chi2ndfcut * (nCl * 2 - 5); @@ -1240,6 +1203,54 @@ bool TrackerTraits::trackFollowing(TrackITSExt* track, int rof, bool ou return swapped; } +// create a new seed either from the existing track inner param or reseed from the edgepointd and cluster in the middle +template +TrackITSExt TrackerTraits::seedTrackForRefit(const CellSeedN& seed) +{ + TrackITSExt temporaryTrack(seed); + for (int iL = 0; iL < nLayers; ++iL) { + temporaryTrack.setExternalClusterIndex(iL, seed.getCluster(iL), seed.getCluster(iL) != constants::UnusedIndex); + } + int ncl = temporaryTrack.getNClusters(); + if (ncl < mTrkParams[0].reseedIfShorter) { // reseed with circle passing via edges and the midpoint + int lrMin = 999, lrMax = 0, lrMid = 0; + if (ncl == mTrkParams[0].NLayers) { + lrMin = 0; + lrMax = mTrkParams[0].NLayers - 1; + lrMid = (lrMin + lrMax) / 2; + } else { + for (int iL = 0; iL < nLayers; ++iL) { + if (seed.getCluster(iL) != constants::UnusedIndex) { + if (iL < lrMin) { + lrMin = iL; + } + if (iL > lrMax) { + lrMax = iL; + } + } + } + lrMid = lrMin + 1; + float midR = 0.5 * (mTrkParams[0].LayerRadii[lrMax] + mTrkParams[0].LayerRadii[lrMin]), dstMidR = o2::gpu::GPUCommonMath::Abs(midR - mTrkParams[0].LayerRadii[lrMid]); + for (int iL = lrMid + 1; iL < lrMax; ++iL) { // find the midpoint as closest to the midR + auto dst = o2::gpu::GPUCommonMath::Abs(midR - mTrkParams[0].LayerRadii[iL]); + if (dst < dstMidR) { + lrMid = iL; + dstMidR = dst; + } + } + } + const auto& cluster0_tf = mTimeFrame->getTrackingFrameInfoOnLayer(lrMin)[seed.getCluster(lrMin)]; // if the sensor frame! + const auto& cluster1_gl = mTimeFrame->getUnsortedClusters()[lrMid][seed.getCluster(lrMid)]; // global frame + const auto& cluster2_gl = mTimeFrame->getUnsortedClusters()[lrMax][seed.getCluster(lrMax)]; // global frame + temporaryTrack.getParamIn() = buildTrackSeed(cluster2_gl, cluster1_gl, cluster0_tf); + temporaryTrack.setQ2Pt(-temporaryTrack.getQ2Pt()); // we are calling buildTrackSeed with the clusters order opposite to what it expects + temporaryTrack.setSnp(-temporaryTrack.getSnp()); // we are calling buildTrackSeed with the clusters order opposite to what it expects + } + temporaryTrack.resetCovariance(); + temporaryTrack.setCov(temporaryTrack.getQ2Pt() * temporaryTrack.getQ2Pt() * temporaryTrack.getCov()[14], 14); + return temporaryTrack; +} + /// Clusters are given from inside outward (cluster3 is the outermost). The outermost cluster is given in the tracking /// frame coordinates whereas the others are referred to the global frame. template diff --git a/Detectors/TPC/calibration/SpacePoints/include/SpacePoints/SpacePointsCalibConfParam.h b/Detectors/TPC/calibration/SpacePoints/include/SpacePoints/SpacePointsCalibConfParam.h index 6b18df54bc903..8b884209dd697 100644 --- a/Detectors/TPC/calibration/SpacePoints/include/SpacePoints/SpacePointsCalibConfParam.h +++ b/Detectors/TPC/calibration/SpacePoints/include/SpacePoints/SpacePointsCalibConfParam.h @@ -42,6 +42,7 @@ struct SpacePointsCalibConfParam : public o2::conf::ConfigurableParamHelpershiftRefToCluster) { + refLin.setY(posTF[0]); + refLin.setZ(posTF[1]); + } } seed = track; // memorize that this ITS track was already refitted