2 #############################################################################
3 # rawqa.sh. Front-end script to run reconstruction from the grid chunks
5 # ./rawqa.sh <run_number>
6 #############################################################################
9 # version 1.0 July 2008 adapated from rec.C by M. Meoni
10 # author Yves Schutz CERN
14 # SET THE FOLLOWING PARAMETERS IF NEEDED:
15 # ---------------------------------------
17 # ---------------------------------------
21 [ -z $RUNNUM ] && { echo "Please provide a run number..."; exit 1; }
23 [ ! -e "$HOME/.globus/usercert.pem" ] && { echo "FAILED: There is no certificate in $HOME/.globus"; exit 1; }
25 [ -e "/tmp/gclient_env_$UID" ] && { source /tmp/gclient_env_$UID; }
28 [ ! "$?" -eq "0" ] && { echo "FAILED: Token creation failed"; exit 1; }
31 TITLE="Standalone QA checking of Grid rawdata chunks. v$VERSION"
33 # Retrieve the list of chunks from AliEn.......
34 export 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 aliensh -c "gbbox find $BASEDIR $PATTERN" > collection.tmp
39 [ `ls -al collection.tmp | awk '{print $5}'` -eq 0 ] && { echo "No chunks found for the given run"; exit 1; }
42 for ifile in `cat collection.tmp | grep root` ; do printf $ifile" "\|" "0" " >> collection.tmp2 ; done
43 list=`cat collection.tmp2`
44 [ -e collection.tmp2 ] && { rm -f collection.tmp2 ; }
45 totChunks=`cat collection.tmp | wc -l`
48 tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
49 trap "rm -f $tempfile" 0 1 2 5 15
50 dialog --clear --no-cancel --title "$TITLE" \
51 --ok-label OK --checklist "$totChunks chunks available for run $RUNNUM (only the first 500 are shown). Select chunks for reconstruction" 18 80 10 \
54 CHUNKS=`cat $tempfile`
55 echo "Selected chunks:"
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=aliroot #`cat $tempfile`
63 rm -rf $RUNNUM"/"*QA.$RUNNUM*.root
64 for filename in $CHUNKS; do
65 filename=${filename//\"/}
66 CHUNK=`basename $filename | cut -d "." -f 1,2`
68 echo "Running QA for chunk $filename. Outputs will be stored in "$RUNNUM"/"$CHUNK". $SUBCHUNK"
69 rm -rf $RUNNUM"/"$CHUNK
70 mkdir -p $RUNNUM"/"$CHUNK
72 $PROGRAM -q $ALICE_ROOT/test/cosmic/rawqa.C\(\"$filename\"\) 2>&1 | tee rawqa.log
73 ls *.QA.$RUNNUM.0.root > $tempfile
75 QAFILES=`cat $tempfile`
76 for qafile in $QAFILES; do
78 ou=${qafile/.0./.$SUBCHUNK.}
81 ln -si $CHUNK/QA.root QA.$SUBCHUNK.root
86 AliQADataMakerSteer qas ;
87 qas.Merge(atoi(gSystem->Getenv("RUNNUM"))) ;
91 $PROGRAM -b $ALICE_ROOT/test/cosmic/qasummary.C