Skip to content

Commit fe1b8f5

Browse files
authored
Merge branch 'AliceO2Group:dev' into fd3_digits
2 parents 3063b45 + ac48d72 commit fe1b8f5

36 files changed

Lines changed: 1036 additions & 608 deletions

File tree

CCDB/src/CcdbApi.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ void CcdbApi::init(std::string const& host)
213213
snapshotReport += ')';
214214
}
215215

216-
mNeedAlienToken = (host.find("https://") != std::string::npos) || (host.find("alice-ccdb.cern.ch") != std::string::npos);
217-
216+
mNeedAlienToken = (host.find("https://") != std::string::npos) || (host.find("alice-ccdb.cern.ch") != std::string::npos) || (host.find("ccdb-test.cern.ch") != std::string::npos);
218217
// Set the curl timeout. It can be forced with an env var or it has different defaults based on the deployment mode.
219218
if (getenv("ALICEO2_CCDB_CURL_TIMEOUT_DOWNLOAD")) {
220219
auto timeout = atoi(getenv("ALICEO2_CCDB_CURL_TIMEOUT_DOWNLOAD"));

DataFormats/Detectors/ITSMFT/ITS/include/DataFormatsITS/TrackITS.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ class TrackITSExt : public TrackITS
192192
getClusterRefs().setEntries(ncl);
193193
}
194194

195-
GPUhdi() const int& getClusterIndex(int lr) const { return mIndex[lr]; }
195+
GPUhdi() int getClusterIndex(int lr) const { return mIndex[lr]; }
196+
197+
GPUh() int getFirstLayerClusterIndex() const
198+
{
199+
return getClusterIndex(getFirstClusterLayer());
200+
}
196201

197202
GPUhdi() void setExternalClusterIndex(int layer, int idx, bool newCluster = false)
198203
{

Detectors/GlobalTrackingWorkflow/study/src/CheckResidSpec.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void CheckResidSpec::init(InitContext& ic)
132132
int maxLanes = ic.services().get<const o2::framework::DeviceSpec>().maxInputTimeslices;
133133
std::string nm = params.outname;
134134
if (maxLanes > 1) {
135-
o2::conf::ConfigurableParam::updateFromString(fmt::format("checkresid.outname={}_{}", nm, lane));
135+
o2::conf::ConfigurableParam::updateFromString(fmt::format("checkresid.outname={}_t{}", nm, lane));
136136
}
137137
if (mDraw) {
138138
mFillHistos = true;
@@ -173,8 +173,7 @@ void CheckResidSpec::init(InitContext& ic)
173173
mNThreads = 1;
174174
#endif
175175
if (mFillTree) {
176-
nm += ".root";
177-
mDBGOut = std::make_unique<o2::utils::TreeStreamRedirector>(nm.c_str(), "recreate");
176+
mDBGOut = std::make_unique<o2::utils::TreeStreamRedirector>(fmt::format("{}.root", params.outname).c_str(), "recreate");
178177
}
179178
}
180179

Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackerTraitsGPU.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,7 @@ void TrackerTraitsGPU<NLayers>::findRoads(const int iteration)
309309
bounded_vector<TrackSeed<NLayers>> trackSeeds(this->getMemoryPool().get());
310310
for (int startCellTopologyId{0}; startCellTopologyId < hostTopology.nCells; ++startCellTopologyId) {
311311
const int startLayer = hostTopology.getCell(startCellTopologyId).hitLayerMask.last();
312-
if ((this->mTrkParams[iteration].StartLayerMask & (1 << startLayer)) == 0 ||
313-
mTimeFrameGPU->getNCells()[startCellTopologyId] == 0) {
312+
if (!(this->mTrkParams[iteration].StartLayerMask.has(startLayer)) || mTimeFrameGPU->getNCells()[startCellTopologyId] == 0) {
314313
continue;
315314
}
316315
processNeighboursHandler<NLayers>(startLevel,
@@ -387,10 +386,10 @@ void TrackerTraitsGPU<NLayers>::findRoads(const int iteration)
387386
mTimeFrameGPU->downloadTrackITSExtDevice();
388387

389388
auto& tracks = mTimeFrameGPU->getTrackITSExt();
390-
this->acceptTracks(iteration, tracks, firstClusters, sharedFirstClusters);
389+
this->acceptTracks(iteration, tracks, firstClusters);
391390
mTimeFrameGPU->loadUsedClustersDevice();
392391
}
393-
this->markTracks(iteration, sharedFirstClusters);
392+
this->markTracks(iteration);
394393
// wipe the artefact memory
395394
mTimeFrameGPU->popMemoryStack(iteration);
396395
};

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "CommonUtils/EnumFlags.h"
2727
#include "DetectorsBase/Propagator.h"
2828
#include "ITStracking/Constants.h"
29+
#include "ITStracking/LayerMask.h"
2930

3031
namespace o2::its
3132
{
@@ -70,11 +71,9 @@ struct TrackingParameters {
7071
float DiamondCov[6] = {25.e-6f, 0.f, 0.f, 25.e-6f, 0.f, 36.f};
7172

7273
/// General parameters
73-
bool AllowSharingFirstCluster = false;
74-
int ClusterSharing = 0;
7574
int MinTrackLength = 7;
7675
int MaxHoles = 0;
77-
uint16_t HoleLayerMask = 0;
76+
LayerMask HoleLayerMask = 0;
7877
float NSigmaCut = 5;
7978
float PVres = 1.e-2f;
8079
/// Trackleting cuts
@@ -87,7 +86,7 @@ struct TrackingParameters {
8786
float MaxChi2NDF = 30.f;
8887
int ReseedIfShorter = 6; // reseed for the final fit track with the length shorter than this
8988
std::vector<float> MinPt = {0.f, 0.f, 0.f, 0.f};
90-
uint16_t StartLayerMask = 0x7F;
89+
LayerMask StartLayerMask = 0x7F;
9190
bool RepeatRefitOut = false; // repeat outward refit using inward refit as a seed
9291
bool ShiftRefToCluster = true; // TrackFit: after update shift the linearization reference to cluster
9392
bool PerPrimaryVertexProcessing = false;
@@ -98,6 +97,13 @@ struct TrackingParameters {
9897
bool PrintMemory = false; // print allocator usage in epilog report
9998
size_t MaxMemory = std::numeric_limits<size_t>::max();
10099
bool DropTFUponFailure = false;
100+
101+
// Selections on tracks sharing clusters
102+
bool AllowSharingFirstCluster = false;
103+
float SharedClusterMaxDeltaPhi = 0.05f; // For tracks sharing clusters, maximum allowed delta phi at the cluster position
104+
float SharedClusterMaxDeltaEta = 0.03f; // For tracks sharing clusters, maximum allowed delta eta at the cluster position
105+
bool SharedClusterOppositeSign = false; // For tracks sharing clusters, require opposite sign of the tracklets
106+
int SharedMaxClusters = 0; // Maximal allowed shared clusters (excluding first cluster)
101107
};
102108

103109
struct VertexingParameters {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ class TrackerTraits
5555
template <typename InputSeed>
5656
void processNeighbours(int iteration, int defaultCellTopologyId, int iLevel, const bounded_vector<InputSeed>& currentCellSeed, const bounded_vector<int>& currentCellId, const bounded_vector<int>& currentCellTopologyId, bounded_vector<TrackSeedN>& updatedCellSeed, bounded_vector<int>& updatedCellId, bounded_vector<int>& updatedCellTopologyId);
5757

58-
void acceptTracks(int iteration, bounded_vector<TrackITSExt>& tracks, bounded_vector<bounded_vector<int>>& firstClusters, bounded_vector<bounded_vector<int>>& sharedFirstClusters);
59-
void markTracks(int iteration, bounded_vector<bounded_vector<int>>& sharedFirstClusters);
58+
void acceptTracks(int iteration, bounded_vector<TrackITSExt>& tracks, bounded_vector<bounded_vector<int>>& firstClusters);
59+
void markTracks(int iteration);
6060

6161
void updateTrackingParameters(const std::vector<TrackingParameters>& trkPars)
6262
{

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ struct TrackerParamConfig : public o2::conf::ConfigurableParamHelper<TrackerPara
102102
size_t maxMemory = std::numeric_limits<size_t>::max();
103103
bool dropTFUponFailure = false;
104104
bool fataliseUponFailure = true; // granular management of the fatalisation in async mode
105+
106+
// Selections on tracks sharing clusters
105107
bool allowSharingFirstCluster = false; // allow first cluster sharing among tracks
108+
float sharedClusterMaxDeltaPhi = 0.05f; // Maximum allowed delta phi at the cluster position
109+
float sharedClusterMaxDeltaEta = 0.03f; // Maximum allowed delta eta at the cluster position
110+
bool sharedClusterOppositeSign = false; // Require opposite sign of the tracklets
106111

107112
O2ParamDef(TrackerParamConfig, "ITSCATrackerParam");
108113
};

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ using namespace o2::its;
2424

2525
std::string TrackingParameters::asString() const
2626
{
27-
std::string str = std::format("NZb:{} NPhB:{} PerVtx:{} DropFail:{} ClSh:{} TtklMinPt:{:.2f} MinCl:{} MaxHoles:{} HoleMask:{:#x}",
28-
ZBins, PhiBins, PerPrimaryVertexProcessing, DropTFUponFailure, ClusterSharing, TrackletMinPt, MinTrackLength, MaxHoles, HoleLayerMask);
27+
std::string str = std::format("NZb:{} NPhB:{} PerVtx:{} DropFail:{} TtklMinPt:{:.2f} MinCl:{}", ZBins, PhiBins, PerPrimaryVertexProcessing, DropTFUponFailure, TrackletMinPt, MinTrackLength);
28+
auto isSet = [](auto e) { return e >= 0; };
29+
auto isAnySet = [&isSet](auto v) { return !v.empty() && std::any_of(v.begin(), v.end(), isSet); };
2930
bool first = true;
3031
for (int il = NLayers; il >= MinTrackLength; il--) {
3132
int slot = NLayers - il;
@@ -37,18 +38,27 @@ std::string TrackingParameters::asString() const
3738
str += std::format("L{}:{:.2f} ", il, MinPt[slot]);
3839
}
3940
}
40-
if (!SystErrorY2.empty() || !SystErrorZ2.empty()) {
41+
if (isAnySet(SystErrorY2) || isAnySet(SystErrorZ2)) {
4142
str += " SystErrY/Z:";
4243
for (size_t i = 0; i < SystErrorY2.size(); i++) {
4344
str += std::format("{:.2e}/{:.2e} ", SystErrorY2[i], SystErrorZ2[i]);
4445
}
4546
}
46-
if (!AddTimeError.empty()) {
47+
if (isAnySet(AddTimeError)) {
4748
str += " AddTimeError:";
4849
for (unsigned int i : AddTimeError) {
4950
str += std::format("{} ", i);
5051
}
5152
}
53+
if (SharedMaxClusters) {
54+
str += std::format(" ShaMaxCls:{} ", SharedMaxClusters);
55+
}
56+
if (AllowSharingFirstCluster) {
57+
str += std::format(" ShaClsDPhi:{} ShaClsDEta:{} ShaClsSign:{}", SharedClusterMaxDeltaPhi, SharedClusterMaxDeltaEta, SharedClusterOppositeSign);
58+
}
59+
if (MaxHoles) {
60+
str += std::format(" MaxHoles:{} HoleMask:{}", MaxHoles, HoleLayerMask.asString());
61+
}
5262
if (std::numeric_limits<size_t>::max() != MaxMemory) {
5363
str += std::format(" MemLimit {:.2f} GB", double(MaxMemory) / constants::GB);
5464
}
@@ -204,6 +214,9 @@ std::vector<TrackingParameters> TrackingMode::getTrackingParameters(TrackingMode
204214
p.SaveTimeBenchmarks = tc.saveTimeBenchmarks;
205215
p.FataliseUponFailure = tc.fataliseUponFailure;
206216
p.AllowSharingFirstCluster = tc.allowSharingFirstCluster;
217+
p.SharedClusterMaxDeltaPhi = tc.sharedClusterMaxDeltaPhi;
218+
p.SharedClusterMaxDeltaEta = tc.sharedClusterMaxDeltaEta;
219+
p.SharedClusterOppositeSign = tc.sharedClusterOppositeSign;
207220
const auto iter = &p - trackParams.data();
208221
if (iter < constants::MaxIter) {
209222
p.MaxHoles = tc.maxHolesIter[iter];

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

Lines changed: 21 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -168,85 +168,41 @@ int FastMultEst::selectROFs(const std::array<gsl::span<const o2::itsmft::ROFReco
168168
ROFMaskTableN& sel)
169169
{
170170
const auto& multEstConf = FastMultEstConfig::Instance(); // parameters for mult estimation and cuts
171-
const int selectionLayer = overlapView.getClock();
172-
int multLayer = std::clamp(multEstConf.cutMultClusLayer, 0, NLayers - 1);
173-
if (doStaggering && rofs[multLayer].empty()) {
174-
LOGP(info, "FastMultEst multiplicity layer {} has no ROFs, falling back to selection layer {}", multLayer, selectionLayer);
175-
multLayer = selectionLayer;
176-
}
177-
178-
const auto multCounts = buildMultiplicityCounts<NLayers>(rofs, clus, doStaggering, multLayer);
171+
const int selectionLayer = multEstConf.isMultCutRequested() ? std::clamp(multEstConf.cutMultClusLayer, 0, NLayers - 1) : overlapView.getClock();
172+
const auto multCounts = buildMultiplicityCounts<NLayers>(rofs, clus, doStaggering, selectionLayer);
179173
const int selectionRofCount = doStaggering ? static_cast<int>(rofs[selectionLayer].size()) : static_cast<int>(rofs[0].size());
180174

181175
sel.resetMask();
182176
lastRandomSeed = gRandom->GetSeed();
183177
const o2::InteractionRecord tfStartIR{0, firstTForbit};
184-
185-
if (!trig.empty()) {
178+
// mask ROFs which are not good from the multiplicity selection (if any) POV
179+
struct ROFStatus {
180+
int entry = 0, priority = 0;
181+
};
182+
std::vector<ROFStatus> selROFs;
183+
selROFs.reserve(selectionRofCount);
184+
bool selmult = multEstConf.isMultCutRequested();
185+
for (int selectionRof = 0; selectionRof < selectionRofCount; ++selectionRof) {
186+
selROFs.emplace_back(selectionRof, (selmult && !multEstConf.isPassingMultCut(process(multCounts[selectionRof]))) ? -1 : 0);
187+
}
188+
if (!trig.empty() && multEstConf.preferTriggered) {
186189
const auto& selectionLayerTiming = overlapView.getLayer(selectionLayer);
187-
const auto& multLayerTiming = overlapView.getLayer(multLayer);
188-
189190
for (const auto& trigger : trig) {
190191
const int selectionRof = findROFForIR(trigger.ir, tfStartIR, selectionLayerTiming);
191-
if (selectionRof < 0) {
192-
continue;
193-
}
194-
if (multEstConf.cutRandomFraction > 0.f && gRandom->Rndm() < multEstConf.cutRandomFraction) {
195-
continue;
196-
}
197-
if (multEstConf.isMultCutRequested()) {
198-
const int triggerMultRof = doStaggering ? findROFForIR(trigger.ir, tfStartIR, multLayerTiming) : selectionRof;
199-
if (triggerMultRof < 0 || triggerMultRof >= static_cast<int>(multCounts.size())) {
200-
continue;
201-
}
202-
if (!multEstConf.isPassingMultCut(process(multCounts[triggerMultRof]))) {
203-
continue;
204-
}
205-
}
206-
enableCompatibleROFs<NLayers>(selectionLayer, selectionRof, overlapView, sel);
207-
}
208-
} else {
209-
LOGP(info, "FastMultEst received no physics/TRD triggers, falling back to ROF-driven filtering on layer {}", selectionLayer);
210-
for (int selectionRof = 0; selectionRof < selectionRofCount; ++selectionRof) {
211-
if (multEstConf.isMultCutRequested()) {
212-
bool passes = false;
213-
if (!doStaggering || selectionLayer == multLayer) {
214-
if (selectionRof < static_cast<int>(multCounts.size())) {
215-
passes = multEstConf.isPassingMultCut(process(multCounts[selectionRof]));
216-
}
217-
} else {
218-
const auto& overlap = overlapView.getOverlap(selectionLayer, multLayer, selectionRof);
219-
for (int rof = overlap.getFirstEntry(); rof < overlap.getEntriesBound(); ++rof) {
220-
if (rof < static_cast<int>(multCounts.size())) {
221-
if (multEstConf.isPassingMultCut(process(multCounts[rof]))) {
222-
passes = true;
223-
break;
224-
}
225-
}
226-
}
227-
}
228-
if (!passes) {
229-
continue;
230-
}
231-
}
232-
if (multEstConf.cutRandomFraction > 0.f && gRandom->Rndm() < multEstConf.cutRandomFraction) {
192+
if (selectionRof < 0 || selROFs[selectionRof].priority < 0) {
233193
continue;
234194
}
235-
enableCompatibleROFs<NLayers>(selectionLayer, selectionRof, overlapView, sel);
195+
selROFs[selectionRof].priority++; // increment trigger counter
236196
}
197+
sort(selROFs.begin(), selROFs.end(), [](const ROFStatus& a, const ROFStatus& b) { return a.priority > b.priority; }); // order in number of triggers, masked will go to the end
237198
}
238-
239-
const auto selView = sel.getView();
240199
int nsel = 0;
241-
for (int irof = 0; irof < selectionRofCount; ++irof) {
242-
nsel += selView.isROFEnabled(selectionLayer, irof);
243-
}
244-
245-
if (!trig.empty() && multEstConf.preferTriggered) {
246-
LOGP(debug, "FastMultEst preferTriggered is ignored in trigger-driven mask mode");
200+
for (auto& rof : selROFs) {
201+
if (rof.priority >= 0 && (multEstConf.cutRandomFraction <= 0.f || (gRandom->Rndm() > multEstConf.cutRandomFraction))) {
202+
enableCompatibleROFs<NLayers>(selectionLayer, rof.entry, overlapView, sel);
203+
nsel++;
204+
}
247205
}
248-
249206
LOGP(debug, "NSel = {} of {} rofs on layer {} Seeds: before {} after {}", nsel, selectionRofCount, selectionLayer, lastRandomSeed, gRandom->GetSeed());
250-
251207
return nsel;
252208
}

0 commit comments

Comments
 (0)