source: trunk/DataCheck/Processing/FillNumEvts.sh@ 19187

Last change on this file since 19187 was 18687, checked in by Daniela Dorner, 8 years ago
improved logging
  • Property svn:executable set to *
File size: 3.2 KB
Line 
1#!/bin/bash
2
3source `dirname $0`/../Sourcefile.sh
4printprocesslog "INFO starting "$0
5
6logfile=$runlogpath"/FillNumEvts-"$datetime".log"
7date >> $logfile
8
9# this script doesn't need variable $doupdate
10# filling is done by macro. therefore update is always done
11
12# get dates
13if [ "$certaindate" != "" ]
14then
15 getdates $certaindate
16else
17 # get all night
18 #getdates "all"
19 # get last 6 nights if hour between 7 and 19h, else only current night
20 getdates 6 7 19
21fi
22
23
24printprocesslog "INFO processing the following night(s): "${dates[@]}
25echo `date`": processing the following night(s): "${dates[@]} >> $logfile 2>&1
26
27cd $mars
28
29# do filling of aux data
30for date in ${dates[@]}
31do
32 #echo $date
33 runnumber=`echo $date | sed -e 's/\///g'`
34
35 # process only data which are available
36 if [ $runnumber -lt $firstnight ]
37 then
38 continue
39 fi
40
41 # fill run-wise processing
42 if [ -d $anapath/ganymed_run/$date ]
43 then
44 echo "run numevts.C for night "$runnumber" (run-wise processing) for table "$resulttable1 >> $logfile 2>&1
45 printprocesslog "INFO run numevts.C for night "$runnumber" (run-wise processing) for table "$resulttable1
46 printprocesslog "DEBUG root -q -b -l fact/processing/numevents.C+\($runnumber\,"\"$anapath"\"\,"\"$resulttable1"\"\,kFALSE\,kFALSE\)"
47 check1=`root -q -b -l fact/processing/numevents.C+\($runnumber\,"\"$anapath"\"\,"\"$resulttable1"\"\,kFALSE\,kFALSE\) | tee $logfile | intgrep`
48
49 case $check1 in
50 1) printprocesslog "INFO filling numevts.C was successfully for night "$runnumber" and table "$resulttable1" (check1="$check1")"
51 ;;
52 0) printprocesslog "WARN connection to DB failed in numevts.C (check1="$check1")"
53 ;;
54 *) printprocesslog "ERROR numevts.C failed for night "$runnumber" and table "$resulttable1" (check1="$check1" -> missing files?)"
55 ;;
56 esac
57 fi
58
59 query="SELECT fSourceKEY FROM RunInfo WHERE fNight="$runnumber" AND fSourceKey > 0 AND fRunTypeKEY=1 GROUP BY fSourceKey "
60 sources=( `sendquery` )
61 # fill night-wise processing
62 for source in ${sources[@]}
63 do
64 if [ -d $anapath/ganymed_night/$source/$date ]
65 then
66 echo "run numevts.C for night "$runnumber" and source "$source" (night-wise processing) " >> $logfile 2>&1
67 printprocesslog "INFO run numevents.C for night "$runnumber" and source "$source" (night-wise processing) "
68 printprocesslog "DEBUG root -q -b -l fact/processing/numevents.C+\($runnumber\,"\"$anapath"\"\,"\"$resulttable2"\"\,kFALSE\,kTRUE\,$source\)"
69
70 check1=`root -q -b -l fact/processing/numevents.C+\($runnumber\,"\"$anapath"\"\,"\"$resulttable2"\"\,kFALSE\,kTRUE\,$source\) | tee $logfile | intgrep`
71 case $check1 in
72 1) printprocesslog "INFO filling numevts.C was successfully for night "$runnumber" and table "$resulttable2" (check1=$check1)"
73 ;;
74 0) printprocesslog "WARN connection to DB failed in numevts.C (check1=$check1)"
75 ;;
76 *) printprocesslog "ERROR numevts.C failed for night "$runnumber" and table "$resulttable2" (check1=$check1)"
77 ;;
78 esac
79 fi
80 done
81done
82
83finish
84
85
Note: See TracBrowser for help on using the repository browser.