Project
Loading...
Searching...
No Matches
TrackingInterface.cxx
Go to the documentation of this file.
1// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include <algorithm>
13#include <array>
14#include <format>
15#include <memory>
16
17#include <oneapi/tbb/task_arena.h>
18
21
24
28
38
39using namespace o2::framework;
40using namespace o2::its;
41
43{
44 // get parameters
45 const auto& trackConf = o2::its::TrackerParamConfig::Instance();
46 const auto& vertConf = o2::its::VertexerParamConfig::Instance();
47 if (auto parmode = (TrackingMode::Type)trackConf.trackingMode; mMode == TrackingMode::Unset || (parmode != TrackingMode::Unset && mMode != parmode)) {
48 LOGP(info, "Tracking mode overwritten by configurable params from {} to {}", TrackingMode::toString(mMode), TrackingMode::toString(parmode));
49 mMode = parmode;
50 }
51 auto trackParams = TrackingMode::getTrackingParameters(mMode);
52 auto vertParams = TrackingMode::getVertexingParameters(mMode);
53 overrideParameters(trackParams, vertParams);
54 LOGP(info, "Initializing tracker in {} phase reconstruction with {} passes for tracking and {}/{} for vertexing", TrackingMode::toString(mMode), trackParams.size(), o2::its::VertexerParamConfig::Instance().nIterations, vertParams.size());
55 mTracker->setParameters(trackParams);
56 mVertexer->setParameters(vertParams);
57 TrackingParameters vertexTrackingParams;
58 mTimeFrame->initVertexingTopology(vertexTrackingParams);
59 if (!trackParams.empty()) {
61 mTimeFrame->initTrackerTopologies(gsl::span<const TrackingParameters>(trackParams.data(), trackParams.size()));
62 }
63
64 if (mMode == TrackingMode::Cosmics) {
65 mRunVertexer = false;
66 mCosmicsProcessing = true;
67 LOGP(info, "Cosmic mode enabled, will skip vertexing");
68 }
69
70 // threading
71 if (trackConf.nThreads == vertConf.nThreads) {
72 bool clamped{false};
73 int nThreads = trackConf.nThreads;
74 if (nThreads > 0) {
75 const int hw = std::thread::hardware_concurrency();
76 const int maxThreads = (hw == 0 ? 1 : hw);
77 nThreads = std::clamp(nThreads, 1, maxThreads);
78 clamped = trackConf.nThreads > maxThreads;
79 }
80 LOGP(info, "Tracker and Vertexer will share the task arena with {} thread(s){}", nThreads, (clamped) ? " (clamped)" : "");
81 mTaskArena = std::make_shared<tbb::task_arena>(std::abs(nThreads));
82 }
83 mVertexer->setNThreads(vertConf.nThreads, mTaskArena);
84 mTracker->setNThreads(trackConf.nThreads, mTaskArena);
85 mTimeFrame->setIsStaggered(mDoStaggering);
86
87 // prepare data filter
88 for (int iLayer = 0; iLayer < ((mDoStaggering) ? NLayers : 1); ++iLayer) {
89 mFilter.emplace_back("compClusters", "ITS", "COMPCLUSTERS", iLayer, Lifetime::Timeframe);
90 mFilter.emplace_back("patterns", "ITS", "PATTERNS", iLayer, Lifetime::Timeframe);
91 mFilter.emplace_back("ROframe", "ITS", "CLUSTERSROF", iLayer, Lifetime::Timeframe);
92 if (mIsMC) {
93 mFilter.emplace_back("itsmclabels", "ITS", "CLUSTERSMCTR", iLayer, Lifetime::Timeframe);
94 }
95 }
96}
97
99{
101
102 // filter input and compose
103 std::array<gsl::span<const itsmft::CompClusterExt>, NLayers> compClusters;
104 std::array<gsl::span<const unsigned char>, NLayers> patterns;
105 std::array<gsl::span<const itsmft::ROFRecord>, NLayers> rofsinput;
106 std::array<const dataformats::MCTruthContainer<MCCompLabel>*, NLayers> labels{};
107 for (const DataRef& ref : framework::InputRecordWalker{pc.inputs(), mFilter}) {
108 auto const* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(ref);
109 if (framework::DataRefUtils::match(ref, {"compClusters", framework::ConcreteDataTypeMatcher{"ITS", "COMPCLUSTERS"}})) {
110 compClusters[dh->subSpecification] = pc.inputs().get<gsl::span<o2::itsmft::CompClusterExt>>(ref);
111 }
112 if (framework::DataRefUtils::match(ref, {"patterns", framework::ConcreteDataTypeMatcher{"ITS", "PATTERNS"}})) {
113 patterns[dh->subSpecification] = pc.inputs().get<gsl::span<unsigned char>>(ref);
114 }
115 if (framework::DataRefUtils::match(ref, {"ROframes", framework::ConcreteDataTypeMatcher{"ITS", "CLUSTERSROF"}})) {
116 rofsinput[dh->subSpecification] = pc.inputs().get<gsl::span<o2::itsmft::ROFRecord>>(ref);
117 }
118 if (framework::DataRefUtils::match(ref, {"itsmclabels", framework::ConcreteDataTypeMatcher{"ITS", "CLUSTERSMCTR"}})) {
119 labels[dh->subSpecification] = pc.inputs().get<const dataformats::MCTruthContainer<MCCompLabel>*>(ref).release();
120 }
121 }
122
123 bool hasClusters = false;
124 for (int iLayer = 0; iLayer < ((mDoStaggering) ? NLayers : 1); ++iLayer) {
125 LOGP(info, "ITSTracker{} pulled {} clusters, {} RO frames", ((mDoStaggering) ? std::format(" on layer {}", iLayer) : ""), compClusters[iLayer].size(), rofsinput[iLayer].size());
126 if (compClusters[iLayer].empty()) {
127 LOGP(warn, " -> received no processable data{}", (mDoStaggering) ? std::format(" on layer {}", iLayer) : "");
128 } else {
129 hasClusters = true;
130 }
131 if (mIsMC) {
132 LOG(info) << " -> " << labels[iLayer]->getIndexedSize() << " MC label objects";
133 }
134 }
135
136 const auto& tfInfo = pc.services().get<o2::framework::TimingInfo>();
137 gsl::span<const o2::itsmft::PhysTrigger> physTriggers;
138 std::vector<o2::itsmft::PhysTrigger> fromTRD;
139 if (mUseTriggers == 2) { // use TRD triggers
140 o2::InteractionRecord irFirstTF{0, tfInfo.firstTForbit};
141 auto trdTriggers = pc.inputs().get<gsl::span<o2::trd::TriggerRecord>>("phystrig");
142 for (const auto& trig : trdTriggers) {
143 if (trig.getBCData() >= irFirstTF && trig.getNumberOfTracklets()) {
144 irFirstTF = trig.getBCData();
145 fromTRD.emplace_back(o2::itsmft::PhysTrigger{.ir = irFirstTF, .data = 0});
146 }
147 }
148 physTriggers = gsl::span<const o2::itsmft::PhysTrigger>(fromTRD.data(), fromTRD.size());
149 } else if (mUseTriggers == 1) { // use Phys triggers from ITS stream
150 physTriggers = pc.inputs().get<gsl::span<o2::itsmft::PhysTrigger>>("phystrig");
151 }
152
153 const int clockLayerId{mDoStaggering ? mTimeFrame->getROFOverlapTableView().getClock() : 0};
154 auto& irFrames = pc.outputs().make<std::vector<o2::dataformats::IRFrame>>(Output{"ITS", "IRFRAMES", 0});
155 irFrames.reserve(rofsinput[clockLayerId].size());
156
157 auto& allClusIdx = pc.outputs().make<std::vector<int>>(Output{"ITS", "TRACKCLSID", 0});
158 auto& allTracks = pc.outputs().make<std::vector<o2::its::TrackITS>>(Output{"ITS", "TRACKS", 0});
159 auto& allTrackROFs = pc.outputs().make<std::vector<o2::itsmft::ROFRecord>>(Output{"ITS", "ITSTrackROF", 0});
160 auto& vertices = pc.outputs().make<std::vector<Vertex>>(Output{"ITS", "VERTICES", 0});
161 auto& vertROFvec = pc.outputs().make<std::vector<o2::itsmft::ROFRecord>>(Output{"ITS", "VERTICESROF", 0}); // TODO fill this!
162
163 // MC
164 static pmr::vector<o2::MCCompLabel> dummyMCLabTracks, dummyMCLabVerts;
165 static pmr::vector<float> dummyMCPurVerts;
166 auto& allTrackLabels = mIsMC ? pc.outputs().make<std::vector<o2::MCCompLabel>>(Output{"ITS", "TRACKSMCTR", 0}) : dummyMCLabTracks;
167 auto& allVerticesLabels = mIsMC ? pc.outputs().make<std::vector<o2::MCCompLabel>>(Output{"ITS", "VERTICESMCTR", 0}) : dummyMCLabVerts;
168 auto& allVerticesPurities = mIsMC ? pc.outputs().make<std::vector<float>>(Output{"ITS", "VERTICESMCPUR", 0}) : dummyMCPurVerts;
169
170 const auto clock = mTimeFrame->getROFOverlapTableView().getClock();
171 const auto& clockLayer = mTimeFrame->getROFOverlapTableView().getClockLayer();
172 auto setBCData = [&](auto& rofs) {
173 for (size_t iROF{0}; iROF < rofs.size(); ++iROF) { // set BC data
174 auto& rof = rofs[iROF];
175 int orb = (iROF * par.getROFLengthInBC(clock) / o2::constants::lhc::LHCMaxBunches) + tfInfo.firstTForbit;
176 int bc = (iROF * par.getROFLengthInBC(clock) % o2::constants::lhc::LHCMaxBunches) + par.getROFDelayInBC(clock);
178 rof.setBCData(ir);
179 rof.setROFrame(iROF);
180 rof.setNEntries(0);
181 rof.setFirstEntry(-1);
182 }
183 };
184
185 if (!hasClusters) {
186 // skip processing if no data is received entirely but still create empty output so consumers do not wait
187 allTrackROFs.resize(clockLayer.mNROFsTF);
188 vertROFvec.resize(clockLayer.mNROFsTF);
189 setBCData(allTrackROFs);
190 setBCData(vertROFvec);
191 return;
192 }
193
194 if (mOverrideBeamEstimation) {
195 mTimeFrame->setBeamPosition(mMeanVertex->getX(),
196 mMeanVertex->getY(),
197 mMeanVertex->getSigmaY2(),
198 mTracker->getParameters()[0].LayerResolution[0],
199 mTracker->getParameters()[0].SystErrorY2[0]);
200 }
201
202 mTracker->setBz(o2::base::Propagator::Instance()->getNominalBz());
203 mTracker->setTimeSlice(tfInfo.timeslice);
204
205 for (int iLayer = 0; iLayer < ((mDoStaggering) ? NLayers : 1); ++iLayer) {
206 gsl::span<const unsigned char>::iterator pattIt = patterns[iLayer].begin();
207 loadROF(rofsinput[iLayer], compClusters[iLayer], pattIt, ((mDoStaggering) ? iLayer : -1), labels[iLayer]);
208 }
209
210 auto logger = [&](const std::string& s) { LOG(info) << s; };
211 auto fatalLogger = [&](const std::string& s) { LOG(fatal) << s; };
212 auto errorLogger = [&](const std::string& s) { LOG(error) << s; };
213
214 FastMultEst multEst; // mult estimator
216 multEst.selectROFs(rofsinput, compClusters, physTriggers, tfInfo.firstTForbit, mDoStaggering, mTimeFrame->getROFOverlapTableView(), processMultiplictyMask);
217 mTimeFrame->setMultiplicityCutMask(processMultiplictyMask);
218 for (int iLayer = 0; iLayer < ((mDoStaggering) ? NLayers : 1); ++iLayer) {
219 mTimeFrame->getROFMaskView().print(iLayer);
220 }
221
222 float vertexerElapsedTime{0.f}, trackerElapsedTime{0.f};
223 if (mRunVertexer) {
224 // Run seeding vertexer
225 vertexerElapsedTime = mVertexer->clustersToVertices(logger);
226 const auto& vtx = mTimeFrame->getPrimaryVertices();
227 vertices.insert(vertices.begin(), vtx.begin(), vtx.end());
228 if (mIsMC) {
229 allVerticesLabels.reserve(vertices.size());
230 allVerticesPurities.reserve(vertices.size());
231 for (const auto& lbl : mTimeFrame->getPrimaryVerticesLabels()) {
232 allVerticesLabels.push_back(lbl.first);
233 allVerticesPurities.push_back(lbl.second);
234 }
235 }
236 }
237 multEst.selectROFsWithVertices(vertices, mTimeFrame->getROFOverlapTableView(), processMultiplictyMask);
238
239 auto clockROFspan = rofsinput[clockLayerId];
240 auto clockTiming = mTimeFrame->getROFOverlapTableView().getClockLayer();
241 for (auto iRof{0}; iRof < clockROFspan.size(); ++iRof) {
242 auto& vtxROF = vertROFvec.emplace_back(clockROFspan[iRof]);
243 if (mRunVertexer) {
244 auto vtxSpan = mTimeFrame->getPrimaryVertices(clockLayerId, iRof);
246 if (!vtxSpan.empty()) {
247 bool hasUPC = std::any_of(vtxSpan.begin(), vtxSpan.end(), [](const auto& v) { return v.isFlagSet(Vertex::UPCMode); });
248 if (hasUPC) { // at least one vertex in this ROF and it is from second vertex iteration
249 LOGP(debug, "ROF {} accepted as vertices are from the UPC iteration", iRof);
250 const auto startBC = clockTiming.getROFStartInBC(iRof);
251 const auto endBC = clockTiming.getROFEndInBC(iRof);
252 processUPCMask.selectROF({startBC, endBC - startBC});
253 vtxROF.setFlag(o2::itsmft::ROFRecord::VtxUPCMode);
254 } else { // in all cases except if as standard mode vertex was found, the ROF was processed with UPC settings
255 vtxROF.setFlag(o2::itsmft::ROFRecord::VtxStdMode);
256 }
257 } else {
258 vtxROF.setFlag(o2::itsmft::ROFRecord::VtxUPCMode);
259 }
260 } else {
261 vtxROF.setFlag(o2::itsmft::ROFRecord::VtxStdMode);
262 }
263 }
264 }
265
266 if (mRunVertexer && hasClusters) {
267 LOGP(info, " + Vertex seeding total elapsed time: {} ms for {} vertices found", vertexerElapsedTime, mTimeFrame->getPrimaryVerticesNum());
268 }
269
270 if (mOverrideBeamEstimation) {
271 LOG(info) << fmt::format(" + Beam position set to: {}, {} from meanvertex object", mTimeFrame->getBeamX(), mTimeFrame->getBeamY());
272 } else {
273 LOG(info) << fmt::format(" + Beam position computed for the TF: {}, {}", mTimeFrame->getBeamX(), mTimeFrame->getBeamY());
274 }
275
276 if (hasClusters) {
277 mTimeFrame->setMultiplicityCutMask(processMultiplictyMask);
278 mTimeFrame->setUPCCutMask(processUPCMask);
279 if (mMode == o2::its::TrackingMode::Async && o2::its::TrackerParamConfig::Instance().fataliseUponFailure) {
280 trackerElapsedTime = mTracker->clustersToTracks(logger, fatalLogger);
281 } else {
282 trackerElapsedTime = mTracker->clustersToTracks(logger, errorLogger);
283 }
284 LOGP(info, " + Tracking total elapse time: {} ms for {} tracks found", trackerElapsedTime, mTimeFrame->getNumberOfTracks());
285 }
286 if constexpr (constants::DoTimeBenchmarks) {
287 const auto& trackConf = o2::its::TrackerParamConfig::Instance();
288 const auto& vertConf = o2::its::VertexerParamConfig::Instance();
289 logger(std::format("=== TimeSlice {} processing completed in: {:.2f} ms using {}/{} thread(s) ===", tfInfo.timeslice, trackerElapsedTime + vertexerElapsedTime, vertConf.nThreads, trackConf.nThreads));
290 }
291
292 size_t totTracks{mTimeFrame->getNumberOfTracks()}, totClusIDs{mTimeFrame->getNumberOfUsedClusters()};
293 if (totTracks) {
294 allTracks.reserve(totTracks);
295 allClusIdx.reserve(totClusIDs);
296
298 LOG(warning) << fmt::format(" + The processed timeframe had {} clusters with wild z coordinates, check the dictionaries", mTimeFrame->hasBogusClusters());
299 }
300 }
301
302 auto& tracks = mTimeFrame->getTracks();
303 allTrackLabels.reserve(mTimeFrame->getTracksLabel().size()); // should be 0 if not MC
304 std::copy(mTimeFrame->getTracksLabel().begin(), mTimeFrame->getTracksLabel().end(), std::back_inserter(allTrackLabels));
305 // create the track to clock ROF association here
306 // the clock ROF is just the fastest ROF
307 // the number of ROFs does not necessarily reflect the actual ROFs
308 // due to possible delay of other layers, however it is guaranteed to be >=0
309 // tracks are guaranteed to be sorted here by their lower edge
310 // we pick whatever is the largest possible number of rofs since there might be tracks/vertices which are beyond
311 // the clock layer
312 int highestROF{0};
313 for (const auto& trc : tracks) {
314 highestROF = std::max(highestROF, (int)clockLayer.getROF(trc.getTimeStamp()));
315 }
316 for (const auto& vtx : vertices) {
317 highestROF = std::max(highestROF, (int)clockLayer.getROF(vtx.getTimeStamp().lower()));
318 }
319 highestROF = std::max(highestROF, (int)clockLayer.mNROFsTF);
320 allTrackROFs.resize(highestROF);
321 vertROFvec.resize(highestROF);
322 setBCData(allTrackROFs);
323 setBCData(vertROFvec);
324
325 mTimeFrame->useMultiplictyMask(); // use multiplicty selection for IR frames
326
327 std::vector<int> rofEntries(highestROF + 1, 0);
328 for (unsigned int iTrk{0}; iTrk < tracks.size(); ++iTrk) {
329 auto& trc{tracks[iTrk]};
330 trc.setFirstClusterEntry((int)allClusIdx.size()); // before adding tracks, create final cluster indices
331 int ncl = trc.getNumberOfClusters(), nclf = 0;
332 for (int ic = TrackITSExt::MaxClusters; ic--;) { // track internally keeps in->out cluster indices, but we want to store the references as out->in!!!
333 auto clid = trc.getClusterIndex(ic);
334 if (clid >= 0) {
335 trc.setClusterSize(ic, mTimeFrame->getClusterSize((mDoStaggering) ? ic : 0, clid));
336 allClusIdx.push_back(clid);
337 nclf++;
338 }
339 }
340 assert(ncl == nclf);
341 allTracks.emplace_back(trc);
342 auto rof = clockLayer.getROF(trc.getTimeStamp());
343 ++rofEntries[rof];
344 }
345 std::exclusive_scan(rofEntries.begin(), rofEntries.end(), rofEntries.begin(), 0);
346 for (size_t iROF{0}; iROF < allTrackROFs.size(); ++iROF) {
347 allTrackROFs[iROF].setFirstEntry(rofEntries[iROF]);
348 allTrackROFs[iROF].setNEntries(rofEntries[iROF + 1] - rofEntries[iROF]);
349 if (mTimeFrame->getROFMaskView().isROFEnabled(clockLayerId, (int)iROF)) {
350 auto& irFrame = irFrames.emplace_back(allTrackROFs[iROF].getBCData(), allTrackROFs[iROF].getBCData() + clockLayer.mROFLength - 1);
351 irFrame.info = allTrackROFs[iROF].getNEntries();
352 }
353 }
354 // same thing for vertices rofs
355 std::fill(rofEntries.begin(), rofEntries.end(), 0);
356 for (const auto& vtx : vertices) {
357 auto rof = clockLayer.getROF(vtx.getTimeStamp().lower());
358 ++rofEntries[rof];
359 }
360 std::exclusive_scan(rofEntries.begin(), rofEntries.end(), rofEntries.begin(), 0);
361 for (size_t iROF{0}; iROF < vertROFvec.size(); ++iROF) {
362 vertROFvec[iROF].setFirstEntry(rofEntries[iROF]);
363 vertROFvec[iROF].setNEntries(rofEntries[iROF + 1] - rofEntries[iROF]);
364 }
365
366 LOGP(info, "ITSTracker pushed {} tracks in {} rofs and {} vertices {}", allTracks.size(), allTrackROFs.size(), vertices.size(), ((mDoStaggering) ? "in staggered-readout mode" : ""));
367 if (mIsMC) {
368 LOGP(info, "ITSTracker pushed {} track labels", allTrackLabels.size());
369 LOGP(info, "ITSTracker pushed {} vertex labels", allVerticesLabels.size());
370 LOGP(info, "ITSTracker pushed {} vertex purities", allVerticesPurities.size());
371 }
372 mTimeFrame->wipe();
373}
374
376{
378 static bool initOnceDone = false;
379 if (mOverrideBeamEstimation) {
381 }
382 if (!initOnceDone) { // this params need to be queried only once
383 initOnceDone = true;
386 if (pc.inputs().getPos("itsTGeo") >= 0) {
387 pc.inputs().get<o2::its::GeometryTGeo*>("itsTGeo");
388 }
391 initialise();
392
393 if (pc.services().get<const o2::framework::DeviceSpec>().inputTimesliceId == 0) { // print settings only for the 1st pipeling
394 // print all used settings
395 if (o2::its::FastMultEstConfig::Instance().isRequested()) {
397 }
398 const auto& vtxParams = mVertexer->getParameters();
399 if (!vtxParams.empty()) {
401 }
402 const auto& trParams = mTracker->getParameters();
403 if (!trParams.empty()) {
405 }
406 // quick summary
407 for (size_t it = 0; it < vtxParams.size(); it++) {
408 const auto& par = vtxParams[it];
409 LOGP(info, "vtxIter#{} : {}", it, par.asString());
410 }
411 for (size_t it = 0; it < trParams.size(); it++) {
412 const auto& par = trParams[it];
413 LOGP(info, "recoIter#{} : {}", it, par.asString());
414 }
415 }
416
417 // prepare rof lookup table(s)
419 const int nOrbitsPerTF = o2::base::GRPGeomHelper::getNHBFPerTF();
422 const auto& trackParams = mTracker->getParameters();
423 for (int iLayer = 0; iLayer < NLayers; ++iLayer) {
424 const unsigned int nROFsPerOrbit = o2::constants::lhc::LHCMaxBunches / par.getROFLengthInBC(iLayer);
425 const LayerTiming timing{
426 .mNROFsTF = (nROFsPerOrbit * nOrbitsPerTF),
427 .mROFLength = (uint32_t)par.getROFLengthInBC(iLayer),
428 .mROFDelay = (uint32_t)par.getROFDelayInBC(iLayer),
429 .mROFBias = (uint32_t)par.getROFBiasInBC(iLayer),
430 .mROFAddTimeErr = (trackParams.empty() ? o2::its::TrackerParamConfig::Instance().addTimeError[iLayer] : trackParams[0].AddTimeError[iLayer])};
431 rofTable.defineLayer(iLayer, timing);
432 vtxTable.defineLayer(iLayer, timing);
433 }
434 rofTable.init();
436 vtxTable.init();
438 }
439}
440
442{
444 return;
445 }
446 if (matcher == ConcreteDataMatcher("ITS", "CLUSDICT", 0)) {
447 LOG(info) << "cluster dictionary updated";
449 return;
450 }
451 // Note: strictly speaking, for Configurable params we don't need finaliseCCDB check, the singletons are updated at the CCDB fetcher level
452 if (matcher == ConcreteDataMatcher("ITS", "ALPIDEPARAM", 0)) {
453 LOG(info) << "Alpide param updated";
455 par.printKeyValues();
456 return;
457 }
458 if (matcher == ConcreteDataMatcher("GLO", "MEANVERTEX", 0)) {
459 LOGP(info, "Mean vertex acquired");
461 return;
462 }
463 if (matcher == ConcreteDataMatcher("ITS", "GEOMTGEO", 0)) {
464 LOG(info) << "ITS GeometryTGeo loaded from ccdb";
466 return;
467 }
468}
469
471{
472 mVertexer->printSummary();
473 mTracker->printSummary();
474}
475
477 TrackerTraitsN* trackerTraits,
478 TimeFrameN* frame)
479{
480 mVertexer = std::make_unique<VertexerN>(vertexerTraits);
481 mTracker = std::make_unique<TrackerN>(trackerTraits);
482 mTimeFrame = frame;
483 mVertexer->adoptTimeFrame(*mTimeFrame);
484 mTracker->adoptTimeFrame(*mTimeFrame);
485
486 // set common memory resource
487 if (!mMemoryPool) {
488 mMemoryPool = std::make_shared<BoundedMemoryResource>();
489 }
490 vertexerTraits->setMemoryPool(mMemoryPool);
491 trackerTraits->setMemoryPool(mMemoryPool);
492 mTimeFrame->setMemoryPool(mMemoryPool);
493 mTracker->setMemoryPool(mMemoryPool);
494 mVertexer->setMemoryPool(mMemoryPool);
495}
496
498{
499 pc.inputs().get<o2::itsmft::TopologyDictionary*>("itscldict"); // just to trigger the finaliseCCDB
500}
501
502void ITSTrackingInterface::loadROF(gsl::span<const itsmft::ROFRecord>& trackROFspan,
503 gsl::span<const itsmft::CompClusterExt> clusters,
504 gsl::span<const unsigned char>::iterator& pattIt,
505 int layer,
507{
508 mTimeFrame->loadROFrameData(trackROFspan, clusters, pattIt, mDict, layer, mcLabels);
509}
std::vector< std::string > labels
std::ostringstream debug
uint64_t bc
Definition RawEventData.h:5
Configuration parameters for ITS fast multiplicity estimator.
Fast multiplicity estimator for ITS.
Helper for geometry and GRP related CCDB requests.
Class to delimit start and end IR of certain time period.
Definition of the GeometryTGeo class.
Definition of the ITSMFT ROFrame (trigger) record.
A helper class to iteratate over all parts of all input routes.
Definition Physics trigger record extracted from the ITS/MFT stream.
void checkUpdates(o2::framework::ProcessingContext &pc)
static GRPGeomHelper & instance()
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
Definition Propagator.h:178
void printKeyValues(bool showProv=true, bool useLogger=false, bool withPadding=true, bool showHash=true) const final
A container to hold and manage MC truth information/labels.
decltype(auto) make(const Output &spec, Args... args)
A helper class to iteratate over all parts of all input routes.
int getPos(const char *name) const
decltype(auto) get(R binding, int part=0) const
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
static GeometryTGeo * Instance()
void fillMatrixCache(int mask) override
static void adopt(GeometryTGeo *raw, bool canDelete=false)
void run(framework::ProcessingContext &pc)
void setMeanVertex(const o2::dataformats::MeanVertexObject *v)
void setClusterDictionary(const o2::itsmft::TopologyDictionary *d)
virtual void requestTopologyDictionary(framework::ProcessingContext &pc)
virtual void updateTimeDependentParams(framework::ProcessingContext &pc)
virtual void loadROF(gsl::span< const itsmft::ROFRecord > &trackROFspan, gsl::span< const itsmft::CompClusterExt > clusters, gsl::span< const unsigned char >::iterator &pattIt, int layer, const dataformats::MCTruthContainer< MCCompLabel > *mcLabels)
virtual void finaliseCCDB(framework::ConcreteDataMatcher &matcher, void *obj)
void setTraitsFromProvider(VertexerTraitsN *, TrackerTraitsN *, TimeFrameN *)
virtual void overrideParameters(std::vector< TrackingParameters > &t, std::vector< VertexingParameters > &v)
static constexpr int MaxClusters
< heavy version of TrackITS, with clusters embedded
Definition TrackITS.h:171
void setMemoryPool(std::shared_ptr< BoundedMemoryResource > pool) noexcept
void setMemoryPool(std::shared_ptr< BoundedMemoryResource > pool)
GLsizeiptr size
Definition glcorearb.h:659
const GLdouble * v
Definition glcorearb.h:832
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLint ref
Definition glcorearb.h:291
constexpr int LHCMaxBunches
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< VertexingParameters > getVertexingParameters(Type mode)
std::string toString(Type mode)
std::vector< TrackingParameters > getTrackingParameters(Type mode)
constexpr bool DoTimeBenchmarks
Definition Constants.h:28
std::vector< T, fair::mq::pmr::polymorphic_allocator< T > > vector
void empty(int)
static bool match(DataRef const &ref, const char *binding)
size_t inputTimesliceId
The time pipelining id of this particular device.
Definition DeviceSpec.h:68
void selectROFsWithVertices(const auto &vertices, const ROFOverlapTableN::View &overlapView, ROFMaskTableN &sel) const
Definition FastMultEst.h:54
int selectROFs(const std::array< gsl::span< const o2::itsmft::ROFRecord >, NLayers > &rofs, const std::array< gsl::span< const o2::itsmft::CompClusterExt >, NLayers > &clus, const gsl::span< const o2::itsmft::PhysTrigger > trig, uint32_t firstTForbit, bool doStaggering, const ROFOverlapTableN::View &overlapView, ROFMaskTableN &sel)
ROFVertexLookupTable< NLayers > ROFVertexLookupTableN
Definition TimeFrame.h:68
size_t getNumberOfUsedClusters() const
Definition TimeFrame.h:598
void initDefaultTrackingTopology(const TrackingParameters &trkParam, const int maxLayers=NLayers)
void useMultiplictyMask() noexcept
Definition TimeFrame.h:160
void setMemoryPool(std::shared_ptr< BoundedMemoryResource > pool)
memory management
size_t getNumberOfTracks() const
Definition TimeFrame.h:592
void initVertexingTopology(const TrackingParameters &trkParam)
int getClusterSize(int layer, int clusterId) const
Definition TimeFrame.h:177
float getBeamY() const
Definition TimeFrame.h:110
const auto & getROFMaskView() const
Definition TimeFrame.h:171
int hasBogusClusters() const
Definition TimeFrame.h:243
void loadROFrameData(gsl::span< const o2::itsmft::ROFRecord > rofs, gsl::span< const itsmft::CompClusterExt > clusters, gsl::span< const unsigned char >::iterator &pattIt, const itsmft::TopologyDictionary *dict, int layer, const dataformats::MCTruthContainer< MCCompLabel > *mcLabels=nullptr)
Definition TimeFrame.cxx:59
void initTrackerTopologies(gsl::span< const TrackingParameters > trkParams, const int maxLayers=NLayers)
void setUPCCutMask(ROFMaskTableN cutMask)
Definition TimeFrame.h:165
float getBeamX() const
Definition TimeFrame.h:109
void setROFVertexLookupTable(ROFVertexLookupTableN table)
Definition TimeFrame.h:149
auto getPrimaryVerticesNum()
Definition TimeFrame.h:79
virtual void wipe()
void setBeamPosition(const float x, const float y, const float s2, const float base=50.f, const float systematic=0.f)
Definition TimeFrame.h:103
auto & getTracksLabel()
Definition TimeFrame.h:206
auto & getPrimaryVertices()
Definition TimeFrame.h:78
const auto & getROFOverlapTableView() const
Definition TimeFrame.h:139
ROFOverlapTable< NLayers > ROFOverlapTableN
Definition TimeFrame.h:67
auto & getPrimaryVerticesLabels()
Definition TimeFrame.h:81
void setIsStaggered(bool b) noexcept
staggering
Definition TimeFrame.h:224
void setROFOverlapTable(ROFOverlapTableN table)
Definition TimeFrame.h:142
void setMultiplicityCutMask(ROFMaskTableN cutMask)
Definition TimeFrame.h:155
const auto & getROFOverlapTable() const
Definition TimeFrame.h:138
o2::InteractionRecord ir
Definition PhysTrigger.h:24
static constexpr int T2L
Definition Cartesian.h:55
static constexpr int T2GRot
Definition Cartesian.h:57
static constexpr int T2G
Definition Cartesian.h:56
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
o2::InteractionRecord ir(0, 0)
std::vector< Cluster > clusters