source: trunk/MagicSoft/Mars/datacenter/scripts/doqualityplots@ 7805

Last change on this file since 7805 was 7646, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.6 KB
Line 
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-2006
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
35user=`whoami`
36program=doqualityplots
37source /home/$user/Mars/datacenter/scripts/sourcefile
38
39set -C
40
41cd $mars
42
43datetime=`date +%F-%H-%M-%S`
44
45scriptlogpath=$logpath/run/doqualityplots/`date +%Y/%m/%d`
46makedir $scriptlogpath
47
48scriptlog=$scriptlogpath/doqualityplots-$datetime.log
49
50date >> $scriptlog 2>&1
51
52# check if script is already running
53lockfile=$lockpath/lock-doqualityplots.txt
54checklock >> $scriptlog 2>&1
55
56# producing the plots with the values from the database
57echo "producing plots: " >> $scriptlog 2>&1
58check0=`root -q -b $macrospath/plotdb.C+\(\) | tee -a $scriptlog | grep int | sed -e 's/.*(int)//'`
59
60case $check0 in
61 1) echo "check0=$check0 -> everything ok -> move files" >> $scriptlog 2>&1;;
62 *) echo "check0=$check0 -> ERROR -> couldn't create plots -> exit" >> $scriptlog 2>&1
63 rm -v $lockfile >> $scriptlog 2>&1
64 exit;;
65esac
66
67# making files available in the web
68webpath=/www/htdocs/datacenter/datacheck
69name=plotdb
70psfile=$webpath/$name.ps
71
72echo "moving files: " >> $scriptlog 2>&1
73mv -v $name.{root,ps} $webpath >> $scriptlog 2>&1
74
75echo "creating temporary dir for pstoimg..." >> $scriptlog 2>&1
76tempwebplotspath=$webpath/tempqualityplots
77makedir $tempwebplotspath >> $scriptlog 2>&1
78
79echo "producing png files: " >> $scriptlog 2>&1
80pstoimg -antialias -flip r270 -density 100 -tmp $tempwebplotspath -type png -multipage $psfile >> $scriptlog 2>&1
81
82echo "removing temporary dir..." >> $scriptlog 2>&1
83rmdir -v $tempwebplotspath >> $scriptlog 2>&1
84
85# second part
86# making plots for all datasets
87datasets=`find $datapath/ganymed -name ganymed*.root | grep -v summary`
88
89for dataset in ${datasets[@]}
90do
91 nr=`echo $dataset | cut -d/ -f6`
92 nr2=`echo $nr | cut -c 1-5`
93 outpath=`dirname $dataset`
94 webpath=`echo $outpath | sed -e 's/magic\/data/www\/htdocs\/datacenter/'`
95 plotlog=$outpath/plotdb$nr.log
96 datasetfile=$datasetpath/$nr2/dataset$nr.txt
97 makedir $outpath >> $scriptlog 2>&1
98 rm -v $plotlog >> $scriptlog 2>&1
99 check1=`root -q -b $macrospath/plotdb.C+\("\"$datasetfile\""\) 2>>$plotlog | tee -a $scriptlog | grep int | sed -e 's/.*(int)//'`
100 echo "check1: "$check1 >> $scriptlog 2>&1
101 newpsfile=$outpath/plotdb$nr.ps
102 newrootfile=$outpath/plotdb$nr.root
103 mv -v plotdb.ps $newpsfile >> $scriptlog 2>&1
104 mv -v plotdb.root $newrootfile >> $scriptlog 2>&1
105 cp -v $newrootfile $webpath >> $scriptlog 2>&1
106 check1=
107done
108
109rm -v $lockfile >> $scriptlog 2>&1
110
111set +C
112
113date >> $scriptlog 2>&1
114
Note: See TracBrowser for help on using the repository browser.