Coding convention compliant version (by Raffaele)
[u/mrichter/AliRoot.git] / test / prompt / RunPromptReco
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
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}"
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
71mkdir ${DATADIR}
72
73cp ${RECMACRO} ${DATADIR}
74cd ${DATADIR}
8ec2068a 75aliroot ${PROMPTOFFLINEMACRO}\(${1},${2}\) | tee rec.log
c720eafa 76