]>
Commit | Line | Data |
---|---|---|
6bc9e7bc | 1 | #!/bin/bash |
21d4a8d1 | 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 | # --------------------------------------- | |
bb72d990 | 15 | YEAR=09 |
794df840 | 16 | DIALOG=`which dialog` |
21d4a8d1 | 17 | # --------------------------------------- |
18 | ||
48360675 | 19 | kill -9 `ps | grep aliroot | awk '{print $1}'` |
20 | ||
21 | export RUNNUM=$1 | |
21d4a8d1 | 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; } | |
28 | alien-token-init | |
21d4a8d1 | 29 | |
02a8cae4 | 30 | [ ! "$?" -eq "0" ] && { echo "FAILED: Token creation failed"; exit 1; } |
21d4a8d1 | 31 | |
32 | VERSION=1.0 | |
33 | TITLE="Standalone reconstruction of Grid rawdata chunks. v$VERSION" | |
21d4a8d1 | 34 | |
35 | # Retrieve the list of chunks from AliEn....... | |
172fe4b6 | 36 | export BASEDIR="/alice/data/20"$YEAR/LHC${YEAR}* |
37 | PATTERN="$RUNNUM/raw/${YEAR}*${RUNNUM}*.root" | |
794df840 | 38 | gbbox find $BASEDIR $PATTERN | head -n 500 > collection.tmp |
21d4a8d1 | 39 | |
794df840 | 40 | [ $(wc -l collection.tmp) -eq 0 ] && { echo "No chunks found for the given run"; exit 1; } |
6bc9e7bc | 41 | rm -f collection.tmp2 |
794df840 | 42 | for ifile in `cat collection.tmp | head -n 500` ; do printf $ifile" "\|" "0" " >> collection.tmp2 ; done |
3778611a | 43 | list=`cat collection.tmp2` |
44 | rm -f collection.tmp2 | |
45 | totChunks=`cat collection.tmp | wc -l` | |
21d4a8d1 | 46 | rm -f collection.tmp |
47 | ||
21d4a8d1 | 48 | tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$ |
49 | trap "rm -f $tempfile" 0 1 2 5 15 | |
21d4a8d1 | 50 | $DIALOG --clear --no-cancel --title "$TITLE" \ |
3778611a | 51 | --ok-label OK --checklist "$totChunks chunks available for run $RUNNUM (only the first 500 are shown). Select chunks for reconstruction" 18 80 10 \ |
21d4a8d1 | 52 | $list 2> $tempfile |
53 | ||
3778611a | 54 | CHUNKS=`cat $tempfile` |
21d4a8d1 | 55 | echo "Selected chunks:" |
56 | echo $CHUNKS | |
57 | echo | |
58 | ||
3778611a | 59 | $DIALOG --clear --no-cancel \ |
60 | --ok-label OK --radiolist "Program to run:" 15 20 5 "aliroot -b" \| on alieve \| off 2> $tempfile | |
61 | PROGRAM=`cat $tempfile` | |
62 | ||
63 | for filename in $CHUNKS; do | |
6bc9e7bc | 64 | filename=${filename//\"/} |
3778611a | 65 | CHUNK=`basename $filename | cut -d "." -f 1,2` |
21d4a8d1 | 66 | |
67 | echo "Running AliRoot reconstruction for chunk $filename. Outputs will be stored in "$RUNNUM"/"$CHUNK"." | |
68 | rm -rf $RUNNUM"/"$CHUNK | |
69 | mkdir -p $RUNNUM"/"$CHUNK | |
70 | cd $RUNNUM"/"$CHUNK | |
48360675 | 71 | $PROGRAM -q $ALICE_ROOT/prod/cosmic/rec.C\(\"alien://$filename\"\) 2>&1 | tee rec.log |
21d4a8d1 | 72 | cd ../.. |
73 | done |