13 # Input (data and scripts)
14 ana=$ALICE_ROOT/PWGLF/FORWARD/analysis2
22 # Pass 2 event selection
28 # Pass 3 visualisation options
42 output2=forward_dndeta.root
43 outputs1="${output1} AliAOD.root event_stat.root EventStat_temp.root"
45 gdb_script=$ALICE_ROOT/PWGLF/FORWARD/analysis2/gdb_cmds
46 name=`date +analysis%Y%m%d_%H%M`
49 #_____________________________________________________________________
56 Do Pass1 and Pass2 on ESD files in current directory.
61 -b,--batch Do batch processing ($batch)
62 -P,--proof NWORKERS Run in PROOF(Lite) mode ($proof)
63 -1,--pass1 Run pass 1 (AOD) ($dopass1)
64 -2,--pass2 Run pass 2 (Hists) ($dopass2)
65 -3,--pass3 Run pass 3 (Vizualisation) ($dopass3)
66 -n,--events N Number of events ($nev)
67 -g,--gdb Run in GDB mode ($gdb)
68 -N,--name STRING Name of analysis ($name)
69 -E,--eloss Run energy loss script
70 -A,--script-dir Script directory ($ana)
71 -a,--program Program to use ($prog)
72 Pass 1 options and event selection
73 -C,--use-centrality Run centrality task ($cent)
74 -M,--mc Run over MC data ($mc)
75 -I,--input-dir PATH Path to input ESD data ($esddir)
77 -v,--vz-min CM Minimum value of vz ($vzmin)
78 -V,--vz-max CM Maximum value of vz ($vzmax)
79 -t,--trigger TYPE Select trigger TYPE ($type)
80 -S,--scheme SCHEME Normalisation scheme ($scheme)
81 -q,--mcfilename Result of MC analysis ($mcfilename)
83 -r,--rebin Rebin factor ($rebin)
84 -O,--others WHICH Show other data ($others)
85 -J,--show-rings Show individual rings ($rings)
86 -R,--show-ratios Show ratios to other data ($ratios)
87 -Z,--show-asymmetry Show asymmetry ($asymm)
88 -G,--show-syserror Show systematic errors ($syserr)
89 -T,--title STRING Title on plots ($tit)
91 TYPE is a comma or space separated list of
93 INEL Inelastic triggers (V0A|V0C|SPD)
94 INEL>0 As above + N_ch > 0 in -0.5<eta<+0.5
95 NSD Non-single diffractive ((VOA&VOC)|N_ch > 5 -1.9<eta<+1.9)
97 SCHEME is a comma or space separated list of
99 NONE No event-level normalization except trivial one
100 EVENT Event-level normalization
101 BACKGROUND Not implemented yet
102 SHAPE Shape correction
103 TRIGGER Trigger efficiency
104 FULL Same as EVENTLEVEL,BACKGROUND,SHAPE,TRIGGER
106 WHICH is a comma or space separated list of
108 UA5 UA5 data (900GeV, ppbar, INEL, NSD)
110 ALICE ALICE published data
111 PYTHIA Event generator data
113 If NWORKERS is 0, then the analysis will be run in local mode.
117 #_____________________________________________________________________
120 aliroot -l -b <<EOF > /dev/null 2>&1
121 int ret = gSystem->Load("libRAliEn");
122 gApplication->Terminate(ret);
128 #_____________________________________________________________________
135 #_____________________________________________________________________
140 if test -f ${fname}.${max_rotate} ; then
141 # echo "Removing ${fname}.${max_rotate}"
142 rm -f ${fname}.${max_rotate}
143 # echo "Maximum number of rotations - $max_rotate - for $fname found" \
147 let max=$max_rotate-1
148 for i in `seq $max -1 1` ; do
149 if test ! -f ${fname}.${i} ; then continue ; fi
151 # echo "Moving ${fname}.$i to ${fname}.$newn"
152 mv ${fname}.$i ${fname}.$newn
154 if test -f $fname ; then
155 # echo "Moving ${fname} to ${fname}.1"
160 #_____________________________________________________________________
162 # Function to run pass
164 # Arguments (in order)
165 # isBatch: Should we do batch processing
166 # output: Main output file
167 # outputs: All outputs
168 # outdir: Where the output will be put
169 # notlast: Not last pass
170 # script: Script name
171 # args: Arguments for script
183 # --- Log file name ----------------------------------------------
184 if test "x$output" = "x" ; then
187 log=`dirname $output`/`basename $output .root`.log
190 # --- Make options for AliROOT -----------------------------------
192 if test $isbatch -gt 0 || test $notLast -gt 0 ; then
195 if test $isbatch -gt 0 ; then
199 # --- Rotate output file -----------------------------------------
200 for i in ${outputs} ${log} ; do
204 # --- Some print out ---------------------------------------------
209 All outputs: $outputs
210 Output directory: $outdir
212 Script to run: $script
213 Script arguments: $args
215 AliROOT options: $opts
218 # --- Run AliROOT ------------------------------------------------
219 echo "Running ${prog} $opts ${script}${args}"
220 if test $isbatch -gt 0 || test $notLast -gt 0 ; then
221 ${prog} ${opts} ${script}"${args}" 2>&1 | tee ${log}
223 ${prog} ${opts} ${script}"${args}"
227 # --- Check exit conditions --------------------------------------
228 if test $fail -gt 0 ; then
229 echo "Returned $fail"
232 for i in ${outputs} ; do
233 if test ! -f ${outdir}${i} ; then
234 echo "File ${i} not generated in ${outdir}"
238 echo "Success (log in $log)"
241 #_____________________________________________________________________
242 # Loop over arguments
243 while test $# -gt 0 ; do
246 -h|--help) usage ; exit 0 ;;
247 -b|--batch) batch=`toggle $batch` ;;
248 -P|--proof) proof=$2 ; shift ;;
249 -1|--pass1|--aod) dopass1=`toggle $dopass1` ;;
250 -2|--pass2|--hist) dopass2=`toggle $dopass2` ;;
251 -3|--pass3|--draw) dopass3=`toggle $dopass3` ;;
252 -n|--events) nev=$2 ; shift ;;
253 -g|--gdb) gdb=`toggle $gdb` ;;
254 -N|--name) name=$2 ; shift ;;
255 -A|--script-dir) ana=$2; shift ;;
256 -a|--program) prog=$2 ; shift ;;
257 -E|--eloss) pass1=MakeELossFits.C
258 pass2=scripts/ExtractELoss.C
259 pass3=scripts/DrawAnaELoss.C
260 output1=forward_eloss.root
261 outputs1="${output1} event_stat.root EventStat_temp.root"
266 -C|--use-centrality) cent=`toggle $cent` ;;
267 -M|--mc) mc=`toggle $mc` ;;
268 -I|--input-dir) esddir=$2 ; shift ;;
270 -v|--vz-min) vzmin=$2 ; shift ;;
271 -V|--vz-max) vzmax=$2 ; shift ;;
272 -S|--scheme) scheme=`echo $2 | tr ' ' ','` ; shift ;;
273 -t|--type) type=$2 ; shift ;;
274 -q|--mcname) mcfilename=$2 ; shift ;;
276 -r|--rebin) rebin=$2 ; shift ;;
277 -O|--others) others=`echo $2 | tr ',' ' '` ; shift ;;
278 -R|--show-ratios) ratios=`toggle $ratios` ;;
279 -J|--show-rings) rings=`toggle $rings` ;;
280 -Z|--show-asymmetry) asymm=`toggle $asymm` ;;
281 -G|--show-syserror) syserr=`toggle $syserr` ;;
282 -T|--title) tit=$2 ; shift ;;
283 *) echo "$0: Unknown option '$1'" >> /dev/stderr ; exit 1 ;;
288 #_____________________________________________________________________
289 # Check for RAlien if needed
290 if test "x$name" != "x" && test_ralien ; then
291 echo "AliEn plug-in available - output will be in $name"
295 #_____________________________________________________________________
297 if test $dopass1 -gt 0 ; then
298 args="(\"${esddir}\",$nev,$proof,$mc,$cent,\"${name}\")"
300 run_pass ${batch} ${output1} "${outputs1}" "${pass2dir}" ${dopass2} \
301 ${ana}/${pass1} ${args}
305 #_____________________________________________________________________
307 if test $dopass2 -gt 0 ; then
308 if test -f forward_dndeta_mc.root ; then
309 if test "x$mcfilename" = "xnone" ||
310 test "x$mcfilename" = "x" ; then
311 mcfilename=forward_dndeta_mc.root
314 args="(\"${pass2dir}\",$nev,\"$type\",$cent,\"$scheme\",$vzmin,$vzmax,$proof,\"$name\",\"$mcfilename\")"
315 if test "x$pass1" = "xMakeELossFits.C" ; then
316 args=(\(\"${pass2dir}${output1}\"\))
319 run_pass ${batch} ${output2} "${outputs2}" "${pass2dir}" ${dopass3} \
320 ${ana}/${pass2} ${args}
324 #_____________________________________________________________________
326 if test $dopass3 -gt 0 ; then
327 tit=`echo $tit | tr ' ' '@'`
329 if test $ratios -gt 0 ; then let flags=$(($flags|0x1)); fi
330 if test $asymm -gt 0 ; then let flags=$(($flags|0x2)); fi
331 if test $syserr -gt 0 ; then let flags=$(($flags|0x4)); fi
332 if test $rings -gt 0 ; then let flags=$(($flags|0x8)); fi
334 others=`echo $others | tr ',' ' ' | tr '[a-z]' '[A-Z]'`
335 for i in $others ; do
337 UA5) let which=$(($which|0x1)) ;;
338 CMS) let which=$(($which|0x2)) ;;
339 ALICE) let which=$(($which|0x4)) ;;
340 PYTHIA|MC) let which=$(($which|0x8)) ;;
344 args="(\"${pass2dir}${output2}\",\"$tit\",$rebin,${which},${flags})"
345 if test "x$pass1" = "xMakeELossFits.C" ; then
346 args="(\"${pass2dir}${output1}\")"
349 run_pass ${batch} "" "" "" 0 ${ana}/${pass3} ${args}