-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunAnalysis.sh
executable file
·62 lines (55 loc) · 1.64 KB
/
runAnalysis.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
#!/bin/bash
# This bash script runs the runAnalysisTrain.C macro
# Here set the parameters for the macro
#inputType=ReducedEvent
#eventType=AliAnalysisTaskReducedTreeMaker::kFullEventsWithFullTracks
#tasks=iarsene_testTask
#tasks=iarsene_jpsi2ee
#period=LHC15o_lowIR
#period=LHC15o_highIR
#period=LHC15o_pidfix
#period=LHC17p
#period=LHC15n
#period=mcPbPb
#period=LHC16r
#period=LHC10b
#period=LHC16r
jobs=`cat $1`
inputDir=$2
outputDir=$3
nchunksPerJob=$4
hasMC=$5
inputType=$6
eventType=$7
period=$8
tasks=$9
nworkers=$10
workingDir=$PWD
mkdir -p $outputDir
for job in $jobs; do
while [ $(ps -ef | grep aliroot | grep runAnalysisTrain.C | wc -l) -gt $nworkers ]; do
sleep 10s;
done
jobId=${job#jobInput.}
jobId=${jobId%.txt}
chunks=`cat $outputDir/jobInputs/$job`
run=0
inputFileList=''
for chunk in $chunks; do
idx=`expr index "chunk" /chunk`
let idx=idx-1
run=${chunk:$idx:9}
inputFileList=`printf "$inputFileList\n$inputDir/$chunk/dstTree.root"`
done
mkdir -p $outputDir/runOutput/$run/job$jobId
printf "$inputFileList\n" > $outputDir/runOutput/$run/job$jobId/inputFileList.txt
cd $outputDir/runOutput/$run/job$jobId
if [ "$hasMC" = "kFALSE" ]; then
aliroot -b -q $workingDir/runAnalysisTrain.C\(\"inputFileList.txt\",\"local\",\"$inputType\",$hasMC,$eventType,kFALSE,\"$tasks\",\"$period\",-1,0,\"$outputDir/macros\"\)
fi
if [ "$hasMC" = "kTRUE" ]; then
aliroot -b -q $workingDir/runAnalysisTrain.C\(\"inputFileList.txt\",\"local\",\"$inputType\",$hasMC,$eventType,kFALSE,\"$tasks\",\"$period\",100000,0,\"$outputDir/macros\"\)
fi
cd $workingDir
sleep 0.5
done