]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/Run.sh
MC sharing sub-algorithm
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / Run.sh
1 #!/bin/bash 
2
3 ana=$ALICE_ROOT/PWG2/FORWARD/analysis2
4 nev=10000
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              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 EOF
52 }
53
54 toggle()
55 {
56     echo $((($1+1)%2))
57 }
58
59
60 while test $# -gt 0 ; do
61     case $1 in 
62         -h|--help)           usage            ; exit 0;; 
63         -n|--events)         nev=$2           ; shift ;; 
64         -2|--pass2)          noanal=`toggle $noanal`   ;; 
65         -1|--pass1)          nodraw=`toggle $nodraw`   ;; 
66         -b|--batch)          batch=`toggle $batch`   ;; 
67         -P|--proof)          proof=`toggle $proof`   ;; 
68         -M|--mc)             mc=`toggle $mc`   ;; 
69         -g|--gdb)            gdb=`toggle $gdb`   ;; 
70         -H|--hhd)            hhd=`toggle $hhd`   ;; 
71         -O|--other)          other=`toggle $other`   ;; 
72         -r|--rebin)          rebin=$2         ; shift ;; 
73         -v|--vz-min)         vzmin=$2         ; shift ;; 
74         -V|--vz-max)         vzmax=$2         ; shift ;; 
75         -e|--energy)         cms=$2           ; shift ;;
76         -S|--title)          tit="$2"         ; shift ;;
77         -t|--type)           
78             if test "x$type" = "x" ; then type=$2 ; else type="$type|$2"; fi
79             shift ;;
80         *) echo "$0: Unknown option '$1'" >> /dev/stderr ; exit 1 ;;
81     esac
82     shift
83 done 
84
85 base=`printf dndeta_%07d $nev`
86 opts="-l -x"
87 opts1=""
88 redir=
89 if test $nodraw -lt 1 ; then 
90     opts1="-q" 
91 fi
92 if test $batch -gt 0 ; then 
93     opts="-b -q $opts"
94     redir="2>&1 | tee ${base}.log"
95     echo "redir=$redir"
96 fi 
97 if test $noanal -lt 1 ; then 
98     rm -f AnalysisResult.root AliAODs.root
99     rm -f fmdana.png
100
101     if test $gdb -gt 0 ; then 
102         export PROOF_WRAPPERCMD="gdb -batch -x $ALICE_ROOT/PWG2/FORWARD/analysis2/gdb_cmds --args"
103     fi
104     echo "Running aliroot ${opts} ${opts1} ${ana}/Pass1.C\(\".\",$nev,$proof,$mc\) $redir"
105     if test $batch -gt 0 ; then 
106         aliroot $opts $opts1 ${ana}/Pass1.C\(\".\",$nev,$proof,$mc\) 2>&1 | tee ${base}.log
107     else 
108         aliroot $opts $opts1 ${ana}/Pass1.C\(\".\",$nev,$proof,$mc\)
109     fi
110     rm -f event_stat.root \
111         EventStat_temp.root \
112         outputs_valid \
113         `printf %09d.stat $nev` 
114     if test ! -f AnalysisResults.root || test ! -f AliAODs.root ; then 
115         echo "Analysis failed" 
116         exit 1
117     fi
118     echo "Analysis done"
119 fi
120
121 if test $nodraw -lt 1 ; then
122     rm -f result.root 
123     if test "x$tit" = "x" ; then 
124         tit="$nev events, v_{z}#in[$vzmin,$vzmax], $type"
125     fi
126     tit=`echo $tit | tr ' ' '@'` 
127     echo "Running aliroot ${opts} ${opts1} ${ana}/Pass2.C\(\"AliAODs.root\",\"$type\",$cms,$vzmin,$vzmax,$rebin,$hhd,$comp\)"
128     aliroot ${opts} ${ana}/Pass2.C\(\"AliAODs.root\",\"$type\",$cms,$vzmin,$vzmax,$rebin,\"$tit\",$hhd,$comp\)
129 fi
130
131
132 #
133 # EOF
134 #