Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct TrackMCStudyConfig : o2::conf::ConfigurableParamHelper<TrackMCStudyConfig
int nTBPerOccBin = 48; // number of TB per occ bin
float rejectClustersResStat = 0.1;
float maxTPCRefExtrap = 2; // max dX to extrapolate the track ref when extrapolating track true posions
int minITSClForITSoutput = 7; // create special ITS otput only for long enough tracks
int decayPDG[5] = {310, 3122, 411, 421, -1}; // decays to study, must end by -1
O2ParamDef(TrackMCStudyConfig, "trmcconf");
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,7 @@ void TrackMCStudy::processITSTracks(const o2::globaltracking::RecoContainer& rec
const auto itsClRefs = recoData.getITSTracksClusterRefs();
const auto clusITS = recoData.getITSClusters();
const auto patterns = recoData.getITSClustersPatterns();
const auto& params = o2::trackstudy::TrackMCStudyConfig::Instance();
auto pattIt = patterns.begin();
mITSClustersArray.clear();
mITSClustersArray.reserve(clusITS.size());
Expand All @@ -1324,7 +1325,7 @@ void TrackMCStudy::processITSTracks(const o2::globaltracking::RecoContainer& rec
const auto& itsLb = itsLbls[itr];
// LOGP(info,"proc {} {} {}",itr0, itr, itsLb.asString());
int nCl = itsTr.getNClusters();
if (itsLb.isFake() || nCl != 7) {
if (itsLb.isFake() || nCl < params.minITSClForITSoutput) {
continue;
}
auto entrySel = mSelMCTracks.find(itsLb);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ struct TrackingParameters {
o2::base::PropagatorImpl<float>::MatCorrType CorrType = o2::base::PropagatorImpl<float>::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<float> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ struct TrackerParamConfig : public o2::conf::ConfigurableParamHelper<TrackerPara
int trackingMode = -1; // -1: unset, 0=sync, 1=async, 2=cosmics used by gpuwf only
bool doUPCIteration = false; // Perform an additional iteration for UPC events on tagged vertices. You want to combine this config with VertexerParamConfig.nIterations=2
int nIterations = MaxIter; // overwrite the number of iterations

int reseedIfShorter = 6; // for the final refit reseed the track with circle if they are shorter than this value
bool shiftRefToCluster{true}; // TrackFit: after update shift the linearization reference to cluster
bool createArtefactLabels{false}; // create on-the-fly labels for the artefacts

int nThreads = 1;
Expand Down
3 changes: 2 additions & 1 deletion Detectors/ITSMFT/ITS/tracking/src/Configuration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ std::vector<TrackingParameters> 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;
Expand Down
101 changes: 56 additions & 45 deletions Detectors/ITSMFT/ITS/tracking/src/TrackerTraits.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -763,63 +763,22 @@ void TrackerTraits<nLayers>::findRoads(const int iteration)
bounded_vector<TrackITSExt> 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 (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]);
// 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);
fitSuccess = fitTrack(temporaryTrack, mTrkParams[0].NLayers - 1, -1, -1, mTrkParams[0].MaxChi2ClusterAttachment, mTrkParams[0].MaxChi2NDF, 50.f, 0, &linRef);
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) {
Expand Down Expand Up @@ -1123,6 +1082,10 @@ bool TrackerTraits<nLayers>::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);
Expand Down Expand Up @@ -1240,6 +1203,54 @@ bool TrackerTraits<nLayers>::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 <int nLayers>
TrackITSExt TrackerTraits<nLayers>::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 <int nLayers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct SpacePointsCalibConfParam : public o2::conf::ConfigurableParamHelper<Spac
bool ignoreNonPVContrib = true; ///< flag if tracks which did not contribute to the PV should be ignored or not
bool enableTrackDownsampling = false; ///< flag if track sampling shall be enabled or not
bool refitITS = true; ///< refit ITS tracks with PID attached to the seed
bool shiftRefToCluster = true; ///< when reftting the ITS track, shift the lin.reference to cluster after every update (better material matching)
float tsalisThreshold = 1.f; ///< in case the sampling functions returns a value smaller than this the track is discarded (1. means no downsampling)

// other settings for track interpolation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,10 @@ bool TrackInterpolation::refITSTrack(o2::dataformats::GlobalTrackID gid, int see
LOGP(debug, "failed to update ITS tracks by cluster ({},{})/({},{},{})", track.asString(), cls.getY(), cls.getZ(), cls.getSigmaY2(), cls.getSigmaYZ(), cls.getSigmaZ2());
return false;
}
if (mParams->shiftRefToCluster) {
refLin.setY(posTF[0]);
refLin.setZ(posTF[1]);
}
}
seed = track;
// memorize that this ITS track was already refitted
Expand Down