Skip to content

Commit d9d6894

Browse files
committed
TPC QA: Separate normalized attached counts for non-fake and all tracks
1 parent 2a7442d commit d9d6894

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

GPU/GPUTracking/qa/GPUQA.cxx

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ inline float GPUQA::GetMCLabelWeight(const mcLabel_t& label) { return 1; }
234234
inline bool GPUQA::mcPresent() { return !mConfig.noMC && mTracking && mClNative && mClNative->clustersMCTruth && mMCInfos.size(); }
235235
uint32_t GPUQA::GetMCLabelCol(const mcLabel_t& label) const { return !label.isValid() ? 0 : (mMCEventOffset[label.getSourceID()] + label.getEventID()); }
236236
GPUQA::mcLabelI_t GPUQA::GetMCTrackLabel(uint32_t trackId) const { return trackId >= mTrackMCLabels.size() ? MCCompLabel() : mTrackMCLabels[trackId]; }
237+
bool GPUQA::CompareIgnoreFake(const mcLabelI_t& l1, const mcLabelI_t& l2) { return l1.compare(l2) >= 0; }
237238
#define TRACK_EXPECTED_REFERENCE_X 78
238239
#else
239240
inline GPUQA::mcLabelI_t::mcLabelI_t(const GPUQA::mcLabel_t& l) : track(l.fMCID) {}
@@ -263,6 +264,7 @@ inline int32_t GPUQA::AbsLabelID(int32_t id) { return id >= 0 ? id : (-id - 2);
263264
inline bool GPUQA::mcPresent() { return !mConfig.noMC && mTracking && GetNMCLabels() && GetNMCTracks(0); }
264265
uint32_t GPUQA::GetMCLabelCol(const mcLabel_t& label) const { return 0; }
265266
GPUQA::mcLabelI_t GPUQA::GetMCTrackLabel(uint32_t trackId) const { return trackId >= mTrackMCLabels.size() ? mcLabelI_t() : mTrackMCLabels[trackId]; }
267+
bool GPUQA::CompareIgnoreFake(const mcLabelI_t& l1, const mcLabelI_t& l2) { return AbsLabelID(l1) == AbsLabelID(l2); }
266268
#define TRACK_EXPECTED_REFERENCE_X TRACK_EXPECTED_REFERENCE_X_DEFAULT
267269
#endif
268270
template <class T>
@@ -1660,7 +1662,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16601662

16611663
if (mQATasks & taskTrackStatistics) {
16621664
// Fill track statistic histograms
1663-
std::vector<std::array<float, 2>> clusterAttachCounts;
1665+
std::vector<std::array<float, 3>> clusterAttachCounts;
16641666
if (mcAvail) {
16651667
clusterAttachCounts.resize(GetNMCLabels(), {0.f, 0.f});
16661668
}
@@ -1691,17 +1693,23 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16911693
if (cl.state & GPUTPCGMMergedTrackHit::flagReject) {
16921694
continue;
16931695
}
1694-
bool labelOk = false;
1695-
if (mTrackMCLabels[i].isValid() && !mTrackMCLabels[i].isFake()) {
1696+
bool labelOk = false, labelOkNonFake = false;
1697+
const mcLabelI_t& trkLabel = mTrackMCLabels[i];
1698+
if (trkLabel.isValid() && !trkLabel.isNoise()) {
16961699
for (int32_t l = 0; l < GetMCLabelNID(cl.num); l++) {
1697-
if (GetMCLabel(cl.num, l) == mTrackMCLabels[i]) {
1700+
const mcLabelI_t& clLabel = GetMCLabel(cl.num, l);
1701+
if (clLabel.isValid() && !clLabel.isNoise() && CompareIgnoreFake(trkLabel, clLabel)) {
16981702
labelOk = true;
1703+
if (!trkLabel.isFake()) {
1704+
labelOkNonFake = true;
1705+
}
16991706
break;
17001707
}
17011708
}
17021709
}
1703-
clusterAttachCounts[cl.num][0] += (float)labelOk / rowClCount;
1704-
clusterAttachCounts[cl.num][1] += 1.0f;
1710+
clusterAttachCounts[cl.num][0] += 1.0f;
1711+
clusterAttachCounts[cl.num][1] += (float)labelOk / rowClCount;
1712+
clusterAttachCounts[cl.num][2] += (float)labelOkNonFake / rowClCount;
17051713
}
17061714
}
17071715
}
@@ -1721,13 +1729,15 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
17211729
}
17221730
}
17231731
if (mcAvail) {
1724-
double clusterAttachNormalizedCount = 0;
1732+
double clusterAttachNormalizedCount = 0, clusterAttachNormalizedCountNonFake = 0;
17251733
for (uint32_t i = 0; i < clusterAttachCounts.size(); i++) {
1726-
if (clusterAttachCounts[i][1]) {
1727-
clusterAttachNormalizedCount += clusterAttachCounts[i][0] / clusterAttachCounts[i][1];
1734+
if (clusterAttachCounts[i][0]) {
1735+
clusterAttachNormalizedCount += clusterAttachCounts[i][1] / clusterAttachCounts[i][0];
1736+
clusterAttachNormalizedCountNonFake += clusterAttachCounts[i][2] / clusterAttachCounts[i][0];
17281737
}
17291738
}
17301739
mClusterCounts.nCorrectlyAttachedNormalized = clusterAttachNormalizedCount;
1740+
mClusterCounts.nCorrectlyAttachedNormalizedNonFake = clusterAttachNormalizedCountNonFake;
17311741
clusterAttachCounts.clear();
17321742
}
17331743

@@ -2901,7 +2911,8 @@ int32_t GPUQA::DoClusterCounts(uint64_t* attachClusterCounts, int32_t mode)
29012911
PrintClusterCount(mode, num, "Fake Protect (< 40 MeV)", mClusterCounts.nFakeProtect40, mClusterCounts.nBelow40);
29022912
}
29032913
if (mcPresent() && (mQATasks & taskTrackStatistics)) {
2904-
PrintClusterCount(mode, num, "Correctly Attached non-fake normalized", mClusterCounts.nCorrectlyAttachedNormalized, mClusterCounts.nTotal);
2914+
PrintClusterCount(mode, num, "Correctly Attached all-trk normalized", mClusterCounts.nCorrectlyAttachedNormalized, mClusterCounts.nTotal);
2915+
PrintClusterCount(mode, num, "Correctly Attached non-fake normalized", mClusterCounts.nCorrectlyAttachedNormalizedNonFake, mClusterCounts.nTotal);
29052916
}
29062917
return num;
29072918
}

GPU/GPUTracking/qa/GPUQA.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ class GPUQA
226226
float GetMCLabelWeight(uint32_t i, uint32_t j);
227227
float GetMCLabelWeight(const mcLabels_t& label, uint32_t j);
228228
float GetMCLabelWeight(const mcLabel_t& label);
229+
static bool CompareIgnoreFake(const mcLabelI_t& l1, const mcLabelI_t& l2);
229230
const auto& GetClusterLabels();
230231
bool mcPresent();
231232

@@ -290,7 +291,7 @@ class GPUQA
290291
TLegend* mLClust[N_CLS_TYPE];
291292

292293
struct counts_t {
293-
int64_t nRejected = 0, nTube = 0, nTube200 = 0, nLoopers = 0, nLowPt = 0, n200MeV = 0, nPhysics = 0, nProt = 0, nUnattached = 0, nTotal = 0, nHighIncl = 0, nAbove400 = 0, nFakeRemove400 = 0, nFullFakeRemove400 = 0, nBelow40 = 0, nFakeProtect40 = 0, nMergedLooper = 0, nCorrectlyAttachedNormalized = 0;
294+
int64_t nRejected = 0, nTube = 0, nTube200 = 0, nLoopers = 0, nLowPt = 0, n200MeV = 0, nPhysics = 0, nProt = 0, nUnattached = 0, nTotal = 0, nHighIncl = 0, nAbove400 = 0, nFakeRemove400 = 0, nFullFakeRemove400 = 0, nBelow40 = 0, nFakeProtect40 = 0, nMergedLooper = 0, nCorrectlyAttachedNormalized = 0, nCorrectlyAttachedNormalizedNonFake = 0;
294295
double nUnaccessible = 0;
295296
} mClusterCounts;
296297

0 commit comments

Comments
 (0)