]> git.uio.no Git - u/mrichter/AliRoot.git/blob - test/cosmic/rawqa.sh
setting the alien environment
[u/mrichter/AliRoot.git] / test / cosmic / rawqa.sh
1 #!/bin/sh 
2 #############################################################################
3 # rawqa.sh. Front-end script to run reconstruction from the grid chunks
4 # Usage:
5 #    ./rawqa.sh <run_number>
6 #############################################################################
7 #
8 # modification history
9 # version 1.0  July 2008 adapated from rec.C by M. Meoni
10 # author Yves Schutz CERN
11 #
12
13 # SET THE FOLLOWING PARAMETERS IF NEEDED: 
14 # ---------------------------------------
15 export YEAR=08
16 # ---------------------------------------
17
18 export RUNNUM=$1
19
20 [ -z $RUNNUM ] && { echo "Please provide a run number..."; exit 1; }
21
22 [ ! -e "$HOME/.globus/usercert.pem" ] && { echo "FAILED: There is no certificate in $HOME/.globus"; exit 1; }
23
24 #[ -e "/tmp/gclient_env_$UID" ] && { source /tmp/gclient_env_$UID; }
25 #echo 12==========================  $LD_LIBRARY_PATH
26 alien-token-init 
27 source /tmp/gclient_env_$UID;
28
29 [ ! "$?" -eq "0" ] && { echo "FAILED: Token creation failed"; exit 1; }
30
31 VERSION=1.0
32 TITLE="Standalone QA checking of Grid rawdata chunks. v$VERSION"
33
34 # Retrieve the list of chunks from AliEn.......
35 export BASEDIR="/alice/data/20"$YEAR
36 PATTERN="/raw/"$YEAR"0000"$RUNNUM"*0.root"
37 #aliensh -c "gbbox find $BASEDIR $PATTERN" | head --lines=-1 > collection.tmp
38 aliensh -c "gbbox find $BASEDIR $PATTERN" > collection.tmp
39
40 [ `ls -al collection.tmp | awk '{print $5}'` -eq 0 ] && { echo "No chunks found for the given run"; exit 1; }
41 rm -r collection.tmp2
42 #
43 for ifile in `cat collection.tmp | grep root` ; do printf $ifile" "\|" "0" " >> collection.tmp2 ; done
44 list=`cat collection.tmp2`
45 [ -e collection.tmp2 ] && { rm -f collection.tmp2 ; } 
46 totChunks=`cat collection.tmp | wc -l`
47 rm -f collection.tmp
48
49 tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
50 trap "rm -f $tempfile" 0 1 2 5 15
51 dialog --clear --no-cancel --title "$TITLE" \
52         --ok-label OK --checklist "$totChunks chunks available for run $RUNNUM (only the first 500 are shown). Select chunks for reconstruction" 18 80 10 \
53         $list 2> $tempfile
54
55 CHUNKS=`cat $tempfile`
56 echo "Selected chunks:"
57 echo $CHUNKS
58 echo
59
60 #dialog --clear --no-cancel \
61 #        --ok-label OK --radiolist "Program to run:" 15 20 5 "aliroot -b" \| on alieve \| off 2> $tempfile
62 PROGRAM=aliroot #`cat $tempfile`
63
64
65 for filename in $CHUNKS; do
66      filename=${filename//\"/} 
67      CHUNK=`basename $filename | cut -d "." -f 1,2`
68      BEG=`expr index "$CHUNK" .`
69      BEG=`expr $BEG - 4`
70      SUBCHUNK=${CHUNK:$BEG}
71      echo "Running QA for chunk $filename. Outputs will be stored in "$RUNNUM"/"$CHUNK".   $SUBCHUNK"
72      [ -e $RUNNUM"/"$CHUNK ] && { rm -rf   $RUNNUM"/"$CHUNK ; }
73      mkdir -p $RUNNUM"/"$CHUNK
74      rm $RUNNUM"/"*.QA.$RUNNUM.$SUBCHUNK.root 
75      rm $RUNNUM"/"QA.$SUBCHUNK.root 
76      cd       $RUNNUM"/"$CHUNK
77      $PROGRAM -q $ALICE_ROOT/test/cosmic/rawqa.C\(\"$filename\"\) 2>&1 | tee rawqa.log
78      ls *.QA.$RUNNUM.0.root > $tempfile
79      cd ../
80      QAFILES=`cat $tempfile`
81      for qafile in $QAFILES; do
82         in=$CHUNK/$qafile
83         ou=${qafile/.0./.$SUBCHUNK.}
84         ln -si $in $ou
85      done
86      ln -si $CHUNK/QA.root QA.$SUBCHUNK.root
87      cd ..
88 done
89 cd $RUNNUM
90 $PROGRAM -b <<EOF
91  AliQADataMakerSteer qas ; 
92  qas.Merge(atoi(gSystem->Getenv("RUNNUM"))) ;
93 EOF
94 rm -f tempo.txt
95
96 $PROGRAM -b -q $ALICE_ROOT/test/cosmic/qasummary.C 
97 $PROGRAM -b  $ALICE_ROOT/test/QA/menuQA.C
98 cd ..