Skip to content

Commit 6b6098b

Browse files
authored
ITS: create artefacts labels only on demand (#14594)
1 parent 556556a commit 6b6098b

File tree

5 files changed

+29
-13
lines changed

5 files changed

+29
-13
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ struct TrackingParameters {
8080
float TrackFollowerNSigmaCutZ = 1.f;
8181
float TrackFollowerNSigmaCutPhi = 1.f;
8282

83+
bool createArtefactLabels{false};
84+
8385
bool PrintMemory = false; // print allocator usage in epilog report
8486
size_t MaxMemory = std::numeric_limits<size_t>::max();
8587
bool DropTFUponFailure = false;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ struct TrackerParamConfig : public o2::conf::ConfigurableParamHelper<TrackerPara
9797
bool doUPCIteration = false; // Perform an additional iteration for UPC events on tagged vertices. You want to combine this config with VertexerParamConfig.nIterations=2
9898
int nIterations = MaxIter; // overwrite the number of iterations
9999

100+
bool createArtefactLabels{false}; // create on-the-fly labels for the artefacts
101+
100102
int nThreads = 1;
101103
bool printMemory = false;
102104
size_t maxMemory = std::numeric_limits<size_t>::max();

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ std::vector<TrackingParameters> TrackingMode::getTrackingParameters(TrackingMode
187187
p.MinPt[lslot] *= bFactor;
188188
}
189189

190+
p.createArtefactLabels = tc.createArtefactLabels;
191+
190192
p.PrintMemory = tc.printMemory;
191193
p.MaxMemory = tc.maxMemory;
192194
p.DropTFUponFailure = tc.dropTFUponFailure;

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,6 @@ void TimeFrame<nLayers>::wipe()
666666
deepVectorClear(mROFramesPV);
667667
deepVectorClear(mPrimaryVertices);
668668
deepVectorClear(mRoads);
669-
deepVectorClear(mRoadLabels);
670669
deepVectorClear(mMSangles);
671670
deepVectorClear(mPhiCuts);
672671
deepVectorClear(mPositionResolution);
@@ -676,9 +675,15 @@ void TimeFrame<nLayers>::wipe()
676675
deepVectorClear(mTrackletsIndexROF);
677676
deepVectorClear(mPrimaryVertices);
678677
deepVectorClear(mTrackletClusters);
679-
deepVectorClear(mVerticesContributorLabels);
680678
deepVectorClear(mLines);
681-
deepVectorClear(mLinesLabels);
679+
if (hasMCinformation()) {
680+
deepVectorClear(mLinesLabels);
681+
deepVectorClear(mVerticesContributorLabels);
682+
deepVectorClear(mTrackletLabels);
683+
deepVectorClear(mCellLabels);
684+
deepVectorClear(mRoadLabels);
685+
deepVectorClear(mTracksLabel);
686+
}
682687
}
683688

684689
template class TimeFrame<7>;

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

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ void TrackerTraits<nLayers>::computeLayerTracklets(const int iteration, int iROF
272272
});
273273

274274
/// Create tracklets labels
275-
if (mTimeFrame->hasMCinformation()) {
275+
if (mTimeFrame->hasMCinformation() && mTrkParams[iteration].createArtefactLabels) {
276276
tbb::parallel_for(
277277
tbb::blocked_range<int>(0, mTrkParams[iteration].TrackletsPerRoad()),
278278
[&](const tbb::blocked_range<int>& Layers) {
@@ -313,7 +313,7 @@ void TrackerTraits<nLayers>::computeLayerCells(const int iteration)
313313
if (iLayer > 0) {
314314
deepVectorClear(mTimeFrame->getCellsLookupTable()[iLayer - 1]);
315315
}
316-
if (mTimeFrame->hasMCinformation()) {
316+
if (mTimeFrame->hasMCinformation() && mTrkParams[iteration].createArtefactLabels) {
317317
deepVectorClear(mTimeFrame->getCellsLabel(iLayer));
318318
}
319319
}
@@ -458,14 +458,19 @@ void TrackerTraits<nLayers>::computeLayerCells(const int iteration)
458458
});
459459

460460
/// Create cells labels
461-
if (mTimeFrame->hasMCinformation()) {
462-
for (int iLayer{0}; iLayer < mTrkParams[iteration].CellsPerRoad(); ++iLayer) {
463-
for (const auto& cell : mTimeFrame->getCells()[iLayer]) {
464-
MCCompLabel currentLab{mTimeFrame->getTrackletsLabel(iLayer)[cell.getFirstTrackletIndex()]};
465-
MCCompLabel nextLab{mTimeFrame->getTrackletsLabel(iLayer + 1)[cell.getSecondTrackletIndex()]};
466-
mTimeFrame->getCellsLabel(iLayer).emplace_back(currentLab == nextLab ? currentLab : MCCompLabel());
467-
}
468-
}
461+
if (mTimeFrame->hasMCinformation() && mTrkParams[iteration].createArtefactLabels) {
462+
tbb::parallel_for(
463+
tbb::blocked_range<int>(0, mTrkParams[iteration].CellsPerRoad()),
464+
[&](const tbb::blocked_range<int>& Layers) {
465+
for (int iLayer = Layers.begin(); iLayer < Layers.end(); ++iLayer) {
466+
mTimeFrame->getCellsLabel(iLayer).reserve(mTimeFrame->getCells()[iLayer].size());
467+
for (const auto& cell : mTimeFrame->getCells()[iLayer]) {
468+
MCCompLabel currentLab{mTimeFrame->getTrackletsLabel(iLayer)[cell.getFirstTrackletIndex()]};
469+
MCCompLabel nextLab{mTimeFrame->getTrackletsLabel(iLayer + 1)[cell.getSecondTrackletIndex()]};
470+
mTimeFrame->getCellsLabel(iLayer).emplace_back(currentLab == nextLab ? currentLab : MCCompLabel());
471+
}
472+
}
473+
});
469474
}
470475
}
471476

0 commit comments

Comments
 (0)