Fixing bug #59470
[u/mrichter/AliRoot.git] / test / prompt / RunOnlineAlieve
CommitLineData
c720eafa 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
8ec2068a 16if [ $# -lt 2 ]
c720eafa 17then
18 echo ""
8ec2068a 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!)"
c720eafa 21 echo ""
22 exit 999
23fi
24
25DATADIRBASE="/local/home/daq/data/current"
26RECMACRO="$ALICE_ROOT/test/cosmic/rec.C"
27PROMPTOFFLINEMACRO="/local/home/daq/alisoft/macros/RunPromptOffline.C"
28
29#override the default rec.C if ~/rec.C exists and is symlink
30if [ -h $HOME/rec.C ]
31then
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
46fi
47
48# data gets put in a dir named after the run number
8ec2068a 49DATADIR="${DATADIRBASE}/${1}_OnlineDisplay"
c720eafa 50
51# never overwrite existing data, make a new directory if necessary
52# and give it a unique (sequential) number
53BIGGESTNUMBER=0
54DIRNUMBER=0
55if [ -d ${DATADIR} ]
56then
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}
70fi
71
72mkdir ${DATADIR}
73
74cp ${RECMACRO} ${DATADIR}
75cd ${DATADIR}
c720eafa 76
8ec2068a 77if [ $# -eq 3 ]
78then
79 alieve ${PROMPTOFFLINEMACRO}\(${1},${2},${3}\) | tee alieve.log
80else
81 alieve ${PROMPTOFFLINEMACRO}\(${1},${2}\) | tee alieve.log
82fi