Skip to content

Commit f467060

Browse files
committed
[O2DPG,UTILS,O2-5725] Expand macros to find corrupted AO2Ds
- Added check for "repair" messages in the `checkCorruptedAO2Ds.C` macro to also catch files, where some problem appears and root tries to repair on the fly. This addition is made based on the recent report by Nicolas on the JIRA ticket O2-5725 that we see still some AO2D files with problems that can not be catched with the old version of `checkCorruptedAO2Ds.C`. - Modified `findCorruptedAO2Ds.sh` to correctly read those cases and identify them as "broken" aswell.
1 parent c9da131 commit f467060

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

UTILS/checkCorruptedAO2Ds.C

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
#include <TTreeReader.h>
55
#include <TGrid.h>
66
#include <iostream>
7+
#include <TError.h>
8+
#include <cstring>
9+
10+
bool gWarningDetected = false; // Global flag to track the warning
11+
12+
void MyErrorHandler(int level, Bool_t abort, const char *location, const char *msg) {
13+
if (strstr(msg, "repair") != nullptr) {
14+
gWarningDetected = true;
15+
}
16+
DefaultErrorHandler(level, abort, location, msg); // Call ROOT’s default handler
17+
}
718

819
int checkCorruptedAO2Ds(TString infileName = "/alice/sim/2024/LHC24h2/535545/AOD/005/AO2D.root", bool fromAlien = true) {
920

@@ -42,11 +53,15 @@ int checkCorruptedAO2Ds(TString infileName = "/alice/sim/2024/LHC24h2/535545/AOD
4253
std::cout << "Found corrupted file! DF: " << dirKey->GetName() << " Tree:" << pair.first.data() << " Branch:" << branchName.data() << std::endl;
4354
return -1;
4455
}
56+
if (gWarningDetected) {
57+
std::cout << "Found file in need of repair! DF: " << dirKey->GetName() << " Tree:" << pair.first.data() << " Branch:" << branchName.data() << std::endl;
58+
return -2;
59+
}
4560
}
4661
}
4762
}
4863
}
4964
}
5065

5166
return 0;
52-
}
67+
}

UTILS/findCorruptedAO2Ds.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ parallel -j $NJOBS process_file ::: "${FILESTOCHECK[@]}"
3333
# create list of corrupted files
3434
touch $OUTPUTFILE
3535
ERRORSTR="Found corrupted file!"
36+
REPAIRSTR="Found file in need of repair!"
3637
for FILE in "${FILESTOCHECK[@]}"; do
3738
IFS='/' read -a num <<< "$FILE"
3839
if grep -q "$ERRORSTR" log_${num[5]}_${num[7]}; then
3940
echo $FILE >> $OUTPUTFILE
41+
else grep -q "$REPAIRSTR" log_${num[5]}_${num[7]}; then
42+
echo $FILE >> $OUTPUTFILE
4043
fi
4144
done
4245

4346
rm files_to_check.txt
44-
rm log*
47+
rm log*

0 commit comments

Comments
 (0)