]> git.uio.no Git - u/mrichter/AliRoot.git/blob - test/proof/prepareAlienCollection.sh
Example of CAF raw-data reconstruction. The simplest usage is rec.sh <run#>.
[u/mrichter/AliRoot.git] / test / proof / prepareAlienCollection.sh
1 #!/bin/sh
2 #############################################################################
3 # prepareCollection.sh. Script to prepare a raw-data chunks collection
4 # for a given run
5 # Usage:
6 #    ./prepareCollection.sh <run_number> <collection_file>
7 #############################################################################
8 #
9 # modification history
10 # version 1.0  2008/09/12 Cvetan Cheshkov
11
12 # SET THE FOLLOWING PARAMETERS IF NEEDED: 
13 # ---------------------------------------
14 YEAR=09
15 # ---------------------------------------
16
17 RUNNUM=$1
18
19 [ -z $RUNNUM ] && { echo "Please provide a run number..."; exit 1; }
20
21 OUTFILE=$2
22
23 [ -z $OUTFILE ] && { echo "Please provide an output filename..."; 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 
29
30 [ ! "$?" -eq "0" ] && { echo "FAILED: Token creation failed"; exit 1; }
31
32 # Retrieve the list of chunks from AliEn.......
33 BASEDIR="/alice/data/20"$YEAR
34 PATTERN="/raw/"$YEAR"0000"$RUNNUM"*0.root"
35 rm -f collection.tmp
36 gbbox find $BASEDIR $PATTERN | grep -v found | 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
40 rm -f $OUTFILE
41 for ifile in `cat collection.tmp` ; do echo "alien://$ifile" >> $OUTFILE 2>&1; done
42 rm -f collection.tmp
43
44 echo `cat $OUTFILE | wc -l`" raw-data chunks are found and added to the collection file "$OUTFILE;
45