Skip to content

Commit 9fa8cf5

Browse files
committed
GPU QA: Add Correctly Attached non-fake normalized cluster count§
1 parent 925c580 commit 9fa8cf5

File tree

2 files changed

+47
-13
lines changed

2 files changed

+47
-13
lines changed

GPU/GPUTracking/qa/GPUQA.cxx

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,10 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16601660

16611661
if (mQATasks & taskTrackStatistics) {
16621662
// Fill track statistic histograms
1663+
std::vector<std::array<float, 2>> clusterAttachCounts;
1664+
if (mcAvail) {
1665+
clusterAttachCounts.resize(GetNMCLabels(), {0.f, 0.f});
1666+
}
16631667
for (uint32_t i = 0; i < nReconstructedTracks; i++) {
16641668
const GPUTPCGMMergedTrack& track = mTracking->mIOPtrs.mergedTracks[i];
16651669
if (!track.OK()) {
@@ -1668,21 +1672,38 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16681672
mTracks->Fill(1.f / fabsf(track.GetParam().GetQPt()));
16691673
mNCl[0]->Fill(track.NClustersFitted());
16701674
uint32_t nClCorrected = 0;
1671-
int32_t lastSector = -1, lastRow = -1;
16721675
const auto& trackClusters = mTracking->mIOPtrs.mergedTrackHits;
1673-
for (uint32_t j = 0; j < track.NClusters(); j++) {
1674-
if (trackClusters[track.FirstClusterRef() + j].state & GPUTPCGMMergedTrackHit::flagReject) {
1675-
continue;
1676+
uint32_t jNext = 0;
1677+
for (uint32_t j = 0; j < track.NClusters(); j = jNext) {
1678+
uint32_t rowClCount = !(trackClusters[track.FirstClusterRef() + j].state & GPUTPCGMMergedTrackHit::flagReject);
1679+
for (jNext = j + 1; j < track.NClusters(); jNext++) {
1680+
if (trackClusters[track.FirstClusterRef() + j].sector != trackClusters[track.FirstClusterRef() + jNext].sector || trackClusters[track.FirstClusterRef() + j].row != trackClusters[track.FirstClusterRef() + jNext].row) {
1681+
break;
1682+
}
1683+
rowClCount += !(trackClusters[track.FirstClusterRef() + jNext].state & GPUTPCGMMergedTrackHit::flagReject);
16761684
}
1677-
if (trackClusters[track.FirstClusterRef() + j].sector == lastSector && trackClusters[track.FirstClusterRef() + j].row == lastRow) {
1678-
continue;
1685+
if (trackClusters[track.FirstClusterRef() + j].leg == trackClusters[track.FirstClusterRef() + track.NClusters() - 1].leg && rowClCount) {
1686+
nClCorrected++;
16791687
}
1680-
if (trackClusters[track.FirstClusterRef() + j].leg != trackClusters[track.FirstClusterRef() + track.NClusters() - 1].leg) {
1681-
continue;
1688+
if (mcAvail && rowClCount) {
1689+
for (uint32_t k = j; k < jNext; k++) {
1690+
const auto& cl = trackClusters[track.FirstClusterRef() + k];
1691+
if (cl.state & GPUTPCGMMergedTrackHit::flagReject) {
1692+
continue;
1693+
}
1694+
bool labelOk = false;
1695+
if (mTrackMCLabels[i].isValid() && !mTrackMCLabels[i].isFake()) {
1696+
for (int32_t l = 0; l < GetMCLabelNID(cl.num); l++) {
1697+
if (GetMCLabel(cl.num, l) == mTrackMCLabels[i]) {
1698+
labelOk = true;
1699+
break;
1700+
}
1701+
}
1702+
}
1703+
clusterAttachCounts[cl.num][0] += (float)labelOk / rowClCount;
1704+
clusterAttachCounts[cl.num][1] += 1.0f;
1705+
}
16821706
}
1683-
nClCorrected++;
1684-
lastSector = trackClusters[track.FirstClusterRef() + j].sector;
1685-
lastRow = trackClusters[track.FirstClusterRef() + j].sector;
16861707
}
16871708
mNCl[1]->Fill(nClCorrected);
16881709
}
@@ -1699,6 +1720,16 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16991720
}
17001721
}
17011722
}
1723+
if (mcAvail) {
1724+
double clusterAttachNormalizedCount = 0;
1725+
for (uint32_t i = 0; i < clusterAttachCounts.size(); i++) {
1726+
if (clusterAttachCounts[i][1]) {
1727+
clusterAttachNormalizedCount += clusterAttachCounts[i][0] / clusterAttachCounts[i][1];
1728+
}
1729+
}
1730+
mClusterCounts.nCorrectlyAttachedNormalized = clusterAttachNormalizedCount;
1731+
clusterAttachCounts.clear();
1732+
}
17021733

17031734
if (QA_TIMING || (mTracking && mTracking->GetProcessingSettings().debugLevel >= 3)) {
17041735
GPUInfo("QA Time: Fill track statistics:\t%6.0f us", timer.GetCurrentElapsedTime(true) * 1e6);
@@ -2824,7 +2855,7 @@ void GPUQA::PrintClusterCount(int32_t mode, int32_t& num, const char* name, uint
28242855
createHist(mHistClusterCount[num], name2, name, 1000, 0, mConfig.histMaxNClusters, 1000, 0, 100);
28252856
} else if (mode == 0) {
28262857
if (normalization && mConfig.enableLocalOutput) {
2827-
printf("\t%35s: %'12" PRIu64 " (%6.2f%%)\n", name, n, 100.f * n / normalization);
2858+
printf("\t%40s: %'12" PRIu64 " (%6.2f%%)\n", name, n, 100.f * n / normalization);
28282859
}
28292860
if (mConfig.clusterRejectionHistograms) {
28302861
float ratio = 100.f * n / std::max<uint64_t>(normalization, 1);
@@ -2869,6 +2900,9 @@ int32_t GPUQA::DoClusterCounts(uint64_t* attachClusterCounts, int32_t mode)
28692900
PrintClusterCount(mode, num, "Tracks < 40 MeV", mClusterCounts.nBelow40, mClusterCounts.nTotal);
28702901
PrintClusterCount(mode, num, "Fake Protect (< 40 MeV)", mClusterCounts.nFakeProtect40, mClusterCounts.nBelow40);
28712902
}
2903+
if (mcPresent() && (mQATasks & taskTrackStatistics)) {
2904+
PrintClusterCount(mode, num, "Correctly Attached non-fake normalized", mClusterCounts.nCorrectlyAttachedNormalized, mClusterCounts.nTotal);
2905+
}
28722906
return num;
28732907
}
28742908

GPU/GPUTracking/qa/GPUQA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ class GPUQA
290290
TLegend* mLClust[N_CLS_TYPE];
291291

292292
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;
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;
294294
double nUnaccessible = 0;
295295
} mClusterCounts;
296296

0 commit comments

Comments
 (0)