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 <cmath>
15#include <format>
16#include <memory>
17#include <ranges>
18#include <set>
19#include <string>
20#include <utility>
21#include <vector>
22
23#include <oneapi/tbb/task_arena.h>
24
27
30
34
45
46using namespace o2::framework;
47using namespace o2::its;
48
50{
51 // get parameters
52 const auto& trackConf = o2::its::TrackerParamConfig::Instance();
53 const auto& vertConf = o2::its::VertexerParamConfig::Instance();
54 if (auto parmode = (TrackingMode::Type)trackConf.trackingMode; mMode == TrackingMode::Unset || (parmode != TrackingMode::Unset && mMode != parmode)) {
55 LOGP(info, "Tracking mode overwritten by configurable params from {} to {}", TrackingMode::toString(mMode), TrackingMode::toString(parmode));
56 mMode = parmode;
57 }
58 auto trackParams = TrackingMode::getTrackingParameters(mMode);
59 auto vertParams = TrackingMode::getVertexingParameters(mMode);
60 overrideParameters(trackParams, vertParams);
61 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());
62 mTracker->setParameters(trackParams);
63 mVertexer->setParameters(vertParams);
64 TrackingParameters vertexTrackingParams;
65 mTimeFrame->initVertexingTopology(vertexTrackingParams);
66 if (!trackParams.empty()) {
68 mTimeFrame->initTrackerTopologies(gsl::span<const TrackingParameters>(trackParams.data(), trackParams.size()));
69 }
70
71 if (mMode == TrackingMode::Cosmics) {
72 mRunVertexer = false;
73 mCosmicsProcessing = true;
74 LOGP(info, "Cosmic mode enabled, will skip vertexing");
75 }
76
77 // threading
78 if (trackConf.nThreads == vertConf.nThreads) {
79 bool clamped{false};
80 int nThreads = trackConf.nThreads;
81 if (nThreads > 0) {
82 const int hw = std::thread::hardware_concurrency();
83 const int maxThreads = (hw == 0 ? 1 : hw);
84 nThreads = std::clamp(nThreads, 1, maxThreads);
85 clamped = trackConf.nThreads > maxThreads;
86 }
87 LOGP(info, "Tracker and Vertexer will share the task arena with {} thread(s){}", nThreads, (clamped) ? " (clamped)" : "");
88 mTaskArena = std::make_shared<tbb::task_arena>(std::abs(nThreads));
89 }
90 mVertexer->setNThreads(vertConf.nThreads, mTaskArena);
91 mTracker->setNThreads(trackConf.nThreads, mTaskArena);
92 mTimeFrame->setIsStaggered(mDoStaggering);
93
94 // prepare data filter
95 for (int iLayer = 0; iLayer < ((mDoStaggering) ? NLayers : 1); ++iLayer) {
96 mFilter.emplace_back("compClusters", "ITS", "COMPCLUSTERS", iLayer, Lifetime::Timeframe);
97 mFilter.emplace_back("patterns", "ITS", "PATTERNS", iLayer, Lifetime::Timeframe);
98 mFilter.emplace_back("ROframe", "ITS", "CLUSTERSROF", iLayer, Lifetime::Timeframe);
99 if (mIsMC) {
100 mFilter.emplace_back("itsmclabels", "ITS", "CLUSTERSMCTR", iLayer, Lifetime::Timeframe);
101 }
102 }
103}
104
106{
108
109 // filter input and compose
110 std::array<gsl::span<const itsmft::CompClusterExt>, NLayers> compClusters;
111 std::array<gsl::span<const unsigned char>, NLayers> patterns;
112 std::array<gsl::span<const itsmft::ROFRecord>, NLayers> rofsinput;
113 std::array<const dataformats::MCTruthContainer<MCCompLabel>*, NLayers> labels{};
114 for (const DataRef& ref : framework::InputRecordWalker{pc.inputs(), mFilter}) {
115 auto const* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(ref);
116 if (framework::DataRefUtils::match(ref, {"compClusters", framework::ConcreteDataTypeMatcher{"ITS", "COMPCLUSTERS"}})) {
117 compClusters[dh->subSpecification] = pc.inputs().get<gsl::span<o2::itsmft::CompClusterExt>>(ref);
118 }
119 if (framework::DataRefUtils::match(ref, {"patterns", framework::ConcreteDataTypeMatcher{"ITS", "PATTERNS"}})) {
120 patterns[dh->subSpecification] = pc.inputs().get<gsl::span<unsigned char>>(ref);
121 }
122 if (framework::DataRefUtils::match(ref, {"ROframes", framework::ConcreteDataTypeMatcher{"ITS", "CLUSTERSROF"}})) {
123 rofsinput[dh->subSpecification] = pc.inputs().get<gsl::span<o2::itsmft::ROFRecord>>(ref);
124 }
125 if (framework::DataRefUtils::match(ref, {"itsmclabels", framework::ConcreteDataTypeMatcher{"ITS", "CLUSTERSMCTR"}})) {
126 labels[dh->subSpecification] = pc.inputs().get<const dataformats::MCTruthContainer<MCCompLabel>*>(ref).release();
127 }
128 }
129
130 bool hasClusters = false;
131 for (int iLayer = 0; iLayer < ((mDoStaggering) ? NLayers : 1); ++iLayer) {
132 LOGP(info, "ITSTracker{} pulled {} clusters, {} RO frames", ((mDoStaggering) ? std::format(" on layer {}", iLayer) : ""), compClusters[iLayer].size(), rofsinput[iLayer].size());
133 if (compClusters[iLayer].empty()) {
134 LOGP(warn, " -> received no processable data{}", (mDoStaggering) ? std::format(" on layer {}", iLayer) : "");
135 } else {
136 hasClusters = true;
137 }
138 if (mIsMC) {
139 LOG(info) << " -> " << labels[iLayer]->getIndexedSize() << " MC label objects";
140 }
141 }
142
143 const auto& tfInfo = pc.services().get<o2::framework::TimingInfo>();
144 gsl::span<const o2::itsmft::PhysTrigger> physTriggers;
145 std::vector<o2::itsmft::PhysTrigger> fromTRD;
146 if (mUseTriggers == 2) { // use TRD triggers
147 o2::InteractionRecord irFirstTF{0, tfInfo.firstTForbit};
148 auto trdTriggers = pc.inputs().get<gsl::span<o2::trd::TriggerRecord>>("phystrig");
149 for (const auto& trig : trdTriggers) {
150 if (trig.getBCData() >= irFirstTF && trig.getNumberOfTracklets()) {
151 irFirstTF = trig.getBCData();
152 fromTRD.emplace_back(o2::itsmft::PhysTrigger{.ir = irFirstTF, .data = 0});
153 }
154 }
155 physTriggers = gsl::span<const o2::itsmft::PhysTrigger>(fromTRD.data(), fromTRD.size());
156 } else if (mUseTriggers == 1) { // use Phys triggers from ITS stream
157 physTriggers = pc.inputs().get<gsl::span<o2::itsmft::PhysTrigger>>("phystrig");
158 }
159
160 const int clockLayerId{mDoStaggering ? mTimeFrame->getROFOverlapTableView().getClock() : 0};
161 auto& irFrames = pc.outputs().make<std::vector<o2::dataformats::IRFrame>>(Output{"ITS", "IRFRAMES", 0});
162 irFrames.reserve(rofsinput[clockLayerId].size());
163
164 auto& allClusIdx = pc.outputs().make<std::vector<int>>(Output{"ITS", "TRACKCLSID", 0});
165 auto& allTracks = pc.outputs().make<std::vector<o2::its::TrackITS>>(Output{"ITS", "TRACKS", 0});
166 auto& allTrackROFs = pc.outputs().make<std::vector<o2::itsmft::ROFRecord>>(Output{"ITS", "ITSTrackROF", 0});
167 auto& vertices = pc.outputs().make<std::vector<Vertex>>(Output{"ITS", "VERTICES", 0});
168 auto& vertROFvec = pc.outputs().make<std::vector<o2::itsmft::ROFRecord>>(Output{"ITS", "VERTICESROF", 0}); // TODO fill this!
169
170 // MC
171 static pmr::vector<o2::MCCompLabel> dummyMCLabTracks, dummyMCLabVerts;
172 static pmr::vector<float> dummyMCPurVerts;
173 auto& allTrackLabels = mIsMC ? pc.outputs().make<std::vector<o2::MCCompLabel>>(Output{"ITS", "TRACKSMCTR", 0}) : dummyMCLabTracks;
174 auto& allVerticesLabels = mIsMC ? pc.outputs().make<std::vector<o2::MCCompLabel>>(Output{"ITS", "VERTICESMCTR", 0}) : dummyMCLabVerts;
175 auto& allVerticesPurities = mIsMC ? pc.outputs().make<std::vector<float>>(Output{"ITS", "VERTICESMCPUR", 0}) : dummyMCPurVerts;
176
177 const auto clock = mTimeFrame->getROFOverlapTableView().getClock();
178 const auto& clockLayer = mTimeFrame->getROFOverlapTableView().getClockLayer();
179 auto setBCData = [&](auto& rofs) {
180 for (size_t iROF{0}; iROF < rofs.size(); ++iROF) { // set BC data
181 auto& rof = rofs[iROF];
182 int orb = (iROF * par.getROFLengthInBC(clock) / o2::constants::lhc::LHCMaxBunches) + tfInfo.firstTForbit;
183 int bc = (iROF * par.getROFLengthInBC(clock) % o2::constants::lhc::LHCMaxBunches) + par.getROFDelayInBC(clock);
185 rof.setBCData(ir);
186 rof.setROFrame(iROF);
187 rof.setNEntries(0);
188 rof.setFirstEntry(-1);
189 }
190 };
191
192 if (!hasClusters) {
193 // skip processing if no data is received entirely but still create empty output so consumers do not wait
194 allTrackROFs.resize(clockLayer.mNROFsTF);
195 vertROFvec.resize(clockLayer.mNROFsTF);
196 setBCData(allTrackROFs);
197 setBCData(vertROFvec);
198 return;
199 }
200
201 if (mOverrideBeamEstimation) {
202 mTimeFrame->setBeamPosition(mMeanVertex->getX(),
203 mMeanVertex->getY(),
204 mMeanVertex->getSigmaY2(),
205 mTracker->getParameters()[0].LayerResolution[0],
206 mTracker->getParameters()[0].SystErrorY2[0]);
207 }
208
209 mTracker->setBz(o2::base::Propagator::Instance()->getNominalBz());
210 mTracker->setTimeSlice(tfInfo.timeslice);
211
212 for (int iLayer = 0; iLayer < ((mDoStaggering) ? NLayers : 1); ++iLayer) {
213 gsl::span<const unsigned char>::iterator pattIt = patterns[iLayer].begin();
214 loadROF(rofsinput[iLayer], compClusters[iLayer], pattIt, ((mDoStaggering) ? iLayer : -1), labels[iLayer]);
215 }
216
217 auto logger = [&](const std::string& s) { LOG(info) << s; };
218 auto fatalLogger = [&](const std::string& s) { LOG(fatal) << s; };
219 auto errorLogger = [&](const std::string& s) { LOG(error) << s; };
220
221 FastMultEst multEst; // mult estimator
223 multEst.selectROFs(rofsinput, compClusters, physTriggers, tfInfo.firstTForbit, mDoStaggering, mTimeFrame->getROFOverlapTableView(), processMultiplictyMask);
224 mTimeFrame->setMultiplicityCutMask(processMultiplictyMask);
225 for (int iLayer = 0; iLayer < ((mDoStaggering) ? NLayers : 1); ++iLayer) {
226 mTimeFrame->getROFMaskView().print(iLayer);
227 }
228
229 float vertexerElapsedTime{0.f}, trackerElapsedTime{0.f};
230 if (mRunVertexer) {
232 ? mTracker->clustersToVertices(logger)
233 : mVertexer->clustersToVertices(logger);
234 const auto& vtx = mTimeFrame->getPrimaryVertices();
235 vertices.insert(vertices.begin(), vtx.begin(), vtx.end());
236 if (mIsMC) {
237 allVerticesLabels.reserve(vertices.size());
238 allVerticesPurities.reserve(vertices.size());
239 for (const auto& lbl : mTimeFrame->getPrimaryVerticesLabels()) {
240 allVerticesLabels.push_back(lbl.first);
241 allVerticesPurities.push_back(lbl.second);
242 }
243 }
244 }
245 multEst.selectROFsWithVertices(vertices, mTimeFrame->getROFOverlapTableView(), processMultiplictyMask);
246
247 auto clockROFspan = rofsinput[clockLayerId];
248 auto clockTiming = mTimeFrame->getROFOverlapTableView().getClockLayer();
249 for (auto iRof{0}; iRof < clockROFspan.size(); ++iRof) {
250 auto& vtxROF = vertROFvec.emplace_back(clockROFspan[iRof]);
251 if (mRunVertexer) {
252 auto vtxSpan = mTimeFrame->getPrimaryVertices(clockLayerId, iRof);
254 if (!vtxSpan.empty()) {
255 bool hasUPC = std::any_of(vtxSpan.begin(), vtxSpan.end(), [](const auto& v) { return v.isFlagSet(Vertex::UPCMode); });
256 if (hasUPC) { // at least one vertex in this ROF and it is from second vertex iteration
257 LOGP(debug, "ROF {} accepted as vertices are from the UPC iteration", iRof);
258 const auto startBC = clockTiming.getROFStartInBC(iRof);
259 const auto endBC = clockTiming.getROFEndInBC(iRof);
260 processUPCMask.selectROF({startBC, endBC - startBC});
261 vtxROF.setFlag(o2::itsmft::ROFRecord::VtxUPCMode);
262 } else { // in all cases except if as standard mode vertex was found, the ROF was processed with UPC settings
263 vtxROF.setFlag(o2::itsmft::ROFRecord::VtxStdMode);
264 }
265 } else {
266 vtxROF.setFlag(o2::itsmft::ROFRecord::VtxUPCMode);
267 }
268 } else {
269 vtxROF.setFlag(o2::itsmft::ROFRecord::VtxStdMode);
270 }
271 }
272 }
273
274 if (mRunVertexer && hasClusters) {
275 LOGP(info, " + Vertex seeding total elapsed time: {} ms for {} vertices found", vertexerElapsedTime, mTimeFrame->getPrimaryVerticesNum());
276 }
277
278 if (mOverrideBeamEstimation) {
279 LOG(info) << fmt::format(" + Beam position set to: {}, {} from meanvertex object", mTimeFrame->getBeamX(), mTimeFrame->getBeamY());
280 } else {
281 LOG(info) << fmt::format(" + Beam position computed for the TF: {}, {}", mTimeFrame->getBeamX(), mTimeFrame->getBeamY());
282 }
283
284 if (hasClusters) {
285 mTimeFrame->setMultiplicityCutMask(processMultiplictyMask);
286 mTimeFrame->setUPCCutMask(processUPCMask);
287 if (mMode == o2::its::TrackingMode::Async && o2::its::TrackerParamConfig::Instance().fataliseUponFailure) {
288 trackerElapsedTime = mTracker->clustersToTracks(logger, fatalLogger);
289 } else {
290 trackerElapsedTime = mTracker->clustersToTracks(logger, errorLogger);
291 }
292 LOGP(info, " + Tracking total elapse time: {} ms for {} tracks found", trackerElapsedTime, mTimeFrame->getNumberOfTracks());
293 }
294 if constexpr (constants::DoTimeBenchmarks) {
295 const auto& trackConf = o2::its::TrackerParamConfig::Instance();
296 const auto& vertConf = o2::its::VertexerParamConfig::Instance();
297 logger(std::format("=== TimeSlice {} processing completed in: {:.2f} ms using {}/{} thread(s) ===", tfInfo.timeslice, trackerElapsedTime + vertexerElapsedTime, vertConf.nThreads, trackConf.nThreads));
298 }
299
300 size_t totTracks{mTimeFrame->getNumberOfTracks()}, totClusIDs{mTimeFrame->getNumberOfUsedClusters()};
301 if (totTracks) {
302 allTracks.reserve(totTracks);
303 allClusIdx.reserve(totClusIDs);
304
306 LOG(warning) << fmt::format(" + The processed timeframe had {} clusters with wild z coordinates, check the dictionaries", mTimeFrame->hasBogusClusters());
307 }
308 }
309
310 auto& tracks = mTimeFrame->getTracks();
311 allTrackLabels.reserve(mTimeFrame->getTracksLabel().size()); // should be 0 if not MC
312 std::copy(mTimeFrame->getTracksLabel().begin(), mTimeFrame->getTracksLabel().end(), std::back_inserter(allTrackLabels));
313 // create the track to clock ROF association here
314 // the clock ROF is just the fastest ROF
315 // the number of ROFs does not necessarily reflect the actual ROFs
316 // due to possible delay of other layers, however it is guaranteed to be >=0
317 // tracks are guaranteed to be sorted here by their lower edge
318 // we pick whatever is the largest possible number of rofs since there might be tracks/vertices which are beyond
319 // the clock layer
320 int highestROF{0};
321 for (const auto& trc : tracks) {
322 highestROF = std::max(highestROF, (int)clockLayer.getROF(trc.getTimeStamp()));
323 }
324 for (const auto& vtx : vertices) {
325 highestROF = std::max(highestROF, (int)clockLayer.getROF(vtx.getTimeStamp().lower()));
326 }
327 highestROF = std::max(highestROF, (int)clockLayer.mNROFsTF);
328 allTrackROFs.resize(highestROF);
329 vertROFvec.resize(highestROF);
330 setBCData(allTrackROFs);
331 setBCData(vertROFvec);
332
333 mTimeFrame->useMultiplictyMask(); // use multiplicty selection for IR frames
334
335 std::vector<int> rofEntries(highestROF + 1, 0);
336 for (unsigned int iTrk{0}; iTrk < tracks.size(); ++iTrk) {
337 auto& trc{tracks[iTrk]};
338 trc.setFirstClusterEntry((int)allClusIdx.size()); // before adding tracks, create final cluster indices
339 int ncl = trc.getNumberOfClusters(), nclf = 0;
340 for (int ic = TrackITSExt::MaxClusters; ic--;) { // track internally keeps in->out cluster indices, but we want to store the references as out->in!!!
341 auto clid = trc.getClusterIndex(ic);
342 if (clid >= 0) {
343 trc.setClusterSize(ic, mTimeFrame->getClusterSize((mDoStaggering) ? ic : 0, clid));
344 // with the per-layer clusters input the index is local to the layer, hence the layer must be
345 // encoded into the stored reference; with the monolithic input the composed ID is just the index
346 allClusIdx.push_back(o2::itsmft::composeClusID((mDoStaggering) ? ic : 0, clid));
347 nclf++;
348 }
349 }
350 assert(ncl == nclf);
351 allTracks.emplace_back(trc);
352 auto rof = clockLayer.getROF(trc.getTimeStamp());
353 ++rofEntries[rof];
354 }
355 std::exclusive_scan(rofEntries.begin(), rofEntries.end(), rofEntries.begin(), 0);
356 for (size_t iROF{0}; iROF < allTrackROFs.size(); ++iROF) {
357 allTrackROFs[iROF].setFirstEntry(rofEntries[iROF]);
358 allTrackROFs[iROF].setNEntries(rofEntries[iROF + 1] - rofEntries[iROF]);
359 allTrackROFs[iROF].setFlags(vertROFvec[iROF].getFlags());
360 if (mTimeFrame->getROFMaskView().isROFEnabled(clockLayerId, (int)iROF)) {
361 auto& irFrame = irFrames.emplace_back(allTrackROFs[iROF].getBCData(), allTrackROFs[iROF].getBCData() + clockLayer.mROFLength - 1);
362 irFrame.info = allTrackROFs[iROF].getNEntries();
363 }
364 }
365 // same thing for vertices rofs
366 std::fill(rofEntries.begin(), rofEntries.end(), 0);
367 for (const auto& vtx : vertices) {
368 auto rof = clockLayer.getROF(vtx.getTimeStamp().lower());
369 ++rofEntries[rof];
370 }
371 std::exclusive_scan(rofEntries.begin(), rofEntries.end(), rofEntries.begin(), 0);
372 for (size_t iROF{0}; iROF < vertROFvec.size(); ++iROF) {
373 vertROFvec[iROF].setFirstEntry(rofEntries[iROF]);
374 vertROFvec[iROF].setNEntries(rofEntries[iROF + 1] - rofEntries[iROF]);
375 }
376
377 LOGP(info, "ITSTracker pushed {} tracks in {} rofs and {} vertices {}", allTracks.size(), allTrackROFs.size(), vertices.size(), ((mDoStaggering) ? "in staggered-readout mode" : ""));
378 if (mIsMC) {
379 LOGP(info, "ITSTracker pushed {} track labels", allTrackLabels.size());
380 LOGP(info, "ITSTracker pushed {} vertex labels", allVerticesLabels.size());
381 LOGP(info, "ITSTracker pushed {} vertex purities", allVerticesPurities.size());
382 }
383 mTimeFrame->wipe();
384}
385
387{
389 static bool initOnceDone = false;
390 if (mOverrideBeamEstimation) {
392 }
393 if (!initOnceDone) { // this params need to be queried only once
394 initOnceDone = true;
397 if (pc.inputs().getPos("itsTGeo") >= 0) {
398 pc.inputs().get<o2::its::GeometryTGeo*>("itsTGeo");
399 }
401 geom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::T2GRot, o2::math_utils::TransformType::T2G));
402 initialise();
403
404 if (pc.services().get<const o2::framework::DeviceSpec>().inputTimesliceId == 0) { // print settings only for the 1st pipeling
405 // print all used settings
406 if (o2::its::FastMultEstConfig::Instance().isRequested()) {
408 }
409 const auto& vtxParams = mVertexer->getParameters();
410 if (!vtxParams.empty()) {
412 }
413 const auto& trParams = mTracker->getParameters();
414 if (!trParams.empty()) {
416 }
417 // quick summary
418 for (size_t it = 0; it < vtxParams.size(); it++) {
419 const auto& par = vtxParams[it];
420 LOGP(info, "vtxIter#{} : {}", it, par.asString());
421 }
422 for (size_t it = 0; it < trParams.size(); it++) {
423 const auto& par = trParams[it];
424 LOGP(info, "recoIter#{} : {}", it, par.asString());
425 }
426 }
427
428 // prepare rof lookup table(s)
430 const int nOrbitsPerTF = o2::base::GRPGeomHelper::getNHBFPerTF();
433 const auto& trackParams = mTracker->getParameters();
434 for (int iLayer = 0; iLayer < NLayers; ++iLayer) {
435 const unsigned int nROFsPerOrbit = o2::constants::lhc::LHCMaxBunches / par.getROFLengthInBC(iLayer);
436 const LayerTiming timing{
437 .mNROFsTF = (nROFsPerOrbit * nOrbitsPerTF),
438 .mROFLength = (uint32_t)par.getROFLengthInBC(iLayer),
439 .mROFDelay = (uint32_t)par.getROFDelayInBC(iLayer),
440 .mROFBias = (uint32_t)par.getROFBiasInBC(iLayer),
441 .mROFAddTimeErr = (trackParams.empty() ? o2::its::TrackerParamConfig::Instance().addTimeError[iLayer] : trackParams[0].AddTimeError[iLayer])};
442 rofTable.defineLayer(iLayer, timing);
443 vtxTable.defineLayer(iLayer, timing);
444 }
445 rofTable.init();
447 vtxTable.init();
449 }
450}
451
453{
455 return;
456 }
457 if (matcher == ConcreteDataMatcher("ITS", "CLUSDICT", 0)) {
458 LOG(info) << "cluster dictionary updated";
460 return;
461 }
462 // Note: strictly speaking, for Configurable params we don't need finaliseCCDB check, the singletons are updated at the CCDB fetcher level
463 if (matcher == ConcreteDataMatcher("ITS", "ALPIDEPARAM", 0)) {
464 LOG(info) << "Alpide param updated";
466 par.printKeyValues();
467 return;
468 }
469 if (matcher == ConcreteDataMatcher("GLO", "MEANVERTEX", 0)) {
470 LOGP(info, "Mean vertex acquired");
472 return;
473 }
474 if (matcher == ConcreteDataMatcher("ITS", "GEOMTGEO", 0)) {
475 LOG(info) << "ITS GeometryTGeo loaded from ccdb";
477 return;
478 }
479}
480
482{
483 mVertexer->printSummary();
484 mTracker->printSummary();
486}
487
489 TrackerTraitsN* trackerTraits,
490 TimeFrameN* frame)
491{
492 mVertexer = std::make_unique<VertexerN>(vertexerTraits);
493 mTracker = std::make_unique<TrackerN>(trackerTraits);
494 mTimeFrame = frame;
495 mVertexer->adoptTimeFrame(*mTimeFrame);
496 mTracker->adoptTimeFrame(*mTimeFrame);
497
498 // set common memory resource
499 if (!mMemoryPool) {
500 mMemoryPool = std::make_shared<BoundedMemoryResource>();
501 }
502 vertexerTraits->setMemoryPool(mMemoryPool);
503 trackerTraits->setMemoryPool(mMemoryPool);
504 mTimeFrame->setMemoryPool(mMemoryPool);
505 mTracker->setMemoryPool(mMemoryPool);
506 mVertexer->setMemoryPool(mMemoryPool);
507}
508
510{
511 pc.inputs().get<o2::itsmft::TopologyDictionary*>("itscldict"); // just to trigger the finaliseCCDB
512}
513
514void ITSTrackingInterface::loadROF(gsl::span<const itsmft::ROFRecord>& trackROFspan,
515 gsl::span<const itsmft::CompClusterExt> clusters,
516 gsl::span<const unsigned char>::iterator& pattIt,
517 int layer,
519{
520 mTimeFrame->loadROFrameData(trackROFspan, clusters, pattIt, mDict, layer, mcLabels);
521}
Composition/decomposition of the ITS/MFT cluster IDs referring to per-layer cluster arrays.
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.
char error[CURL_ERROR_SIZE]
Class to delimit start and end IR of certain time period.
Definition of the GeometryTGeo class.
Definition of the ITSMFT ROFrame (trigger) record.
std::vector< o2::MCCompLabel > labels
std::vector< o2::its::TrackITS > tracks
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:180
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:207
void setMemoryPool(std::shared_ptr< BoundedMemoryResource > pool) noexcept
void setMemoryPool(std::shared_ptr< BoundedMemoryResource > pool)
std::string asString() const
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
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
o2::track::TrackParametrization< float > par
constexpr int composeClusID(int lr, int idx)
Definition ClusterID.h:37
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:75
size_t getNumberOfUsedClusters() const
Definition TimeFrame.h:631
void initDefaultTrackingTopology(const TrackingParameters &trkParam, const int maxLayers=NLayers)
void useMultiplictyMask() noexcept
Definition TimeFrame.h:170
void setMemoryPool(std::shared_ptr< BoundedMemoryResource > pool)
memory management
size_t getNumberOfTracks() const
Definition TimeFrame.h:625
void initVertexingTopology(const TrackingParameters &trkParam)
CapacityEstimator & getCapacityEstimator() noexcept
Definition TimeFrame.h:246
int getClusterSize(int layer, int clusterId) const
Definition TimeFrame.h:193
float getBeamY() const
Definition TimeFrame.h:119
const auto & getROFMaskView() const
Definition TimeFrame.h:187
int hasBogusClusters() const
Definition TimeFrame.h:268
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:71
void initTrackerTopologies(gsl::span< const TrackingParameters > trkParams, const int maxLayers=NLayers)
void setUPCCutMask(ROFMaskTableN cutMask)
Definition TimeFrame.h:175
float getBeamX() const
Definition TimeFrame.h:118
void setROFVertexLookupTable(ROFVertexLookupTableN table)
Definition TimeFrame.h:159
auto getPrimaryVerticesNum()
Definition TimeFrame.h:88
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:112
auto & getTracksLabel()
Definition TimeFrame.h:222
auto & getPrimaryVertices()
Definition TimeFrame.h:87
const auto & getROFOverlapTableView() const
Definition TimeFrame.h:149
ROFOverlapTable< NLayers > ROFOverlapTableN
Definition TimeFrame.h:74
auto & getPrimaryVerticesLabels()
Definition TimeFrame.h:90
void setIsStaggered(bool b) noexcept
staggering
Definition TimeFrame.h:244
void setROFOverlapTable(ROFOverlapTableN table)
Definition TimeFrame.h:152
void setMultiplicityCutMask(ROFMaskTableN cutMask)
Definition TimeFrame.h:165
const auto & getROFOverlapTable() const
Definition TimeFrame.h:148
o2::InteractionRecord ir
Definition PhysTrigger.h:24
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
o2::InteractionRecord ir(0, 0)
std::vector< Cluster > clusters