-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunAllAnalysis.sh
83 lines (61 loc) · 1.91 KB
/
runAllAnalysis.sh
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
dirname=$1
#Nom du dossier dans lequel il y aura les dossiers à analyser
newdirname=${dirname%?????????????????????????}
#nom du dossier mais simplifié
outputDirName=histoResults_${newdirname}
baseDir=$PWD
mkdir ${newdirname}
cd ${newdirname}
alien_cp /alice/cern.ch/user/a/aliperf/alibi_nightlies/O2DPG_pp_minbias_testbeam.sh/${dirname}/mcarchive.tar.gz mcarchive.tar.gz
tar -xvf mcarchive.tar.gz
rm mcarchive.tar.gz
mkdir ${outputDirName}
outputDir=${PWD}/${outputDirName}
echo "I am working in the directory " $PWD
filenb=0
for i in $(seq 25)
do
if [[ -d "tf$i" ]]
then
echo "entering directory tf$i"
cd tf$i
cp $baseDir/StudyMFTTracks.C .
cp $baseDir/StudyMFTPurity.C .
cp $baseDir/MFTdictionary.bin .
i2=$(printf "%03d" $i)
filenameout=${outputDir}/outputfile_studyTracks_${i2}.root
if [[ -f "mfttracks.root" && -f "mftclusters.root" ]]
then
#root -l -b -q 'StudyMFTTracks.C('\"${filenameout}\"','\"sgn_${i}_Kine.root\"')' && root -l -b -q 'StudyMFTPurity.C('\"${filenameout}\"','\"sgn_${i}_Kine.root\"')' &
root -l -b -q 'StudyMFTTracks.C('\"${filenameout}\"','\"sgn_${i}_Kine.root\"')' &
filenb=$((filenb+1))
else
echo "The directory tf$i does not contain mfttracks.root or mftclusters.root"
continue
fi
cd ..
fi
done
sleep 6m
if [ $filenb -eq 0 ]; then
echo "No files mfttracks.root or mftclusters.root, exiting"
exit 1
fi
cd ${outputDir}
n=$(ls |wc -l)
end=$((SECONDS+600))
until [ $n == $filenb ]
do
n=$(ls |wc -l)
sleep 2s
if [ $SECONDS -gt $end ]; then
echo "The script has been stuck for 10m, let's break it"
break
fi
done
filenamemerged=outputfile_studyTracks_merged.root
filestomerge=outputfile_studyTracks_???.root
hadd -f $filenamemerged ${filestomerge}
cp $baseDir/EvalEffAndPurity.C .
root -l -b -q 'EvalEffAndPurity.C('\"${filenamemerged}\"','\"${newdirname}_EvalEffAndPurity\"')'