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 getTransitionPhiCut(int transitionId) const { return mTransitionPhiCuts[transitionId]; }
118 float getTransitionMSAngle(int transitionId) const { return mTransitionMSAngles[transitionId]; }
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;
215
217 void setMemoryPool(std::shared_ptr<BoundedMemoryResource> pool);
218 auto& getMemoryPool() const noexcept { return mMemoryPool; }
219 bool checkMemory(unsigned long max) { return getArtefactsMemory() < max; }
220 unsigned long getArtefactsMemory() const;
221 void printArtefactsMemory() const;
222
224 void setIsStaggered(bool b) noexcept { mIsStaggered = b; }
225
226 // Vertexer
229 int& getNTrackletsROF(int rofId, int combId) { return mNTrackletsPerROF[combId][rofId]; }
230 auto& getLines(int rofId) { return mLines[rofId]; }
231 int getNLinesTotal() const noexcept { return mTotalLines; }
232 void setNLinesTotal(uint32_t a) noexcept { mTotalLines = a; }
233 auto& getTrackletClusters(int rofId) { return mTrackletClusters[rofId]; }
234 gsl::span<const Tracklet> getFoundTracklets(int rofId, int combId) const;
235 gsl::span<Tracklet> getFoundTracklets(int rofId, int combId);
236 gsl::span<const MCCompLabel> getLabelsFoundTracklets(int rofId, int combId) const;
237 gsl::span<int> getNTrackletsCluster(int rofId, int combId);
238 gsl::span<int> getExclusiveNTrackletsCluster(int rofId, int combId);
239 uint32_t getTotalTrackletsTF(const int iLayer) { return mTotalTracklets[iLayer]; }
240 int getTotalClustersPerROFrange(int rofMin, int range, int layerId) const;
241 // \Vertexer
242
243 int hasBogusClusters() const { return std::accumulate(mBogusClusters.begin(), mBogusClusters.end(), 0); }
244
245 void setBz(float bz) { mBz = bz; }
246 float getBz() const { return mBz; }
247
250 std::shared_ptr<BoundedMemoryResource> mExtMemoryPool; // host memory pool managed by the framework
253 bool hasFrameworkAllocator() const noexcept { return mExternalAllocator != nullptr; }
254 std::pmr::memory_resource* getMaybeFrameworkHostResource(bool forceHost = false) { return (hasFrameworkAllocator() && !forceHost) ? mExtMemoryPool.get() : mMemoryPool.get(); }
255
256 // Propagator
258 virtual void setDevicePropagator(const o2::base::PropagatorImpl<float>* /*unused*/) {};
259
260 template <typename... T>
261 void addClusterToLayer(int layer, T&&... args);
262 template <typename... T>
263 void addTrackingFrameInfoToLayer(int layer, T&&... args);
264 void addClusterExternalIndexToLayer(int layer, const int idx) { mClusterExternalIndices[layer].push_back(idx); }
265
266 std::array<bounded_vector<Cluster>, NLayers> mClusters;
267 std::array<bounded_vector<TrackingFrameInfo>, NLayers> mTrackingFrameInfo;
268 std::array<bounded_vector<int>, NLayers> mClusterExternalIndices;
269 std::array<bounded_vector<int>, NLayers> mROFramesClusters;
270 std::array<const dataformats::MCTruthContainer<MCCompLabel>*, NLayers> mClusterLabels{nullptr};
271 std::array<bounded_vector<int>, 2> mNTrackletsPerCluster;
272 std::array<bounded_vector<int>, 2> mNTrackletsPerClusterSum;
273 std::array<bounded_vector<int>, NLayers> mNClustersPerROF;
274 std::array<bounded_vector<int>, NLayers> mIndexTables;
275 std::vector<bounded_vector<int>> mTrackletsLookupTable;
276 std::array<bounded_vector<uint8_t>, NLayers> mUsedClusters;
277
278 std::array<bounded_vector<Cluster>, NLayers> mUnsortedClusters;
279 std::vector<bounded_vector<Tracklet>> mTracklets;
280 std::vector<bounded_vector<CellSeed>> mCells;
283 std::vector<bounded_vector<int>> mCellsNeighbours;
284 std::vector<bounded_vector<int>> mCellsNeighboursTopology;
285 std::vector<bounded_vector<int>> mCellsLookupTable;
286
287 const o2::base::PropagatorImpl<float>* mPropagatorDevice = nullptr; // Needed only for GPU
288
289 virtual void wipe();
290
291 // interface
292 virtual bool isGPU() const noexcept { return false; }
293 virtual const char* getName() const noexcept { return "CPU"; }
294
295 protected:
296 void prepareClusters(const TrackingParameters& trkParam, const int maxLayers = NLayers);
297 float mBz = 5.;
298 unsigned int mNTotalLowPtVertices = 0;
300 std::array<float, 2> mBeamPos = {0.f, 0.f};
302 std::array<float, NLayers> mMinR;
303 std::array<float, NLayers> mMaxR;
307 std::array<bounded_vector<uint8_t>, NLayers> mClusterSize;
308
310 std::vector<bounded_vector<MCCompLabel>> mTrackletLabels;
311 std::vector<bounded_vector<MCCompLabel>> mCellLabels;
312 std::vector<bounded_vector<int>> mCellsNeighboursLUT;
314
315 // Vertexer
318 std::vector<bounded_vector<int>> mNTrackletsPerROF;
319 std::vector<bounded_vector<Line>> mLines;
320 std::vector<bounded_vector<ClusterLines>> mTrackletClusters;
321 std::array<bounded_vector<int>, 2> mTrackletsIndexROF;
322 std::vector<bounded_vector<MCCompLabel>> mLinesLabels;
323 std::array<uint32_t, 2> mTotalTracklets = {0, 0};
324 uint32_t mTotalLines = 0;
325 // \Vertexer
326
327 // lookup tables
330 ROFOverlapTableN::View mROFOverlapTableView;
333 std::vector<TrackingTopologyN> mTrackerTopologies;
334 typename TrackingTopologyN::View mTrackingTopologyView;
336 ROFVertexLookupTableN::View mROFVertexLookupTableView;
340 ROFMaskTableN::View mROFMaskView;
341
342 bool mIsStaggered{false};
343
344 std::shared_ptr<BoundedMemoryResource> mMemoryPool;
345};
346
347template <int NLayers>
348gsl::span<const Vertex> TimeFrame<NLayers>::getPrimaryVertices(int layer, int rofId) const
349{
350 if (rofId < 0 || rofId >= getNrof(layer)) {
351 return {};
352 }
353 const auto& entry = mROFVertexLookupTableView.getVertices(layer, rofId);
354 return {&mPrimaryVertices[entry.getFirstEntry()], static_cast<gsl::span<const Vertex>::size_type>(entry.getEntries())};
355}
356
357template <int NLayers>
358inline void TimeFrame<NLayers>::resetBeamXY(const float x, const float y, const float w)
359{
360 mBeamPos[0] = x;
361 mBeamPos[1] = y;
362 mBeamPosWeight = w;
363}
364
365template <int NLayers>
366inline gsl::span<const int> TimeFrame<NLayers>::getROFrameClusters(int layerId) const
367{
368 return {&mROFramesClusters[layerId][0], static_cast<gsl::span<const int>::size_type>(mROFramesClusters[layerId].size())};
369}
370
371template <int NLayers>
372inline gsl::span<Cluster> TimeFrame<NLayers>::getClustersOnLayer(int rofId, int layerId)
373{
374 if (rofId < 0 || rofId >= getNrof(layerId)) {
375 return {};
376 }
377 int startIdx{mROFramesClusters[layerId][rofId]};
378 return {&mClusters[layerId][startIdx], static_cast<gsl::span<Cluster>::size_type>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
379}
380
381template <int NLayers>
382inline gsl::span<const Cluster> TimeFrame<NLayers>::getClustersOnLayer(int rofId, int layerId) const
383{
384 if (rofId < 0 || rofId >= getNrof(layerId)) {
385 return {};
386 }
387 int startIdx{mROFramesClusters[layerId][rofId]};
388 return {&mClusters[layerId][startIdx], static_cast<gsl::span<const Cluster>::size_type>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
389}
390
391template <int NLayers>
392inline gsl::span<uint8_t> TimeFrame<NLayers>::getUsedClustersROF(int rofId, int layerId)
393{
394 if (rofId < 0 || rofId >= getNrof(layerId)) {
395 return {};
396 }
397 int startIdx{mROFramesClusters[layerId][rofId]};
398 return {&mUsedClusters[layerId][startIdx], static_cast<gsl::span<uint8_t>::size_type>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
399}
400
401template <int NLayers>
402inline gsl::span<const uint8_t> TimeFrame<NLayers>::getUsedClustersROF(int rofId, int layerId) const
403{
404 if (rofId < 0 || rofId >= getNrof(layerId)) {
405 return {};
406 }
407 int startIdx{mROFramesClusters[layerId][rofId]};
408 return {&mUsedClusters[layerId][startIdx], static_cast<gsl::span<const uint8_t>::size_type>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
409}
410
411template <int NLayers>
412inline gsl::span<const Cluster> TimeFrame<NLayers>::getClustersPerROFrange(int rofMin, int range, int layerId) const
413{
414 if (rofMin < 0 || rofMin >= getNrof(layerId)) {
415 return {};
416 }
417 int startIdx{mROFramesClusters[layerId][rofMin]}; // First cluster of rofMin
418 int endIdx{mROFramesClusters[layerId][o2::gpu::CAMath::Min(rofMin + range, getNrof(layerId))]};
419 return {&mClusters[layerId][startIdx], static_cast<gsl::span<Cluster>::size_type>(endIdx - startIdx)};
420}
421
422template <int NLayers>
423inline gsl::span<const int> TimeFrame<NLayers>::getROFramesClustersPerROFrange(int rofMin, int range, int layerId) const
424{
425 int chkdRange{o2::gpu::CAMath::Min(range, getNrof(layerId) - rofMin)};
426 return {&mROFramesClusters[layerId][rofMin], static_cast<gsl::span<int>::size_type>(chkdRange)};
427}
428
429template <int NLayers>
430inline gsl::span<const int> TimeFrame<NLayers>::getNClustersROFrange(int rofMin, int range, int layerId) const
431{
432 int chkdRange{o2::gpu::CAMath::Min(range, getNrof(layerId) - rofMin)};
433 return {&mNClustersPerROF[layerId][rofMin], static_cast<gsl::span<int>::size_type>(chkdRange)};
434}
435
436template <int NLayers>
437inline int TimeFrame<NLayers>::getTotalClustersPerROFrange(int rofMin, int range, int layerId) const
438{
439 int startIdx{rofMin}; // First cluster of rofMin
440 int endIdx{o2::gpu::CAMath::Min(rofMin + range, getNrof(layerId))};
441 return mROFramesClusters[layerId][endIdx] - mROFramesClusters[layerId][startIdx];
442}
443
444template <int NLayers>
445inline int TimeFrame<NLayers>::getClusterROF(int iLayer, int iCluster)
446{
447 return std::lower_bound(mROFramesClusters[iLayer].begin(), mROFramesClusters[iLayer].end(), iCluster + 1) - mROFramesClusters[iLayer].begin() - 1;
448}
449
450template <int NLayers>
451inline gsl::span<const Cluster> TimeFrame<NLayers>::getUnsortedClustersOnLayer(int rofId, int layerId) const
452{
453 if (rofId < 0 || rofId >= getNrof(layerId)) {
454 return {};
455 }
456 int startIdx{mROFramesClusters[layerId][rofId]};
457 return {&mUnsortedClusters[layerId][startIdx], static_cast<gsl::span<Cluster>::size_type>(mROFramesClusters[layerId][rofId + 1] - startIdx)};
458}
459
460template <int NLayers>
461inline gsl::span<int> TimeFrame<NLayers>::getIndexTable(int rofId, int layer)
462{
463 if (rofId < 0 || rofId >= getNrof(layer)) {
464 return {};
465 }
466 const int tableSize = mIndexTableUtils.getNphiBins() * mIndexTableUtils.getNzBins() + 1;
467 return {&mIndexTables[layer][rofId * tableSize], static_cast<gsl::span<int>::size_type>(tableSize)};
468}
469
470template <int NLayers>
471template <typename... T>
473{
474 mUnsortedClusters[layer].emplace_back(std::forward<T>(values)...);
475}
476
477template <int NLayers>
478template <typename... T>
480{
481 mTrackingFrameInfo[layer].emplace_back(std::forward<T>(values)...);
482}
483
484template <int NLayers>
485inline gsl::span<uint8_t> TimeFrame<NLayers>::getUsedClusters(const int layer)
486{
487 return {&mUsedClusters[layer][0], static_cast<gsl::span<uint8_t>::size_type>(mUsedClusters[layer].size())};
488}
489
490template <int NLayers>
491inline gsl::span<int> TimeFrame<NLayers>::getNTrackletsCluster(int rofId, int combId)
492{
493 if (rofId < 0 || rofId >= getNrof(1)) {
494 return {};
495 }
496 auto startIdx{mROFramesClusters[1][rofId]};
497 return {&mNTrackletsPerCluster[combId][startIdx], static_cast<gsl::span<int>::size_type>(mROFramesClusters[1][rofId + 1] - startIdx)};
498}
499
500template <int NLayers>
501inline gsl::span<int> TimeFrame<NLayers>::getExclusiveNTrackletsCluster(int rofId, int combId)
502{
503 if (rofId < 0 || rofId >= getNrof(1)) {
504 return {};
505 }
506 auto clusStartIdx{mROFramesClusters[1][rofId]};
507
508 return {&mNTrackletsPerClusterSum[combId][clusStartIdx], static_cast<gsl::span<int>::size_type>(mROFramesClusters[1][rofId + 1] - clusStartIdx)};
509}
510
511template <int NLayers>
512inline gsl::span<Tracklet> TimeFrame<NLayers>::getFoundTracklets(int rofId, int combId)
513{
514 if (rofId < 0 || rofId >= getNrof(1) || mTracklets[combId].empty()) {
515 return {};
516 }
517 auto startIdx{mNTrackletsPerROF[combId][rofId]};
518 return {&mTracklets[combId][startIdx], static_cast<gsl::span<Tracklet>::size_type>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
519}
520
521template <int NLayers>
522inline gsl::span<const Tracklet> TimeFrame<NLayers>::getFoundTracklets(int rofId, int combId) const
523{
524 if (rofId < 0 || rofId >= getNrof(1)) {
525 return {};
526 }
527 auto startIdx{mNTrackletsPerROF[combId][rofId]};
528 return {&mTracklets[combId][startIdx], static_cast<gsl::span<Tracklet>::size_type>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
529}
530
531template <int NLayers>
532inline gsl::span<const MCCompLabel> TimeFrame<NLayers>::getLabelsFoundTracklets(int rofId, int combId) const
533{
534 if (rofId < 0 || rofId >= getNrof(1) || !hasMCinformation()) {
535 return {};
536 }
537 auto startIdx{mNTrackletsPerROF[combId][rofId]};
538 return {&mTrackletLabels[combId][startIdx], static_cast<gsl::span<Tracklet>::size_type>(mNTrackletsPerROF[combId][rofId + 1] - startIdx)};
539}
540
541template <int NLayers>
543{
544 size_t totalClusters{0};
545 for (const auto& clusters : mUnsortedClusters) {
546 totalClusters += clusters.size();
547 }
548 return int(totalClusters);
549}
550
551template <int NLayers>
553{
554 size_t nClusters{0};
555 for (const auto& layer : mClusters) {
556 nClusters += layer.size();
557 }
558 return nClusters;
559}
560
561template <int NLayers>
563{
564 size_t nCells{0};
565 for (const auto& layer : mCells) {
566 nCells += layer.size();
567 }
568 return nCells;
569}
570
571template <int NLayers>
573{
574 size_t nTracklets{0};
575 for (const auto& layer : mTracklets) {
576 nTracklets += layer.size();
577 }
578 return nTracklets;
579}
580
581template <int NLayers>
583{
584 size_t neigh{0};
585 for (const auto& l : mCellsNeighbours) {
586 neigh += l.size();
587 }
588 return neigh;
589}
590
591template <int NLayers>
593{
594 return mTracks.size();
595}
596
597template <int NLayers>
599{
600 size_t nClusters = 0;
601 for (const auto& layer : mUsedClusters) {
602 nClusters += std::count(layer.begin(), layer.end(), true);
603 }
604 return nClusters;
605}
606
607} // namespace its
608} // namespace o2
609
610#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
GLuint GLuint end
Definition glcorearb.h:469
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:32
std::pmr::vector< T > bounded_vector
std::pair< o2::MCCompLabel, float > VertexLabel
Definition Vertex.h:27
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
void empty(int)
ROFVertexLookupTable< NLayers > ROFVertexLookupTableN
Definition TimeFrame.h:68
virtual size_t getNumberOfCells() const
Definition TimeFrame.h:562
void prepareClusters(const TrackingParameters &trkParam, const int maxLayers=NLayers)
std::vector< TrackingTopologyN > mTrackerTopologies
Definition TimeFrame.h:333
std::vector< bounded_vector< Line > > mLines
Definition TimeFrame.h:319
std::vector< bounded_vector< int > > mTrackletsLookupTable
Definition TimeFrame.h:275
bounded_vector< int > mBogusClusters
Definition TimeFrame.h:313
std::array< float, NLayers > mMaxR
Definition TimeFrame.h:303
const TrackingFrameInfo & getClusterTrackingFrameInfo(int layerId, const Cluster &cl) const
virtual void setDevicePropagator(const o2::base::PropagatorImpl< float > *)
Definition TimeFrame.h:258
const auto & getROFVertexLookupTableView() const
Definition TimeFrame.h:148
size_t getNumberOfUsedClusters() const
Definition TimeFrame.h:598
std::array< bounded_vector< int >, NLayers > mIndexTables
Definition TimeFrame.h:274
ROFMaskTableN mUPCCutMask
Definition TimeFrame.h:338
gsl::span< const Cluster > getUnsortedClustersOnLayer(int rofId, int layerId) const
Definition TimeFrame.h:451
std::array< bounded_vector< int >, 2 > mNTrackletsPerClusterSum
Definition TimeFrame.h:272
size_t getNumberOfClusters() const
Definition TimeFrame.h:552
gsl::span< const Cluster > getClustersOnLayer(int rofId, int layerId) const
Definition TimeFrame.h:382
void initDefaultTrackingTopology(const TrackingParameters &trkParam, const int maxLayers=NLayers)
auto & getPositionResolutions()
Definition TimeFrame.h:122
bounded_vector< MCCompLabel > mTracksLabel
Definition TimeFrame.h:282
void useMultiplictyMask() noexcept
Definition TimeFrame.h:160
bool checkMemory(unsigned long max)
Definition TimeFrame.h:219
ROFMaskTableN * mROFMask
Definition TimeFrame.h:339
const auto & getTrackingFrameInfoOnLayer(int layerId) const
Definition TimeFrame.h:134
std::array< uint32_t, 2 > mTotalTracklets
Definition TimeFrame.h:323
void setMemoryPool(std::shared_ptr< BoundedMemoryResource > pool)
memory management
size_t getNumberOfTracks() const
Definition TimeFrame.h:592
void resetBeamXY(const float x, const float y, const float w=0)
Definition TimeFrame.h:358
void computeTracletsPerClusterScans()
auto & getTrackletsLabel(int layer)
Definition TimeFrame.h:180
uint32_t mTotalLines
Definition TimeFrame.h:324
ROFOverlapTableN mROFOverlapTable
Definition TimeFrame.h:329
std::shared_ptr< BoundedMemoryResource > mExtMemoryPool
Definition TimeFrame.h:250
bounded_vector< TrackITSExt > mTracks
Definition TimeFrame.h:281
auto getFrameworkAllocator()
Definition TimeFrame.h:251
virtual size_t getNumberOfNeighbours() const
Definition TimeFrame.h:582
ROFVertexLookupTableN::View mROFVertexLookupTableView
Definition TimeFrame.h:336
gsl::span< Tracklet > getFoundTracklets(int rofId, int combId)
Definition TimeFrame.h:512
void initVertexingTopology(const TrackingParameters &trkParam)
gsl::span< uint8_t > getUsedClustersROF(int rofId, int layerId)
Definition TimeFrame.h:392
std::array< const dataformats::MCTruthContainer< MCCompLabel > *, NLayers > mClusterLabels
Definition TimeFrame.h:270
std::vector< bounded_vector< CellSeed > > mCells
Definition TimeFrame.h:280
gsl::span< const MCCompLabel > getLabelsFoundTracklets(int rofId, int combId) const
Definition TimeFrame.h:532
void printArtefactsMemory() const
bool empty() const
Definition TimeFrame.h:97
void useUPCMask() noexcept
Definition TimeFrame.h:166
float getBz() const
Definition TimeFrame.h:246
ROFOverlapTableN::View mROFOverlapTableView
Definition TimeFrame.h:330
gsl::span< const Tracklet > getFoundTracklets(int rofId, int combId) const
Definition TimeFrame.h:522
const Vertex & getPrimaryVertex(const int ivtx) const
Definition TimeFrame.h:77
virtual const char * getName() const noexcept
Definition TimeFrame.h:293
auto & getTransitionPhiCuts()
Definition TimeFrame.h:119
const o2::base::PropagatorImpl< float > * getDevicePropagator() const
Definition TimeFrame.h:257
gsl::span< const Cluster > getClustersPerROFrange(int rofMin, int range, int layerId) const
Definition TimeFrame.h:412
int getClusterSize(int layer, int clusterId) const
Definition TimeFrame.h:177
void updateROFVertexLookupTable()
Definition TimeFrame.h:154
float getBeamY() const
Definition TimeFrame.h:110
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:253
gsl::span< const int > getNClustersROFrange(int rofMin, int range, int layerId) const
Definition TimeFrame.h:430
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
void prepareROFrameData(gsl::span< const itsmft::CompClusterExt > clusters, int layer)
gsl::span< unsigned char > getUsedClusters(const int layer)
Definition TimeFrame.h:485
TrackingTopologyN mDefaultTrackingTopology
Definition TimeFrame.h:332
auto & getLines(int rofId)
Definition TimeFrame.h:230
void addClusterExternalIndexToLayer(int layer, const int idx)
Definition TimeFrame.h:264
virtual bool isGPU() const noexcept
Definition TimeFrame.h:292
auto & getTransitionMSAngles()
Definition TimeFrame.h:120
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:461
void computeTrackletsPerROFScans()
const o2::base::PropagatorImpl< float > * mPropagatorDevice
Definition TimeFrame.h:287
std::vector< bounded_vector< MCCompLabel > > mLinesLabels
Definition TimeFrame.h:322
auto & getTracklets()
Definition TimeFrame.h:193
std::array< bounded_vector< TrackingFrameInfo >, NLayers > mTrackingFrameInfo
Definition TimeFrame.h:267
void addPrimaryVertex(const Vertex &vertex)
Definition TimeFrame.cxx:47
int getNrof(int layer) const
Definition TimeFrame.h:100
int hasBogusClusters() const
Definition TimeFrame.h:243
std::array< bounded_vector< uint8_t >, NLayers > mUsedClusters
Definition TimeFrame.h:276
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:283
float getTransitionMSAngle(int transitionId) const
Definition TimeFrame.h:118
std::array< float, 2 > & getBeamXY()
Definition TimeFrame.h:111
auto & getCellsNeighbours()
Definition TimeFrame.h:202
void addTrackingFrameInfoToLayer(int layer, T &&... args)
Definition TimeFrame.h:479
bounded_vector< float > mTransitionMSAngles
Definition TimeFrame.h:305
std::vector< bounded_vector< MCCompLabel > > mTrackletLabels
PV x and alpha for track propagation.
Definition TimeFrame.h:310
ROFMaskTableN::View mROFMaskView
Definition TimeFrame.h:340
void resetROFrameData(int iLayer)
void initTrackerTopologies(gsl::span< const TrackingParameters > trkParams, const int maxLayers=NLayers)
bounded_vector< float > mTransitionPhiCuts
Definition TimeFrame.h:304
TrackingTopologyN mVertexingTopology
Definition TimeFrame.h:331
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:300
std::vector< bounded_vector< int > > mCellsNeighboursTopology
Definition TimeFrame.h:284
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:298
int getTotalClusters() const
Definition TimeFrame.h:542
virtual ~TimeFrame()=default
TrackingTopologyN::View mTrackingTopologyView
Definition TimeFrame.h:334
uint32_t getTotalTrackletsTF(const int iLayer)
Definition TimeFrame.h:239
float getTransitionPhiCut(int transitionId) const
Definition TimeFrame.h:117
std::vector< bounded_vector< int > > mNTrackletsPerROF
Definition TimeFrame.h:318
auto & getMemoryPool() const noexcept
Definition TimeFrame.h:218
gsl::span< const int > getROFramesClustersPerROFrange(int rofMin, int range, int layerId) const
Definition TimeFrame.h:423
ExternalAllocator * mExternalAllocator
State if memory will be externally managed by the GPU framework.
Definition TimeFrame.h:249
std::array< bounded_vector< int >, NLayers > mNClustersPerROF
Definition TimeFrame.h:273
int getClusterROF(int iLayer, int iCluster)
Definition TimeFrame.h:445
int getTotalClustersPerROFrange(int rofMin, int range, int layerId) const
Definition TimeFrame.h:437
auto getPrimaryVerticesNum()
Definition TimeFrame.h:79
std::array< bounded_vector< int >, 2 > mTrackletsIndexROF
Definition TimeFrame.h:321
virtual void wipe()
bounded_vector< float > mPositionResolution
Definition TimeFrame.h:306
std::array< bounded_vector< Cluster >, NLayers > mUnsortedClusters
Definition TimeFrame.h:278
std::vector< bounded_vector< Tracklet > > mTracklets
Definition TimeFrame.h:279
std::vector< bounded_vector< MCCompLabel > > mCellLabels
Definition TimeFrame.h:311
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:320
auto & getTracksLabel()
Definition TimeFrame.h:206
ROFMaskTableN mMultiplicityCutMask
Definition TimeFrame.h:337
auto & getPrimaryVertices()
Definition TimeFrame.h:78
std::vector< bounded_vector< int > > mCellsNeighboursLUT
Definition TimeFrame.h:312
gsl::span< const MCCompLabel > getClusterLabels(int layerId, const int clId) const
Definition TimeFrame.h:175
bounded_vector< VertexLabel > mPrimaryVerticesLabels
Definition TimeFrame.h:317
gsl::span< const uint8_t > getUsedClustersROF(int rofId, int layerId) const
Definition TimeFrame.h:402
virtual size_t getNumberOfTracklets() const
Definition TimeFrame.h:572
bool hasMCinformation() const
Definition TimeFrame.h:183
TrackingTopology< NLayers > TrackingTopologyN
Definition TimeFrame.h:70
float getPositionResolution(int layer) const
Definition TimeFrame.h:121
std::array< bounded_vector< uint8_t >, NLayers > mClusterSize
Definition TimeFrame.h:307
gsl::span< const int > getROFrameClusters(int layerId) const
Definition TimeFrame.h:366
std::pmr::memory_resource * getMaybeFrameworkHostResource(bool forceHost=false)
Definition TimeFrame.h:254
std::array< bounded_vector< int >, NLayers > mClusterExternalIndices
Definition TimeFrame.h:268
auto & getCellsLabel(int layer)
Definition TimeFrame.h:181
std::shared_ptr< BoundedMemoryResource > mMemoryPool
Definition TimeFrame.h:344
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:372
IndexTableUtilsN mIndexTableUtils
Definition TimeFrame.h:328
std::array< bounded_vector< int >, NLayers > mROFramesClusters
Definition TimeFrame.h:269
void setBz(float bz)
Definition TimeFrame.h:245
const auto & getROFVertexLookupTable() const
Definition TimeFrame.h:147
void setNLinesTotal(uint32_t a) noexcept
Definition TimeFrame.h:232
void addClusterToLayer(int layer, T &&... args)
Definition TimeFrame.h:472
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:266
std::vector< bounded_vector< int > > mCellsLookupTable
Definition TimeFrame.h:285
bool isBeamPositionOverridden
Definition TimeFrame.h:301
auto & getPrimaryVerticesLabels()
Definition TimeFrame.h:81
gsl::span< const Vertex > getPrimaryVertices(int layer, int rofId) const
Definition TimeFrame.h:348
void setIsStaggered(bool b) noexcept
staggering
Definition TimeFrame.h:224
int getNLinesTotal() const noexcept
Definition TimeFrame.h:231
auto & getTrackletClusters(int rofId)
Definition TimeFrame.h:233
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:316
void setROFOverlapTable(ROFOverlapTableN table)
Definition TimeFrame.h:142
gsl::span< int > getExclusiveNTrackletsCluster(int rofId, int combId)
Definition TimeFrame.h:501
void setMultiplicityCutMask(ROFMaskTableN cutMask)
Definition TimeFrame.h:155
bounded_vector< std::array< float, 2 > > mPValphaX
Definition TimeFrame.h:309
auto & getTrackletsLookupTable()
Definition TimeFrame.h:194
ROFVertexLookupTableN mROFVertexLookupTable
Definition TimeFrame.h:335
ROFMaskTable< NLayers > ROFMaskTableN
Definition TimeFrame.h:69
int getClusterExternalIndex(int layerId, const int clId) const
Definition TimeFrame.h:176
std::array< float, NLayers > mMinR
Definition TimeFrame.h:302
const auto & getROFOverlapTable() const
Definition TimeFrame.h:138
int & getNTrackletsROF(int rofId, int combId)
Definition TimeFrame.h:229
gsl::span< int > getNTrackletsCluster(int rofId, int combId)
Definition TimeFrame.h:491
auto & getCellsNeighboursLUT()
Definition TimeFrame.h:204
std::array< bounded_vector< int >, 2 > mNTrackletsPerCluster
Definition TimeFrame.h:271
constexpr size_t max
std::vector< Cluster > clusters