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