Example for mixing analysis.
[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# ---------------------------------------
15export YEAR=08
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
24[ -e "/tmp/gclient_env_$UID" ] && { source /tmp/gclient_env_$UID; }
12e6d563 25echo 12========================== $LD_LIBRARY_PATH
de3b7b4d 26alien-token-init
27
28[ ! "$?" -eq "0" ] && { echo "FAILED: Token creation failed"; exit 1; }
29
30VERSION=1.0
31TITLE="Standalone QA checking of Grid rawdata chunks. v$VERSION"
32
33# Retrieve the list of chunks from AliEn.......
34export BASEDIR="/alice/data/20"$YEAR
35PATTERN="/raw/"$YEAR"0000"$RUNNUM"*0.root"
36#aliensh -c "gbbox find $BASEDIR $PATTERN" | head --lines=-1 > collection.tmp
37aliensh -c "gbbox find $BASEDIR $PATTERN" > collection.tmp
38
39[ `ls -al collection.tmp | awk '{print $5}'` -eq 0 ] && { echo "No chunks found for the given run"; exit 1; }
40rm -r collection.tmp2
41#
42for ifile in `cat collection.tmp | grep root` ; do printf $ifile" "\|" "0" " >> collection.tmp2 ; done
43list=`cat collection.tmp2`
44[ -e collection.tmp2 ] && { rm -f collection.tmp2 ; }
45totChunks=`cat collection.tmp | wc -l`
46rm -f collection.tmp
47
48tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
49trap "rm -f $tempfile" 0 1 2 5 15
50dialog --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 \
52 $list 2> $tempfile
53
54CHUNKS=`cat $tempfile`
55echo "Selected chunks:"
56echo $CHUNKS
57echo
58
59#dialog --clear --no-cancel \
60# --ok-label OK --radiolist "Program to run:" 15 20 5 "aliroot -b" \| on alieve \| off 2> $tempfile
61PROGRAM=aliroot #`cat $tempfile`
12e6d563 62
de3b7b4d 63#
64for filename in $CHUNKS; do
65 filename=${filename//\"/}
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
76 $PROGRAM -q $ALICE_ROOT/test/cosmic/rawqa.C\(\"$filename\"\) 2>&1 | tee rawqa.log
35bb17ae 77 ls *.QA.$RUNNUM.0.root > $tempfile
78 cd ../
79 QAFILES=`cat $tempfile`
80 for qafile in $QAFILES; do
81 in=$CHUNK/$qafile
82 ou=${qafile/.0./.$SUBCHUNK.}
83 ln -si $in $ou
84 done
85 ln -si $CHUNK/QA.root QA.$SUBCHUNK.root
c2df60cc 86 cd ..
de3b7b4d 87done
35bb17ae 88cd $RUNNUM
89$PROGRAM -b <<EOF
90 AliQADataMakerSteer qas ;
91 qas.Merge(atoi(gSystem->Getenv("RUNNUM"))) ;
92EOF
93rm -f tempo.txt
94
c2df60cc 95$PROGRAM -b -q $ALICE_ROOT/test/cosmic/qasummary.C
384c0618 96$PROGRAM -b $ALICE_ROOT/test/QA/menuQA.C
35bb17ae 97cd ..