source: trunk/DataCheck/QuickLook/Step3.sh@ 15402

Last change on this file since 15402 was 15402, checked in by Daniela Dorner, 11 years ago
avoid that non-existent data is processed
  • Property svn:executable set to *
File size: 5.6 KB
Line 
1#!/bin/bash
2#
3source `dirname $0`/../Sourcefile.sh
4printprocesslog "INFO starting $0 $1"
5
6#root=/opt/root_svn/bin/thisroot.sh
7#source $root
8#factpath=/home/fact/FACT++.in-run-fad-loss
9#export LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH
10
11mars=/home/fact/Mars
12cd $mars
13pwd
14# use macro from different mars version until versions are sorted out
15mars2=/home/fact/SW.automatic.processing/Mars.svn.2013.04.12
16
17if ! [ "$1" = "run" ] && ! [ "$1" = "night" ]
18then
19 #echo "wrong option "$1" (only min and nights valid)."
20 echo "wrong option "$1" (only run and night valid)."
21 finish
22fi
23
24if [ "$1" = "run" ]
25then
26 tablenam=$resulttable1
27fi
28
29if [ "$1" = "night" ]
30then
31 tablenam=$resulttable2
32fi
33
34# get current hour
35hour=`date +%k`
36if [ $hour -le 7 ] || [ $hour -ge 19 ]
37then
38 dates=( `date +%Y/%m/%d --date="-12hour"` )
39else
40 # get last 3, 6 or 9 nights
41 dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
42 # `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
43 # `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
44 )
45fi
46#dates=( `find -L $auxdata -mindepth 3 -type d | sort -r | sed "s/\${auxdata_for_sed}//g" | sed -e 's/^\///'` ) #all available dates in /loc_data/zipraw
47
48#dates=( "2013/04/19" )
49
50# source info on daq in /loc_data/analysis/sources.txt
51# (dump of DB scheduling.sources)
52
53timebins=( 5 10 20 30 40 60 90 120 180 240 300 360 )
54
55echo ${dates[@]}
56for date in ${dates[@]}
57do
58 date2=`echo $date | sed -e 's/\///g'`
59 if [ $date2 -le $firstnight ]
60 then
61 continue
62 fi
63 query="SELECT fSourceKEY FROM RunInfo WHERE fNight="$date2" AND fSourceKey > 0 AND fRunTypeKEY=1 GROUP BY fSourceKey "
64 sources=( `sendquery` )
65 echo "process "$date" -> sources: "${sources[@]}
66 for source in ${sources[@]}
67 do
68 echo $source
69 printprocesslog "INFO processing files for source "$source
70 outpath=$anapath/lightcurves/$date
71 makedir $outpath
72
73 for timebin in ${timebins[@]}
74 do
75 # doing the plots for one night
76 logfile=$outpath"/lightcurve"$source"_"$timebin"min_"$date2".log"
77 outfile=$outpath"/lightcurve"$source"_"$timebin"min_"$date2".root"
78 echo $outfile
79 printprocesslog "INFO starting lightcurve.C+ for source "$source" timebin "$timebin" night "$date2
80
81 check1=`root -q -b $mars2/fact/analysis/lightcurve.C+\($source\,$date2\\,$date2\,$timebin\,"\"$resulttable1"\"\,"\"$outfile\""\) | tee $logfile | intgrep`
82
83 case $check1 in
84 0) printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2" (check1=$check1)"
85 ./showplot -b --save-as-png $outfile
86 ;;
87 1) printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2", but nothing to plot (check1=$check1)"
88 ;;
89 *) printprocesslog "ERROR lightcurve.C failed for source "$source" timebin "$timebin" night "$date2" (check1=$check1)"
90 ;;
91 esac
92
93
94 # doing the plots for last week
95 lastweek=`date +%Y%m%d --date="$date -1 week"`
96 logfile=$outpath"/lightcurve"$source"_"$timebin"min_week.log"
97 outfile=$outpath"/lightcurve"$source"_"$timebin"min_week.root"
98 echo $outfile
99 printprocesslog "INFO starting lightcurve.C+ for source "$source" timebin "$timebin" night "$date2" last week ("$lastweek")"
100
101 check1=`root -q -b $mars2/fact/analysis/lightcurve.C+\($source\,$lastweek\\,$date2\,$timebin\,"\"$resulttable1"\"\,"\"$outfile\""\) | tee $logfile | intgrep`
102
103 case $check1 in
104 0) printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2" last week (check1=$check1)"
105 ./showplot -b --save-as-png $outfile
106 ;;
107 1) printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2" last week, but nothing to plot (check1=$check1)"
108 ;;
109 *) printprocesslog "ERROR lightcurve.C failed for source "$source" timebin "$timebin" night "$date2" last week (check1=$check1)"
110 ;;
111 esac
112
113 # doing the plots for all nights
114 logfile=$outpath"/lightcurve"$source"_"$timebin"min_all.log"
115 outfile=$outpath"/lightcurve"$source"_"$timebin"min_all.root"
116 echo $outfile
117 printprocesslog "INFO starting lightcurve.C+ for source "$source" timebin "$timebin" night "$date2" all nights"
118
119 check1=`root -q -b $mars2/fact/analysis/lightcurve.C+\($source\,$firstnight\\,$date2\,$timebin\,"\"$resulttable1"\"\,"\"$outfile\""\) | tee $logfile | intgrep`
120
121 case $check1 in
122 0) printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2" all nights (check1=$check1)"
123 ./showplot -b --save-as-png $outfile
124 ;;
125 1) printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2" all nights, but nothing to plot (check1=$check1)"
126 ;;
127 *) printprocesslog "ERROR lightcurve.C failed for source "$source" timebin "$timebin" night "$date2" all nights (check1=$check1)"
128 ;;
129 esac
130 done
131 done
132 printprocesslog "INFO rsync output of source "$source" to gate."
133 rsync -av $anapath/lightcurves/ gate:/home/factwww/lightcurves
134done
135
136
137finish
138
Note: See TracBrowser for help on using the repository browser.