|
21 | 21 | #include "ITStracking/VertexerTraits.h" |
22 | 22 | #include "ITStracking/TrackingConfigParam.h" |
23 | 23 |
|
24 | | -#include <array> |
25 | | - |
26 | | -namespace o2 |
27 | | -{ |
28 | | -namespace its |
| 24 | +namespace o2::its |
29 | 25 | { |
30 | 26 |
|
31 | | -Vertexer::Vertexer(VertexerTraits* traits) |
| 27 | +Vertexer::Vertexer(VertexerTraits* traits) : mTraits(traits) |
32 | 28 | { |
33 | | - if (!traits) { |
| 29 | + if (!mTraits) { |
34 | 30 | LOG(fatal) << "nullptr passed to ITS vertexer construction."; |
35 | 31 | } |
36 | 32 | mVertParams.resize(1); |
37 | | - mTraits = traits; |
38 | 33 | } |
39 | 34 |
|
40 | | -float Vertexer::clustersToVertices(std::function<void(std::string s)> logger) |
| 35 | +float Vertexer::clustersToVertices(LogFunc logger) |
41 | 36 | { |
| 37 | + LogFunc evalLog = [](const std::string&) {}; |
42 | 38 | TrackingParameters trkPars; |
43 | 39 | TimeFrameGPUParameters tfGPUpar; |
44 | 40 | mTraits->updateVertexingParameters(mVertParams, tfGPUpar); |
45 | 41 | float timeTracklet{0.f}, timeSelection{0.f}, timeVertexing{0.f}, timeInit{0.f}; |
46 | 42 | 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)); |
| 43 | + unsigned int nTracklets01{0}, nTracklets12{0}; |
| 44 | + logger(fmt::format("=== ITS {} Seeding vertexer iteration {} summary:", mTraits->getName(), iteration)); |
49 | 45 | trkPars.PhiBins = mTraits->getVertexingParameters()[0].PhiBins; |
50 | 46 | trkPars.ZBins = mTraits->getVertexingParameters()[0].ZBins; |
51 | 47 | auto timeInitIteration = evaluateTask( |
52 | | - &Vertexer::initialiseVertexer, "Vertexer initialisation", [](std::string) {}, trkPars, iteration); |
| 48 | + &Vertexer::initialiseVertexer, " - Vertexer initialisation", evalLog, trkPars, iteration); |
53 | 49 | auto timeTrackletIteration = evaluateTask( |
54 | | - &Vertexer::findTracklets, "Vertexer tracklet finding", [](std::string) {}, iteration); |
| 50 | + &Vertexer::findTracklets, " - Vertexer tracklet finding", evalLog, iteration); |
55 | 51 | nTracklets01 = mTimeFrame->getTotalTrackletsTF(0); |
56 | 52 | nTracklets12 = mTimeFrame->getTotalTrackletsTF(1); |
57 | 53 | auto timeSelectionIteration = evaluateTask( |
58 | | - &Vertexer::validateTracklets, "Vertexer tracklets validation", [](std::string) {}, iteration); |
| 54 | + &Vertexer::validateTracklets, " - Vertexer tracklets validation", evalLog, iteration); |
59 | 55 | 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 | | - |
71 | | -float Vertexer::clustersToVerticesHybrid(std::function<void(std::string s)> logger) |
72 | | -{ |
73 | | - TrackingParameters trkPars; |
74 | | - TimeFrameGPUParameters tfGPUpar; |
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); |
| 56 | + &Vertexer::findVertices, " - Vertexer vertex finding", evalLog, iteration); |
| 57 | + printEpilog(logger, nTracklets01, nTracklets12, mTimeFrame->getNLinesTotal(), mTimeFrame->getTotVertIteration()[iteration], timeInitIteration, timeTrackletIteration, timeSelectionIteration, timeVertexingIteration); |
94 | 58 | timeInit += timeInitIteration; |
95 | 59 | timeTracklet += timeTrackletIteration; |
96 | 60 | timeSelection += timeSelectionIteration; |
@@ -135,17 +99,16 @@ void Vertexer::adoptTimeFrame(TimeFrame& tf) |
135 | 99 | mTraits->adoptTimeFrame(&tf); |
136 | 100 | } |
137 | 101 |
|
138 | | -void 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) |
| 102 | +void Vertexer::printEpilog(LogFunc& logger, |
| 103 | + const unsigned int trackletN01, const unsigned int trackletN12, |
| 104 | + const unsigned selectedN, const unsigned int vertexN, const float initT, |
| 105 | + const float trackletT, const float selecT, const float vertexT) |
142 | 106 | { |
143 | 107 | 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)); |
| 108 | + logger(fmt::format(" - {} Vertexer: found {} | {} tracklets in: {} ms", mTraits->getName(), trackletN01, trackletN12, trackletT)); |
| 109 | + logger(fmt::format(" - {} Vertexer: selected {} tracklets in: {} ms", mTraits->getName(), selectedN, selecT)); |
| 110 | + logger(fmt::format(" - {} Vertexer: found {} vertices in: {} ms", mTraits->getName(), vertexN, vertexT)); |
147 | 111 | // logger(fmt::format(" - Timeframe {} vertexing completed in: {} ms, using {} thread(s).", mTimeFrameCounter++, total, mTraits->getNThreads())); |
148 | 112 | } |
149 | 113 |
|
150 | | -} // namespace its |
151 | | -} // namespace o2 |
| 114 | +} // namespace o2::its |
0 commit comments