]> git.uio.no Git - u/mrichter/AliRoot.git/blob - test/prompt/RunOnlineDisplay
Root6-enabled version
[u/mrichter/AliRoot.git] / test / prompt / RunOnlineDisplay
1 #!/bin/bash
2 #################################################################
3 # This script sets up and runs the online display.
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}_OnlineDisplay"
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 #Prepare ang go to the dir
72 mkdir ${DATADIR}
73 cp ${RECMACRO} ${DATADIR}
74 cd ${DATADIR}
75
76 xterm -T "Reconstruction run: ${1} GDC: ${2}" -e "cd $DATADIR; aliroot ${PROMPTOFFLINEMACRO}\(${1},${2}\) | tee rec.log"&
77
78 #wait some time for data to appear
79 waitcount=0
80 runalieve=1
81 while [ ! -f AliESDs.root ]; do
82   waitcount=$((waitcount+1))
83   if [[ $waitcount -ge 20000 ]]; then
84     runalieve=0
85     break
86   fi
87   echo "reconstruction produced no data yet"
88   sleep 2
89 done
90
91 if [[ $runalieve -eq 1 ]]; then
92   alieve anyscan_init.C | tee alieve.log
93 fi