Skip to content

Commit da5f704

Browse files
committed
GPU QA: Dump also text output to output folder
1 parent ab41f53 commit da5f704

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

GPU/GPUTracking/qa/GPUQA.cxx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3141,7 +3141,9 @@ void GPUQA::PrintClusterCount(int32_t mode, int32_t& num, const char* name, uint
31413141
createHist(mHistClusterCount[num], name2, name, 1000, 0, mConfig.histMaxNClusters, 1000, 0, 100);
31423142
} else if (mode == 0) {
31433143
if (normalization && mConfig.enableLocalOutput) {
3144-
printf("\t%40s: %'12" PRIu64 " (%6.2f%%)\n", name, n, 100.f * n / normalization);
3144+
for (uint32_t i = 0; i < 1 + (mTextDump != nullptr); i++) {
3145+
fprintf(i ? mTextDump : stdout, "\t%40s: %'12" PRIu64 " (%6.2f%%)\n", name, n, 100.f * n / normalization);
3146+
}
31453147
}
31463148
if (mConfig.clusterRejectionHistograms) {
31473149
float ratio = 100.f * n / std::max<uint64_t>(normalization, 1);
@@ -3153,6 +3155,9 @@ void GPUQA::PrintClusterCount(int32_t mode, int32_t& num, const char* name, uint
31533155

31543156
int32_t GPUQA::DoClusterCounts(uint64_t* attachClusterCounts, int32_t mode)
31553157
{
3158+
if (mConfig.enableLocalOutput && !mConfig.inputHistogramsOnly && mConfig.plotsDir != "") {
3159+
mTextDump = fopen((mConfig.plotsDir + "/clusterCounts.txt").c_str(), "w+");
3160+
}
31563161
int32_t num = 0;
31573162
if (mcPresent() && (mQATasks & taskClusterAttach) && attachClusterCounts) {
31583163
for (int32_t i = 0; i < N_CLS_HIST; i++) { // TODO: Check that these counts are still printed correctly!
@@ -3191,6 +3196,10 @@ int32_t GPUQA::DoClusterCounts(uint64_t* attachClusterCounts, int32_t mode)
31913196
PrintClusterCount(mode, num, "Correctly Attached all-trk normalized", mClusterCounts.nCorrectlyAttachedNormalized, mClusterCounts.nTotal);
31923197
PrintClusterCount(mode, num, "Correctly Attached non-fake normalized", mClusterCounts.nCorrectlyAttachedNormalizedNonFake, mClusterCounts.nTotal);
31933198
}
3199+
if (mTextDump) {
3200+
fclose(mTextDump);
3201+
mTextDump = nullptr;
3202+
}
31943203
return num;
31953204
}
31963205

GPU/GPUTracking/qa/GPUQA.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class GPUQA
6262
#else
6363

6464
#include "GPUTPCDef.h"
65+
#include <cstdio>
6566
#include <cmath>
6667
#include <vector>
6768
#include <memory>
@@ -365,6 +366,7 @@ class GPUQA
365366
int32_t mMCTrackMin = -1, mMCTrackMax = -1;
366367

367368
const o2::tpc::ClusterNativeAccess* mClNative = nullptr;
369+
FILE* mTextDump = nullptr;
368370
};
369371

370372
inline bool GPUQA::SuppressTrack(int32_t iTrack) const { return (mConfig.matchMCLabels.size() && !mGoodTracks[mNEvents][iTrack]); }

0 commit comments

Comments
 (0)