allowing other root versions for acr reco
[u/mrichter/AliRoot.git] / prod / acrcaf / rec.sh
1 #!/bin/bash
2
3 [ -d reco/local ] || mkdir reco/local
4 [ -d reco/log   ] || mkdir reco/log
5
6 if [ "$1" == "-local" ] && [ ! -z $2 ]
7 then
8     
9   nev=${3:-10000}
10   fev=${4:-0}
11
12   cd reco/local
13   mkdir -p run$2
14   rm -f run$2/*
15   cd run$2
16   
17   echo "Reconstructing into reco/local/run$2 and redirecting output to the file reco/local/run$2/stdout"
18
19   unbuffer aliroot -q ../../rec.C\($2,$nev,$fev\) 2>&1 | tee stdout
20
21 else
22
23   if [ "$1" != "-force" ]
24   then
25     pgrep aliroot > /dev/null
26     if [ "$?" -eq "0" ]
27     then
28       echo "Error: You can only start one rec.sh at a time. Please wait for the other session to terminate or close it."
29       exit
30     fi
31   else
32     shift
33   fi
34
35   CAFROOT=v5-24-00b-caf
36   BASE=
37   
38   if [ "$1" == "-ALICE_pro" ]
39   then
40     shift
41  
42     CAFROOT=ALICE_pro
43     BASE=/afs/cern.ch/alice/library/afs_volumes/vol12
44   fi
45
46   if [ "$1" == "-ALICE_new" ]
47   then
48     shift
49  
50     CAFROOT=ALICE_new
51     BASE=/afs/cern.ch/alice/library/afs_volumes/vol02
52   fi
53
54   if [ ! -z $BASE ]
55   then
56     echo "Setting ROOT and AliRoot to $CAFROOT"    
57
58     export ROOTSYS=$BASE/root
59     export PATH=$ROOTSYS/bin:$PATH
60     export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH
61
62     export ALICE_ROOT=$BASE/AliRoot
63     export ALICE_TARGET=`root-config --arch`
64     export LD_LIBRARY_PATH=$ALICE_ROOT/lib/tgt_${ALICE_TARGET}:$LD_LIBRARY_PATH
65     export PATH=$ALICE_ROOT/bin/tgt_${ALICE_TARGET}:$PATH
66   fi 
67
68   [ -z $1 ] && { echo "Usage: rec.sh [-local] <run_number>"; exit 1; }
69
70   nev=${2:-10000}
71   fev=${3:-0}
72
73   cd reco
74   aliroot -q run.C\($1,$nev,$fev,\"$CAFROOT\"\)
75
76 fi