16#ifndef O2_ITS_TRACKING_VERTEXER_H_
17#define O2_ITS_TRACKING_VERTEXER_H_
27#include <oneapi/tbb/task_arena.h>
43 using LogFunc = std::function<
void(
const std::string&
s)>;
53 void setParameters(
const std::vector<VertexingParameters>& vertParams) { mVertParams = vertParams; }
55 void setMemoryPool(std::shared_ptr<BoundedMemoryResource> pool) { mMemoryPool = pool; }
61 template <
typename... T>
66 template <
typename... T>
71 template <
typename... T>
79 template <
typename... T>
84 template <
typename... T>
90 template <
typename... T>
94 unsigned int trackletN01,
unsigned int trackletN12,
95 unsigned selectedN,
unsigned int vertexN,
unsigned int totalVertexN,
96 float initT,
float trackletT,
float selecT,
float vertexT);
101 std::uint32_t mTimeFrameCounter = 0;
102 double mTotalTime{0};
104 VertexerTraitsN* mTraits =
nullptr;
105 TimeFrameN* mTimeFrame =
nullptr;
107 std::vector<VertexingParameters> mVertParams;
108 std::shared_ptr<BoundedMemoryResource> mMemoryPool;
118 Steps mCurStep{Init};
119 static constexpr std::array<const char*, NSteps> StateNames{
"Initialisation",
"Tracklet finding",
"Tracklet selection",
"Vertex finding",
"Truth seeding"};
120 std::vector<std::array<TimingStats, NSteps>> mTimingStats;
121 void addTimingStatCurStep(
int iteration,
double timeMs);
124template <
int NLayers>
125template <
typename...
T>
130 if (mVertParams[iteration].PrintMemory) {
131 mMemoryPool->resetPeakMemory();
135 auto start = std::chrono::high_resolution_clock::now();
136 (this->*task)(std::forward<T>(args)...);
137 auto end = std::chrono::high_resolution_clock::now();
139 std::chrono::duration<double, std::milli> diff_t{
end -
start};
140 diff = diff_t.count();
142 std::stringstream sstream;
143 if (taskName.empty()) {
144 sstream << diff <<
"\t";
146 sstream << std::setw(2) <<
" - " << taskName <<
" completed in: " << diff <<
" ms";
148 logger(sstream.str());
150 if (mVertParams[iteration].SaveTimeBenchmarks) {
151 std::string taskNameStr(taskName);
152 std::transform(taskNameStr.begin(), taskNameStr.end(), taskNameStr.begin(),
153 [](
unsigned char c) { return std::tolower(c); });
154 std::replace(taskNameStr.begin(), taskNameStr.end(),
' ',
'_');
155 if (std::ofstream
file{
"its_time_benchmarks.txt", std::ios::app}) {
156 file <<
"vtx:" << iteration <<
'\t' << taskNameStr <<
'\t' << diff <<
'\n';
158 addTimingStatCurStep(iteration, diff);
161 (this->*task)(std::forward<T>(args)...);
164 if (mVertParams[iteration].PrintMemory) {
165 LOGP(info,
"iter:{}:{}: {}", iteration, StateNames[mCurStep], mMemoryPool->asString());
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h configStandalone Internal display display_internal Number of updates the Qt GUI may send ahead of the last one the display has before it waits for the display Opacity of the console background Number of console lines the history is shortened to this when it reaches twice the size Time in seconds an info message fades out after setInfoTime h OpenGL display display Font size Do not use Freetype for font Renderer for event Frontend to use for event ROOT macros used as track filter Console script file
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Shared budgeted host allocation and bounded-vector utilities.
Class to compute the primary vertex in ITS from tracklets.
void setNThreads(int n, std::shared_ptr< tbb::task_arena > &arena)
virtual void computeVertices(const int iteration)
virtual void initialise(const TrackingParameters &trackingParams)
auto & getVertexingParameters()
virtual void computeTrackletMatching(const int iteration)
virtual void computeTracklets(const int iteration)
void addTruthSeedingVertices()
Vertexer(const Vertexer &)=delete
void initialiseVertexer(T &&... args)
float evaluateTask(void(Vertexer::*task)(T...), std::string_view taskName, int iteration, LogFunc &logger, T &&... args)
void setParameters(const std::vector< VertexingParameters > &vertParams)
void setMemoryPool(std::shared_ptr< BoundedMemoryResource > pool)
void initialiseTimeFrame(T &&... args)
const auto & getParameters() const noexcept
void setNThreads(int n, std::shared_ptr< tbb::task_arena > &arena)
virtual ~Vertexer()=default
void adoptTimeFrame(TimeFrameN &tf)
void printEpilog(LogFunc &logger, unsigned int trackletN01, unsigned int trackletN12, unsigned selectedN, unsigned int vertexN, unsigned int totalVertexN, float initT, float trackletT, float selecT, float vertexT)
void validateTracklets(T &&... args)
void printSummary() const
Vertexer & operator=(const Vertexer &)=delete
float clustersToVertices(LogFunc=[](const std::string &s) { std::cout<< s<< '\n';})
void findTracklets(T &&... args)
auto & getVertParameters() const
void findVertices(T &&... args)
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
constexpr bool DoTimeBenchmarks
std::unique_ptr< GPUReconstructionTimeframe > tf