]> git.uio.no Git - u/mrichter/AliRoot.git/blob - test/prompt/RunPromptReco
allow to set the number of events throub an env variable
[u/mrichter/AliRoot.git] / test / prompt / RunPromptReco
1 #!/bin/bash
2 #################################################################
3 # This script sets up and runs the prompt offline reco
4 #
5 # Data gets put in a dir named after the run number in the
6 # $DATADIRBASE dir (default in ~/data)
7 # Never overwrite existing data, make a new directory if necessary
8 # and give it a unique (sequential) number
9 #
10 # it is possible to override the default rec.C by putting a symlink
11 # rec.C in homedir.
12
13 # origin: Mikolaj Krzewicki, Nikhef, Mikolaj.Krzewicki@cern.ch
14 #################################################################
15
16 if [ $# -ne 2 ]
17 then
18   echo ""
19   echo "  Usage: `basename $0` RunNumber GDCnumber"
20   echo ""
21   exit 999
22 fi
23
24 DATADIRBASE="/local/home/daq/data/current"
25 RECMACRO="$ALICE_ROOT/test/cosmic/rec.C"
26 PROMPTOFFLINEMACRO="/local/home/daq/alisoft/macros/RunPromptOffline.C"
27
28 #override the default rec.C if ~/rec.C exists and is symlink
29 if [ -h $HOME/rec.C ]
30 then
31   echo ""
32   echo "~/rec.C will override the default rec.C"
33   read -n 1 -p "Do you want to use the new one? [Y/n]" ans
34   if [[ $ans == "Y" || $ans == "y" || $ans == "" ]]
35   then
36     RECMACRO="$HOME/rec.C"
37     echo ""
38     echo "OK, using $RECMACRO"
39     echo ""
40   else
41     echo ""
42     echo "OK, using $RECMACRO"
43     echo ""
44   fi
45 fi
46
47 # data gets put in a dir named after the run number
48 DATADIR="${DATADIRBASE}/${1}"
49
50 # never overwrite existing data, make a new directory if necessary
51 # and give it a unique (sequential) number
52 BIGGESTNUMBER=0
53 DIRNUMBER=0
54 if [ -d ${DATADIR} ]
55 then
56   for x in ${DATADIR}*;
57   do
58     DIRNUMBER=`echo ${x} | sed -e s%${DATADIR}_*%%`
59     if [[ ${DIRNUMBER} == "" ]]
60     then
61       DIRNUMBER="0"
62     fi
63     if [[ ${DIRNUMBER} -ge ${BIGGESTNUMBER} ]]
64     then
65       BIGGESTNUMBER=$((DIRNUMBER+1))
66     fi
67   done
68   DATADIR=${DATADIR}_${BIGGESTNUMBER}
69 fi
70
71 mkdir ${DATADIR}
72
73 cp ${RECMACRO} ${DATADIR}
74 cd ${DATADIR}
75 aliroot ${PROMPTOFFLINEMACRO}\(${1},${2}\) | tee rec.log
76