]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/FORWARD/analysis2/Run.sh
Renamed script to add Central AOD task from
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / Run.sh
index 684be240b915cd6859d1388a0ff81c8af9a79453..abbc9f6ccd776867a25ab143b5113f48d6697132 100755 (executable)
@@ -5,8 +5,6 @@ nev=-1
 rebin=1
 vzmin=-10
 vzmax=10
-centlow=0
-centhigh=100
 batch=0
 gdb=0
 proof=0
@@ -17,6 +15,11 @@ hhd=1
 comp=1
 cent=0
 tit=
+others=0
+published=1
+ratios=1
+asymm=1 
+scheme="full"
 dopass1=0
 dopass2=0
 dopass3=0
@@ -25,8 +28,12 @@ pass2=MakedNdeta.C
 pass3=DrawdNdeta.C++g
 output1=forward.root
 output2=forward_dndeta.root
+outputs1="${output1} AliAOD.root event_stat.root EventStat_temp.root"
+outputs2="${output2}"
 gdb_script=$ALICE_ROOT/PWG2/FORWARD/analysis2/gdb_cmds
 max_rotate=10
+name=`date +analysis%Y%m%d_%H%M`
+pass2dir=./
 
 usage()
 {
@@ -50,9 +57,14 @@ Options:
        -g,--gdb                Run in GDB mode             ($gdb)
        -E,--eloss              Run energy loss script      
         -r,--rebin              Rebin factor                ($rebin)
-        -A,--cent               Run centrality task         ($cent)
-       -c,--cent-low           Lower centrality cut        ($centlow)
-       -C,--cent-high          Upper centrality cut        ($centhigh)
+        -C,--use-centrality     Run centrality task         ($cent)
+       -O,--show-older         Show older data             ($others)
+       -J,--show-published     Show ALICE published data   ($published)
+       -R,--show-ratios        Show ratios to other data   ($ratios)
+       -Z,--show-asymmetry     Show asymmetry              ($asymm)
+       -S,--scheme SCHEME      Normalisation scheme        ($scheme)
+       -T,--title STRING       Title on plots              ($tit)
+       -N,--name STRING        Name of analysis            ($name)
 
 TYPE is a comma or space separated list of 
  
@@ -60,10 +72,29 @@ TYPE is a comma or space separated list of
   INEL>0      As above + N_ch > 0 in -0.5<eta<+0.5
   NSD         Non-single diffractive ((VOA&VOC)|N_ch > 5 -1.9<eta<+1.9)
 
+SCHEME is a comma or space separated list of 
+
+  NONE          No event-level normalization except trivial one 
+  EVENT         Event-level normalization 
+  BACKGROUND    Not implemented yet 
+  SHAPE         Shape correction 
+  TRIGGER       Trigger efficiency 
+  FULL          Same as EVENTLEVEL,BACKGROUND,SHAPE,TRIGGER
+
 If NWORKERS is 0, then the analysis will be run in local mode. 
 EOF
 }
 
+test_ralien()
+{
+    aliroot -l -b <<EOF > /dev/null 2>&1
+int ret = gSystem->Load("libRAliEn");
+gApplication->Terminate(ret);
+EOF
+    ret=$?
+    return $ret
+}
+
 toggle()
 {
     echo $((($1+1)%2))
@@ -100,20 +131,27 @@ while test $# -gt 0 ; do
        -1|--pass1|-A|--aod)  dopass1=`toggle $dopass1`   ;; 
        -b|--batch)           batch=`toggle $batch`       ;; 
        -P|--proof)           proof=$2            ; shift ;; 
-       -B|--use-cent)        cent=`toggle $cent` ;;
+       -C|--use-centrality)  cent=`toggle $cent` ;;
        -M|--mc)              mc=`toggle $mc`     ;; 
        -g|--gdb)             gdb=`toggle $gdb`   ;;
        -r|--rebin)           rebin=$2            ; shift ;;
-       -c|--cent-low)        centlow=$2          ; shift ;;
-       -C|--cent-high)       centhigh=$2         ; shift ;;
        -v|--vz-min)          vzmin=$2            ; shift ;; 
        -V|--vz-max)          vzmax=$2            ; shift ;; 
        -E|--eloss)           pass1=MakeELossFits.C 
                              pass2=scripts/ExtractELoss.C
                              pass3=scripts/DrawAnaELoss.C 
                              output1=forward_eloss.root 
+                             outputs1="${output1} event_stat.root EventStat_temp.root"
+                             outputs2=""
                              dopass2=1 
-                            ;;
+                             ;;
+       -O|--show-older)      others=`toggle $others`   ;;
+       -J|--show-published)  published=`toggle $published`     ;;
+       -R|--show-ratios)     ratios=`toggle $ratios`   ;;
+       -Z|--show-asymmetry)  asymm=`toggle $asymm`     ;;
+       -S|--scheme)          scheme=`echo $2 | tr ' ' ','` ; shift ;;
+       -T|--title)           tit=$2 ; shift ;; 
+       -N|--name)            name=$2 ; shift ;; 
        -t|--type)           
            #if test "x$type" = "x" ; then type=$2 ; else type="$type|$2"; fi
            type=$2
@@ -123,6 +161,11 @@ while test $# -gt 0 ; do
     shift
 done 
 
+if test "x$name" != "x" && test_ralien ; then 
+    echo "AliEn plug-in available - output will be in $name"
+    pass2dir=${name}/
+fi
+
 if test $nev -lt 0 ; then 
     base=dndeta_xxxxxxx
 else 
@@ -141,37 +184,41 @@ if test $batch -gt 0 ; then
     echo "redir=$redir"
 fi 
 if test $dopass1 -gt 0 ; then 
-    rotate AliAOD.root
-    rotate ${output1}
+    for i in ${outputs1} ; do 
+       rotate ${pass2dir}${i}
+    done
 
     if test $gdb -gt 0 ; then 
        export PROOF_WRAPPERCMD="gdb -batch -x ${gdb_script} --args"
     fi
     echo "Running aliroot ${opts} ${opts1} ${ana}/${pass1}\(\".\",$nev,$proof,$mc\) $redir"
     if test $batch -gt 0 ; then 
-       aliroot $opts $opts1 ${ana}/${pass1}\(\".\",$nev,$proof,$mc,$cent\) 2>&1 | tee ${base}.log
+       aliroot $opts $opts1 ${ana}/${pass1}\(\".\",$nev,$proof,$mc,$cent,\"${name}\"\) 2>&1 | tee ${base}.log
     else 
-       aliroot $opts $opts1 ${ana}/${pass1}\(\".\",$nev,$proof,$mc,$cent\)
+       aliroot $opts $opts1 ${ana}/${pass1}\(\".\",$nev,$proof,$mc,$cent,\"${name}\"\)
     fi
     fail=$?
     if  test $fail -gt 0  ; then 
         echo "Return value $fail not 0" ; exit $fail 
     fi
-    if test ! -f ${output1} ; then 
-       echo "$output1 not made" ; exit 1; 
-    fi
-    if test ! -f AliAOD.root ; then 
-       echo "No AOD creates" ; exit 1;
-    fi
+    for i in ${outputs1} ; do 
+       if test ! -f ${pass2dir}${i} ; then 
+           echo "File ${i} in ${pass2dir} not generated"
+           exit 1
+       fi
+       ls -l ${pass2dir}/${i}
+    done
     echo "Pass 1 done"
 fi
 
 if test $dopass2 -gt 0 ; then
-    rotate ${output2}
+    for i in ${outputs2} ; do 
+       rotate ${pass2dir}${i} 
+    done 
 
-    args=(\(\".\",$nev,\"$type\",$centlow,$centhigh,$vzmin,$vzmax,$proof\))
+    args=(\(\"${pass2dir}\",$nev,\"$type\",$cent,\"$scheme\",$vzmin,$vzmax,$proof,\"$name\"\))
     if test "x$pass1" = "xMakeELossFits.C" ; then 
-       args=(\(\"${output1}\"\))
+       args=(\(\"${pass2dir}${output1}\"\))
     fi
     echo We are Running aliroot ${opts} ${opts1} ${ana}/${pass2}${args}
     aliroot ${opts} ${opts1} ${ana}/${pass2}${args}
@@ -180,17 +227,27 @@ if test $dopass2 -gt 0 ; then
     if test $fail -gt 0 ; then 
        echo "Return value $fail not 0" ; exit $fail 
     fi
-    if test ! -f ${output2} ; then 
-       echo "$output2 not made" ; exit 1; 
-    fi
+    for i in ${outputs2} ; do 
+       if test ! -f ${pass2dir}${i} ; then 
+           echo "File ${i} in ${pass2dir} not generated"
+           exit 1
+       fi
+       ls -l ${pass2dir}/${i}
+    done
     echo "Pass 2 done"
 fi
 
 if test $dopass3 -gt 0 ; then
     tit=`echo $tit | tr ' ' '@'` 
-    args=(\(\"${output2}\"\,0xf,\"\",$rebin \))
+    flags=0
+    if test $others    -gt 0 ; then let flags=$(($flags|0x1)); fi
+    if test $published -gt 0 ; then let flags=$(($flags|0x2)); fi
+    if test $ratios    -gt 0 ; then let flags=$(($flags|0x4)); fi
+    if test $asymm     -gt 0 ; then let flags=$(($flags|0x8)); fi
+
+    args=(\(\"${pass2dir}${output2}\"\,${flags},\"$tit\",$rebin \))
     if test "x$pass1" = "xMakeELossFits.C" ; then 
-       args=(\(\"${output1}\"\))
+       args=(\(\"${pass2dir}${output1}\"\))
     fi
     
     echo "Running aliroot ${opts} ${opts1} ${ana}/${pass3}${args}"