Project
Loading...
Searching...
No Matches
TimeFrameScratch.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.
17#ifndef ALICEO2_ITSMFT_TRACKING_TimeFrameScratch_H_
18#define ALICEO2_ITSMFT_TRACKING_TimeFrameScratch_H_
19
20#include <algorithm>
21#include <array>
22#include <cstddef>
23#include <cstdint>
24#include <memory>
25#include <type_traits>
26#include <vector>
27
28#include <gsl/gsl>
29
34
36{
37
41{
42 private:
43 // Pool must outlive allocator-backed members.
44 std::shared_ptr<BoundedMemoryResource> mMemoryPool;
45
46 public:
47 TimeFrameScratch() = default;
48 ~TimeFrameScratch() = default;
53
55 void configureStorage(std::size_t nEdges, std::size_t nCells);
56 void beginIteration(std::size_t nEdges, std::size_t nCells,
57 gsl::span<const std::size_t> trackletLookupSizes);
58 std::size_t getNEdges() const noexcept { return mNEdges; }
59 std::size_t getNCells() const noexcept { return mNCells; }
60
62 void reset();
63
66
68 void setMemoryPool(std::shared_ptr<BoundedMemoryResource> pool);
69 auto& getMemoryPool() const noexcept { return mMemoryPool; }
70 float getEdgePhiCut(int edgeId) const { return mEdgePhiCuts[edgeId]; }
71 float getEdgeMSAngle(int edgeId) const { return mEdgeMSAngles[edgeId]; }
72 auto& getEdgePhiCuts() { return mEdgePhiCuts; }
73 auto& getEdgeMSAngles() { return mEdgeMSAngles; }
75 auto& getCellsLabel(int layer) { return mCellLabels[layer]; }
76
77 auto& getTracklets() { return mTracklets; }
79
80 auto& getCells() { return mCells; }
81 const auto& getCells() const { return mCells; }
82
87 size_t getNumberOfCells() const;
88 size_t getNumberOfTracklets() const;
89 size_t getNumberOfNeighbours() const;
90
91 // ---- Per-iteration surface and CA construction state ----
92 std::vector<bounded_vector<Tracklet>> mTracklets;
93 std::vector<bounded_vector<int>> mTrackletsLookupTable;
94 std::vector<bounded_vector<o2::MCCompLabel>> mTrackletLabels;
97 std::vector<bounded_vector<Triplet>> mCells;
98 std::vector<bounded_vector<int>> mCellsLookupTable;
99 std::vector<bounded_vector<int>> mCellsNeighbours;
100 std::vector<bounded_vector<int>> mCellsNeighboursTopology;
101 std::vector<bounded_vector<int>> mCellsNeighboursLUT;
102 std::vector<bounded_vector<o2::MCCompLabel>> mCellLabels;
103
104 private:
105 void clearResizeEdgeStorage(std::size_t nEdges);
106 void clearResizeCellStorage(std::size_t nCells);
107
108 std::size_t mNEdges{0};
109 std::size_t mNCells{0};
110};
111
112} // namespace o2::itsmft::tracking
113
114#endif /* ALICEO2_ITSMFT_TRACKING_TimeFrameScratch_H_ */
CA geometric triplet types with hole-layer support.
TimeFrameScratch & operator=(TimeFrameScratch &&)=delete
std::vector< bounded_vector< o2::MCCompLabel > > mTrackletLabels
std::vector< bounded_vector< int > > mCellsLookupTable
std::vector< bounded_vector< Triplet > > mCells
std::vector< bounded_vector< int > > mTrackletsLookupTable
void beginIteration(std::size_t nEdges, std::size_t nCells, gsl::span< const std::size_t > trackletLookupSizes)
void setMemoryPool(std::shared_ptr< BoundedMemoryResource > pool)
Reseat allocator-backed containers.
TimeFrameScratch & operator=(const TimeFrameScratch &)=delete
TimeFrameScratch(const TimeFrameScratch &)=delete
std::size_t getNCells() const noexcept
std::vector< bounded_vector< int > > mCellsNeighboursLUT
std::vector< bounded_vector< int > > mCellsNeighbours
std::size_t getNEdges() const noexcept
std::vector< bounded_vector< int > > mCellsNeighboursTopology
std::vector< bounded_vector< Tracklet > > mTracklets
void configureStorage(std::size_t nEdges, std::size_t nCells)
Size reusable edge and cell storage; setMemoryPool() comes first.
void reset()
Clear iteration state without changing plan sizes.
std::vector< bounded_vector< o2::MCCompLabel > > mCellLabels
void clearStorage() noexcept
Release plan-sized storage while preserving this object's identity.
TimeFrameScratch(TimeFrameScratch &&)=delete
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
uint32_t trackClusterIndicesSize noexcept
std::pmr::vector< T > bounded_vector