The turbo version of decoding now as option for DA.
[u/mrichter/AliRoot.git] / test / cosmic / rec.sh
CommitLineData
21d4a8d1 1#!/bin/sh
2#############################################################################
3# rec.sh. Front-end script to run reconstruction from the grid chunks
4# Usage:
5# ./rec.sh <run_number>
6#############################################################################
7#
8# modification history
9# version 1.0 2008/03/04 02:12 Marco Meoni
10
11# SET THE FOLLOWING PARAMETERS IF NEEDED:
12# ---------------------------------------
13YEAR=08
14ALIENBIN=$ALIEN_ROOT/bin
15DIALOG=${DIALOG=dialog}
16PATH=$PATH:$ALIEN_ROOT/api/bin
17#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/alien/api/lib
18# ---------------------------------------
19
20RUNNUM=$1
21
22if [ -z $RUNNUM ]; then
23 echo "Please provide a run number..."
24 exit
25fi
26
27[ -e $ALIENBIN/alien ] || { echo "Cannot find AliEn client: missing ALIEN_ROOT environment variable and/or AliEn installation..."; exit 1; }
28
29VERSION=1.0
30TITLE="Standalone reconstruction of Grid rawdata chunks. v$VERSION"
31ALIEN="$ALIENBIN/alien login -exec"
32
33# Retrieve the list of chunks from AliEn.......
34BASEDIR="/alice/data/20"$YEAR
35PATTERN=$YEAR"0000"$RUNNUM"*0.root"
36
37$ALIEN " find $BASEDIR $PATTERN" > collection.tmp
38[ $(stat -c%s collection.tmp) -eq 0 ] && { echo "No chunks found for the given run"; exit 1; }
39list=`cat collection.tmp | awk '{printf("%s %s %s ",$1," .","0");}'`
40rm -f collection.tmp
41
42totChunks=`echo $list | wc -w`; totChunks=`echo \($totChunks / 3\) | bc`
43
44tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
45trap "rm -f $tempfile" 0 1 2 5 15
46
47$DIALOG --clear --no-cancel --title "$TITLE" \
48 --ok-label OK --checklist "$totChunks chunks available. Select chunks for reconstruction" 18 74 10 \
49 $list 2> $tempfile
50
51CHUNKS=`cat $tempfile`" ."
52echo "Selected chunks:"
53echo $CHUNKS
54echo
55
56alien-token-init
57. /tmp/gclient_env_$UID
58
59echo $CHUNKS | while read -d " " filename; do
60 filename=${filename//\"/}
61 CHUNK=`echo $filename | cut -d "/" -f 8 | cut -d "." -f 1,2 | cut -c 12-14,16-`
62
63 echo "Running AliRoot reconstruction for chunk $filename. Outputs will be stored in "$RUNNUM"/"$CHUNK"."
64 rm -rf $RUNNUM"/"$CHUNK
65 mkdir -p $RUNNUM"/"$CHUNK
66 cd $RUNNUM"/"$CHUNK
67 aliroot -b -q ../../rec.C\(\"alien://$filename\"\) 2>&1 | tee rec.log
68 cd ../..
69done