]>
Commit | Line | Data |
---|---|---|
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 | # version 1.1 2008/03/28 00:33 Marco Meoni. Used aliensh instead of alien client | |
12 | ||
13 | # SET THE FOLLOWING PARAMETERS IF NEEDED: | |
14 | # --------------------------------------- | |
15 | YEAR=08 | |
16 | DIALOG=/usr/bin/dialog | |
17 | # --------------------------------------- | |
18 | ||
19 | RUNNUM=$1 | |
20 | ||
21 | [ -z $RUNNUM ] && { echo "Please provide a run number..."; exit 1; } | |
22 | ||
23 | [ ! -e "$HOME/.globus/usercert.pem" ] && { echo "FAILED: There is no certificate in $HOME/.globus"; exit 1; } | |
24 | ||
25 | [ -e "/tmp/gclient_env_$UID" ] && { source /tmp/gclient_env_$UID; } | |
26 | alien-token-init | |
27 | ||
28 | [ ! "$?" -eq "0" ] && { echo "FAILED: Token creation failed"; exit 1; } | |
29 | ||
30 | VERSION=1.0 | |
31 | TITLE="Standalone reconstruction of Grid rawdata chunks. v$VERSION" | |
32 | ||
33 | # Retrieve the list of chunks from AliEn....... | |
34 | BASEDIR="/alice/data/20"$YEAR | |
35 | PATTERN="/raw/"$YEAR"0000"$RUNNUM"*0.root" | |
36 | aliensh -c "gbbox find $BASEDIR $PATTERN" | head --lines=-1 > collection.tmp | |
37 | ||
38 | [ $(stat -c%s collection.tmp) -eq 0 ] && { echo "No chunks found for the given run"; exit 1; } | |
39 | rm -r collection.tmp2 | |
40 | for ifile in `cat collection.tmp | head --lines=500` ; do printf $ifile" "\|" "0" " >> collection.tmp2 ; done | |
41 | list=`cat collection.tmp2` | |
42 | rm -f collection.tmp2 | |
43 | totChunks=`cat collection.tmp | wc -l` | |
44 | rm -f collection.tmp | |
45 | ||
46 | tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$ | |
47 | trap "rm -f $tempfile" 0 1 2 5 15 | |
48 | $DIALOG --clear --no-cancel --title "$TITLE" \ | |
49 | --ok-label OK --checklist "$totChunks chunks available for run $RUNNUM (only the first 500 are shown). Select chunks for reconstruction" 18 80 10 \ | |
50 | $list 2> $tempfile | |
51 | ||
52 | CHUNKS=`cat $tempfile` | |
53 | echo "Selected chunks:" | |
54 | echo $CHUNKS | |
55 | echo | |
56 | ||
57 | $DIALOG --clear --no-cancel \ | |
58 | --ok-label OK --radiolist "Program to run:" 15 20 5 "aliroot -b" \| on alieve \| off 2> $tempfile | |
59 | PROGRAM=`cat $tempfile` | |
60 | ||
61 | for filename in $CHUNKS; do | |
62 | filename=${filename//\"/} | |
63 | CHUNK=`basename $filename | cut -d "." -f 1,2` | |
64 | ||
65 | echo "Running AliRoot reconstruction for chunk $filename. Outputs will be stored in "$RUNNUM"/"$CHUNK"." | |
66 | rm -rf $RUNNUM"/"$CHUNK | |
67 | mkdir -p $RUNNUM"/"$CHUNK | |
68 | cd $RUNNUM"/"$CHUNK | |
69 | $PROGRAM -q $ALICE_ROOT/test/cosmic/rec.C\(\"alien://$filename\"\) 2>&1 | tee rec.log | |
70 | cd ../.. | |
71 | done |