@@ -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
31543156int32_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
0 commit comments