Project
Loading...
Searching...
No Matches
TimeFrame.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
24
25#include <iostream>
26
27#ifdef WITH_OPENMP
28#include <omp.h>
29#endif
30
31namespace
32{
33struct ClusterHelper {
34 float phi;
35 float r;
36 int bin;
37 int ind;
38};
39
40float MSangle(float mass, float p, float xX0)
41{
42 float beta = p / o2::gpu::CAMath::Hypot(mass, p);
43 return 0.0136f * o2::gpu::CAMath::Sqrt(xX0) * (1.f + 0.038f * o2::gpu::CAMath::Log(xX0)) / (beta * p);
44}
45
46float Sq(float v)
47{
48 return v * v;
49}
50
51} // namespace
52
53namespace o2
54{
55namespace its
56{
57
62
64{
65 mMinR.resize(nLayers, 10000.);
66 mMaxR.resize(nLayers, -1.);
67 mClusters.resize(nLayers);
68 mUnsortedClusters.resize(nLayers);
69 mTrackingFrameInfo.resize(nLayers);
70 mClusterExternalIndices.resize(nLayers);
71 mUsedClusters.resize(nLayers);
72 mROFramesClusters.resize(nLayers, {0});
73 mNClustersPerROF.resize(nLayers);
74 mTrackletsIndexROF.resize(2, {0});
75}
76
77void TimeFrame::addPrimaryVertices(const std::vector<Vertex>& vertices)
78{
79 for (const auto& vertex : vertices) {
80 mPrimaryVertices.emplace_back(vertex);
81 if (!isBeamPositionOverridden) {
82 const int w{vertex.getNContributors()};
83 mBeamPos[0] = (mBeamPos[0] * mBeamPosWeight + vertex.getX() * w) / (mBeamPosWeight + w);
84 mBeamPos[1] = (mBeamPos[1] * mBeamPosWeight + vertex.getY() * w) / (mBeamPosWeight + w);
85 mBeamPosWeight += w;
86 }
87 }
88 mROFramesPV.push_back(mPrimaryVertices.size());
89}
90
91void TimeFrame::addPrimaryVertices(const std::vector<Vertex>& vertices, const int rofId, const int iteration)
92{
93 addPrimaryVertices(gsl::span<const Vertex>(vertices), rofId, iteration);
94}
95
96void TimeFrame::addPrimaryVerticesLabels(std::vector<std::pair<MCCompLabel, float>>& labels)
97{
98 mVerticesMCRecInfo.insert(mVerticesMCRecInfo.end(), labels.begin(), labels.end());
99}
100
101void TimeFrame::addPrimaryVerticesInROF(const std::vector<Vertex>& vertices, const int rofId, const int iteration)
102{
103 mPrimaryVertices.insert(mPrimaryVertices.begin() + mROFramesPV[rofId], vertices.begin(), vertices.end());
104 for (int i = rofId + 1; i < mROFramesPV.size(); ++i) {
105 mROFramesPV[i] += vertices.size();
106 }
107 mTotVertPerIteration[iteration] += vertices.size();
108}
109
110void TimeFrame::addPrimaryVerticesLabelsInROF(const std::vector<std::pair<MCCompLabel, float>>& labels, const int rofId)
111{
112 mVerticesMCRecInfo.insert(mVerticesMCRecInfo.begin() + mROFramesPV[rofId], labels.begin(), labels.end());
113}
114
115void TimeFrame::addPrimaryVertices(const gsl::span<const Vertex>& vertices, const int rofId, const int iteration)
116{
117 std::vector<Vertex> futureVertices;
118 for (const auto& vertex : vertices) {
119 if (vertex.getTimeStamp().getTimeStamp() < rofId) { // put a copy in the past
120 insertPastVertex(vertex, iteration);
121 } else {
122 if (vertex.getTimeStamp().getTimeStamp() > rofId) { // or put a copy in the future
123 futureVertices.emplace_back(vertex);
124 }
125 }
126 mPrimaryVertices.emplace_back(vertex); // put a copy in the present
127 mTotVertPerIteration[iteration]++;
128 if (!isBeamPositionOverridden) { // beam position is updated only at first occurrence of the vertex. A bit sketchy if we have past/future vertices, it should not impact too much.
129 const int w{vertex.getNContributors()};
130 mBeamPos[0] = (mBeamPos[0] * mBeamPosWeight + vertex.getX() * w) / (mBeamPosWeight + w);
131 mBeamPos[1] = (mBeamPos[1] * mBeamPosWeight + vertex.getY() * w) / (mBeamPosWeight + w);
132 mBeamPosWeight += w;
133 }
134 }
135 mROFramesPV.push_back(mPrimaryVertices.size()); // current rof must have number of vertices up to present
136 if (futureVertices.size()) { // append future vertices. In the last rofId we cannot have ones from the next, so we are never here.
137 for (auto& vertex : futureVertices) {
138 mPrimaryVertices.emplace_back(vertex);
139 mTotVertPerIteration[iteration]++;
140 }
141 }
142}
143
144int TimeFrame::loadROFrameData(const o2::itsmft::ROFRecord& rof, gsl::span<const itsmft::Cluster> clusters,
146{
149 int clusterId{0};
150
151 auto first = rof.getFirstEntry();
152 auto clusters_in_frame = rof.getROFData(clusters);
153 for (auto& c : clusters_in_frame) {
154 int layer = geom->getLayer(c.getSensorID());
155
157 auto xyz = c.getXYZGloRot(*geom);
158 addTrackingFrameInfoToLayer(layer, xyz.x(), xyz.y(), xyz.z(), c.getX(), geom->getSensorRefAlpha(c.getSensorID()),
159 std::array<float, 2>{c.getY(), c.getZ()},
160 std::array<float, 3>{c.getSigmaY2(), c.getSigmaYZ(), c.getSigmaZ2()});
161
163 addClusterToLayer(layer, xyz.x(), xyz.y(), xyz.z(), mUnsortedClusters[layer].size());
165 clusterId++;
166 }
167
168 for (unsigned int iL{0}; iL < mUnsortedClusters.size(); ++iL) {
169 mNClustersPerROF[iL].push_back(mUnsortedClusters[iL].size() - mROFramesClusters[iL].back());
170 mROFramesClusters[iL].push_back(mUnsortedClusters[iL].size());
171 if (iL < 2) {
172 mTrackletsIndexROF[iL].push_back(mUnsortedClusters[1].size()); // Tracklets used in vertexer are always computed starting from L1
173 }
174 }
175 if (mcLabels) {
176 mClusterLabels = mcLabels;
177 }
178 mNrof++;
179 return clusters_in_frame.size();
180}
181
182int TimeFrame::loadROFrameData(gsl::span<o2::itsmft::ROFRecord> rofs,
183 gsl::span<const itsmft::CompClusterExt> clusters,
184 gsl::span<const unsigned char>::iterator& pattIt,
185 const itsmft::TopologyDictionary* dict,
187{
188 for (int iLayer{0}; iLayer < mUnsortedClusters.size(); ++iLayer) {
192 mROFramesClusters[iLayer].resize(1, 0);
193
194 if (iLayer < 2) {
195 deepVectorClear(mTrackletsIndexROF[iLayer]);
198 }
199 }
200
203
204 mNrof = 0;
205 deepVectorClear(mClusterSize);
206 mClusterSize.reserve(clusters.size());
207 for (auto& rof : rofs) {
208 for (int clusterId{rof.getFirstEntry()}; clusterId < rof.getFirstEntry() + rof.getNEntries(); ++clusterId) {
209 auto& c = clusters[clusterId];
210
211 int layer = geom->getLayer(c.getSensorID());
212
213 auto pattID = c.getPatternID();
215 float sigmaY2 = DefClusError2Row, sigmaZ2 = DefClusError2Col, sigmaYZ = 0; // Dummy COG errors (about half pixel size)
216 unsigned int clusterSize{0};
218 sigmaY2 = dict->getErr2X(pattID);
219 sigmaZ2 = dict->getErr2Z(pattID);
220 if (!dict->isGroup(pattID)) {
221 locXYZ = dict->getClusterCoordinates(c);
222 clusterSize = dict->getNpixels(pattID);
223 } else {
224 o2::itsmft::ClusterPattern patt(pattIt);
225 locXYZ = dict->getClusterCoordinates(c, patt);
226 clusterSize = patt.getNPixels();
227 }
228 } else {
229 o2::itsmft::ClusterPattern patt(pattIt);
230 locXYZ = dict->getClusterCoordinates(c, patt, false);
231 clusterSize = patt.getNPixels();
232 }
233 if (clusterSize < 255) {
234 mClusterSize.push_back(clusterSize);
235 } else {
236 mClusterSize.push_back(255);
237 }
238 auto sensorID = c.getSensorID();
239 // Inverse transformation to the local --> tracking
240 auto trkXYZ = geom->getMatrixT2L(sensorID) ^ locXYZ;
241 // Transformation to the local --> global
242 auto gloXYZ = geom->getMatrixL2G(sensorID) * locXYZ;
243
244 addTrackingFrameInfoToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), trkXYZ.x(), geom->getSensorRefAlpha(sensorID),
245 std::array<float, 2>{trkXYZ.y(), trkXYZ.z()},
246 std::array<float, 3>{sigmaY2, sigmaYZ, sigmaZ2});
247
249 addClusterToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), mUnsortedClusters[layer].size());
251 }
252 for (unsigned int iL{0}; iL < mUnsortedClusters.size(); ++iL) {
253 mROFramesClusters[iL].push_back(mUnsortedClusters[iL].size());
254 }
255 mNrof++;
256 }
257
258 for (auto i = 0; i < mNTrackletsPerCluster.size(); ++i) {
260 mNTrackletsPerClusterSum[i].resize(mUnsortedClusters[1].size() + 1); // Exc sum "prepends" a 0
261 }
262
263 if (mcLabels) {
264 mClusterLabels = mcLabels;
265 }
266 return mNrof;
267}
268
270{
271 size_t totalClusters{0};
272 for (auto& clusters : mUnsortedClusters) {
273 totalClusters += clusters.size();
274 }
275 return int(totalClusters);
276}
277
278void TimeFrame::prepareClusters(const TrackingParameters& trkParam, const int maxLayers)
279{
280 std::vector<ClusterHelper> cHelper;
281 std::vector<int> clsPerBin(trkParam.PhiBins * trkParam.ZBins, 0);
282 for (int rof{0}; rof < mNrof; ++rof) {
283 if ((int)mMultiplicityCutMask.size() == mNrof && !mMultiplicityCutMask[rof]) {
284 continue;
285 }
286 for (int iLayer{0}; iLayer < std::min(trkParam.NLayers, maxLayers); ++iLayer) {
287 std::fill(clsPerBin.begin(), clsPerBin.end(), 0);
288 const auto unsortedClusters{getUnsortedClustersOnLayer(rof, iLayer)};
289 const int clustersNum{static_cast<int>(unsortedClusters.size())};
290
291 deepVectorClear(cHelper);
292 cHelper.resize(clustersNum);
293
294 for (int iCluster{0}; iCluster < clustersNum; ++iCluster) {
295
296 const Cluster& c = unsortedClusters[iCluster];
297 ClusterHelper& h = cHelper[iCluster];
298 float x = c.xCoordinate - mBeamPos[0];
299 float y = c.yCoordinate - mBeamPos[1];
300 const float& z = c.zCoordinate;
301 float phi = math_utils::computePhi(x, y);
302 int zBin{mIndexTableUtils.getZBinIndex(iLayer, z)};
303 if (zBin < 0) {
304 zBin = 0;
305 mBogusClusters[iLayer]++;
306 } else if (zBin >= trkParam.ZBins) {
307 zBin = trkParam.ZBins - 1;
308 mBogusClusters[iLayer]++;
309 }
310 int bin = mIndexTableUtils.getBinIndex(zBin, mIndexTableUtils.getPhiBinIndex(phi));
311 h.phi = phi;
312 h.r = math_utils::hypot(x, y);
313 mMinR[iLayer] = o2::gpu::GPUCommonMath::Min(h.r, mMinR[iLayer]);
314 mMaxR[iLayer] = o2::gpu::GPUCommonMath::Max(h.r, mMaxR[iLayer]);
315 h.bin = bin;
316 h.ind = clsPerBin[bin]++;
317 }
318 std::vector<int> lutPerBin(clsPerBin.size());
319 lutPerBin[0] = 0;
320 for (unsigned int iB{1}; iB < lutPerBin.size(); ++iB) {
321 lutPerBin[iB] = lutPerBin[iB - 1] + clsPerBin[iB - 1];
322 }
323
324 auto clusters2beSorted{getClustersOnLayer(rof, iLayer)};
325 for (int iCluster{0}; iCluster < clustersNum; ++iCluster) {
326 const ClusterHelper& h = cHelper[iCluster];
327
328 Cluster& c = clusters2beSorted[lutPerBin[h.bin] + h.ind];
329 c = unsortedClusters[iCluster];
330 c.phi = h.phi;
331 c.radius = h.r;
332 c.indexTableBinIndex = h.bin;
333 }
334
335 for (unsigned int iB{0}; iB < clsPerBin.size(); ++iB) {
336 mIndexTables[iLayer][rof * (trkParam.ZBins * trkParam.PhiBins + 1) + iB] = lutPerBin[iB];
337 }
338 for (auto iB{clsPerBin.size()}; iB < (trkParam.ZBins * trkParam.PhiBins + 1); iB++) {
339 mIndexTables[iLayer][rof * (trkParam.ZBins * trkParam.PhiBins + 1) + iB] = clustersNum;
340 }
341 }
342 }
343}
344
345void TimeFrame::initialise(const int iteration, const TrackingParameters& trkParam, const int maxLayers, bool resetVertices)
346{
347 if (iteration == 0) {
348 if (maxLayers < trkParam.NLayers && resetVertices) {
349 resetRofPV();
350 deepVectorClear(mTotVertPerIteration);
351 }
353 deepVectorClear(mTracksLabel);
354 deepVectorClear(mLinesLabels);
355 if (resetVertices) {
356 deepVectorClear(mVerticesMCRecInfo);
357 }
358 mTracks.resize(mNrof);
359 mTracksLabel.resize(mNrof);
360 mLinesLabels.resize(mNrof);
361 mCells.resize(trkParam.CellsPerRoad());
362 mCellsLookupTable.resize(trkParam.CellsPerRoad() - 1);
363 mCellsNeighbours.resize(trkParam.CellsPerRoad() - 1);
364 mCellsNeighboursLUT.resize(trkParam.CellsPerRoad() - 1);
365 mCellLabels.resize(trkParam.CellsPerRoad());
366 mTracklets.resize(std::min(trkParam.TrackletsPerRoad(), maxLayers - 1));
367 mTrackletLabels.resize(trkParam.TrackletsPerRoad());
368 mTrackletsLookupTable.resize(trkParam.CellsPerRoad());
370 mPositionResolution.resize(trkParam.NLayers);
371 mBogusClusters.resize(trkParam.NLayers, 0);
372 deepVectorClear(mLines);
373 deepVectorClear(mTrackletClusters);
374 for (unsigned int iLayer{0}; iLayer < std::min((int)mClusters.size(), maxLayers); ++iLayer) {
375 deepVectorClear(mClusters[iLayer]);
376 mClusters[iLayer].resize(mUnsortedClusters[iLayer].size());
378 mUsedClusters[iLayer].resize(mUnsortedClusters[iLayer].size(), false);
379 mPositionResolution[iLayer] = o2::gpu::CAMath::Sqrt(0.5 * (trkParam.SystErrorZ2[iLayer] + trkParam.SystErrorY2[iLayer]) + trkParam.LayerResolution[iLayer] * trkParam.LayerResolution[iLayer]);
380 }
382 mIndexTables.resize(mClusters.size(), std::vector<int>(mNrof * (trkParam.ZBins * trkParam.PhiBins + 1), 0));
383 mLines.resize(mNrof);
384 mTrackletClusters.resize(mNrof);
385
386 for (int iLayer{0}; iLayer < trkParam.NLayers; ++iLayer) {
387 if (trkParam.SystErrorY2[iLayer] > 0.f || trkParam.SystErrorZ2[iLayer] > 0.f) {
388 for (auto& tfInfo : mTrackingFrameInfo[iLayer]) {
390 tfInfo.covarianceTrackingFrame[0] += trkParam.SystErrorY2[iLayer];
391 tfInfo.covarianceTrackingFrame[2] += trkParam.SystErrorZ2[iLayer];
392 }
393 }
394 }
395 }
396 mNTrackletsPerROF.resize(2);
397 for (auto& v : mNTrackletsPerROF) {
398 v = std::vector<int>(mNrof + 1, 0);
399 }
400 if (iteration == 0 || iteration == 3) {
401 prepareClusters(trkParam, maxLayers);
402 }
403 mTotalTracklets = {0, 0};
404 if (maxLayers < trkParam.NLayers) { // Vertexer only, but in both iterations
405 for (size_t iLayer{0}; iLayer < maxLayers; ++iLayer) {
407 mUsedClusters[iLayer].resize(mUnsortedClusters[iLayer].size(), false);
408 }
409 }
410
411 mTotVertPerIteration.resize(1 + iteration);
412 mNoVertexROF = 0;
414 deepVectorClear(mRoadLabels);
415
416 mMSangles.resize(trkParam.NLayers);
417 mPhiCuts.resize(mClusters.size() - 1, 0.f);
418
419 float oneOverR{0.001f * 0.3f * std::abs(mBz) / trkParam.TrackletMinPt};
420 for (unsigned int iLayer{0}; iLayer < mClusters.size(); ++iLayer) {
421 mMSangles[iLayer] = MSangle(0.14f, trkParam.TrackletMinPt, trkParam.LayerxX0[iLayer]);
422 mPositionResolution[iLayer] = o2::gpu::CAMath::Sqrt(0.5f * (trkParam.SystErrorZ2[iLayer] + trkParam.SystErrorY2[iLayer]) + trkParam.LayerResolution[iLayer] * trkParam.LayerResolution[iLayer]);
423 if (iLayer < mClusters.size() - 1) {
424 const float& r1 = trkParam.LayerRadii[iLayer];
425 const float& r2 = trkParam.LayerRadii[iLayer + 1];
426 const float res1 = o2::gpu::CAMath::Hypot(trkParam.PVres, mPositionResolution[iLayer]);
427 const float res2 = o2::gpu::CAMath::Hypot(trkParam.PVres, mPositionResolution[iLayer + 1]);
428 const float cosTheta1half = o2::gpu::CAMath::Sqrt(1.f - Sq(0.5f * r1 * oneOverR));
429 const float cosTheta2half = o2::gpu::CAMath::Sqrt(1.f - Sq(0.5f * r2 * oneOverR));
430 float x = r2 * cosTheta1half - r1 * cosTheta2half;
431 float delta = o2::gpu::CAMath::Sqrt(1. / (1.f - 0.25f * Sq(x * oneOverR)) * (Sq(0.25f * r1 * r2 * Sq(oneOverR) / cosTheta2half + cosTheta1half) * Sq(res1) + Sq(0.25f * r1 * r2 * Sq(oneOverR) / cosTheta1half + cosTheta2half) * Sq(res2)));
432 mPhiCuts[iLayer] = std::min(o2::gpu::CAMath::ASin(0.5f * x * oneOverR) + 2.f * mMSangles[iLayer] + delta, constants::math::Pi * 0.5f);
433 }
434 }
435
436 for (int iLayer{0}; iLayer < std::min((int)mTracklets.size(), maxLayers); ++iLayer) {
438 deepVectorClear(mTrackletLabels[iLayer]);
439 if (iLayer < (int)mCells.size()) {
440 deepVectorClear(mCells[iLayer]);
442 mTrackletsLookupTable[iLayer].resize(mClusters[iLayer + 1].size(), 0);
443 deepVectorClear(mCellLabels[iLayer]);
444 }
445
446 if (iLayer < (int)mCells.size() - 1) {
449 deepVectorClear(mCellsNeighboursLUT[iLayer]);
450 }
451 }
452}
453
455{
456 unsigned long size{0};
457 for (auto& trkl : mTracklets) {
458 size += sizeof(Tracklet) * trkl.size();
459 }
460 for (auto& cells : mCells) {
461 size += sizeof(CellSeed) * cells.size();
462 }
463 for (auto& cellsN : mCellsNeighbours) {
464 size += sizeof(int) * cellsN.size();
465 }
466 return size + sizeof(Road<5>) * mRoads.size();
467}
468
470{
471 if (mPValphaX.size()) {
472 mPValphaX.clear();
473 }
474 mPValphaX.reserve(mPrimaryVertices.size());
475 for (auto& pv : mPrimaryVertices) {
476 mPValphaX.emplace_back(std::array<float, 2>{o2::gpu::CAMath::Hypot(pv.getX(), pv.getY()), math_utils::computePhi(pv.getX(), pv.getY())});
477 }
478}
479
481{
482 for (ushort iLayer = 0; iLayer < 2; ++iLayer) {
483 for (unsigned int iRof{0}; iRof < mNrof; ++iRof) {
484 if (mMultiplicityCutMask[iRof]) {
485 mTotalTracklets[iLayer] += mNTrackletsPerROF[iLayer][iRof];
486 }
487 }
488 std::exclusive_scan(mNTrackletsPerROF[iLayer].begin(), mNTrackletsPerROF[iLayer].end(), mNTrackletsPerROF[iLayer].begin(), 0);
489 std::exclusive_scan(mNTrackletsPerCluster[iLayer].begin(), mNTrackletsPerCluster[iLayer].end(), mNTrackletsPerClusterSum[iLayer].begin(), 0);
490 }
491}
492
494{
495 for (uint32_t iLayer{0}; iLayer < getTracklets().size(); ++iLayer) {
496 int prev{-1};
497 int count{0};
498 for (uint32_t iTracklet{0}; iTracklet < getTracklets()[iLayer].size(); ++iTracklet) {
499 auto& trk = getTracklets()[iLayer][iTracklet];
500 int currentId{trk.firstClusterIndex};
501 if (currentId < prev) {
502 std::cout << "First Cluster Index not increasing monotonically on L:T:ID:Prev " << iLayer << "\t" << iTracklet << "\t" << currentId << "\t" << prev << std::endl;
503 } else if (currentId == prev) {
504 count++;
505 } else {
506 if (iLayer > 0) {
507 auto& lut{getTrackletsLookupTable()[iLayer - 1]};
508 if (count != lut[prev + 1] - lut[prev]) {
509 std::cout << "LUT count broken " << iLayer - 1 << "\t" << prev << "\t" << count << "\t" << lut[prev + 1] << "\t" << lut[prev] << std::endl;
510 }
511 }
512 count = 1;
513 }
514 prev = currentId;
515 if (iLayer > 0) {
516 auto& lut{getTrackletsLookupTable()[iLayer - 1]};
517 if (iTracklet >= (uint32_t)(lut[currentId + 1]) || iTracklet < (uint32_t)(lut[currentId])) {
518 std::cout << "LUT broken: " << iLayer - 1 << "\t" << currentId << "\t" << iTracklet << std::endl;
519 }
520 }
521 }
522 }
523}
524
526{
527 mMinR.resize(nLayers, 10000.);
528 mMaxR.resize(nLayers, -1.);
529 mClusters.resize(nLayers);
530 mUnsortedClusters.resize(nLayers);
531 mTrackingFrameInfo.resize(nLayers);
532 mClusterExternalIndices.resize(nLayers);
533 mUsedClusters.resize(nLayers);
534 mROFramesClusters.resize(nLayers, {0});
535 mNClustersPerROF.resize(nLayers);
536 mTrackletsIndexROF.resize(2, {0});
537}
538
540{
541 std::cout << "--------" << std::endl
542 << "Tracklet LUT " << i << std::endl;
543 for (int j : mTrackletsLookupTable[i]) {
544 std::cout << j << "\t";
545 }
546 std::cout << "\n--------" << std::endl
547 << std::endl;
548}
549
551{
552 std::cout << "--------" << std::endl
553 << "Cell LUT " << i << std::endl;
554 for (int j : mCellsLookupTable[i]) {
555 std::cout << j << "\t";
556 }
557 std::cout << "\n--------" << std::endl
558 << std::endl;
559}
560
562{
563 for (unsigned int i{0}; i < mTrackletsLookupTable.size(); ++i) {
565 }
566}
567
569{
570 for (unsigned int i{0}; i < mCellsLookupTable.size(); ++i) {
572 }
573}
574
576{
577 std::cout << "Vertices in ROF (nROF = " << mNrof << ", lut size = " << mROFramesPV.size() << ")" << std::endl;
578 for (unsigned int iR{0}; iR < mROFramesPV.size(); ++iR) {
579 std::cout << mROFramesPV[iR] << "\t";
580 }
581 std::cout << "\n\n Vertices:" << std::endl;
582 for (unsigned int iV{0}; iV < mPrimaryVertices.size(); ++iV) {
583 std::cout << mPrimaryVertices[iV].getX() << "\t" << mPrimaryVertices[iV].getY() << "\t" << mPrimaryVertices[iV].getZ() << std::endl;
584 }
585 std::cout << "--------" << std::endl;
586}
587
589{
590 std::cout << "--------" << std::endl;
591 for (unsigned int iLayer{0}; iLayer < mROFramesClusters.size(); ++iLayer) {
592 std::cout << "Layer " << iLayer << std::endl;
593 for (auto value : mROFramesClusters[iLayer]) {
594 std::cout << value << "\t";
595 }
596 std::cout << std::endl;
597 }
598}
599
601{
602 std::cout << "--------" << std::endl;
603 for (unsigned int iLayer{0}; iLayer < mNClustersPerROF.size(); ++iLayer) {
604 std::cout << "Layer " << iLayer << std::endl;
605 for (auto& value : mNClustersPerROF[iLayer]) {
606 std::cout << value << "\t";
607 }
608 std::cout << std::endl;
609 }
610}
611
612void TimeFrame::printSliceInfo(const int startROF, const int sliceSize)
613{
614 std::cout << "Dumping slice of " << sliceSize << " rofs:" << std::endl;
615 for (int iROF{startROF}; iROF < startROF + sliceSize; ++iROF) {
616 std::cout << "ROF " << iROF << " dump:" << std::endl;
617 for (unsigned int iLayer{0}; iLayer < mClusters.size(); ++iLayer) {
618 std::cout << "Layer " << iLayer << " has: " << getClustersOnLayer(iROF, iLayer).size() << " clusters." << std::endl;
619 }
620 std::cout << "Number of seeding vertices: " << getPrimaryVertices(iROF).size() << std::endl;
621 int iVertex{0};
622 for (auto& v : getPrimaryVertices(iROF)) {
623 std::cout << "\t vertex " << iVertex++ << ": x=" << v.getX() << " " << " y=" << v.getY() << " z=" << v.getZ() << " has " << v.getNContributors() << " contributors." << std::endl;
624 }
625 }
626}
627
628} // namespace its
629} // namespace o2
Definition of the ITSMFT compact cluster.
Definition of the ITSMFT cluster.
Definition of the ClusterTopology class.
uint64_t vertex
Definition RawEventData.h:9
int32_t i
Definition of the GeometryTGeo class.
Definition of the ITSMFT ROFrame (trigger) record.
uint32_t j
Definition RawData.h:0
uint32_t c
Definition RawData.h:2
Definition of the SegmentationAlpide class.
int clusterSize
Class for time synchronization of RawReader instances.
A container to hold and manage MC truth information/labels.
const Mat3D & getMatrixL2G(int sensID) const
HMPID cluster implementation.
Definition Cluster.h:27
const Mat3D & getMatrixT2L(int lay, int hba, int sta, int det) const
int getLayer(int index) const
Get chip layer, from 0.
float getSensorRefAlpha(int isn) const
static GeometryTGeo * Instance()
void fillMatrixCache(int mask) override
void setTrackingParameters(const T &params)
gsl::span< const Vertex > getPrimaryVertices(int rofId) const
Definition TimeFrame.h:355
TimeFrame(int nLayers=7)
Definition TimeFrame.cxx:63
std::vector< std::vector< int > > & getTrackletsLookupTable()
Definition TimeFrame.h:587
void resizeVectors(int nLayers)
std::vector< std::vector< int > > mCellsLookupTable
Definition TimeFrame.h:296
std::array< std::vector< int >, 2 > mNTrackletsPerClusterSum
Definition TimeFrame.h:274
void fillPrimaryVerticesXandAlpha()
std::vector< std::vector< int > > mROFramesClusters
Definition TimeFrame.h:271
void printTrackletLUTonLayer(int i)
IndexTableUtils mIndexTableUtils
Definition TimeFrame.h:264
unsigned long getArtefactsMemory()
std::vector< std::vector< TrackingFrameInfo > > mTrackingFrameInfo
Definition TimeFrame.h:269
void addPrimaryVerticesInROF(const std::vector< Vertex > &vertices, const int rofId, const int iteration)
std::vector< uint8_t > mMultiplicityCutMask
Definition TimeFrame.h:297
void initialise(const int iteration, const TrackingParameters &trkParam, const int maxLayers=7, bool resetVertices=true)
gsl::span< const Cluster > getUnsortedClustersOnLayer(int rofId, int layerId) const
Definition TimeFrame.h:490
std::vector< std::vector< unsigned char > > mUsedClusters
Definition TimeFrame.h:278
void addPrimaryVerticesLabels(std::vector< std::pair< MCCompLabel, float > > &labels)
Definition TimeFrame.cxx:96
void addTrackingFrameInfoToLayer(int layer, T &&... args)
Definition TimeFrame.h:555
std::vector< std::vector< TrackITSExt > > mTracks
Definition TimeFrame.h:294
std::vector< Vertex > mPrimaryVertices
Definition TimeFrame.h:283
void computeTrackletsPerROFScans()
std::vector< std::vector< Tracklet > > & getTracklets()
Definition TimeFrame.h:582
std::vector< std::vector< Cluster > > mUnsortedClusters
Definition TimeFrame.h:288
const dataformats::MCTruthContainer< MCCompLabel > * mClusterLabels
Definition TimeFrame.h:272
void checkTrackletLUTs()
Debug and printing.
std::vector< std::vector< int > > mClusterExternalIndices
Definition TimeFrame.h:270
std::vector< int > mROFramesPV
Definition TimeFrame.h:282
std::vector< std::vector< int > > mNClustersPerROF
Definition TimeFrame.h:275
std::vector< std::vector< int > > mCellsNeighbours
Definition TimeFrame.h:295
int loadROFrameData(const o2::itsmft::ROFRecord &rof, gsl::span< const itsmft::Cluster > clusters, const dataformats::MCTruthContainer< MCCompLabel > *mcLabels=nullptr)
std::vector< std::vector< Tracklet > > mTracklets
Definition TimeFrame.h:289
std::vector< std::vector< Cluster > > mClusters
Definition TimeFrame.h:268
gsl::span< Cluster > getClustersOnLayer(int rofId, int layerId)
Definition TimeFrame.h:413
void addPrimaryVerticesLabelsInROF(const std::vector< std::pair< MCCompLabel, float > > &labels, const int rofId)
std::vector< Road< 5 > > mRoads
Definition TimeFrame.h:293
std::vector< std::vector< int > > mIndexTables
Definition TimeFrame.h:276
void addClusterExternalIndexToLayer(int layer, const int idx)
Definition TimeFrame.h:560
void printCellLUTonLayer(int i)
std::vector< std::vector< int > > mTrackletsLookupTable
Definition TimeFrame.h:277
int getTotalClusters() const
void addPrimaryVertices(const std::vector< Vertex > &vertices)
Definition TimeFrame.cxx:77
std::vector< std::vector< CellSeed > > mCells
Definition TimeFrame.h:290
std::array< std::vector< int >, 2 > mNTrackletsPerCluster
Definition TimeFrame.h:273
void addClusterToLayer(int layer, T &&... args)
Definition TimeFrame.h:549
void insertPastVertex(const Vertex &vertex, const int refROFId)
Definition TimeFrame.h:741
void deepVectorClear(std::vector< T > &vec)
Definition TimeFrame.h:309
void printSliceInfo(const int, const int)
int getNPixels() const
Returns the number of fired pixels.
static constexpr unsigned short InvalidPatternID
Definition CompCluster.h:46
gsl::span< const T > getROFData(const gsl::span< const T > tfdata) const
Definition ROFRecord.h:73
int getFirstEntry() const
Definition ROFRecord.h:63
static constexpr float PitchCol
static constexpr float PitchRow
math_utils::Point3D< T > getClusterCoordinates(const CompCluster &cl) const
float getErr2X(int n) const
Returns the error^2 on the x position of the COG for the n_th element.
int getNpixels(int n) const
Returns the number of fired pixels of the n_th element.
bool isGroup(int n) const
Returns true if the element corresponds to a group of rare topologies.
float getErr2Z(int n) const
Returns the error^2 on the z position of the COG for the n_th element.
GLint GLenum GLint x
Definition glcorearb.h:403
GLint GLsizei count
Definition glcorearb.h:399
GLsizeiptr size
Definition glcorearb.h:659
GLuint GLuint end
Definition glcorearb.h:469
const GLdouble * v
Definition glcorearb.h:832
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLboolean r
Definition glcorearb.h:1233
GLubyte GLubyte GLubyte GLubyte w
Definition glcorearb.h:852
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
constexpr float Pi
Definition Constants.h:43
constexpr float DefClusError2Col
Definition TimeFrame.cxx:61
constexpr float DefClusError2Row
Definition TimeFrame.cxx:60
constexpr float DefClusErrorRow
Definition TimeFrame.cxx:58
constexpr float DefClusErrorCol
Definition TimeFrame.cxx:59
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< float > LayerRadii
std::vector< float > SystErrorY2
std::vector< float > SystErrorZ2
float TrackletMinPt
Trackleting cuts.
std::vector< float > LayerResolution
std::vector< float > LayerxX0
static constexpr int L2G
Definition Cartesian.h:54
static constexpr int T2L
Definition Cartesian.h:55
std::vector< Cluster > clusters
std::vector< Cell > cells