diff --git a/GPU/GPUTracking/qa/GPUQA.cxx b/GPU/GPUTracking/qa/GPUQA.cxx index b32ef80c7c87a..6f640578a8804 100644 --- a/GPU/GPUTracking/qa/GPUQA.cxx +++ b/GPU/GPUTracking/qa/GPUQA.cxx @@ -234,6 +234,7 @@ inline float GPUQA::GetMCLabelWeight(const mcLabel_t& label) { return 1; } inline bool GPUQA::mcPresent() { return !mConfig.noMC && mTracking && mClNative && mClNative->clustersMCTruth && mMCInfos.size(); } uint32_t GPUQA::GetMCLabelCol(const mcLabel_t& label) const { return !label.isValid() ? 0 : (mMCEventOffset[label.getSourceID()] + label.getEventID()); } GPUQA::mcLabelI_t GPUQA::GetMCTrackLabel(uint32_t trackId) const { return trackId >= mTrackMCLabels.size() ? MCCompLabel() : mTrackMCLabels[trackId]; } +bool GPUQA::CompareIgnoreFake(const mcLabelI_t& l1, const mcLabelI_t& l2) { return l1.compare(l2) >= 0; } #define TRACK_EXPECTED_REFERENCE_X 78 #else 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); inline bool GPUQA::mcPresent() { return !mConfig.noMC && mTracking && GetNMCLabels() && GetNMCTracks(0); } uint32_t GPUQA::GetMCLabelCol(const mcLabel_t& label) const { return 0; } GPUQA::mcLabelI_t GPUQA::GetMCTrackLabel(uint32_t trackId) const { return trackId >= mTrackMCLabels.size() ? mcLabelI_t() : mTrackMCLabels[trackId]; } +bool GPUQA::CompareIgnoreFake(const mcLabelI_t& l1, const mcLabelI_t& l2) { return AbsLabelID(l1) == AbsLabelID(l2); } #define TRACK_EXPECTED_REFERENCE_X TRACK_EXPECTED_REFERENCE_X_DEFAULT #endif template @@ -1660,7 +1662,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector* tracksEx if (mQATasks & taskTrackStatistics) { // Fill track statistic histograms - std::vector> clusterAttachCounts; + std::vector> clusterAttachCounts; if (mcAvail) { clusterAttachCounts.resize(GetNMCLabels(), {0.f, 0.f}); } @@ -1691,17 +1693,23 @@ void GPUQA::RunQA(bool matchOnly, const std::vector* tracksEx if (cl.state & GPUTPCGMMergedTrackHit::flagReject) { continue; } - bool labelOk = false; - if (mTrackMCLabels[i].isValid() && !mTrackMCLabels[i].isFake()) { + bool labelOk = false, labelOkNonFake = false; + const mcLabelI_t& trkLabel = mTrackMCLabels[i]; + if (trkLabel.isValid() && !trkLabel.isNoise()) { for (int32_t l = 0; l < GetMCLabelNID(cl.num); l++) { - if (GetMCLabel(cl.num, l) == mTrackMCLabels[i]) { + const mcLabelI_t& clLabel = GetMCLabel(cl.num, l); + if (clLabel.isValid() && !clLabel.isNoise() && CompareIgnoreFake(trkLabel, clLabel)) { labelOk = true; + if (!trkLabel.isFake()) { + labelOkNonFake = true; + } break; } } } - clusterAttachCounts[cl.num][0] += (float)labelOk / rowClCount; - clusterAttachCounts[cl.num][1] += 1.0f; + clusterAttachCounts[cl.num][0] += 1.0f; + clusterAttachCounts[cl.num][1] += (float)labelOk / rowClCount; + clusterAttachCounts[cl.num][2] += (float)labelOkNonFake / rowClCount; } } } @@ -1721,13 +1729,15 @@ void GPUQA::RunQA(bool matchOnly, const std::vector* tracksEx } } if (mcAvail) { - double clusterAttachNormalizedCount = 0; + double clusterAttachNormalizedCount = 0, clusterAttachNormalizedCountNonFake = 0; for (uint32_t i = 0; i < clusterAttachCounts.size(); i++) { - if (clusterAttachCounts[i][1]) { - clusterAttachNormalizedCount += clusterAttachCounts[i][0] / clusterAttachCounts[i][1]; + if (clusterAttachCounts[i][0]) { + clusterAttachNormalizedCount += clusterAttachCounts[i][1] / clusterAttachCounts[i][0]; + clusterAttachNormalizedCountNonFake += clusterAttachCounts[i][2] / clusterAttachCounts[i][0]; } } mClusterCounts.nCorrectlyAttachedNormalized = clusterAttachNormalizedCount; + mClusterCounts.nCorrectlyAttachedNormalizedNonFake = clusterAttachNormalizedCountNonFake; clusterAttachCounts.clear(); } @@ -2901,7 +2911,8 @@ int32_t GPUQA::DoClusterCounts(uint64_t* attachClusterCounts, int32_t mode) PrintClusterCount(mode, num, "Fake Protect (< 40 MeV)", mClusterCounts.nFakeProtect40, mClusterCounts.nBelow40); } if (mcPresent() && (mQATasks & taskTrackStatistics)) { - PrintClusterCount(mode, num, "Correctly Attached non-fake normalized", mClusterCounts.nCorrectlyAttachedNormalized, mClusterCounts.nTotal); + PrintClusterCount(mode, num, "Correctly Attached all-trk normalized", mClusterCounts.nCorrectlyAttachedNormalized, mClusterCounts.nTotal); + PrintClusterCount(mode, num, "Correctly Attached non-fake normalized", mClusterCounts.nCorrectlyAttachedNormalizedNonFake, mClusterCounts.nTotal); } return num; } diff --git a/GPU/GPUTracking/qa/GPUQA.h b/GPU/GPUTracking/qa/GPUQA.h index 9e137f6a6b34c..e587b15f68d80 100644 --- a/GPU/GPUTracking/qa/GPUQA.h +++ b/GPU/GPUTracking/qa/GPUQA.h @@ -226,6 +226,7 @@ class GPUQA float GetMCLabelWeight(uint32_t i, uint32_t j); float GetMCLabelWeight(const mcLabels_t& label, uint32_t j); float GetMCLabelWeight(const mcLabel_t& label); + static bool CompareIgnoreFake(const mcLabelI_t& l1, const mcLabelI_t& l2); const auto& GetClusterLabels(); bool mcPresent(); @@ -290,7 +291,7 @@ class GPUQA TLegend* mLClust[N_CLS_TYPE]; struct counts_t { - 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; + 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; double nUnaccessible = 0; } mClusterCounts;