]> git.uio.no Git - u/mrichter/AliRoot.git/blame - test/prompt/RunOnlineDisplay
updates from Salvatore
[u/mrichter/AliRoot.git] / test / prompt / RunOnlineDisplay
CommitLineData
c720eafa 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
16if [ $# -ne 2 ]
17then
18 echo ""
19 echo " Usage: `basename $0` RunNumber GDCnumber"
20 echo ""
21 exit 999
22fi
23
24DATADIRBASE="/local/home/daq/data/current"
25RECMACRO="$ALICE_ROOT/test/cosmic/rec.C"
26PROMPTOFFLINEMACRO="/local/home/daq/alisoft/macros/RunPromptOffline.C"
27
28#override the default rec.C if ~/rec.C exists and is symlink
29if [ -h $HOME/rec.C ]
30then
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
45fi
46
47# data gets put in a dir named after the run number
48DATADIR="${DATADIRBASE}/${1}_OnlineDisplay"
49
50# never overwrite existing data, make a new directory if necessary
51# and give it a unique (sequential) number
52BIGGESTNUMBER=0
53DIRNUMBER=0
54if [ -d ${DATADIR} ]
55then
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}
69fi
70
71#Prepare ang go to the dir
72mkdir ${DATADIR}
73cp ${RECMACRO} ${DATADIR}
74cd ${DATADIR}
75
8ec2068a 76xterm -T "Reconstruction run: ${1} GDC: ${2}" -e "cd $DATADIR; aliroot ${PROMPTOFFLINEMACRO}\(${1},${2}\) | tee rec.log"&
c720eafa 77
78#wait some time for data to appear
79waitcount=0
80runalieve=1
81while [ ! -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
89done
90
91if [[ $runalieve -eq 1 ]]; then
8ec2068a 92 alieve anyscan_init.C | tee alieve.log
c720eafa 93fi