Project
Loading...
Searching...
No Matches
TimeFrame.h
Go to the documentation of this file.
1// Copyright 2019-2020 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.
12
13#ifndef TRACKINGITSU_INCLUDE_TIMEFRAME_H_
14#define TRACKINGITSU_INCLUDE_TIMEFRAME_H_
15
16#include <array>
17#include <vector>
18#include <utility>
19#include <algorithm>
20#include <numeric>
21#include <gsl/gsl>
22
25
26#include "ITStracking/Cell.h"
27#include "ITStracking/Cluster.h"
38
40
41namespace o2
42{
43namespace gpu
44{
45class GPUChainITS;
46}
47
48namespace itsmft
49{
50class Cluster;
51class CompClusterExt;
52class TopologyDictionary;
53class ROFRecord;
54} // namespace itsmft
55
56namespace its
57{
58namespace gpu
59{
60template <int>
61class TimeFrameGPU;
62}
63
64template <int NLayers>
65struct TimeFrame {
72 friend class gpu::TimeFrameGPU<NLayers>;
73
74 TimeFrame() = default;
75 virtual ~TimeFrame() = default;
76
77 const Vertex& getPrimaryVertex(const int ivtx) const { return mPrimaryVertices[ivtx]; }
79 auto getPrimaryVerticesNum() { return mPrimaryVertices.size(); };
80 const auto& getPrimaryVertices() const { return mPrimaryVertices; };
82 gsl::span<const Vertex> getPrimaryVertices(int layer, int rofId) const;
83 void addPrimaryVertex(const Vertex& vertex);
85
86 // read-in data
87 void loadROFrameData(gsl::span<const o2::itsmft::ROFRecord> rofs,
88 gsl::span<const itsmft::CompClusterExt> clusters,
89 gsl::span<const unsigned char>::iterator& pattIt,
91 int layer,
92 const dataformats::MCTruthContainer<MCCompLabel>* mcLabels = nullptr);
93 void resetROFrameData(int iLayer);
94 void prepareROFrameData(gsl::span<const itsmft::CompClusterExt> clusters, int layer);
95
96 int getTotalClusters() const;
97 bool empty() const { return getTotalClusters() == 0; }
98 int getSortedIndex(int rofId, int layer, int idx) const { return mROFramesClusters[layer][rofId] + idx; }
99 int getSortedStartIndex(const int rofId, const int layer) const { return mROFramesClusters[layer][rofId]; }
100 int getNrof(int layer) const { return mROFramesClusters[layer].size() - 1; }
101
102 void resetBeamXY(const float x, const float y, const float w = 0);
103 void setBeamPosition(const float x, const float y, const float s2, const float base = 50.f, const float systematic = 0.f)
104 {
106 resetBeamXY(x, y, s2 / o2::gpu::CAMath::Sqrt((base * base) + systematic));
107 }
108
109 float getBeamX() const { return mBeamPos[0]; }
110 float getBeamY() const { return mBeamPos[1]; }
111 std::array<float, 2>& getBeamXY() { return mBeamPos; }
112
113 auto& getMinRs() { return mMinR; }
114 auto& getMaxRs() { return mMaxR; }
115 float getMinR(int layer) const { return mMinR[layer]; }
116 float getMaxR(int layer) const { return mMaxR[layer]; }
117 float getLinkPhiCut(int linkId) const { return mLinkPhiCuts[linkId]; }
118 float getLinkMSAngle(int linkId) const { return mLinkMSAngles[linkId]; }
119 auto& getLinkPhiCuts() { return mLinkPhiCuts; }
120 auto& getLinkMSAngles() { return mLinkMSAngles; }
123
124 gsl::span<Cluster> getClustersOnLayer(int rofId, int layerId);
125 gsl::span<const Cluster> getClustersOnLayer(int rofId, int layerId) const;
126 gsl::span<const Cluster> getClustersPerROFrange(int rofMin, int range, int layerId) const;
127 gsl::span<const Cluster> getUnsortedClustersOnLayer(int rofId, int layerId) const;
128 gsl::span<uint8_t> getUsedClustersROF(int rofId, int layerId);
129 gsl::span<const uint8_t> getUsedClustersROF(int rofId, int layerId) const;
130 gsl::span<const int> getROFramesClustersPerROFrange(int rofMin, int range, int layerId) const;
131 gsl::span<const int> getROFrameClusters(int layerId) const;
132 gsl::span<const int> getNClustersROFrange(int rofMin, int range, int layerId) const;
133 gsl::span<int> getIndexTable(int rofId, int layerId);
134 const auto& getTrackingFrameInfoOnLayer(int layerId) const { return mTrackingFrameInfo[layerId]; }
135
136 // navigation tables
137 const auto& getIndexTableUtils() const { return mIndexTableUtils; }
138 const auto& getROFOverlapTable() const { return mROFOverlapTable; }
139 const auto& getROFOverlapTableView() const { return mROFOverlapTableView; }
140 const auto& getTrackerTopologies() const { return mTrackerTopologies; }
141 const auto& getTrackingTopologyView() const { return mTrackingTopologyView; }
143 {
144 mROFOverlapTable = std::move(table);
146 }
147 const auto& getROFVertexLookupTable() const { return mROFVertexLookupTable; }
156 {
157 mMultiplicityCutMask = std::move(cutMask);
158 mROFMaskView = mROFMask->getView();
159 }
160 void useMultiplictyMask() noexcept
161 {
163 mROFMaskView = mROFMask->getView();
164 }
165 void setUPCCutMask(ROFMaskTableN cutMask) { mUPCCutMask = std::move(cutMask); }
166 void useUPCMask() noexcept
167 {
169 mROFMaskView = mROFMask->getView();
170 }
171 const auto& getROFMaskView() const { return mROFMaskView; }
172
173 const TrackingFrameInfo& getClusterTrackingFrameInfo(int layerId, const Cluster& cl) const;
174 gsl::span<const MCCompLabel> getClusterLabels(int layerId, const Cluster& cl) const { return getClusterLabels(layerId, cl.clusterId); }
175 gsl::span<const MCCompLabel> getClusterLabels(int layerId, const int clId) const { return mClusterLabels[((mIsStaggered) ? layerId : 0)]->getLabels(mClusterExternalIndices[layerId][clId]); }
176 int getClusterExternalIndex(int layerId, const int clId) const { return mClusterExternalIndices[layerId][clId]; }
177 int getClusterSize(int layer, int clusterId) const { return mClusterSize[layer][clusterId]; }
179
181 auto& getCellsLabel(int layer) { return mCellLabels[layer]; }
182
183 bool hasMCinformation() const { return mClusterLabels[0] != nullptr; }
184 void initVertexingTopology(const TrackingParameters& trkParam);
185 void initDefaultTrackingTopology(const TrackingParameters& trkParam, const int maxLayers = NLayers);
186 void initTrackerTopologies(gsl::span<const TrackingParameters> trkParams, const int maxLayers = NLayers);
187 void initialise(const TrackingParameters& trkParam, const int maxLayers = NLayers, const int iteration = constants::UnusedIndex);
188
189 bool isClusterUsed(int layer, int clusterId) const { return mUsedClusters[layer][clusterId]; }
190 void markUsedCluster(int layer, int clusterId) { mUsedClusters[layer][clusterId] = true; }
191 gsl::span<unsigned char> getUsedClusters(const int layer);
192
193 auto& getTracklets() { return mTracklets; }
195
196 auto& getClusters() { return mClusters; }
198 int getClusterROF(int iLayer, int iCluster);
199 auto& getCells() { return mCells; }
200
205 auto& getTracks() { return mTracks; }
206 auto& getTracksLabel() { return mTracksLabel; }
207 auto& getLinesLabel(const int rofId) { return mLinesLabels[rofId]; }
208
209 size_t getNumberOfClusters() const;
210 virtual size_t getNumberOfCells() const;
211 virtual size_t getNumberOfTracklets() const;
212 virtual size_t getNumberOfNeighbours() const;
213 size_t getNumberOfTracks() const;
216 void addTrackExtensionCounters(size_t nTracks, size_t nClusters);
217 size_t getNExtendedTracks() const { return mNExtendedTracks; }
218 size_t getNExtendedClusters() const { return mNExtendedClusters; }
219
221 void setMemoryPool(std::shared_ptr<BoundedMemoryResource> pool);
222 auto& getMemoryPool() const noexcept { return mMemoryPool; }
223 bool checkMemory(unsigned long max) { return getArtefactsMemory() < max; }
224 unsigned long getArtefactsMemory() const;
225 void printArtefactsMemory() const;
226
228 void setIsStaggered(bool b) noexcept { mIsStaggered = b; }
229
230 // Vertexer
233 int& getNTrackletsROF(int rofId, int combId) { return mNTrackletsPerROF[combId][rofId]; }
234 auto& getLines(int rofId) { return mLines[rofId]; }
235 int getNLinesTotal() const noexcept { return mTotalLines; }
236 void setNLinesTotal(uint32_t a) noexcept { mTotalLines = a; }
237 auto& getTrackletClusters(int rofId) { return mTrackletClusters[rofId]; }
238 gsl::span<const Tracklet> getFoundTracklets(int rofId, int combId) const;
239 gsl::span<Tracklet> getFoundTracklets(int rofId, int combId);
240 gsl::span<const MCCompLabel> getLabelsFoundTracklets(int rofId, int combId) const;
241 gsl::span<int> getNTrackletsCluster(int rofId, int combId);
242 gsl::span<int> getExclusiveNTrackletsCluster(int rofId, int combId);
243 uint32_t getTotalTrackletsTF(const int iLayer) { return mTotalTracklets[iLayer]; }
244 int getTotalClustersPerROFrange(int rofMin, int range, int layerId) const;
245 // \Vertexer
246
247 int hasBogusClusters() const { return std::accumulate(mBogusClusters.begin(), mBogusClusters.end(), 0); }
248
249 void setBz(float bz) { mBz = bz; }
250 float getBz() const { return mBz; }
251
254 std::shared_ptr<BoundedMemoryResource> mExtMemoryPool; // host memory pool managed by the framework
257 bool hasFrameworkAllocator() const noexcept { return mExternalAllocator != nullptr; }
258 std::pmr::memory_resource* getMaybeFrameworkHostResource(bool forceHost = false) { return (hasFrameworkAllocator() && !forceHost) ? mExtMemoryPool.get() : mMemoryPool.get(); }
259
260 // Propagator
262 virtual void setDevicePropagator(const o2::base::PropagatorImpl<float>* /*unused*/) {};
263
264 template <typename... T>
265 void addClusterToLayer(int layer, T&&... args);
266 template <typename... T>
267 void addTrackingFrameInfoToLayer(int layer, T&&... args);
268 void addClusterExternalIndexToLayer(int layer, const int idx) { mClusterExternalIndices[layer].push_back(idx); }
269
270 std::array<bounded_vector<Cluster>, NLayers> mClusters;
271 std::array<bounded_vector<TrackingFrameInfo>, NLayers> mTrackingFrameInfo;
272 std::array<bounded_vector<int>, NLayers> mClusterExternalIndices;
273 std::array<bounded_vector<int>, NLayers> mROFramesClusters;
274 std::array<const dataformats::MCTruthContainer<MCCompLabel>*, NLayers> mClusterLabels{nullptr};
275 std::array<bounded_vector<int>, 2> mNTrackletsPerCluster;
276 std::array<bounded_vector<int>, 2> mNTrackletsPerClusterSum;
277 std::array<bounded_vector<int>, NLayers> mNClustersPerROF;
278 std::array<bounded_vector<int>, NLayers> mIndexTables;
279 std::vector<bounded_vector<int>> mTrackletsLookupTable;
280 std::array<bounded_vector<uint8_t>, NLayers> mUsedClusters;
281
282 std::array<bounded_vector<Cluster>, NLayers> mUnsortedClusters;
283 std::vector<bounded_vector<Tracklet>> mTracklets;
284 std::vector<bounded_vector<CellSeed>> mCells;
289 std::vector<bounded_vector<int>> mCellsNeighbours;
290 std::vector<bounded_vector<int>> mCellsNeighboursTopology;
291 std::vector<bounded_vector<int>> mCellsLookupTable;
292
293 const o2::base::PropagatorImpl<float>* mPropagatorDevice = nullptr; // Needed only for GPU
294
295 virtual void wipe();
296
297 // interface
298 virtual bool isGPU() const noexcept { return false; }
299 virtual const char* getName() const noexcept { return "CPU"; }
300
301 protected:
302 void prepareClusters(const TrackingParameters& trkParam, const int maxLayers = NLayers);
303 float mBz = 5.;
304 unsigned int mNTotalLowPtVertices = 0;
306 std::array<float, 2> mBeamPos = {0.f, 0.f};
308 std::array<float, NLayers> mMinR;
309 std::array<float, NLayers> mMaxR;
313 std::array<bounded_vector<uint8_t>, NLayers> mClusterSize;
314
316 std::vector<bounded_vector<MCCompLabel>> mTrackletLabels;
317 std::vector<bounded_vector<MCCompLabel>> mCellLabels;
318 std::vector<bounded_vector<int>> mCellsNeighboursLUT;
320
321 // Vertexer
324 std::vector<bounded_vector<int>> mNTrackletsPerROF;
325 std::vector<bounded_vector<Line>> mLines;
326 std::vector<bounded_vector<ClusterLines>> mTrackletClusters;
327 std::array<bounded_vector<int>, 2> mTrackletsIndexROF;
328 std::vector<bounded_vector<MCCompLabel>> mLinesLabels;
329 std::array<uint32_t, 2> mTotalTracklets = {0, 0};
330 uint32_t mTotalLines = 0;
331 // \Vertexer
332
333 // lookup tables
336 ROFOverlapTableN::View mROFOverlapTableView;
339 std::vector<TrackingTopologyN> mTrackerTopologies;
340 typename TrackingTopologyN::View mTrackingTopologyView;
342 ROFVertexLookupTableN::View mROFVertexLookupTableView;
346 ROFMaskTableN::View mROFMaskView;
347
348 bool mIsStaggered{false};
349
350 std::shared_ptr<BoundedMemoryResource> mMemoryPool;
351};
352
353template <int NLayers>
354gsl::span<const Vertex> TimeFrame<NLayers>::getPrimaryVertices(int layer, int rofId) const
355{
356 if (rofId < 0 || rofId >= getNrof(layer)) {
357 return {};
358 }
359 const auto& entry = mROFVertexLookupTableView.getVertices(layer, rofId);
360 return {&mPrimaryVertices[entry.getFirstEntry()], static_cast<gsl::span<const Vertex>::size_type>(entry.getEntries())};
361}
362
363template <int NLayers>
364inline void TimeFrame<NLayers>::resetBeamXY(const float x, const float y, const float w)
365{
366 mBeamPos[0] = x;
367 mBeamPos[1] = y;
368 mBeamPosWeight = w;
369}
370
371template <int NLayers>
372inline gsl::span<const int> TimeFrame<NLayers>::getROFrameClusters(int layerId) const
373{
374 return {&mROFramesClusters[layerId][0], static_cast<gsl::span<const int>::size_type>(mROFramesClusters[layerId].size())};
375}
376
377template <int NLayers>
378inline gsl::span<Cluster> TimeFrame<NLayers>::getClustersOnLayer(int rofId, int layerId)
379{
380 if (rofId < 0 || rofId >= getNrof(layerId)) {
381 return {};
382 }
383 int startIdx{mROFramesClusters[layerId][rofId]};
384 return {&mClusters[layerId][startIdx], static_cast<gsl::span<Cluster>::size_type>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
385}
386
387template <int NLayers>
388inline gsl::span<const Cluster> TimeFrame<NLayers>::getClustersOnLayer(int rofId, int layerId) const
389{
390 if (rofId < 0 || rofId >= getNrof(layerId)) {
391 return {};
392 }
393 int startIdx{mROFramesClusters[layerId][rofId]};
394 return {&mClusters[layerId][startIdx], static_cast<gsl::span<const Cluster>::size_type>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
395}
396
397template <int NLayers>
398inline gsl::span<uint8_t> TimeFrame<NLayers>::getUsedClustersROF(int rofId, int layerId)
399{
400 if (rofId < 0 || rofId >= getNrof(layerId)) {
401 return {};
402 }
403 int startIdx{mROFramesClusters[layerId][rofId]};
404 return {&mUsedClusters[layerId][startIdx], static_cast<gsl::span<uint8_t>::size_type>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
405}
406
407template <int NLayers>
408inline gsl::span<const uint8_t> TimeFrame<NLayers>::getUsedClustersROF(int rofId, int layerId) const
409{
410 if (rofId < 0 || rofId >= getNrof(layerId)) {
411 return {};
412 }
413 int startIdx{mROFramesClusters[layerId][rofId]};
414 return {&mUsedClusters[layerId][startIdx], static_cast<gsl::span<const uint8_t>::size_type>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
415}
416
417template <int NLayers>
418inline gsl::span<const Cluster> TimeFrame<NLayers>::getClustersPerROFrange(int rofMin, int range, int layerId) const
419{
420 if (rofMin < 0 || rofMin >= getNrof(layerId)) {
421 return {};
422 }
423 int startIdx{mROFramesClusters[layerId][rofMin]}; // First cluster of rofMin
424 int endIdx{mROFramesClusters[layerId][o2::gpu::CAMath::Min(rofMin + range, getNrof(layerId))]};
425 return {&mClusters[layerId][startIdx], static_cast<gsl::span<Cluster>::size_type>(endIdx - startIdx)};
426}
427
428template <int NLayers>
429inline gsl::span<const int> TimeFrame<NLayers>::getROFramesClustersPerROFrange(int rofMin, int range, int layerId) const
430{
431 int chkdRange{o2::gpu::CAMath::Min(range, getNrof(layerId) - rofMin)};
432 return {&mROFramesClusters[layerId][rofMin], static_cast<gsl::span<int>::size_type>(chkdRange)};
433}
434
435template <int NLayers>
436inline gsl::span<const int> TimeFrame<NLayers>::getNClustersROFrange(int rofMin, int range, int layerId) const
437{
438 int chkdRange{o2::gpu::CAMath::Min(range, getNrof(layerId) - rofMin)};
439 return {&mNClustersPerROF[layerId][rofMin], static_cast<gsl::span<int>::size_type>(chkdRange)};
440}
441
442template <int NLayers>
443inline int TimeFrame<NLayers>::getTotalClustersPerROFrange(int rofMin, int range, int layerId) const
444{
445 int startIdx{rofMin}; // First cluster of rofMin
446 int endIdx{o2::gpu::CAMath::Min(rofMin + range, getNrof(layerId))};
447 return mROFramesClusters[layerId][endIdx] - mROFramesClusters[layerId][startIdx];
448}
449
450template <int NLayers>
451inline int TimeFrame<NLayers>::getClusterROF(int iLayer, int iCluster)
452{
453 return std::lower_bound(mROFramesClusters[iLayer].begin(), mROFramesClusters[iLayer].end(), iCluster + 1) - mROFramesClusters[iLayer].begin() - 1;
454}
455
456template <int NLayers>
457inline gsl::span<const Cluster> TimeFrame<NLayers>::getUnsortedClustersOnLayer(int rofId, int layerId) const
458{
459 if (rofId < 0 || rofId >= getNrof(layerId)) {
460 return {};
461 }
462 int startIdx{mROFramesClusters[layerId][rofId]};
463 return {&mUnsortedClusters[layerId][startIdx], static_cast<gsl::span<Cluster>::size_type>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
464}
465
466template <int NLayers>
467inline gsl::span<int> TimeFrame<NLayers>::getIndexTable(int rofId, int layer)
468{
469 if (rofId < 0 || rofId >= getNrof(layer)) {
470 return {};
471 }
472 const int tableSize = mIndexTableUtils.getNphiBins() * mIndexTableUtils.getNzBins() + 1;
473 return {&mIndexTables[layer][rofId * tableSize], static_cast<gsl::span<int>::size_type>(tableSize)};
474}
475
476template <int NLayers>
477template <typename... T>
479{
480 mUnsortedClusters[layer].emplace_back(std::forward<T>(values)...);
481}
482
483template <int NLayers>
484template <typename... T>
486{
487 mTrackingFrameInfo[layer].emplace_back(std::forward<T>(values)...);
488}
489
490template <int NLayers>
491inline gsl::span<uint8_t> TimeFrame<NLayers>::getUsedClusters(const int layer)
492{
493 return {&mUsedClusters[layer][0], static_cast<gsl::span<uint8_t>::size_type>(mUsedClusters[layer].size())};
494}
495
496template <int NLayers>
497inline gsl::span<int> TimeFrame<NLayers>::getNTrackletsCluster(int rofId, int combId)
498{
499 if (rofId < 0 || rofId >= getNrof(1)) {
500 return {};
501 }
502 auto startIdx{mROFramesClusters[1][rofId]};
503 return {&mNTrackletsPerCluster[combId][startIdx], static_cast<gsl::span<int>::size_type>(mROFramesClusters[1][rofId + 1] - startIdx)};
504}
505
506template <int NLayers>
507inline gsl::span<int> TimeFrame<NLayers>::getExclusiveNTrackletsCluster(int rofId, int combId)
508{
509 if (rofId < 0 || rofId >= getNrof(1)) {
510 return {};
511 }
512 auto clusStartIdx{mROFramesClusters[1][rofId]};
513
514 return {&mNTrackletsPerClusterSum[combId][clusStartIdx], static_cast<gsl::span<int>::size_type>(mROFramesClusters[1][rofId + 1] - clusStartIdx)};
515}
516
517template <int NLayers>
518inline gsl::span<Tracklet> TimeFrame<NLayers>::getFoundTracklets(int rofId, int combId)
519{
520 if (rofId < 0 || rofId >= getNrof(1) || mTracklets[combId].empty()) {
521 return {};
522 }
523 auto startIdx{mNTrackletsPerROF[combId][rofId]};
524 return {&mTracklets[combId][startIdx], static_cast<gsl::span<Tracklet>::size_type>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
525}
526
527template <int NLayers>
528inline gsl::span<const Tracklet> TimeFrame<NLayers>::getFoundTracklets(int rofId, int combId) const
529{
530 if (rofId < 0 || rofId >= getNrof(1)) {
531 return {};
532 }
533 auto startIdx{mNTrackletsPerROF[combId][rofId]};
534 return {&mTracklets[combId][startIdx], static_cast<gsl::span<Tracklet>::size_type>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
535}
536
537template <int NLayers>
538inline gsl::span<const MCCompLabel> TimeFrame<NLayers>::getLabelsFoundTracklets(int rofId, int combId) const
539{
540 if (rofId < 0 || rofId >= getNrof(1) || !hasMCinformation()) {
541 return {};
542 }
543 auto startIdx{mNTrackletsPerROF[combId][rofId]};
544 return {&mTrackletLabels[combId][startIdx], static_cast<gsl::span<Tracklet>::size_type>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
545}
546
547template <int NLayers>
549{
550 size_t totalClusters{0};
551 for (const auto& clusters : mUnsortedClusters) {
552 totalClusters += clusters.size();
553 }
554 return int(totalClusters);
555}
556
557template <int NLayers>
559{
560 size_t nClusters{0};
561 for (const auto& layer : mClusters) {
562 nClusters += layer.size();
563 }
564 return nClusters;
565}
566
567template <int NLayers>
569{
570 size_t nCells{0};
571 for (const auto& layer : mCells) {
572 nCells += layer.size();
573 }
574 return nCells;
575}
576
577template <int NLayers>
579{
580 size_t nTracklets{0};
581 for (const auto& layer : mTracklets) {
582 nTracklets += layer.size();
583 }
584 return nTracklets;
585}
586
587template <int NLayers>
589{
590 size_t neigh{0};
591 for (const auto& l : mCellsNeighbours) {
592 neigh += l.size();
593 }
594 return neigh;
595}
596
597template <int NLayers>
599{
600 return mTracks.size();
601}
602
603template <int NLayers>
605{
606 size_t nClusters = 0;
607 for (const auto& layer : mUsedClusters) {
608 nClusters += std::count(layer.begin(), layer.end(), true);
609 }
610 return nClusters;
611}
612
613template <int NLayers>
615{
616 mNExtendedTracks = 0;
617 mNExtendedClusters = 0;
618}
619
620template <int NLayers>
622{
623 mNExtendedTracks += nTracks;
624 mNExtendedClusters += nClusters;
625}
626
627} // namespace its
628} // namespace o2
629
630#endif
uint64_t vertex
Definition RawEventData.h:9
Definition of a container to keep Monte Carlo truth external to simulation objects.
Definition of the ITS track.
int nClusters
A container to hold and manage MC truth information/labels.
HMPID cluster implementation.
Definition Cluster.h:27
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint entry
Definition glcorearb.h:5735
const GLdouble * v
Definition glcorearb.h:832
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLenum GLint * range
Definition glcorearb.h:1899
GLint y
Definition glcorearb.h:270
GLenum GLsizei GLsizei GLint * values
Definition glcorearb.h:1576
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
GLubyte GLubyte GLubyte GLubyte w
Definition glcorearb.h:852
constexpr int UnusedIndex
Definition Constants.h:33
std::pmr::vector< T > bounded_vector
std::pair< o2::MCCompLabel, float > VertexLabel
Definition Vertex.h:27
const int end
const int tableSize
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
void empty(int)
size_t mNExtendedClusters
Definition TimeFrame.h:288
ROFVertexLookupTable< NLayers > ROFVertexLookupTableN
Definition TimeFrame.h:68
virtual size_t getNumberOfCells() const
Definition TimeFrame.h:568
void prepareClusters(const TrackingParameters &trkParam, const int maxLayers=NLayers)
std::vector< TrackingTopologyN > mTrackerTopologies
Definition TimeFrame.h:339
std::vector< bounded_vector< Line > > mLines
Definition TimeFrame.h:325
std::vector< bounded_vector< int > > mTrackletsLookupTable
Definition TimeFrame.h:279
bounded_vector< int > mBogusClusters
Definition TimeFrame.h:319
std::array< float, NLayers > mMaxR
Definition TimeFrame.h:309
const TrackingFrameInfo & getClusterTrackingFrameInfo(int layerId, const Cluster &cl) const
virtual void setDevicePropagator(const o2::base::PropagatorImpl< float > *)
Definition TimeFrame.h:262
const auto & getROFVertexLookupTableView() const
Definition TimeFrame.h:148
size_t getNumberOfUsedClusters() const
Definition TimeFrame.h:604
std::array< bounded_vector< int >, NLayers > mIndexTables
Definition TimeFrame.h:278
ROFMaskTableN mUPCCutMask
Definition TimeFrame.h:344
gsl::span< const Cluster > getUnsortedClustersOnLayer(int rofId, int layerId) const
Definition TimeFrame.h:457
std::array< bounded_vector< int >, 2 > mNTrackletsPerClusterSum
Definition TimeFrame.h:276
size_t getNumberOfClusters() const
Definition TimeFrame.h:558
gsl::span< const Cluster > getClustersOnLayer(int rofId, int layerId) const
Definition TimeFrame.h:388
void initDefaultTrackingTopology(const TrackingParameters &trkParam, const int maxLayers=NLayers)
auto & getPositionResolutions()
Definition TimeFrame.h:122
bounded_vector< MCCompLabel > mTracksLabel
Definition TimeFrame.h:286
void useMultiplictyMask() noexcept
Definition TimeFrame.h:160
bool checkMemory(unsigned long max)
Definition TimeFrame.h:223
ROFMaskTableN * mROFMask
Definition TimeFrame.h:345
const auto & getTrackingFrameInfoOnLayer(int layerId) const
Definition TimeFrame.h:134
std::array< uint32_t, 2 > mTotalTracklets
Definition TimeFrame.h:329
void setMemoryPool(std::shared_ptr< BoundedMemoryResource > pool)
memory management
size_t getNumberOfTracks() const
Definition TimeFrame.h:598
void resetBeamXY(const float x, const float y, const float w=0)
Definition TimeFrame.h:364
void computeTracletsPerClusterScans()
auto & getTrackletsLabel(int layer)
Definition TimeFrame.h:180
uint32_t mTotalLines
Definition TimeFrame.h:330
ROFOverlapTableN mROFOverlapTable
Definition TimeFrame.h:335
std::shared_ptr< BoundedMemoryResource > mExtMemoryPool
Definition TimeFrame.h:254
bounded_vector< TrackITSExt > mTracks
Definition TimeFrame.h:285
auto getFrameworkAllocator()
Definition TimeFrame.h:255
virtual size_t getNumberOfNeighbours() const
Definition TimeFrame.h:588
ROFVertexLookupTableN::View mROFVertexLookupTableView
Definition TimeFrame.h:342
gsl::span< Tracklet > getFoundTracklets(int rofId, int combId)
Definition TimeFrame.h:518
void initVertexingTopology(const TrackingParameters &trkParam)
gsl::span< uint8_t > getUsedClustersROF(int rofId, int layerId)
Definition TimeFrame.h:398
std::array< const dataformats::MCTruthContainer< MCCompLabel > *, NLayers > mClusterLabels
Definition TimeFrame.h:274
std::vector< bounded_vector< CellSeed > > mCells
Definition TimeFrame.h:284
gsl::span< const MCCompLabel > getLabelsFoundTracklets(int rofId, int combId) const
Definition TimeFrame.h:538
void printArtefactsMemory() const
bool empty() const
Definition TimeFrame.h:97
void useUPCMask() noexcept
Definition TimeFrame.h:166
float getBz() const
Definition TimeFrame.h:250
ROFOverlapTableN::View mROFOverlapTableView
Definition TimeFrame.h:336
gsl::span< const Tracklet > getFoundTracklets(int rofId, int combId) const
Definition TimeFrame.h:528
const Vertex & getPrimaryVertex(const int ivtx) const
Definition TimeFrame.h:77
virtual const char * getName() const noexcept
Definition TimeFrame.h:299
const o2::base::PropagatorImpl< float > * getDevicePropagator() const
Definition TimeFrame.h:261
gsl::span< const Cluster > getClustersPerROFrange(int rofMin, int range, int layerId) const
Definition TimeFrame.h:418
int getClusterSize(int layer, int clusterId) const
Definition TimeFrame.h:177
void updateROFVertexLookupTable()
Definition TimeFrame.h:154
float getBeamY() const
Definition TimeFrame.h:110
size_t mNExtendedTracks
Definition TimeFrame.h:287
void setFrameworkAllocator(ExternalAllocator *ext)
auto & getCellsNeighboursTopology()
Definition TimeFrame.h:203
void setClusterSize(int layer, bounded_vector< uint8_t > &v)
Definition TimeFrame.h:178
void initialise(const TrackingParameters &trkParam, const int maxLayers=NLayers, const int iteration=constants::UnusedIndex)
const auto & getIndexTableUtils() const
Definition TimeFrame.h:137
void addPrimaryVertexLabel(const VertexLabel &label)
Definition TimeFrame.h:84
bool hasFrameworkAllocator() const noexcept
Definition TimeFrame.h:257
size_t getNExtendedClusters() const
Definition TimeFrame.h:218
gsl::span< const int > getNClustersROFrange(int rofMin, int range, int layerId) const
Definition TimeFrame.h:436
int getSortedStartIndex(const int rofId, const int layer) const
Definition TimeFrame.h:99
auto & getUnsortedClusters()
Definition TimeFrame.h:197
const auto & getROFMaskView() const
Definition TimeFrame.h:171
auto & getLinkMSAngles()
Definition TimeFrame.h:120
void prepareROFrameData(gsl::span< const itsmft::CompClusterExt > clusters, int layer)
gsl::span< unsigned char > getUsedClusters(const int layer)
Definition TimeFrame.h:491
TrackingTopologyN mDefaultTrackingTopology
Definition TimeFrame.h:338
auto & getLines(int rofId)
Definition TimeFrame.h:234
void addClusterExternalIndexToLayer(int layer, const int idx)
Definition TimeFrame.h:268
virtual bool isGPU() const noexcept
Definition TimeFrame.h:298
const auto & getPrimaryVertices() const
Definition TimeFrame.h:80
void markUsedCluster(int layer, int clusterId)
Definition TimeFrame.h:190
gsl::span< int > getIndexTable(int rofId, int layerId)
Definition TimeFrame.h:467
void computeTrackletsPerROFScans()
const o2::base::PropagatorImpl< float > * mPropagatorDevice
Definition TimeFrame.h:293
std::vector< bounded_vector< MCCompLabel > > mLinesLabels
Definition TimeFrame.h:328
auto & getTracklets()
Definition TimeFrame.h:193
std::array< bounded_vector< TrackingFrameInfo >, NLayers > mTrackingFrameInfo
Definition TimeFrame.h:271
void addPrimaryVertex(const Vertex &vertex)
Definition TimeFrame.cxx:47
int getNrof(int layer) const
Definition TimeFrame.h:100
int hasBogusClusters() const
Definition TimeFrame.h:247
std::array< bounded_vector< uint8_t >, NLayers > mUsedClusters
Definition TimeFrame.h:280
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
std::vector< bounded_vector< int > > mCellsNeighbours
Definition TimeFrame.h:289
std::array< float, 2 > & getBeamXY()
Definition TimeFrame.h:111
bounded_vector< float > mLinkPhiCuts
Definition TimeFrame.h:310
auto & getCellsNeighbours()
Definition TimeFrame.h:202
void addTrackingFrameInfoToLayer(int layer, T &&... args)
Definition TimeFrame.h:485
std::vector< bounded_vector< MCCompLabel > > mTrackletLabels
PV x and alpha for track propagation.
Definition TimeFrame.h:316
ROFMaskTableN::View mROFMaskView
Definition TimeFrame.h:346
void resetROFrameData(int iLayer)
void initTrackerTopologies(gsl::span< const TrackingParameters > trkParams, const int maxLayers=NLayers)
TrackingTopologyN mVertexingTopology
Definition TimeFrame.h:337
auto & getClusters()
Definition TimeFrame.h:196
int getSortedIndex(int rofId, int layer, int idx) const
Definition TimeFrame.h:98
auto & getCellsLookupTable()
Definition TimeFrame.h:201
const auto & getTrackerTopologies() const
Definition TimeFrame.h:140
std::array< float, 2 > mBeamPos
Definition TimeFrame.h:306
std::vector< bounded_vector< int > > mCellsNeighboursTopology
Definition TimeFrame.h:290
void setUPCCutMask(ROFMaskTableN cutMask)
Definition TimeFrame.h:165
float getBeamX() const
Definition TimeFrame.h:109
void setROFVertexLookupTable(ROFVertexLookupTableN table)
Definition TimeFrame.h:149
unsigned int mNTotalLowPtVertices
Definition TimeFrame.h:304
int getTotalClusters() const
Definition TimeFrame.h:548
virtual ~TimeFrame()=default
TrackingTopologyN::View mTrackingTopologyView
Definition TimeFrame.h:340
uint32_t getTotalTrackletsTF(const int iLayer)
Definition TimeFrame.h:243
std::vector< bounded_vector< int > > mNTrackletsPerROF
Definition TimeFrame.h:324
auto & getMemoryPool() const noexcept
Definition TimeFrame.h:222
gsl::span< const int > getROFramesClustersPerROFrange(int rofMin, int range, int layerId) const
Definition TimeFrame.h:429
ExternalAllocator * mExternalAllocator
State if memory will be externally managed by the GPU framework.
Definition TimeFrame.h:253
std::array< bounded_vector< int >, NLayers > mNClustersPerROF
Definition TimeFrame.h:277
int getClusterROF(int iLayer, int iCluster)
Definition TimeFrame.h:451
int getTotalClustersPerROFrange(int rofMin, int range, int layerId) const
Definition TimeFrame.h:443
auto getPrimaryVerticesNum()
Definition TimeFrame.h:79
std::array< bounded_vector< int >, 2 > mTrackletsIndexROF
Definition TimeFrame.h:327
void resetTrackExtensionCounters()
Definition TimeFrame.h:614
virtual void wipe()
bounded_vector< float > mPositionResolution
Definition TimeFrame.h:312
std::array< bounded_vector< Cluster >, NLayers > mUnsortedClusters
Definition TimeFrame.h:282
std::vector< bounded_vector< Tracklet > > mTracklets
Definition TimeFrame.h:283
std::vector< bounded_vector< MCCompLabel > > mCellLabels
Definition TimeFrame.h:317
const auto & getTrackingTopologyView() const
Definition TimeFrame.h:141
auto & getLinesLabel(const int rofId)
Definition TimeFrame.h:207
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
std::vector< bounded_vector< ClusterLines > > mTrackletClusters
Definition TimeFrame.h:326
auto & getTracksLabel()
Definition TimeFrame.h:206
ROFMaskTableN mMultiplicityCutMask
Definition TimeFrame.h:343
auto & getLinkPhiCuts()
Definition TimeFrame.h:119
auto & getPrimaryVertices()
Definition TimeFrame.h:78
std::vector< bounded_vector< int > > mCellsNeighboursLUT
Definition TimeFrame.h:318
gsl::span< const MCCompLabel > getClusterLabels(int layerId, const int clId) const
Definition TimeFrame.h:175
void addTrackExtensionCounters(size_t nTracks, size_t nClusters)
Definition TimeFrame.h:621
bounded_vector< VertexLabel > mPrimaryVerticesLabels
Definition TimeFrame.h:323
gsl::span< const uint8_t > getUsedClustersROF(int rofId, int layerId) const
Definition TimeFrame.h:408
virtual size_t getNumberOfTracklets() const
Definition TimeFrame.h:578
bool hasMCinformation() const
Definition TimeFrame.h:183
TrackingTopology< NLayers > TrackingTopologyN
Definition TimeFrame.h:70
float getPositionResolution(int layer) const
Definition TimeFrame.h:121
float getLinkPhiCut(int linkId) const
Definition TimeFrame.h:117
std::array< bounded_vector< uint8_t >, NLayers > mClusterSize
Definition TimeFrame.h:313
gsl::span< const int > getROFrameClusters(int layerId) const
Definition TimeFrame.h:372
std::pmr::memory_resource * getMaybeFrameworkHostResource(bool forceHost=false)
Definition TimeFrame.h:258
std::array< bounded_vector< int >, NLayers > mClusterExternalIndices
Definition TimeFrame.h:272
auto & getCellsLabel(int layer)
Definition TimeFrame.h:181
std::shared_ptr< BoundedMemoryResource > mMemoryPool
Definition TimeFrame.h:350
float getMinR(int layer) const
Definition TimeFrame.h:115
const auto & getROFOverlapTableView() const
Definition TimeFrame.h:139
gsl::span< Cluster > getClustersOnLayer(int rofId, int layerId)
Definition TimeFrame.h:378
IndexTableUtilsN mIndexTableUtils
Definition TimeFrame.h:334
std::array< bounded_vector< int >, NLayers > mROFramesClusters
Definition TimeFrame.h:273
void setBz(float bz)
Definition TimeFrame.h:249
float getLinkMSAngle(int linkId) const
Definition TimeFrame.h:118
const auto & getROFVertexLookupTable() const
Definition TimeFrame.h:147
void setNLinesTotal(uint32_t a) noexcept
Definition TimeFrame.h:236
void addClusterToLayer(int layer, T &&... args)
Definition TimeFrame.h:478
unsigned long getArtefactsMemory() const
ROFOverlapTable< NLayers > ROFOverlapTableN
Definition TimeFrame.h:67
float getMaxR(int layer) const
Definition TimeFrame.h:116
gsl::span< const MCCompLabel > getClusterLabels(int layerId, const Cluster &cl) const
Definition TimeFrame.h:174
std::array< bounded_vector< Cluster >, NLayers > mClusters
Definition TimeFrame.h:270
std::vector< bounded_vector< int > > mCellsLookupTable
Definition TimeFrame.h:291
bool isBeamPositionOverridden
Definition TimeFrame.h:307
auto & getPrimaryVerticesLabels()
Definition TimeFrame.h:81
gsl::span< const Vertex > getPrimaryVertices(int layer, int rofId) const
Definition TimeFrame.h:354
void setIsStaggered(bool b) noexcept
staggering
Definition TimeFrame.h:228
int getNLinesTotal() const noexcept
Definition TimeFrame.h:235
auto & getTrackletClusters(int rofId)
Definition TimeFrame.h:237
bool isClusterUsed(int layer, int clusterId) const
Definition TimeFrame.h:189
bounded_vector< Vertex > mPrimaryVertices
keep track of clusters with wild coordinates
Definition TimeFrame.h:322
void setROFOverlapTable(ROFOverlapTableN table)
Definition TimeFrame.h:142
gsl::span< int > getExclusiveNTrackletsCluster(int rofId, int combId)
Definition TimeFrame.h:507
void setMultiplicityCutMask(ROFMaskTableN cutMask)
Definition TimeFrame.h:155
bounded_vector< std::array< float, 2 > > mPValphaX
Definition TimeFrame.h:315
auto & getTrackletsLookupTable()
Definition TimeFrame.h:194
ROFVertexLookupTableN mROFVertexLookupTable
Definition TimeFrame.h:341
ROFMaskTable< NLayers > ROFMaskTableN
Definition TimeFrame.h:69
bounded_vector< float > mLinkMSAngles
Definition TimeFrame.h:311
int getClusterExternalIndex(int layerId, const int clId) const
Definition TimeFrame.h:176
std::array< float, NLayers > mMinR
Definition TimeFrame.h:308
const auto & getROFOverlapTable() const
Definition TimeFrame.h:138
int & getNTrackletsROF(int rofId, int combId)
Definition TimeFrame.h:233
gsl::span< int > getNTrackletsCluster(int rofId, int combId)
Definition TimeFrame.h:497
auto & getCellsNeighboursLUT()
Definition TimeFrame.h:204
std::array< bounded_vector< int >, 2 > mNTrackletsPerCluster
Definition TimeFrame.h:275
size_t getNExtendedTracks() const
Definition TimeFrame.h:217
constexpr size_t max
std::vector< Cluster > clusters