]> git.uio.no Git - u/mrichter/AliRoot.git/blob - test/prompt/RunOnlineAlieve
bugfix
[u/mrichter/AliRoot.git] / test / prompt / RunOnlineAlieve
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 [ $# -lt 2 ]
17 then
18   echo ""
19   echo "  Usage: `basename $0` RunNumber GDCnumber [Trigger]"
20   echo "          (don't use the Trigger argument unless you're really sure what you're doing!)"
21   echo ""
22   exit 999
23 fi
24
25 DATADIRBASE="/local/home/daq/data/current"
26 RECMACRO="$ALICE_ROOT/test/cosmic/rec.C"
27 PROMPTOFFLINEMACRO="/local/home/daq/alisoft/macros/RunPromptOffline.C"
28
29 #override the default rec.C if ~/rec.C exists and is symlink
30 if [ -h $HOME/rec.C ]
31 then
32   echo ""
33   echo "~/rec.C will override the default rec.C"
34   read -n 1 -p "Do you want to use the new one? [Y/n]" ans
35   if [[ $ans == "Y" || $ans == "y" || $ans == "" ]]
36   then
37     RECMACRO="$HOME/rec.C"
38     echo ""
39     echo "OK, using $RECMACRO"
40     echo ""
41   else
42     echo ""
43     echo "OK, using $RECMACRO"
44     echo ""
45   fi
46 fi
47
48 # data gets put in a dir named after the run number
49 DATADIR="${DATADIRBASE}/${1}_OnlineDisplay"
50
51 # never overwrite existing data, make a new directory if necessary
52 # and give it a unique (sequential) number
53 BIGGESTNUMBER=0
54 DIRNUMBER=0
55 if [ -d ${DATADIR} ]
56 then
57   for x in ${DATADIR}*;
58   do
59     DIRNUMBER=`echo ${x} | sed -e s%${DATADIR}_*%%`
60     if [[ ${DIRNUMBER} == "" ]]
61     then
62       DIRNUMBER="0"
63     fi
64     if [[ ${DIRNUMBER} -ge ${BIGGESTNUMBER} ]]
65     then
66       BIGGESTNUMBER=$((DIRNUMBER+1))
67     fi
68   done
69   DATADIR=${DATADIR}_${BIGGESTNUMBER}
70 fi
71
72 mkdir ${DATADIR}
73
74 cp ${RECMACRO} ${DATADIR}
75 cd ${DATADIR}
76
77 if [ $# -eq 3 ]
78 then
79   alieve ${PROMPTOFFLINEMACRO}\(${1},${2},${3}\) | tee alieve.log
80 else
81   alieve ${PROMPTOFFLINEMACRO}\(${1},${2}\) | tee alieve.log
82 fi