forked from AliceO2Group/O2DPG
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfindCorruptedAO2Ds.sh
More file actions
executable file
·48 lines (40 loc) · 1.27 KB
/
findCorruptedAO2Ds.sh
File metadata and controls
executable file
·48 lines (40 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Simple script to find corrupted AO2Ds using the checkCorruptedAO2Ds.C macro
PRODUCTION=LHC24f3c
RUN=* # use * for all runs
NJOBS=20
PRODUCTIONCYCLE=0
OUTPUTFILE=corrupted_files_$PRODUCTION.txt
if [ -e "$OUTPUTFILE" ]; then
rm $OUTPUTFILE
fi
# find all files in alien
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}/${PRODUCTIONCYCLE}/${RUN}/AOD/*/AO2D.root > files_to_check.txt
fi
mapfile -t FILESTOCHECK < files_to_check.txt
# process AO2Ds
process_file() {
IFS='/' read -a num <<< "$1"
INPUT=$1
echo '.x checkCorruptedAO2Ds.C("'${INPUT}'", true)' | root -l -b > log_${num[6]}_${num[8]}
echo '.q'
}
export -f process_file
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[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_*