|
15 | 15 | #ifndef O2_ITS_STANDALONE_DEBUGGER_H_ |
16 | 16 | #define O2_ITS_STANDALONE_DEBUGGER_H_ |
17 | 17 |
|
| 18 | +#include <string> |
| 19 | +#include <iterator> |
| 20 | + |
| 21 | +// Tracker |
| 22 | +#include "DataFormatsITS/TrackITS.h" |
| 23 | +#include "ITStracking/ROframe.h" |
| 24 | + |
18 | 25 | namespace o2 |
19 | 26 | { |
20 | 27 |
|
21 | | -class MCCompLabel; |
| 28 | +// class MCCompLabel; |
22 | 29 |
|
23 | 30 | namespace utils |
24 | 31 | { |
25 | 32 | class TreeStreamRedirector; |
26 | 33 | } |
27 | 34 |
|
| 35 | +// namespace its |
| 36 | +// { |
| 37 | +// class TrackITSExt; |
| 38 | +// } |
| 39 | + |
28 | 40 | namespace its |
29 | 41 | { |
30 | 42 | class Tracklet; |
31 | 43 | class Line; |
32 | 44 | class ROframe; |
| 45 | +class ClusterLines; |
| 46 | + |
| 47 | +using constants::its::UnusedIndex; |
| 48 | + |
| 49 | +struct FakeTrackInfo { |
| 50 | + public: |
| 51 | + FakeTrackInfo(); |
| 52 | + FakeTrackInfo(const ROframe& event, TrackITSExt& track) : isFake{false}, isAmbiguousId{false}, mainLabel{UnusedIndex, UnusedIndex, UnusedIndex, false} |
| 53 | + { |
| 54 | + occurrences.clear(); |
| 55 | + for (size_t iCluster{0}; iCluster < 7; ++iCluster) { |
| 56 | + int extIndex = track.getClusterIndex(iCluster); |
| 57 | + o2::MCCompLabel mcLabel = event.getClusterLabels(iCluster, extIndex); |
| 58 | + bool found = false; |
| 59 | + |
| 60 | + for (size_t iOcc{0}; iOcc < occurrences.size(); ++iOcc) { |
| 61 | + std::pair<o2::MCCompLabel, int>& occurrence = occurrences[iOcc]; |
| 62 | + if (mcLabel == occurrence.first) { |
| 63 | + ++occurrence.second; |
| 64 | + found = true; |
| 65 | + } |
| 66 | + } |
| 67 | + if (!found) { |
| 68 | + occurrences.emplace_back(mcLabel, 1); |
| 69 | + } |
| 70 | + } |
| 71 | + if (occurrences.size() > 1) { |
| 72 | + isFake = true; |
| 73 | + } |
| 74 | + std::sort(std::begin(occurrences), std::end(occurrences), [](auto e1, auto e2) { |
| 75 | + return e1.second > e2.second; |
| 76 | + }); |
| 77 | + mainLabel = occurrences[0].first; |
| 78 | + |
| 79 | + for (auto iOcc{1}; iOcc < occurrences.size(); ++iOcc) { |
| 80 | + if (occurrences[iOcc].second == occurrences[0].second) { |
| 81 | + isAmbiguousId = true; |
| 82 | + break; |
| 83 | + } |
| 84 | + } |
| 85 | + for (auto iCluster{0}; iCluster < TrackITSExt::MaxClusters; ++iCluster) { |
| 86 | + int extIndex = track.getClusterIndex(iCluster); |
| 87 | + o2::MCCompLabel lbl = event.getClusterLabels(iCluster, extIndex); |
| 88 | + if (lbl == mainLabel && occurrences[0].second > 1 && !lbl.isNoise()) { // if 7 fake clusters -> occurrences[0].second = 1 |
| 89 | + clusStatuses[iCluster] = 1; |
| 90 | + } else { |
| 91 | + clusStatuses[iCluster] = 0; |
| 92 | + ++nFakeClusters; |
| 93 | + } |
| 94 | + } |
| 95 | + } |
| 96 | + std::vector<std::pair<MCCompLabel, int>> occurrences; |
| 97 | + MCCompLabel mainLabel; |
| 98 | + std::array<int, 7> clusStatuses = {-1, -1, -1, -1, -1, -1, -1}; |
| 99 | + bool isFake; |
| 100 | + bool isAmbiguousId; |
| 101 | + int nFakeClusters = 0; |
| 102 | +}; |
33 | 103 |
|
34 | 104 | class StandaloneDebugger |
35 | 105 | { |
@@ -59,6 +129,9 @@ class StandaloneDebugger |
59 | 129 | void fillXYZHistogramTree(std::array<std::vector<int>, 3>, const std::array<int, 3>); |
60 | 130 | void fillVerticesInfoTree(float x, float y, float z, int size, int rId, int eId, float pur); |
61 | 131 |
|
| 132 | + // Tracker debug utilities |
| 133 | + void dumpTrackToBranchWithInfo(const ROframe event, o2::its::TrackITSExt track, std::string branchName); |
| 134 | + |
62 | 135 | static int getBinIndex(const float, const int, const float, const float); |
63 | 136 |
|
64 | 137 | private: |
|
0 commit comments