diff --git a/UTILS/checkCorruptedAO2Ds.C b/UTILS/checkCorruptedAO2Ds.C index 85cbf0098..d51768b17 100644 --- a/UTILS/checkCorruptedAO2Ds.C +++ b/UTILS/checkCorruptedAO2Ds.C @@ -4,8 +4,21 @@ #include #include #include +#include +#include + +bool gWarningDetected = false; // Global flag to track the warning + +void MyErrorHandler(int level, Bool_t abort, const char *location, const char *msg) { + if (strstr(msg, "repair") != nullptr) { + gWarningDetected = true; + } + DefaultErrorHandler(level, abort, location, msg); // Call ROOT’s default handler +} int checkCorruptedAO2Ds(TString infileName = "/alice/sim/2024/LHC24h2/535545/AOD/005/AO2D.root", bool fromAlien = true) { + + SetErrorHandler(MyErrorHandler); if (fromAlien) { TGrid::Connect("alien://"); @@ -21,7 +34,7 @@ int checkCorruptedAO2Ds(TString infileName = "/alice/sim/2024/LHC24h2/535545/AOD // all VLA branches in the AO2Ds.root std::map> branchesToCheck = { - {"O2mcparticle_001", std::vector{"fIndexArray_Mothers"}}, + {"O2mcparticle_001", std::vector{"fIndexArray_Mothers", "fVx", "fIndexMcCollisions"}}, {"O2ft0", std::vector{"fAmplitudeA", "fChannelA", "fAmplitudeC", "fChannelC"}}, {"O2fv0a", std::vector{"fAmplitude", "fChannel"}}, {"O2mccalolabel_001", std::vector{"fIndexArrayMcParticles", "fAmplitudeA"}}, @@ -42,6 +55,10 @@ int checkCorruptedAO2Ds(TString infileName = "/alice/sim/2024/LHC24h2/535545/AOD std::cout << "Found corrupted file! DF: " << dirKey->GetName() << " Tree:" << pair.first.data() << " Branch:" << branchName.data() << std::endl; return -1; } + if (gWarningDetected) { + std::cout << "Found file in need of repair! DF: " << dirKey->GetName() << " Tree:" << pair.first.data() << " Branch:" << branchName.data() << std::endl; + return -2; + } } } } @@ -49,4 +66,4 @@ int checkCorruptedAO2Ds(TString infileName = "/alice/sim/2024/LHC24h2/535545/AOD } return 0; -} \ No newline at end of file +} diff --git a/UTILS/findCorruptedAO2Ds.sh b/UTILS/findCorruptedAO2Ds.sh index fd4ebfccb..af8e8ddb3 100755 --- a/UTILS/findCorruptedAO2Ds.sh +++ b/UTILS/findCorruptedAO2Ds.sh @@ -2,9 +2,10 @@ # Simple script to find corrupted AO2Ds using the checkCorruptedAO2Ds.C macro -PRODUCTION=LHC24h2 +PRODUCTION=LHC24f3c RUN=* # use * for all runs -NJOBS=90 +NJOBS=20 +PRODUCTIONCYCLE=0 OUTPUTFILE=corrupted_files_$PRODUCTION.txt if [ -e "$OUTPUTFILE" ]; then @@ -12,10 +13,10 @@ if [ -e "$OUTPUTFILE" ]; then fi # find all files in alien -if [ "$variable" == "*" ]; then - alien_find alien:///alice/sim/2024/${PRODUCTION} 5*/AOD/*/AO2D.root > files_to_check.txt +if [ "$RUN" == "*" ]; then + alien_find alien:///alice/sim/2024/${PRODUCTION}/${PRODUCTIONCYCLE}/5*/AOD/*/AO2D.root > files_to_check.txt else - alien_find alien:///alice/sim/2024/${PRODUCTION} ${RUN}/AOD/*/AO2D.root > files_to_check.txt + alien_find alien:///alice/sim/2024/${PRODUCTION}/${PRODUCTIONCYCLE}/${RUN}/AOD/*/AO2D.root > files_to_check.txt fi mapfile -t FILESTOCHECK < files_to_check.txt @@ -23,7 +24,7 @@ mapfile -t FILESTOCHECK < files_to_check.txt process_file() { IFS='/' read -a num <<< "$1" INPUT=$1 - echo '.x checkCorruptedAO2Ds.C("'${INPUT}'", true)' | root -l -b > log_${num[5]}_${num[7]} + echo '.x checkCorruptedAO2Ds.C("'${INPUT}'", true)' | root -l -b > log_${num[6]}_${num[8]} echo '.q' } export -f process_file @@ -33,12 +34,15 @@ parallel -j $NJOBS process_file ::: "${FILESTOCHECK[@]}" # create list of corrupted files touch $OUTPUTFILE ERRORSTR="Found corrupted file!" +REPAIRSTR="Found file in need of repair!" for FILE in "${FILESTOCHECK[@]}"; do IFS='/' read -a num <<< "$FILE" - if grep -q "$ERRORSTR" log_${num[5]}_${num[7]}; then - echo $FILE >> $OUTPUTFILE + if grep -q "$ERRORSTR" log_${num[6]}_${num[8]}; then + echo $FILE " is corrupted!" >> $OUTPUTFILE + elif grep -q "$REPAIRSTR" log_${num[6]}_${num[8]}; then + echo $FILE " is broken!" >> $OUTPUTFILE fi done rm files_to_check.txt -rm log* \ No newline at end of file +rm log_*