]> git.uio.no Git - u/mrichter/AliRoot.git/blame - test/cosmic/rawqa.sh
improving raw qa making
[u/mrichter/AliRoot.git] / test / cosmic / rawqa.sh
CommitLineData
12e6d563 1#!/bin/sh
de3b7b4d 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
de3b7b4d 13# SET THE FOLLOWING PARAMETERS IF NEEDED:
14# ---------------------------------------
4e056e45 15export YEAR=09
de3b7b4d 16# ---------------------------------------
17
35bb17ae 18export RUNNUM=$1
de3b7b4d 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
584cf3a1 24#[ -e "/tmp/gclient_env_$UID" ] && { source /tmp/gclient_env_$UID; }
25#echo 12========================== $LD_LIBRARY_PATH
de3b7b4d 26alien-token-init
584cf3a1 27source /tmp/gclient_env_$UID;
de3b7b4d 28
29[ ! "$?" -eq "0" ] && { echo "FAILED: Token creation failed"; exit 1; }
30
31VERSION=1.0
32TITLE="Standalone QA checking of Grid rawdata chunks. v$VERSION"
33
34# Retrieve the list of chunks from AliEn.......
35export BASEDIR="/alice/data/20"$YEAR
36PATTERN="/raw/"$YEAR"0000"$RUNNUM"*0.root"
37#aliensh -c "gbbox find $BASEDIR $PATTERN" | head --lines=-1 > collection.tmp
38aliensh -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; }
41rm -r collection.tmp2
42#
43for ifile in `cat collection.tmp | grep root` ; do printf $ifile" "\|" "0" " >> collection.tmp2 ; done
44list=`cat collection.tmp2`
45[ -e collection.tmp2 ] && { rm -f collection.tmp2 ; }
46totChunks=`cat collection.tmp | wc -l`
47rm -f collection.tmp
48
49tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
50trap "rm -f $tempfile" 0 1 2 5 15
51dialog --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
55CHUNKS=`cat $tempfile`
56echo "Selected chunks:"
57echo $CHUNKS
58echo
59
60#dialog --clear --no-cancel \
61# --ok-label OK --radiolist "Program to run:" 15 20 5 "aliroot -b" \| on alieve \| off 2> $tempfile
62PROGRAM=aliroot #`cat $tempfile`
12e6d563 63
de3b7b4d 64#
65for filename in $CHUNKS; do
de3b7b4d 66 CHUNK=`basename $filename | cut -d "." -f 1,2`
b9a4f38c 67 BEG=`expr index "$CHUNK" .`
68 BEG=`expr $BEG - 4`
69 SUBCHUNK=${CHUNK:$BEG}
35bb17ae 70 echo "Running QA for chunk $filename. Outputs will be stored in "$RUNNUM"/"$CHUNK". $SUBCHUNK"
12e6d563 71 [ -e $RUNNUM"/"$CHUNK ] && { rm -rf $RUNNUM"/"$CHUNK ; }
de3b7b4d 72 mkdir -p $RUNNUM"/"$CHUNK
12e6d563 73 rm $RUNNUM"/"*.QA.$RUNNUM.$SUBCHUNK.root
74 rm $RUNNUM"/"QA.$SUBCHUNK.root
de3b7b4d 75 cd $RUNNUM"/"$CHUNK
4e056e45 76$PROGRAM -b <<EOF
77.L $ALICE_ROOT/test/cosmic/rawqa.C+
78rawqa($filename, $RUNNUM)
79EOF
80
81$PROGRAM -b <<EOF
82AliQAManager * qam = AliQAManager::QAManager(AliQAv1::kRECMODE) ;
83 qam.Merge(atoi(gSystem->Getenv("RUNNUM"))) ;
84EOF
85 rm *QA.$RUNNUM.root
c2df60cc 86 cd ..
de3b7b4d 87done
4e056e45 88ls */Merged.QA.Data.root > merged.list
89outfile="Merged.QA.Data."$RUNNUM".root"
35bb17ae 90$PROGRAM -b <<EOF
4e056e45 91.L $ALICE_ROOT/test/cosmic/MergeQAMerged.C
92MergeQAMerged("$outfile", "merged.list") ;
35bb17ae 93EOF
4e056e45 94rm -f merged.list
95#$PROGRAM -b -q $ALICE_ROOT/test/cosmic/qasummary.C
96#$PROGRAM -b $ALICE_ROOT/test/QA/menuQA.C
35bb17ae 97cd ..