17#include <unordered_map>
19#include <oneapi/tbb/blocked_range.h>
20#include <oneapi/tbb/parallel_for.h>
21#include <oneapi/tbb/combinable.h>
43template <TrackletMode Mode,
bool EvalRun,
int NLayers>
44void trackleterKernelHost(
45 const gsl::span<const Cluster>& clustersNextLayer,
46 const gsl::span<const Cluster>& clustersCurrentLayer,
47 const gsl::span<uint8_t>& usedClustersNextLayer,
48 const int* indexTableNext,
51 gsl::span<int> foundTracklets,
52 const IndexTableUtils<NLayers>&
utils,
53 const TimeEstBC& timErr,
54 gsl::span<int> rofFoundTrackletsOffsets,
55 const int globalOffsetNextLayer,
56 const int globalOffsetCurrentLayer,
57 const int maxTrackletsPerCluster)
59 const int PhiBins{
utils.getNphiBins()};
60 const int ZBins{
utils.getNzBins()};
62 for (
int iCurrentLayerClusterIndex = 0; iCurrentLayerClusterIndex < clustersCurrentLayer.size(); ++iCurrentLayerClusterIndex) {
63 int storedTracklets{0};
64 const Cluster& currentCluster{clustersCurrentLayer[iCurrentLayerClusterIndex]};
66 if (selectedBinsRect.x >= 0) {
67 int phiBinsNum{selectedBinsRect.
w - selectedBinsRect.y + 1};
69 phiBinsNum += PhiBins;
72 for (
int iPhiBin{selectedBinsRect.y}, iPhiCount{0}; iPhiCount < phiBinsNum && storedTracklets < maxTrackletsPerCluster; iPhiBin = ++iPhiBin == PhiBins ? 0 : iPhiBin, iPhiCount++) {
73 const int firstBinIndex{
utils.getBinIndex(selectedBinsRect.x, iPhiBin)};
74 const int firstRowClusterIndex{indexTableNext[firstBinIndex]};
75 const int maxRowClusterIndex{indexTableNext[firstBinIndex + ZBins]};
77 for (
int iNextLayerClusterIndex{firstRowClusterIndex}; iNextLayerClusterIndex < maxRowClusterIndex && iNextLayerClusterIndex < static_cast<int>(clustersNextLayer.size()) && storedTracklets < maxTrackletsPerCluster; ++iNextLayerClusterIndex) {
78 if (usedClustersNextLayer[iNextLayerClusterIndex]) {
81 const Cluster& nextCluster{clustersNextLayer[iNextLayerClusterIndex]};
82 if (math_utils::isPhiDifferenceBelow(currentCluster.phi, nextCluster.phi,
phiCut)) {
83 if (storedTracklets < maxTrackletsPerCluster) {
84 if constexpr (!EvalRun) {
86 tracklets[rofFoundTrackletsOffsets[iCurrentLayerClusterIndex] + storedTracklets] = Tracklet{globalOffsetNextLayer + iNextLayerClusterIndex, globalOffsetCurrentLayer + iCurrentLayerClusterIndex, nextCluster, currentCluster, timErr};
88 tracklets[rofFoundTrackletsOffsets[iCurrentLayerClusterIndex] + storedTracklets] = Tracklet{globalOffsetCurrentLayer + iCurrentLayerClusterIndex, globalOffsetNextLayer + iNextLayerClusterIndex, currentCluster, nextCluster, timErr};
97 if constexpr (EvalRun) {
98 foundTracklets[iCurrentLayerClusterIndex] += storedTracklets;
100 rofFoundTrackletsOffsets[iCurrentLayerClusterIndex] += storedTracklets;
105void trackletSelectionKernelHost(
108 gsl::span<unsigned char> usedClusters0,
109 gsl::span<unsigned char> usedClusters2,
110 const gsl::span<const Tracklet>& tracklets01,
111 const gsl::span<const Tracklet>& tracklets12,
112 bounded_vector<uint8_t>& usedTracklets,
113 const gsl::span<int> foundTracklets01,
114 const gsl::span<int> foundTracklets12,
115 bounded_vector<Line>& lines,
116 const gsl::span<const o2::MCCompLabel>& trackletLabels,
117 bounded_vector<o2::MCCompLabel>& linesLabels,
118 const int nLayer1Clusters,
119 const float tanLambdaCut,
121 const int maxTracklets)
123 int offset01{0}, offset12{0};
124 for (
int iCurrentLayerClusterIndex{0}; iCurrentLayerClusterIndex < nLayer1Clusters; ++iCurrentLayerClusterIndex) {
125 int validTracklets{0};
126 const int endTracklet01 = offset01 + foundTracklets01[iCurrentLayerClusterIndex];
127 const int endTracklet12 = offset12 + foundTracklets12[iCurrentLayerClusterIndex];
128 for (
int iTracklet12{offset12}; iTracklet12 < endTracklet12 && validTracklets != maxTracklets; ++iTracklet12) {
129 const auto& tracklet12{tracklets12[iTracklet12]};
130 for (
int iTracklet01{offset01}; iTracklet01 < endTracklet01 && validTracklets != maxTracklets; ++iTracklet01) {
131 if (usedTracklets[iTracklet01]) {
135 const auto& tracklet01{tracklets01[iTracklet01]};
136 if (!tracklet01.getTimeStamp().isCompatible(tracklet12.getTimeStamp())) {
140 const float deltaTanLambda{o2::gpu::GPUCommonMath::Abs(tracklet01.tanLambda - tracklet12.tanLambda)};
141 if (deltaTanLambda >= tanLambdaCut) {
144 if (math_utils::isPhiDifferenceBelow(tracklet01.phi, tracklet12.phi,
phiCut) && validTracklets != maxTracklets) {
145 usedClusters0[tracklet01.firstClusterIndex] = 1;
146 usedClusters2[tracklet12.secondClusterIndex] = 1;
147 usedTracklets[iTracklet01] =
true;
148 lines.emplace_back(tracklet01, clusters0, clusters1);
149 if (!trackletLabels.empty()) {
150 linesLabels.emplace_back(trackletLabels[iTracklet01]);
156 offset01 += foundTracklets01[iCurrentLayerClusterIndex];
157 offset12 += foundTracklets12[iCurrentLayerClusterIndex];
162template <
int NLayers>
165 mTaskArena->execute([&] { mTimeFrame->initialise(trackingParams, 3); });
168template <
int NLayers>
172 mIndexTableUtils.setTrackingParameters(vrtPar[0]);
173 for (
auto&
par : mVrtParams) {
174 par.phiSpan =
static_cast<int>(std::ceil(mIndexTableUtils.getNphiBins() *
par.phiCut / o2::constants::math::TwoPI));
175 par.zSpan =
static_cast<int>(std::ceil(
par.zCut * mIndexTableUtils.getInverseZCoordinate(0)));
180template <
int NLayers>
183 mTaskArena->execute([&] {
184 tbb::parallel_for(0, mTimeFrame->getNrof(1), [&](
const short pivotRofId) {
185 bool skip = skipROF(iteration, pivotRofId);
186 const auto& rofRange01 = mTimeFrame->getROFOverlapTableView().getOverlap(1, 0, pivotRofId);
187 for (auto targetRofId = rofRange01.getFirstEntry(); targetRofId < rofRange01.getEntriesBound(); ++targetRofId) {
188 const auto timeErr = mTimeFrame->getROFOverlapTableView().getTimeStamp(0, targetRofId, 1, pivotRofId);
189 trackleterKernelHost<TrackletMode::Layer0Layer1, true>(
190 !skip ? mTimeFrame->getClustersOnLayer(targetRofId, 0) : gsl::span<Cluster>(),
191 !skip ? mTimeFrame->getClustersOnLayer(pivotRofId, 1) : gsl::span<Cluster>(),
192 mTimeFrame->getUsedClustersROF(targetRofId, 0),
193 mTimeFrame->getIndexTable(targetRofId, 0).data(),
194 mVrtParams[iteration].phiCut,
195 mTimeFrame->getTracklets()[0],
196 mTimeFrame->getNTrackletsCluster(pivotRofId, 0),
202 mVrtParams[iteration].maxTrackletsPerCluster);
204 const auto& rofRange12 = mTimeFrame->getROFOverlapTableView().getOverlap(1, 2, pivotRofId);
205 for (
auto targetRofId = rofRange12.getFirstEntry(); targetRofId < rofRange12.getEntriesBound(); ++targetRofId) {
206 const auto timeErr = mTimeFrame->getROFOverlapTableView().getTimeStamp(2, targetRofId, 1, pivotRofId);
207 trackleterKernelHost<TrackletMode::Layer1Layer2, true>(
208 !skip ? mTimeFrame->getClustersOnLayer(targetRofId, 2) : gsl::span<Cluster>(),
209 !skip ? mTimeFrame->getClustersOnLayer(pivotRofId, 1) : gsl::span<Cluster>(),
210 mTimeFrame->getUsedClustersROF(targetRofId, 2),
211 mTimeFrame->getIndexTable(targetRofId, 2).data(),
212 mVrtParams[iteration].phiCut,
213 mTimeFrame->getTracklets()[1],
214 mTimeFrame->getNTrackletsCluster(pivotRofId, 1),
220 mVrtParams[iteration].maxTrackletsPerCluster);
222 mTimeFrame->getNTrackletsROF(pivotRofId, 0) = std::accumulate(mTimeFrame->getNTrackletsCluster(pivotRofId, 0).begin(), mTimeFrame->getNTrackletsCluster(pivotRofId, 0).end(), 0);
223 mTimeFrame->getNTrackletsROF(pivotRofId, 1) = std::accumulate(mTimeFrame->getNTrackletsCluster(pivotRofId, 1).begin(), mTimeFrame->getNTrackletsCluster(pivotRofId, 1).end(), 0);
226 mTimeFrame->computeTrackletsPerROFScans();
227 if (
auto tot0 = mTimeFrame->getTotalTrackletsTF(0), tot1 = mTimeFrame->getTotalTrackletsTF(1);
228 tot0 == 0 || tot1 == 0) {
231 mTimeFrame->getTracklets()[0].resize(tot0);
232 mTimeFrame->getTracklets()[1].resize(tot1);
235 tbb::parallel_for(0, mTimeFrame->getNrof(1), [&](
const short pivotRofId) {
236 bool skip = skipROF(iteration, pivotRofId);
237 const int globalOffsetPivot = mTimeFrame->getSortedStartIndex(pivotRofId, 1);
238 const auto& rofRange01 = mTimeFrame->getROFOverlapTableView().getOverlap(1, 0, pivotRofId);
239 for (auto targetRofId = rofRange01.getFirstEntry(); targetRofId < rofRange01.getEntriesBound(); ++targetRofId) {
240 const auto timeErr = mTimeFrame->getROFOverlapTableView().getTimeStamp(0, targetRofId, 1, pivotRofId);
241 trackleterKernelHost<TrackletMode::Layer0Layer1, false>(
242 !skip ? mTimeFrame->getClustersOnLayer(targetRofId, 0) : gsl::span<Cluster>(),
243 !skip ? mTimeFrame->getClustersOnLayer(pivotRofId, 1) : gsl::span<Cluster>(),
244 mTimeFrame->getUsedClustersROF(targetRofId, 0),
245 mTimeFrame->getIndexTable(targetRofId, 0).data(),
246 mVrtParams[iteration].phiCut,
247 mTimeFrame->getTracklets()[0],
248 mTimeFrame->getNTrackletsCluster(pivotRofId, 0),
251 mTimeFrame->getExclusiveNTrackletsCluster(pivotRofId, 0),
252 mTimeFrame->getSortedStartIndex(targetRofId, 0),
254 mVrtParams[iteration].maxTrackletsPerCluster);
256 const auto& rofRange12 = mTimeFrame->getROFOverlapTableView().getOverlap(1, 2, pivotRofId);
257 for (
auto targetRofId = rofRange12.getFirstEntry(); targetRofId < rofRange12.getEntriesBound(); ++targetRofId) {
258 const auto timeErr = mTimeFrame->getROFOverlapTableView().getTimeStamp(2, targetRofId, 1, pivotRofId);
259 trackleterKernelHost<TrackletMode::Layer1Layer2, false>(
260 !skip ? mTimeFrame->getClustersOnLayer(targetRofId, 2) : gsl::span<Cluster>(),
261 !skip ? mTimeFrame->getClustersOnLayer(pivotRofId, 1) : gsl::span<Cluster>(),
262 mTimeFrame->getUsedClustersROF(targetRofId, 2),
263 mTimeFrame->getIndexTable(targetRofId, 2).data(),
264 mVrtParams[iteration].phiCut,
265 mTimeFrame->getTracklets()[1],
266 mTimeFrame->getNTrackletsCluster(pivotRofId, 1),
269 mTimeFrame->getExclusiveNTrackletsCluster(pivotRofId, 1),
270 mTimeFrame->getSortedStartIndex(targetRofId, 2),
272 mVrtParams[iteration].maxTrackletsPerCluster);
278 if (mTimeFrame->hasMCinformation()) {
279 for (
const auto& trk : mTimeFrame->getTracklets()[0]) {
281 int sortedId0{trk.firstClusterIndex};
282 int sortedId1{trk.secondClusterIndex};
283 for (
const auto& lab0 : mTimeFrame->getClusterLabels(0, mTimeFrame->
getClusters()[0][sortedId0].clusterId)) {
284 for (
const auto& lab1 : mTimeFrame->getClusterLabels(1, mTimeFrame->
getClusters()[1][sortedId1].clusterId)) {
285 if (lab0 == lab1 && lab0.isValid()) {
290 if (
label.isValid()) {
294 mTimeFrame->getTrackletsLabel(0).emplace_back(
label);
299template <
int NLayers>
302 mTaskArena->execute([&] {
303 tbb::combinable<int> totalLines{0};
305 tbb::blocked_range<short>(0, (
short)mTimeFrame->getNrof(1)),
306 [&](
const tbb::blocked_range<short>& Rofs) {
307 for (short pivotRofId = Rofs.begin(); pivotRofId < Rofs.end(); ++pivotRofId) {
308 if (mTimeFrame->getFoundTracklets(pivotRofId, 0).empty() || skipROF(iteration, pivotRofId)) {
311 mTimeFrame->getLines(pivotRofId).reserve(std::min(mTimeFrame->getFoundTracklets(pivotRofId, 0).size(), mTimeFrame->getNTrackletsCluster(pivotRofId, 0).size() * constants::MaxSelectedTrackletsPerCluster));
312 bounded_vector<uint8_t> usedTracklets(mTimeFrame->getFoundTracklets(pivotRofId, 0).size(), 0, mMemoryPool.get());
313 trackletSelectionKernelHost(
314 mTimeFrame->getClusters()[0].data(),
315 mTimeFrame->getClusters()[1].data(),
316 mTimeFrame->getUsedClusters(0),
317 mTimeFrame->getUsedClusters(2),
318 mTimeFrame->getFoundTracklets(pivotRofId, 0),
319 mTimeFrame->getFoundTracklets(pivotRofId, 1),
321 mTimeFrame->getNTrackletsCluster(pivotRofId, 0),
322 mTimeFrame->getNTrackletsCluster(pivotRofId, 1),
323 mTimeFrame->getLines(pivotRofId),
324 mTimeFrame->getLabelsFoundTracklets(pivotRofId, 0),
325 mTimeFrame->getLinesLabel(pivotRofId),
326 static_cast<int>(mTimeFrame->getClustersOnLayer(pivotRofId, 1).size()),
327 mVrtParams[iteration].tanLambdaCut,
328 mVrtParams[iteration].phiCut,
329 constants::MaxSelectedTrackletsPerCluster);
330 totalLines.local() += mTimeFrame->getLines(pivotRofId).size();
333 mTimeFrame->setNLinesTotal(totalLines.combine(std::plus<int>()));
337 deepVectorClear(mTimeFrame->getTracklets());
340template <
int NLayers>
343 const int nRofs = mTimeFrame->getNrof(1);
344 std::vector<std::vector<Vertex>> rofVertices(nRofs);
345 std::vector<std::vector<VertexLabel>> rofLabels(nRofs);
346 const float pairCut2 = mVrtParams[iteration].pairCut * mVrtParams[iteration].pairCut;
347 const float duplicateZCut = mVrtParams[iteration].duplicateZCut > 0.f ? mVrtParams[iteration].duplicateZCut : std::max(4.f * mVrtParams[iteration].pairCut, 0.5f * mVrtParams[iteration].clusterCut);
348 const float duplicateDistance2Cut = mVrtParams[iteration].duplicateDistance2Cut > 0.f ? mVrtParams[iteration].duplicateDistance2Cut : std::max(16.f * pairCut2, 0.0625f * mVrtParams[iteration].clusterCut * mVrtParams[iteration].clusterCut);
351 settings.beamY = mTimeFrame->getBeamY();
352 settings.pairCut = mVrtParams[iteration].pairCut;
354 settings.clusterCut = mVrtParams[iteration].clusterCut;
355 settings.coarseZWindow = mVrtParams[iteration].coarseZWindow;
356 settings.seedDedupZCut = mVrtParams[iteration].seedDedupZCut;
357 settings.refitDedupZCut = mVrtParams[iteration].refitDedupZCut;
358 settings.duplicateZCut = duplicateZCut;
359 settings.duplicateDistance2Cut = duplicateDistance2Cut;
360 settings.finalSelectionZCut = mVrtParams[iteration].finalSelectionZCut;
361 settings.maxZ = mVrtParams[iteration].maxZPositionAllowed;
362 settings.seedMemberRadiusTime = mVrtParams[iteration].seedMemberRadiusTime;
363 settings.seedMemberRadiusZ = mVrtParams[iteration].seedMemberRadiusZ;
366 const auto processROF = [&](
const int rofId) {
367 if (skipROF(iteration, rofId)) {
370 auto& lines = mTimeFrame->getLines(rofId);
371 auto clusters = line_vertexer::buildClusters(std::span<const Line>{lines.data(), lines.size()},
settings);
372 deepVectorClear(lines);
374 return (mTimeFrame->getBeamX() - cluster.getVertex()[0]) * (mTimeFrame->getBeamX() - cluster.getVertex()[0]) +
375 (mTimeFrame->getBeamY() - cluster.getVertex()[1]) * (mTimeFrame->getBeamY() - cluster.getVertex()[1]);
378 if (lhs.getSize() != rhs.getSize()) {
379 return lhs.getSize() > rhs.getSize();
381 if (o2::gpu::GPUCommonMath::Abs(lhs.getAvgDistance2() - rhs.getAvgDistance2()) > constants::Tolerance) {
382 return lhs.getAvgDistance2() < rhs.getAvgDistance2();
384 const auto lhsBeam = clusterBeamDistance2(lhs);
385 const auto rhsBeam = clusterBeamDistance2(rhs);
386 if (o2::gpu::GPUCommonMath::Abs(lhsBeam - rhsBeam) > constants::Tolerance) {
387 return lhsBeam < rhsBeam;
389 return lhs.getVertex()[2] < rhs.getVertex()[2];
394 float minClusterZ = std::numeric_limits<float>::max();
395 for (
const auto& cluster :
clusters) {
396 minClusterZ = std::min(minClusterZ, cluster.getVertex()[2]);
398 bounded_vector<line_vertexer::ClusterWithLines> deduplicated(mMemoryPool.get());
399 deduplicated.reserve(
clusters.size());
400 std::unordered_map<int, std::vector<int>> keptByZBin;
402 bool duplicate =
false;
403 const auto candidateZ = candidate.getVertex()[2];
404 const auto zBin =
static_cast<int>(std::floor((candidateZ - minClusterZ) /
settings.duplicateZCut));
405 for (
int neighborBin = zBin - 1; neighborBin <= zBin + 1 && !duplicate; ++neighborBin) {
406 const auto found = keptByZBin.find(neighborBin);
407 if (found == keptByZBin.end()) {
410 for (
const auto ownerId : found->second) {
411 const auto& owner = deduplicated[ownerId];
412 if (!candidate.getTimeStamp().isCompatible(owner.getTimeStamp())) {
415 if (o2::gpu::GPUCommonMath::Abs(candidate.getVertex()[2] - owner.getVertex()[2]) >=
settings.duplicateZCut) {
418 const auto dx = candidate.getVertex()[0] - owner.getVertex()[0];
419 const auto dy = candidate.getVertex()[1] - owner.getVertex()[1];
420 const auto dz = candidate.getVertex()[2] - owner.getVertex()[2];
421 const auto distance2 = math_utils::SqSum(dx, dy, dz);
422 if (distance2 <
settings.duplicateDistance2Cut) {
432 const auto ownerId =
static_cast<int>(deduplicated.size());
433 keptByZBin[zBin].push_back(ownerId);
434 deduplicated.push_back(std::move(candidate));
441 std::vector<int> candidateIndices;
443 for (
int iCluster{0}; iCluster <
nClusters; ++iCluster) {
444 const bool zCompatible = o2::gpu::GPUCommonMath::Abs(
clusters[iCluster].getVertex()[2]) < mVrtParams[iteration].maxZPositionAllowed;
447 candidateIndices.push_back(iCluster);
451 if (candidateIndices.empty()) {
457 auto lhsIt = lhs.getLabels().begin();
458 auto rhsIt = rhs.getLabels().begin();
459 while (lhsIt != lhs.getLabels().end() && rhsIt != rhs.getLabels().end()) {
460 if (*lhsIt == *rhsIt) {
464 }
else if (*lhsIt < *rhsIt) {
473 float minCandidateZ = std::numeric_limits<float>::max();
474 for (
const auto clusterId : candidateIndices) {
475 minCandidateZ = std::min(minCandidateZ,
clusters[clusterId].getVertex()[2]);
477 std::unordered_map<int, std::vector<int>> selectedByZBin;
478 std::vector<int> selectedIndices;
479 selectedIndices.reserve(candidateIndices.size());
480 for (
const auto clusterId : candidateIndices) {
481 const auto& candidate =
clusters[clusterId];
482 const auto candidateZ = candidate.getVertex()[2];
483 const auto zBin =
static_cast<int>((candidateZ - minCandidateZ) /
settings.finalSelectionZCut);
484 bool suppressed =
false;
485 for (
int neighborBin = zBin - 1; neighborBin <= zBin + 1 && !suppressed; ++neighborBin) {
486 const auto found = selectedByZBin.find(neighborBin);
487 if (found == selectedByZBin.end()) {
490 for (
const auto selectedId : found->second) {
491 const auto& selected =
clusters[selectedId];
492 if (!candidate.getTimeStamp().isCompatible(selected.getTimeStamp())) {
495 const auto zDelta = o2::gpu::GPUCommonMath::Abs(candidateZ - selected.getVertex()[2]);
496 const auto sharedLabels = countSharedLabels(candidate, selected);
497 const auto minSize = std::min(candidate.getSize(), selected.getSize());
498 const bool overlapDuplicate = sharedLabels > 0 && sharedLabels * 4 >=
minSize;
499 const bool strongZDuplicate =
zDelta <
settings.finalSelectionZCut;
500 const bool clearlyBetterMultiplicity = selected.getSize() >= candidate.getSize() + 3;
501 const bool clearlyBetterQuality = selected.getSize() > candidate.getSize() &&
502 selected.getAvgDistance2() + constants::Tolerance < 0.8f * candidate.getAvgDistance2();
503 const bool weakCandidate = clearlyBetterMultiplicity || clearlyBetterQuality;
504 if (overlapDuplicate || (strongZDuplicate && weakCandidate)) {
513 selectedByZBin[zBin].push_back(clusterId);
514 selectedIndices.push_back(clusterId);
518 std::vector<int> sortedIndices(selectedIndices.size());
519 std::iota(sortedIndices.begin(), sortedIndices.end(), 0);
520 std::sort(sortedIndices.begin(), sortedIndices.end(), [&selectedIndices, &
clusters](
int i,
int j) {
521 return clusters[selectedIndices[i]].getSize() > clusters[selectedIndices[j]].getSize();
523 for (
const auto sortedId : sortedIndices) {
524 const auto& cluster =
clusters[selectedIndices[sortedId]];
525 const auto beamDistance2 = clusterBeamDistance2(cluster);
526 if (!(beamDistance2 < mVrtParams[iteration].NSigmaCut)) {
529 if (cluster.getSize() < mVrtParams[iteration].clusterContributorsCut) {
532 if (!rofVertices[rofId].
empty() && cluster.getSize() < mVrtParams[iteration].suppressLowMultDebris) {
538 (ushort)cluster.getSize(),
539 cluster.getAvgDistance2()};
540 if (mVrtParams[iteration].PassFlags[IterationStep::MarkVerticesAsUPC]) {
541 vertex.setFlags(Vertex::UPCMode);
543 vertex.setTimeStamp(cluster.getTimeStamp());
544 rofVertices[rofId].push_back(
vertex);
545 if (mTimeFrame->hasMCinformation()) {
546 auto& lineLabels = mTimeFrame->getLinesLabel(rofId);
547 bounded_vector<o2::MCCompLabel>
labels(mMemoryPool.get());
548 for (
auto&
index : cluster.getLabels()) {
552 rofLabels[rofId].push_back(mainLabel);
557 if (mTaskArena->max_concurrency() <= 1) {
558 for (
int rofId{0}; rofId < nRofs; ++rofId) {
562 mTaskArena->execute([&] {
563 tbb::parallel_for(0, nRofs, [&](
const int rofId) {
569 for (
int rofId{0}; rofId < nRofs; ++rofId) {
570 for (
auto&
vertex : rofVertices[rofId]) {
571 mTimeFrame->addPrimaryVertex(
vertex);
573 if (mTimeFrame->hasMCinformation()) {
574 for (
auto&
label : rofLabels[rofId]) {
575 mTimeFrame->addPrimaryVertexLabel(
label);
581template <
int NLayers>
584 LOGP(info,
"Using truth seeds as vertices; will skip computations");
586 const auto irs = dc->getEventRecords();
591 auto eveId2colId = dc->getCollisionIndicesForSource(iSrc);
592 for (
int iEve{0}; iEve < mcReader.
getNEvents(iSrc); ++iEve) {
593 const auto&
ir = irs[eveId2colId[iEve]];
596 auto bc = (
ir - raw::HBFUtils::Instance().getFirstSampledTFIR()).toLong() - roFrameBiasInBC;
601 vert.getTimeStamp().setTimeStamp(
bc);
602 vert.getTimeStamp().setTimeStampError(roFrameLengthInBC / 2);
604 vert.setNContributors(std::max(1L, std::ranges::count_if(mcReader.
getTracks(iSrc, iEve), [](
const auto& trk) {
605 if (!trk.isPrimary() || trk.GetPt() < 0.05 || std::abs(trk.GetEta()) > 1.1) {
609 return (!p) ?
false : p->Charge() != 0;
611 vert.setXYZ((
float)eve.GetX(), (
float)eve.GetY(), (
float)eve.GetZ());
613 constexpr float cov = 25
e-4;
617 mTimeFrame->addPrimaryVertex(vert);
620 mTimeFrame->addPrimaryVertexLabel(lbl);
624 LOGP(info,
"Imposed {} pv collisions from mc-truth", mTimeFrame->getPrimaryVertices().size());
627template <
int NLayers>
630 if (arena ==
nullptr) {
631 mTaskArena = std::make_shared<tbb::task_arena>(std::abs(
n));
632 LOGP(info,
"Setting seeding vertexer with {} threads.",
n);
638template <
int NLayers>
641 return mVrtParams[iteration].PassFlags[IterationStep::SkipROFsAboveThreshold] &&
642 (int)mTimeFrame->getROFVertexLookupTableView().getVertices(1, rof).getEntries() > mVrtParams[iteration].vertPerRofThreshold;
645template class VertexerTraits<7>;
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions false
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if shared
configStandalone Reconstruction settings
configStandalone Reconstruction rec_tpc float
Shared budgeted host allocation and bounded-vector utilities.
std::vector< o2::MCCompLabel > labels
Utility functions for vertex handling.
Class to compute the primary vertex in ITS from tracklets.
static constexpr int maxTrackID()
static TDatabasePDG * Instance()
static const DPLAlpideParam< N > & Instance()
HMPID cluster implementation.
virtual void initialise(const TrackingParameters &trackingParams)
virtual void updateVertexingParameters(const std::vector< VertexingParameters > &vrtPar)
virtual void computeTracklets(const int iteration)
static DigitizationContext * loadFromFile(std::string_view filename="")
size_t getNEvents(int source) const
Get number of events.
o2::dataformats::MCEventHeader const & getMCEventHeader(int source, int event) const
retrieves the MCEventHeader for a given eventID and sourceID
void releaseTracksForSourceAndEvent(int source, int event)
API to ask releasing tracks and track references (freeing memory) for source + event.
std::vector< MCTrack > const & getTracks(int source, int event) const
variant returning all tracks for source and event at once
GLuint GLsizei const GLchar * label
void deepVectorClear(std::vector< T > &vec)
std::pair< o2::MCCompLabel, float > VertexLabel
return getBinsRect(layerIndex, currentCluster.phi, zMean, zDelta, maxdeltaphi, utils)
o2::track::TrackParametrization< float > par
VertexLabel computeMainVertexLabel(const Container &elements)
std::vector< Cluster > getClusters(int event)
Common utility functions.
o2::InteractionRecord ir(0, 0)
std::vector< Cluster > clusters
std::vector< Tracklet64 > tracklets