Project
Loading...
Searching...
No Matches
Vertexer.cxx
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.
15
17#include "ITStracking/Cluster.h"
18#include "ITStracking/ROframe.h"
23
24#include <array>
25
26namespace o2
27{
28namespace its
29{
30
32{
33 if (!traits) {
34 LOG(fatal) << "nullptr passed to ITS vertexer construction.";
35 }
36 mVertParams.resize(1);
37 mTraits = traits;
38}
39
40float Vertexer::clustersToVertices(std::function<void(std::string s)> logger)
41{
42 TrackingParameters trkPars;
44 mTraits->updateVertexingParameters(mVertParams, tfGPUpar);
45 float timeTracklet{0.f}, timeSelection{0.f}, timeVertexing{0.f}, timeInit{0.f};
46 for (int iteration = 0; iteration < std::min(mVertParams[0].nIterations, (int)mVertParams.size()); ++iteration) {
47 unsigned int nTracklets01, nTracklets12;
48 logger(fmt::format("ITS Seeding vertexer iteration {} summary:", iteration));
49 trkPars.PhiBins = mTraits->getVertexingParameters()[0].PhiBins;
50 trkPars.ZBins = mTraits->getVertexingParameters()[0].ZBins;
51 auto timeInitIteration = evaluateTask(
52 &Vertexer::initialiseVertexer, "Vertexer initialisation", [](std::string) {}, trkPars, iteration);
53 auto timeTrackletIteration = evaluateTask(
54 &Vertexer::findTracklets, "Vertexer tracklet finding", [](std::string) {}, iteration);
55 nTracklets01 = mTimeFrame->getTotalTrackletsTF(0);
56 nTracklets12 = mTimeFrame->getTotalTrackletsTF(1);
57 auto timeSelectionIteration = evaluateTask(
58 &Vertexer::validateTracklets, "Vertexer tracklets validation", [](std::string) {}, iteration);
59 auto timeVertexingIteration = evaluateTask(
60 &Vertexer::findVertices, "Vertexer vertex finding", [](std::string) {}, iteration);
61 printEpilog(logger, false, nTracklets01, nTracklets12, mTimeFrame->getNLinesTotal(), mTimeFrame->getTotVertIteration()[iteration], timeInitIteration, timeTrackletIteration, timeSelectionIteration, timeVertexingIteration);
62 timeInit += timeInitIteration;
63 timeTracklet += timeTrackletIteration;
64 timeSelection += timeSelectionIteration;
65 timeVertexing += timeVertexingIteration;
66 }
67
68 return timeInit + timeTracklet + timeSelection + timeVertexing;
69}
70
71float Vertexer::clustersToVerticesHybrid(std::function<void(std::string s)> logger)
72{
73 TrackingParameters trkPars;
75 float timeTracklet, timeSelection, timeVertexing, timeInit;
76 mTraits->updateVertexingParameters(mVertParams, tfGPUpar);
77 for (int iteration = 0; iteration < std::min(mVertParams[0].nIterations, (int)mVertParams.size()); ++iteration) {
78 unsigned int nTracklets01, nTracklets12;
79 logger(fmt::format("ITS Hybrid seeding vertexer iteration {} summary:", iteration));
80 trkPars.PhiBins = mTraits->getVertexingParameters()[0].PhiBins;
81 trkPars.ZBins = mTraits->getVertexingParameters()[0].ZBins;
82 auto timeInitIteration = evaluateTask(
83 &Vertexer::initialiseVertexerHybrid, "Hybrid Vertexer initialisation", [](std::string) {}, trkPars, iteration);
84 auto timeTrackletIteration = evaluateTask(
85 &Vertexer::findTrackletsHybrid, "Hybrid Vertexer tracklet finding", [](std::string) {}, iteration);
86 nTracklets01 = mTimeFrame->getTotalTrackletsTF(0);
87 nTracklets12 = mTimeFrame->getTotalTrackletsTF(1);
88 auto timeSelectionIteration = evaluateTask(
89 &Vertexer::validateTrackletsHybrid, "Hybrid Vertexer adjacent tracklets validation", [](std::string) {}, iteration);
90 auto timeVertexingIteration = evaluateTask(
91 &Vertexer::findVerticesHybrid, "Hybrid Vertexer vertex finding", [](std::string) {}, iteration);
92
93 printEpilog(logger, true, nTracklets01, nTracklets12, mTimeFrame->getNLinesTotal(), mTimeFrame->getTotVertIteration()[iteration], timeInitIteration, timeTrackletIteration, timeSelectionIteration, timeVertexingIteration);
94 timeInit += timeInitIteration;
95 timeTracklet += timeTrackletIteration;
96 timeSelection += timeSelectionIteration;
97 timeVertexing += timeVertexingIteration;
98 }
99
100 return timeInit + timeTracklet + timeSelection + timeVertexing;
101}
102
104{
107
108 // This is odd: we override only the parameters for the first iteration.
109 // Variations for the next iterations are set in the trackingInterfrace.
110 mVertParams[0].nIterations = vc.nIterations;
111 mVertParams[0].deltaRof = vc.deltaRof;
112 mVertParams[0].allowSingleContribClusters = vc.allowSingleContribClusters;
113 mVertParams[0].zCut = vc.zCut;
114 mVertParams[0].phiCut = vc.phiCut;
115 mVertParams[0].pairCut = vc.pairCut;
116 mVertParams[0].clusterCut = vc.clusterCut;
117 mVertParams[0].histPairCut = vc.histPairCut;
118 mVertParams[0].tanLambdaCut = vc.tanLambdaCut;
119 mVertParams[0].lowMultBeamDistCut = vc.lowMultBeamDistCut;
120 mVertParams[0].vertNsigmaCut = vc.vertNsigmaCut;
121 mVertParams[0].vertRadiusSigma = vc.vertRadiusSigma;
122 mVertParams[0].trackletSigma = vc.trackletSigma;
123 mVertParams[0].maxZPositionAllowed = vc.maxZPositionAllowed;
124 mVertParams[0].clusterContributorsCut = vc.clusterContributorsCut;
125 mVertParams[0].maxTrackletsPerCluster = vc.maxTrackletsPerCluster;
126 mVertParams[0].phiSpan = vc.phiSpan;
127 mVertParams[0].nThreads = vc.nThreads;
128 mVertParams[0].ZBins = vc.ZBins;
129 mVertParams[0].PhiBins = vc.PhiBins;
130}
131
133{
134 mTimeFrame = &tf;
135 mTraits->adoptTimeFrame(&tf);
136}
137
138void Vertexer::printEpilog(std::function<void(std::string s)> logger,
139 bool isHybrid,
140 const unsigned int trackletN01, const unsigned int trackletN12, const unsigned selectedN, const unsigned int vertexN,
141 const float initT, const float trackletT, const float selecT, const float vertexT)
142{
143 float total = initT + trackletT + selecT + vertexT;
144 logger(fmt::format(" - {}Vertexer: found {} | {} tracklets in: {} ms", isHybrid ? "Hybrid " : "", trackletN01, trackletN12, trackletT));
145 logger(fmt::format(" - {}Vertexer: selected {} tracklets in: {} ms", isHybrid ? "Hybrid " : "", selectedN, selecT));
146 logger(fmt::format(" - {}Vertexer: found {} vertices in: {} ms", isHybrid ? "Hybrid " : "", vertexN, vertexT));
147 // logger(fmt::format(" - Timeframe {} vertexing completed in: {} ms, using {} thread(s).", mTimeFrameCounter++, total, mTraits->getNThreads()));
148}
149
150} // namespace its
151} // namespace o2
Class to compute the primary vertex in ITS from tracklets.
uint32_t getTotalTrackletsTF(const int iLayer)
Definition TimeFrame.h:204
std::vector< int > & getTotVertIteration()
Definition TimeFrame.h:93
int getNLinesTotal() const
Definition TimeFrame.h:194
virtual void adoptTimeFrame(TimeFrame *tf)
virtual void updateVertexingParameters(const std::vector< VertexingParameters > &vrtPar, const TimeFrameGPUParameters &gpuTfPar)
std::vector< VertexingParameters > & getVertexingParameters()
void findTrackletsHybrid(T &&... args)
Definition Vertexer.h:156
void findTracklets(T &&... args)
Definition Vertexer.h:117
void initialiseVertexer(T &&... args)
Definition Vertexer.h:111
float evaluateTask(void(Vertexer::*)(T...), const char *, std::function< void(std::string s)> logger, T &&... args)
Definition Vertexer.h:174
void validateTracklets(T &&... args)
Definition Vertexer.h:138
void findVertices(T &&... args)
Definition Vertexer.h:144
void validateTrackletsHybrid(T &&... args)
Definition Vertexer.h:162
void findVerticesHybrid(T &&... args)
Definition Vertexer.h:168
float clustersToVertices(std::function< void(std::string s)>=[](std::string s) { std::cout<< s<< std::endl;})
Definition Vertexer.cxx:40
float clustersToVerticesHybrid(std::function< void(std::string s)>=[](std::string s) { std::cout<< s<< std::endl;})
Definition Vertexer.cxx:71
void adoptTimeFrame(TimeFrame &tf)
Definition Vertexer.cxx:132
void printEpilog(std::function< void(std::string s)> logger, bool isHybrid, const unsigned int trackletN01, const unsigned int trackletN12, const unsigned selectedN, const unsigned int vertexN, const float initT, const float trackletT, const float selecT, const float vertexT)
Definition Vertexer.cxx:138
Vertexer(VertexerTraits *traits)
Definition Vertexer.cxx:31
void getGlobalConfiguration()
Definition Vertexer.cxx:103
void initialiseVertexerHybrid(T &&... args)
Definition Vertexer.h:150
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::unique_ptr< GPUReconstructionTimeframe > tf
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"