| 1 | #!/bin/sh
|
|---|
| 2 | #
|
|---|
| 3 | # ========================================================================
|
|---|
| 4 | #
|
|---|
| 5 | # *
|
|---|
| 6 | # * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 7 | # * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 8 | # * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 9 | # * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 10 | # *
|
|---|
| 11 | # * Permission to use, copy, modify and distribute this software and its
|
|---|
| 12 | # * documentation for any purpose is hereby granted without fee,
|
|---|
| 13 | # * provided that the above copyright notice appear in all copies and
|
|---|
| 14 | # * that both that copyright notice and this permission notice appear
|
|---|
| 15 | # * in supporting documentation. It is provided "as is" without express
|
|---|
| 16 | # * or implied warranty.
|
|---|
| 17 | # *
|
|---|
| 18 | #
|
|---|
| 19 | #
|
|---|
| 20 | # Author(s): Daniela Dorner 08/2005 <mailto:dorner@astro.uni-wuerzburg.de>
|
|---|
| 21 | #
|
|---|
| 22 | # Copyright: MAGIC Software Development, 2000-2007
|
|---|
| 23 | #
|
|---|
| 24 | #
|
|---|
| 25 | # ========================================================================
|
|---|
| 26 | #
|
|---|
| 27 | # This script produces the qualityplots in the web by executing the macro
|
|---|
| 28 | # plotdb.C
|
|---|
| 29 | #
|
|---|
| 30 | # After checking, if the script is already running, the plots are produced
|
|---|
| 31 | # (ps and root file). Then they are moved to the webdirectory and there png
|
|---|
| 32 | # files are produced from the ps file.
|
|---|
| 33 | #
|
|---|
| 34 |
|
|---|
| 35 | source `dirname $0`/sourcefile
|
|---|
| 36 | printprocesslog "INFO starting $0"
|
|---|
| 37 | program=doqualityplots
|
|---|
| 38 |
|
|---|
| 39 | set -C
|
|---|
| 40 |
|
|---|
| 41 | cd $mars
|
|---|
| 42 |
|
|---|
| 43 | scriptlog=$runlogpath/$program-$datetime.log
|
|---|
| 44 | date >> $scriptlog 2>&1
|
|---|
| 45 |
|
|---|
| 46 | # check if script is already running
|
|---|
| 47 | lockfile=$lockpath/lock-$program.txt
|
|---|
| 48 | checklock >> $scriptlog 2>&1
|
|---|
| 49 |
|
|---|
| 50 | # producing the plots with the values from the database
|
|---|
| 51 | echo "producing plots: " >> $scriptlog 2>&1
|
|---|
| 52 | printprocesslog "INFO producing data quality plots"
|
|---|
| 53 | check0=`root -q -b $macrospath/plotdb.C+\(\) | tee -a $scriptlog | intgrep`
|
|---|
| 54 |
|
|---|
| 55 | case $check0 in
|
|---|
| 56 | 1) echo " check0=$check0 -> everything ok -> move files" >> $scriptlog 2>&1
|
|---|
| 57 | printprocesslog "INFO plots successfully produced"
|
|---|
| 58 | ;;
|
|---|
| 59 | *) echo " check0=$check0 -> ERROR -> couldn't create plots -> exit" >> $scriptlog 2>&1
|
|---|
| 60 | printprocesslog "ERROR producing plots failed"
|
|---|
| 61 | finish >> $scriptlog 2>&1
|
|---|
| 62 | ;;
|
|---|
| 63 | esac
|
|---|
| 64 |
|
|---|
| 65 | # making files available in the web
|
|---|
| 66 | printprocesslog "INFO moving files to web"
|
|---|
| 67 | webpath=/www/htdocs/datacenter/datacheck
|
|---|
| 68 | name=plotdb
|
|---|
| 69 | psfile=$webpath/$name.ps
|
|---|
| 70 |
|
|---|
| 71 | echo "moving files: " >> $scriptlog 2>&1
|
|---|
| 72 | mv -v $name.{root,ps} $webpath >> $scriptlog 2>&1
|
|---|
| 73 |
|
|---|
| 74 | echo "creating temporary dir for pstoimg..." >> $scriptlog 2>&1
|
|---|
| 75 | tempwebplotspath=/tmp/pstoimgtmp/tempqualityplots
|
|---|
| 76 | makedir $tempwebplotspath >> $scriptlog 2>&1
|
|---|
| 77 |
|
|---|
| 78 | echo "producing png files: " >> $scriptlog 2>&1
|
|---|
| 79 | pstoimg -antialias -aaliastext -interlaced -flip r270 -density 100 -tmp $tempwebplotspath -type png -multipage $psfile >> $scriptlog 2>&1
|
|---|
| 80 |
|
|---|
| 81 | echo "removing temporary dir..." >> $scriptlog 2>&1
|
|---|
| 82 | rmdir -pv $tempwebplotspath >> $scriptlog 2>&1
|
|---|
| 83 |
|
|---|
| 84 | # second part
|
|---|
| 85 | # making plots for all datasets
|
|---|
| 86 | printprocesslog "INFO producing plots for datasets"
|
|---|
| 87 | datasets=`find $datapath/ganymed -name ganymed*.root | grep -v summary`
|
|---|
| 88 |
|
|---|
| 89 | for dataset in ${datasets[@]}
|
|---|
| 90 | do
|
|---|
| 91 | printprocesslog "INFO producing plots for dataset $dataset"
|
|---|
| 92 | nr=`echo $dataset | cut -d/ -f6`
|
|---|
| 93 | nr2=`echo $nr | cut -c 1-5`
|
|---|
| 94 | outpath=`dirname $dataset`
|
|---|
| 95 | webpath=`echo $outpath | sed -e 's/magic\/data/www\/htdocs\/datacenter/'`
|
|---|
| 96 | plotlog=$outpath/plotdb$nr.log
|
|---|
| 97 | datasetfile=$datasetpath/$nr2/dataset$nr.txt
|
|---|
| 98 | makedir $outpath >> $scriptlog 2>&1
|
|---|
| 99 | rm -v $plotlog >> $scriptlog 2>&1
|
|---|
| 100 | check1=`root -q -b $macrospath/plotdb.C+\("\"$datasetfile\""\) 2>>$plotlog | tee -a $scriptlog | intgrep`
|
|---|
| 101 | echo " check1: "$check1 >> $scriptlog 2>&1
|
|---|
| 102 | newpsfile=$outpath/plotdb$nr.ps
|
|---|
| 103 | newrootfile=$outpath/plotdb$nr.root
|
|---|
| 104 | mv -v plotdb.ps $newpsfile >> $scriptlog 2>&1
|
|---|
| 105 | mv -v plotdb.root $newrootfile >> $scriptlog 2>&1
|
|---|
| 106 | cp -v $newrootfile $webpath >> $scriptlog 2>&1
|
|---|
| 107 | check1=
|
|---|
| 108 | done
|
|---|
| 109 |
|
|---|
| 110 | finish >> $scriptlog 2>&1
|
|---|
| 111 |
|
|---|