]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/STRANGENESS/LambdaK0PbPb/MainStreamAnalysis/run.sh
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / LambdaK0PbPb / MainStreamAnalysis / run.sh
1 #!/bin/bash
2
3 run=
4 #pass=/alice/data/LHC10h_000139172_p2
5 pass=
6 mc=0
7 mode="full"
8 #mode="terminate"
9 nev=1234566789
10 workers=26
11 ROPT=""
12 listfile=""
13 offset=500000
14 debug=kTRUE
15 option="SAVE" #FIXME:set option
16 suffix=""
17 fitFolder="LHC10h_000137161_p1_5plus"
18 fitBin="00"
19 partID=1
20 task=no
21 fit=no
22 usePID=kTRUE
23 binMin=0
24 binMax=10
25 ihist=0
26 give_help() {
27
28 cat <<ENDOFGUIDE
29 This scripts runs the the physics selection and centrality on a specified run/dataset
30
31 Available options:
32  * Run the task *
33   -r <mode>                    Run the task
34                                Modes (compulsory):
35                                   0 local
36                                   1 caf
37                                   2 grid    
38   -d <run or dataset>          Run number(s) (grid) or dataset (caf) or file name (local)
39                                Local filename can be an xml collection of files on alies, 
40                                a single esd, or a text file with an ESD filename per line
41   -m                           Set if runnning on MC
42   -t <rootopt>                 Options passed to root
43   -l <list.txt>                Process sequentially all runs/dataset listed in the file 
44                                (one entry per line). If you use this option you don't 
45                                need the -d. in the case you are running on CAF, they 
46                                must have the same path
47   -x <suffix>                  Add extra suffix to files 
48   -i                           Disable PID cuts
49   -c min,max                   First and last centrality bins to process 
50                                (As defined in AddTaskLambdaK0PbPb)
51  Grid only options
52   -g <gridmode>                Plugin Mode [default=$mode]
53   -p <recopass>                Reconstruction pass [default=$pass]       
54  CAF only options
55   -p <path>                    Data set path
56   -n <nev>                     Number of events
57   -w <workers>                 Number of workers [default=$workers]
58
59  * Fit the results *
60   -f <folder>                  Run the fitting macro in the subfolder of ./output
61   -b <bin>                     Centrality bin index [default=$fitBin]
62   -p <particleID>              Fit particle defined by particleID [default=$partID]
63                                  0=K0 
64                                  1=Lambda 
65                                  2=Anti-Lambda 
66                                  3=Lambda + Anti-Lambda, 
67                                  4=Csi 
68                                  6=Omega
69   -x <suffix>                  Add extra suffix to files 
70 ENDOFGUIDE
71
72 }
73
74 while getopts "r:hd:mg:p:n:w:t:l:f:b:x:ic:s:" opt; do
75   case $opt in
76     s)
77     ihist=$OPTARG     
78     ;;
79     c)
80       bins=$OPTARG
81       binMax=${bins#*,}
82       binMin=${bins%,*}
83       ;;
84     r)
85       runMode=$OPTARG
86       task=yes
87       ;;
88     f) 
89       fitFolder=$OPTARG
90       fit=yes
91       ;;
92     b)
93       #fitBin=`printf %2.2d $OPTARG`
94       fitBin=$OPTARG
95       ;;
96     i)
97       usePID=kFALSE
98       ;;
99     d)
100       run=$OPTARG
101       ;;
102     l)
103       listfile=$OPTARG
104       ;;
105     t)
106       ROPT=$OPTARG
107       ;;
108     n)
109       nev=$OPTARG
110       ;;
111     w)
112       workers=$OPTARG
113       ;;
114     m)
115     #Int_t Nev =
116       mc=kTRUE
117       ;;
118     g) 
119       mode=$OPTARG
120       ;;
121     p)
122       pass=$OPTARG
123       partID=$OPTARG
124       ;;
125     x)
126       suffix=$OPTARG
127       ;;
128     h)
129       give_help
130       exit 1
131       ;;
132     \?)
133       echo "Invalid option: -$OPTARG" >&2
134       give_help
135       exit 1
136       ;;
137     :)
138       echo "Option -$OPTARG requires an argument." >&2
139       give_help
140       exit 1
141       ;;
142   esac
143 done
144
145
146 if [ "$task" = "yes" ]
147     then
148     runlist=$run
149     if [ "$listfile" != "" ]
150     then
151         runlist=""
152         while read line
153         do
154             runlist="$runlist $line"
155         done < $listfile        
156     fi
157
158     echo "Run list: $runlist"
159     
160
161     if [ "$runMode" = "2" ]
162     then
163         echo root $ROPT run.C\(\"$run\",\"$pass\",$nev,$offset,$debug,$runMode,$mc,$usePID,$option,$suffix,$workers,\"$mode\",$binMin,$binMax\)
164         root $ROPT run.C\(\"$run\",\"$pass\",$nev,$offset,$debug,$runMode,$mc,$usePID,\"$option\",\"$suffix\",$workers,\"$mode\",$binMin,$binMax\)
165     else
166         for run in $runlist 
167         do
168             echo root $ROPT run.C\(\"$run\",\"$pass\",$nev,$offset,$debug,$runMode,$mc,$usePID,$option,\"$suffix\",$workers,\"$mode\",$binMin,$binMax\)
169             root $ROPT run.C\(\"$run\",\"$pass\",$nev,$offset,$debug,$runMode,$mc,$usePID,\"$option\",\"$suffix\",$workers,\"$mode\",$binMin,$binMax\)
170         done
171     fi
172 elif [ "$fit" = "yes" ]
173 then    
174 #    root FitSpectrum.C\(\"./output/$fitFolder/lambdak0_${fitBin}.root\",\"clambdak0Histo_${fitBin}\",\"$suffix\",${ihist},$partID\)
175     root FitSpectrum.C\(\"./output10binsNew/$fitFolder/lambdak0_${fitBin}.root\",\"clambdak0Histo_${fitBin}\",\"$suffix\",${ihist},$partID\)
176 else
177     give_help
178 fi
179
180
181