run TPC offline clusterer with multiple input blocks for better performance
[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
02a8cae4 10#
11# version 1.1 2008/03/28 00:33 Marco Meoni. Used aliensh instead of alien client
21d4a8d1 12
13# SET THE FOLLOWING PARAMETERS IF NEEDED:
14# ---------------------------------------
15YEAR=08
21d4a8d1 16DIALOG=${DIALOG=dialog}
02a8cae4 17GSHELL_ROOT=$ALIEN_ROOT/api
18PATH=$PATH:$GSHELL_ROOT/bin
21d4a8d1 19# ---------------------------------------
20
21RUNNUM=$1
22
02a8cae4 23[ -z $RUNNUM ] && { echo "Please provide a run number..."; exit 1; }
24
25[ ! -e "$HOME/.globus/usercert.pem" ] && { echo "FAILED: There is no certificate in $HOME/.globus"; exit 1; }
26
27[ -e "/tmp/gclient_env_$UID" ] && { source /tmp/gclient_env_$UID; }
28alien-token-init
21d4a8d1 29
02a8cae4 30[ ! "$?" -eq "0" ] && { echo "FAILED: Token creation failed"; exit 1; }
21d4a8d1 31
32VERSION=1.0
33TITLE="Standalone reconstruction of Grid rawdata chunks. v$VERSION"
21d4a8d1 34
35# Retrieve the list of chunks from AliEn.......
36BASEDIR="/alice/data/20"$YEAR
02a8cae4 37PATTERN="/raw/"$YEAR"0000"$RUNNUM"*0.root"
38aliensh -c "gbbox find $BASEDIR $PATTERN" | head --lines=-1 > collection.tmp
21d4a8d1 39
21d4a8d1 40[ $(stat -c%s collection.tmp) -eq 0 ] && { echo "No chunks found for the given run"; exit 1; }
02a8cae4 41list=`cat collection.tmp | awk '{printf("%s %s %s ",$1," .","0");}'` # improve: put basename
42totChunks=`cat collection.tmp | wc -l`; totChunks=`echo \($totChunks / 3\) | bc`
21d4a8d1 43rm -f collection.tmp
44
21d4a8d1 45tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
46trap "rm -f $tempfile" 0 1 2 5 15
21d4a8d1 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
21d4a8d1 56echo $CHUNKS | while read -d " " filename; do
57 filename=${filename//\"/}
58 CHUNK=`echo $filename | cut -d "/" -f 8 | cut -d "." -f 1,2 | cut -c 12-14,16-`
59
60 echo "Running AliRoot reconstruction for chunk $filename. Outputs will be stored in "$RUNNUM"/"$CHUNK"."
61 rm -rf $RUNNUM"/"$CHUNK
62 mkdir -p $RUNNUM"/"$CHUNK
63 cd $RUNNUM"/"$CHUNK
64 aliroot -b -q ../../rec.C\(\"alien://$filename\"\) 2>&1 | tee rec.log
65 cd ../..
66done