Skip to content

Commit 4f42cba

Browse files
authored
Add option to drop the whole TF and continue (#13791)
1 parent 07a0339 commit 4f42cba

File tree

6 files changed

+70
-43
lines changed

6 files changed

+70
-43
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ struct TrackingParameters {
100100
bool PerPrimaryVertexProcessing = false;
101101
bool SaveTimeBenchmarks = false;
102102
bool DoUPCIteration = false;
103+
bool FataliseUponFailure = true;
104+
bool DropTFUponFailure = false;
103105
/// Cluster attachment
104106
bool UseTrackFollower = false;
105107
bool UseTrackFollowerTop = false;

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class TimeFrame
259259
void printCellLUTonLayer(int i);
260260
void printTrackletLUTs();
261261
void printCellLUTs();
262-
void printROFInfo(const int rofId);
262+
void printSliceInfo(const int, const int);
263263

264264
IndexTableUtils mIndexTableUtils;
265265

@@ -297,6 +297,13 @@ class TimeFrame
297297
std::vector<uint8_t> mMultiplicityCutMask;
298298

299299
const o2::base::PropagatorImpl<float>* mPropagatorDevice = nullptr; // Needed only for GPU
300+
void dropTracks()
301+
{
302+
for (auto& v : mTracks) {
303+
deepVectorClear(v);
304+
}
305+
}
306+
300307
protected:
301308
template <typename T>
302309
void deepVectorClear(std::vector<T>& vec)

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

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ namespace its
2222

2323
struct VertexerParamConfig : public o2::conf::ConfigurableParamHelper<VertexerParamConfig> {
2424

25-
int nIterations = 1; // Number of vertexing passes to perform
26-
int vertPerRofThreshold = 0; // Maximum number of vertices per ROF to trigger second a round
27-
bool allowSingleContribClusters = false;
28-
// Number of ROFs to be considered for the vertexing
29-
int deltaRof = 0;
25+
int nIterations = 1; // Number of vertexing passes to perform.
26+
int vertPerRofThreshold = 0; // Maximum number of vertices per ROF to trigger second a iteration.
27+
bool allowSingleContribClusters = false; // attempt to find vertices in case of a single tracklet found.
28+
int deltaRof = 0; // Number of ROFs to be considered for the vertexing.
3029

31-
// geometrical cuts
30+
// geometrical cuts for tracklet selection
3231
float zCut = 0.002f;
3332
float phiCut = 0.005f;
3433
float pairCut = 0.04f;
@@ -42,12 +41,12 @@ struct VertexerParamConfig : public o2::conf::ConfigurableParamHelper<VertexerPa
4241
float maxZPositionAllowed = 25.f; // 4x sZ of the beam
4342

4443
// Artefacts selections
45-
int clusterContributorsCut = 16;
44+
int clusterContributorsCut = 16; // minimum number of contributors for the second vertex found in the same ROF (pileup cut)
4645
int maxTrackletsPerCluster = 1e2;
4746
int phiSpan = -1;
4847
int zSpan = -1;
49-
int ZBins = 1;
50-
int PhiBins = 128;
48+
int ZBins = 1; // z-phi index table configutation: number of z bins
49+
int PhiBins = 128; // z-phi index table configutation: number of phi bins
5150

5251
int nThreads = 1;
5352

@@ -56,11 +55,11 @@ struct VertexerParamConfig : public o2::conf::ConfigurableParamHelper<VertexerPa
5655

5756
struct TrackerParamConfig : public o2::conf::ConfigurableParamHelper<TrackerParamConfig> {
5857
// Use TGeo for mat. budget
59-
bool useMatCorrTGeo = false;
60-
bool useFastMaterial = false;
61-
int deltaRof = 0;
62-
float sysErrY2[7] = {0}; // systematic error^2 in Y per layer
63-
float sysErrZ2[7] = {0}; // systematic error^2 in Z per layer
58+
bool useMatCorrTGeo = false; // use full geometry to corect for material budget accounting in the fits. Default is to use the material budget LUT.
59+
bool useFastMaterial = false; // use faster material approximation for material budget accounting in the fits.
60+
int deltaRof = 0; // configure the width of the window in ROFs to be considered for the tracking.
61+
float sysErrY2[7] = {0}; // systematic error^2 in Y per layer
62+
float sysErrZ2[7] = {0}; // systematic error^2 in Z per layer
6463
float maxChi2ClusterAttachment = -1.f;
6564
float maxChi2NDF = -1.f;
6665
float nSigmaCut = -1.f;
@@ -69,23 +68,25 @@ struct TrackerParamConfig : public o2::conf::ConfigurableParamHelper<TrackerPara
6968
float pvRes = -1.f;
7069
int LUTbinsPhi = -1;
7170
int LUTbinsZ = -1;
72-
float diamondPos[3] = {0.f, 0.f, 0.f};
73-
bool useDiamond = false;
74-
unsigned long maxMemory = 0;
75-
int useTrackFollower = -1; // bit 0: allow mixing implies bits 1&2; bit 1: topwards; bit2: downwards; => 0 off
76-
float trackFollowerNSigmaZ = 1.f; // sigma in z-cut for track-following search rectangle
77-
float trackFollowerNSigmaPhi = 1.f; // sigma in phi-cut for track-following search rectangle
71+
float diamondPos[3] = {0.f, 0.f, 0.f}; // override the position of the vertex
72+
bool useDiamond = false; // enable overriding the vertex position
73+
unsigned long maxMemory = 0; // override default protections on the maximum memory to be used by the tracking
74+
int useTrackFollower = -1; // bit 0: allow mixing implies bits 1&2; bit 1: topwards; bit2: downwards; => 0 off
75+
float trackFollowerNSigmaZ = 1.f; // sigma in z-cut for track-following search rectangle
76+
float trackFollowerNSigmaPhi = 1.f; // sigma in phi-cut for track-following search rectangle
7877
float cellsPerClusterLimit = -1.f;
7978
float trackletsPerClusterLimit = -1.f;
8079
int findShortTracks = -1;
81-
int nThreads = 1;
82-
int nOrbitsPerIterations = 0;
83-
int nROFsPerIterations = 0;
84-
bool perPrimaryVertexProcessing = false;
85-
bool saveTimeBenchmarks = false;
86-
bool overrideBeamEstimation = false; // used by gpuwf only
87-
int trackingMode = -1; // -1: unset, 0=sync, 1=async, 2=cosmics used by gpuwf only
88-
bool doUPCIteration = false;
80+
int nThreads = 1; // number of threads to perform the operations in parallel.
81+
int nROFsPerIterations = 0; // size of the slice of ROFs to be processed at a time, preferably integer divisors of nROFs per TF, to balance the iterations.
82+
int nOrbitsPerIterations = 0; // not implemented: size of the slice of ROFs to be processed at a time, computed using the number of ROFs per orbit.
83+
bool perPrimaryVertexProcessing = false; // perform the full tracking considering the vertex hypotheses one at the time.
84+
bool saveTimeBenchmarks = false; // dump metrics on file
85+
bool overrideBeamEstimation = false; // use beam position from meanVertex CCDB object
86+
int trackingMode = -1; // -1: unset, 0=sync, 1=async, 2=cosmics used by gpuwf only
87+
bool doUPCIteration = false; // Perform an additional iteration for UPC events on tagged vertices. You want to combine this config with VertexerParamConfig.nIterations=2
88+
bool fataliseUponFailure = true; // granular management of the fatalisation in async mode
89+
bool dropTFUponFailure = false;
8990

9091
O2ParamDef(TrackerParamConfig, "ITSCATrackerParam");
9192
};

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -609,16 +609,19 @@ void TimeFrame::printNClsPerROF()
609609
}
610610
}
611611

612-
void TimeFrame::printROFInfo(const int rofId)
612+
void TimeFrame::printSliceInfo(const int startROF, const int sliceSize)
613613
{
614-
std::cout << "ROF " << rofId << " dump:" << std::endl;
615-
for (int iLayer{0}; iLayer < mClusters.size(); ++iLayer) {
616-
std::cout << "Layer " << iLayer << " has: " << getClustersOnLayer(rofId, iLayer).size() << " clusters." << std::endl;
617-
}
618-
std::cout << "Number of seeding vertices: " << getPrimaryVertices(rofId).size() << std::endl;
619-
int iVertex{0};
620-
for (auto& v : getPrimaryVertices(rofId)) {
621-
std::cout << "\t vertex " << iVertex++ << ": x=" << v.getX() << " " << " y=" << v.getY() << " z=" << v.getZ() << " has " << v.getNContributors() << " contributors." << std::endl;
614+
std::cout << "Dumping slice of " << sliceSize << " rofs:" << std::endl;
615+
for (int iROF{startROF}; iROF < startROF + sliceSize; ++iROF) {
616+
std::cout << "ROF " << iROF << " dump:" << std::endl;
617+
for (unsigned int iLayer{0}; iLayer < mClusters.size(); ++iLayer) {
618+
std::cout << "Layer " << iLayer << " has: " << getClustersOnLayer(iROF, iLayer).size() << " clusters." << std::endl;
619+
}
620+
std::cout << "Number of seeding vertices: " << getPrimaryVertices(iROF).size() << std::endl;
621+
int iVertex{0};
622+
for (auto& v : getPrimaryVertices(iROF)) {
623+
std::cout << "\t vertex " << iVertex++ << ": x=" << v.getX() << " " << " y=" << v.getY() << " z=" << v.getZ() << " has " << v.getNContributors() << " contributors." << std::endl;
624+
}
622625
}
623626
}
624627

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ void Tracker::clustersToTracks(std::function<void(std::string s)> logger, std::f
5757
}
5858
}
5959

60+
bool dropTF = false;
6061
for (int iteration = 0; iteration < (int)mTrkParams.size(); ++iteration) {
6162
if (iteration == 3 && mTrkParams[0].DoUPCIteration) {
6263
mTimeFrame->swapMasks();
@@ -75,9 +76,12 @@ void Tracker::clustersToTracks(std::function<void(std::string s)> logger, std::f
7576
&Tracker::computeTracklets, "Tracklet finding", [](std::string) {}, iteration, iROFs, iVertex);
7677
nTracklets += mTraits->getTFNumberOfTracklets();
7778
if (!mTimeFrame->checkMemory(mTrkParams[iteration].MaxMemory)) {
78-
mTimeFrame->printROFInfo(iROFs);
79+
mTimeFrame->printSliceInfo(iROFs, mTrkParams[iteration].nROFsPerIterations);
7980
error(fmt::format("Too much memory used during trackleting in iteration {} in ROF span {}-{}: {:.2f} GB. Current limit is {:.2f} GB, check the detector status and/or the selections.",
8081
iteration, iROFs, iROFs + mTrkParams[iteration].nROFsPerIterations, mTimeFrame->getArtefactsMemory() / GB, mTrkParams[iteration].MaxMemory / GB));
82+
if (mTrkParams[iteration].DropTFUponFailure) {
83+
dropTF = true;
84+
}
8185
break;
8286
}
8387
float trackletsPerCluster = mTraits->getTFNumberOfClusters() > 0 ? float(mTraits->getTFNumberOfTracklets()) / mTraits->getTFNumberOfClusters() : 0.f;
@@ -91,9 +95,12 @@ void Tracker::clustersToTracks(std::function<void(std::string s)> logger, std::f
9195
&Tracker::computeCells, "Cell finding", [](std::string) {}, iteration);
9296
nCells += mTraits->getTFNumberOfCells();
9397
if (!mTimeFrame->checkMemory(mTrkParams[iteration].MaxMemory)) {
94-
mTimeFrame->printROFInfo(iROFs);
98+
mTimeFrame->printSliceInfo(iROFs, mTrkParams[iteration].nROFsPerIterations);
9599
error(fmt::format("Too much memory used during cell finding in iteration {} in ROF span {}-{}: {:.2f} GB. Current limit is {:.2f} GB, check the detector status and/or the selections.",
96100
iteration, iROFs, iROFs + mTrkParams[iteration].nROFsPerIterations, mTimeFrame->getArtefactsMemory() / GB, mTrkParams[iteration].MaxMemory / GB));
101+
if (mTrkParams[iteration].DropTFUponFailure) {
102+
dropTF = true;
103+
}
97104
break;
98105
}
99106
float cellsPerCluster = mTraits->getTFNumberOfClusters() > 0 ? float(mTraits->getTFNumberOfCells()) / mTraits->getTFNumberOfClusters() : 0.f;
@@ -110,7 +117,7 @@ void Tracker::clustersToTracks(std::function<void(std::string s)> logger, std::f
110117
&Tracker::findRoads, "Road finding", [](std::string) {}, iteration);
111118
}
112119
iVertex++;
113-
} while (iVertex < maxNvertices);
120+
} while (iVertex < maxNvertices && !dropTF);
114121
logger(fmt::format(" - Tracklet finding: {} tracklets found in {:.2f} ms", nTracklets, timeTracklets));
115122
logger(fmt::format(" - Cell finding: {} cells found in {:.2f} ms", nCells, timeCells));
116123
logger(fmt::format(" - Neighbours finding: {} neighbours found in {:.2f} ms", nNeighbours, timeNeighbours));
@@ -122,6 +129,11 @@ void Tracker::clustersToTracks(std::function<void(std::string s)> logger, std::f
122129
total += timeExtending;
123130
logger(fmt::format(" - Extending Tracks: {} extended tracks using {} clusters found in {:.2f} ms", nExtendedTracks + mTimeFrame->mNExtendedTracks, nExtendedClusters + mTimeFrame->mNExtendedUsedClusters, timeExtending));
124131
}
132+
if (dropTF) {
133+
error(fmt::format("...Dropping Timeframe..."));
134+
mTimeFrame->dropTracks();
135+
break; // breaking out the iterations loop
136+
}
125137
}
126138

127139
total += evaluateTask(&Tracker::findShortPrimaries, "Short primaries finding", logger);
@@ -502,6 +514,8 @@ void Tracker::getGlobalConfiguration()
502514
params.nROFsPerIterations = nROFsPerIterations;
503515
params.PerPrimaryVertexProcessing = tc.perPrimaryVertexProcessing;
504516
params.SaveTimeBenchmarks = tc.saveTimeBenchmarks;
517+
params.FataliseUponFailure = tc.fataliseUponFailure;
518+
params.DropTFUponFailure = tc.dropTFUponFailure;
505519
for (int iD{0}; iD < 3; ++iD) {
506520
params.Diamond[iD] = tc.diamondPos[iD];
507521
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,13 @@ void ITSTrackingInterface::run(framework::ProcessingContext& pc)
271271
mTimeFrame->setROFMask(processUPCMask);
272272
// Run CA tracker
273273
if constexpr (isGPU) {
274-
if (mMode == o2::its::TrackingMode::Async) {
274+
if (mMode == o2::its::TrackingMode::Async && o2::its::TrackerParamConfig::Instance().fataliseUponFailure) {
275275
mTracker->clustersToTracksHybrid(logger, fatalLogger);
276276
} else {
277277
mTracker->clustersToTracksHybrid(logger, errorLogger);
278278
}
279279
} else {
280-
if (mMode == o2::its::TrackingMode::Async) {
280+
if (mMode == o2::its::TrackingMode::Async && o2::its::TrackerParamConfig::Instance().fataliseUponFailure) {
281281
mTracker->clustersToTracks(logger, fatalLogger);
282282
} else {
283283
mTracker->clustersToTracks(logger, errorLogger);

0 commit comments

Comments
 (0)