Added some more scripts
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / Run.sh
CommitLineData
97561a26 1#!/bin/bash
2
3nev=10000
4noanal=0
5nodraw=0
6rebin=1
7vzmin=-10
8vzmax=10
97561a26 9batch=0
10gdb=0
11proof=0
12type=
13cms=900
14hhd=1
15comp=1
c389303e 16anal=0
17term=0
18tit=
97561a26 19
20usage()
21{
22cat<<EOF
23Usage: $0 [OPTIONS]
24
25Do Pass1 and Pass2 on ESD files in current directory.
26
27Options:
28 -h,--help This help
29 -n,--events N Number of events ($nev)
c389303e 30 -1,--pass1 Run only pass 1, no draw ($nodraw)
31 -2,--pass2 Run only pass 2, just draw ($noanal)
97561a26 32 -r,--rebin N Rebin by N ($rebin)
97561a26 33 -v,--vz-min CM Minimum value of vz ($vzmin)
34 -V,--vz-max CM Maximum value of vz ($vzmax)
35 -t,--trigger TYPE Select trigger TYPE ($type)
36 -e,--energy CMS Center of mass energy ($cms)
37 -b,--batch Do batch processing ($batch)
c389303e 38 -P,--proof Run in PROOF(Lite) mode ($proof)
39 -A,--analyse-only Run only analysis ($anal)
40 -T,--terminate-only Run only terminate ($term)
41 -S,--title STRING Set the title string ($tit)
97561a26 42 -g,--gdb Run in GDB mode ($gdb)
43 -H,--hhd Do comparison to HHD ($hhd)
44 -O,--other Do comparison to other ($comp)
45
46TYPE is a comma or space separated list of
47
48 INEL Inelastic triggers (V0A|V0C|SPD)
49 INEL>0 As above + N_ch > 0 in -0.5<eta<+0.5
50 NSD Non-single diffractive ((VOA&VOC)|N_ch > 5 -1.9<eta<+1.9)
51
52EOF
53}
54
55toggle()
56{
57 echo $((($1+1)%2))
58}
59
60
61while test $# -gt 0 ; do
62 case $1 in
63 -h|--help) usage ; exit 0;;
64 -n|--events) nev=$2 ; shift ;;
c389303e 65 -2|--pass2) noanal=`toggle $noanal` ;;
66 -1|--pass1) nodraw=`toggle $nodraw` ;;
97561a26 67 -b|--batch) batch=`toggle $batch` ;;
c389303e 68 -P|--proof) proof=`toggle $proof` ;;
69 -A|--analyse-only) anal=`toggle $anal` ;;
70 -T|--terminate-only) term=`toggle $term` ;;
97561a26 71 -g|--gdb) gdb=`toggle $gdb` ;;
72 -H|--hhd) hhd=`toggle $hhd` ;;
73 -O|--other) other=`toggle $other` ;;
74 -r|--rebin) rebin=$2 ; shift ;;
75 -v|--vz-min) vzmin=$2 ; shift ;;
76 -V|--vz-max) vzmax=$2 ; shift ;;
77 -e|--energy) cms=$2 ; shift ;;
c389303e 78 -S|--title) tit="$2" ; shift ;;
97561a26 79 -t|--type)
80 if test "x$type" = "x" ; then type=$2 ; else type="$type|$2"; fi
81 shift ;;
82 *) echo "$0: Unknown option '$1'" >> /dev/stderr ; exit 1 ;;
83 esac
84 shift
85done
86
87base=`printf dndeta_%07d $nev`
88opts="-l -x"
89redir=
90if test $batch -gt 0 ; then
91 opts="-l -b -q -x"
92 redir="2>&1 | tee ${base}.log"
93fi
94if test $noanal -lt 1 ; then
95 rm -f AnalysisResult.root AliAODs.root
96 rm -f fmdana.png
c389303e 97
98 # Setup analysis flags
99 af=0
100 if test $proof -gt 0 ; then
101 af=2
102 else
103 if test $anal -gt 0 ; then
104 af=8
105 elif test $term -gt 0 ; then
106 af=16
107 else
108 af=4
109 fi
110 fi
97561a26 111
112 if test $gdb -gt 0 ; then
113 export PROOF_WRAPPERCMD="gdb -batch -x $ALICE_ROOT/PWG2/FORWARD/analysis2/gdb_cmds --args"
114 fi
c389303e 115 aliroot $opts $ALICE_ROOT/PWG2/FORWARD/analysis2/Pass1.C\(\".\",$nev,$af\) \
116 $redir
97561a26 117 rm -f event_stat.root EventStat_temp.root outputs_valid
118 if test ! -f AnalysisResults.root || test ! -f AliAODs.root ; then
119 echo "Analysis failed"
120 exit 1
121 fi
122 echo "Analysis done"
123fi
124
125if test $nodraw -lt 1 ; then
126 rm -f result.root
c389303e 127 if test "x$tit" = "x" ; then
128 tit="$nev\ events,\ v_{z}#in[$vzmin,$vzmax],\ $type"
129 else
130 tit=`echo $tit | tr ' ' '\ '`
131 fi
132 aliroot ${opts} $ALICE_ROOT/PWG2/FORWARD/analysis2/Pass2.C\(\"AliAODs.root\",\"$type\",$cms,$vzmin,$vzmax,$rebin,\"$tit\",$hhd,$comp\)
97561a26 133fi
134
135
136#
137# EOF
138#