]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/qa/RunQA.sh
Major overhaul of the QA code.
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / qa / RunQA.sh
CommitLineData
2dbde04b 1#!/bin/bash
2
3jobid=0
4top=.
5verb=0
6
7export PATH=$PATH:$ALICE_ROOT/PWG2/FORWARD/analysis2/qa:../scripts
8
9usage()
10{
11cat <<EOF
12Usage: $0 -j JOBID [OPTIONS]
13
14Options:
15 -h.--help This help
16 -j,--jobid JOBID Job id from MonALisa
17 -o,--output DIRECTORY Where to store the result
18 -v,--verbose Be verbose
19EOF
20}
21
22mess()
23{
24 if test $verb -lt 1 ; then return ; fi
25 echo $@
26}
27
28# --- Get parts of the passed path -----------------------------------
29get_parts()
30{
31 y=$1 ; shift
32 p=$1 ; shift
33 r=$1 ; shift
34 e=$1 ; shift
35 x=$1 ; shift
36 r=$1
37
38 P=`echo $x | sed 's/.*pass\([0-9]*\).*/\1/'`
39 R=`echo $x | sed -n "s/.*pass${P}_//p"`
40 Q=`echo $x | sed -n 's/pass.*//p'`
41
42 case x$r in
43 xQA*) q=`echo $r | sed 's/QA//'` ;;
44 x) ;;
45 *) ;;
46 esac
47
48 opts="-p $p -P $P"
49 if test "x$R" != "x" ; then opts="$opts -R $R" ; fi
50 if test "x$q" != "x" ; then opts="$opts -q $q" ; fi
51 if test "x$Q" != "x" ; then opts="$opts -Q $Q" ; fi
52
53 dest="${p}/${Q}pass${P}"
54 if test "x$R" != "x" ; then dest="${dest}_${R}" ; fi
55
56}
57
58# --- Get the options ------------------------------------------------
59get_opts() {
60 wget -q http://alimonitor.cern.ch/prod/jobs.jsp?t=${jobid} -O job.html
61 p=`grep "/catalogue/index.jsp?path" job.html | head -n 1 | sed -e 's,.*/alice/data/\([^<]*\)<.*,\1,' | tr '/' ' '`
62 get_parts $p
63}
64
65# --- comamnd line ---------------------------------------------------
66while test $# -gt 0 ; do
67 case $1 in
68 -h|--help) usage ; exit 0 ;;
69 -j|--jobid) jobid=$2; shift ;;
70 -o|--output) top=$2 ; shift ;;
71 -v|--verbose) verb=1 ;;
72 *) echo "Unknown option $1" > /dev/stderr ; exit 1 ;;
73 esac
74 shift
75done
76
77# --- Sanity ---------------------------------------------------------
78if test $jobid -lt 1 ; then
79 echo "No JOBID specified" > /dev/stderr
80 exit 1
81fi
82
83# --- Extract options ------------------------------------------------
84get_opts $jobid
85mess "Options for getQAresults: $opts, destingation: $dest"
86if test "x$opts" = "x" ; then
87 echo "No options found"
88 exit 1
89fi
90
91set -e
92
93# --- Download the files ---------------------------------------------
94mess "Running getQAResults.sh $opts -d $top -n "
95getQAResults.sh $opts -d $top -T -v -v
96
97# --- Now run the QA code -------------------------------------------
98savdir=`pwd`
99cd $top/${dest}
100root -l -b -q $ALICE_ROOT/PWG2/FORWARD/analysis2/qa/RunQA.C
101cd $savdir
102
103cat <<EOF
104
105Finished running QA for jobid $jobid.
106Output is stored in $top/${dest}
107EOF
108
109#
110# EOF
111#
112
113
114
115