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