1 | #!/bin/bash
|
---|
2 |
|
---|
3 | source `dirname $0`/../Sourcefile.sh
|
---|
4 | printprocesslog "INFO starting "$0
|
---|
5 |
|
---|
6 | logfile=$runlogpath"/FillNumEvts-"$datetime".log"
|
---|
7 | date >> $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
|
---|
13 | if [ "$certaindate" != "" ]
|
---|
14 | then
|
---|
15 | checkstring=`echo $certaindate | grep -E -o '^20[0-9][0-9]\/[01][0-9]\/[0-3][0-9]$'`
|
---|
16 | if [ "$checkstring" = "" ]
|
---|
17 | then
|
---|
18 | echo "Please give the variable certaindate in the correct format (YYYY/MM/DD)"
|
---|
19 | finish
|
---|
20 | fi
|
---|
21 | getdates $certaindate
|
---|
22 | else
|
---|
23 | # get all night
|
---|
24 | #getdates "all"
|
---|
25 | # get last 6 nights if hour between 7 and 19h, else only current night
|
---|
26 | getdates 6 7 19
|
---|
27 | fi
|
---|
28 |
|
---|
29 |
|
---|
30 | printprocesslog "INFO processing the following night(s): "${dates[@]}
|
---|
31 | echo `date`": processing the following night(s): "${dates[@]} >> $logfile 2>&1
|
---|
32 |
|
---|
33 | cd $mars
|
---|
34 |
|
---|
35 | # do filling of aux data
|
---|
36 | for date in ${dates[@]}
|
---|
37 | do
|
---|
38 | runnumber=`echo $date | sed -e 's/\///g'`
|
---|
39 |
|
---|
40 | # process only data which are available
|
---|
41 | if [ $runnumber -lt $firstnight ]
|
---|
42 | then
|
---|
43 | continue
|
---|
44 | fi
|
---|
45 |
|
---|
46 | # fill run-wise processing
|
---|
47 | if [ -d $anapath/ganymed_run/$date ]
|
---|
48 | then
|
---|
49 | echo "run numevts.C for night "$runnumber" (run-wise processing) for table "$resulttable1 >> $logfile 2>&1
|
---|
50 | printprocesslog "INFO run numevts.C for night "$runnumber" (run-wise processing) for table "$resulttable1
|
---|
51 | printprocesslog "DEBUG root -q -b -l fact/processing/numevents.C+\($runnumber\,"\"$anapath"\"\,"\"$resulttable1"\"\,kFALSE\,kFALSE\)"
|
---|
52 | check1=`root -q -b -l fact/processing/numevents.C+\($runnumber\,"\"$anapath"\"\,"\"$resulttable1"\"\,kFALSE\,kFALSE\) | tee $logfile | intgrep`
|
---|
53 |
|
---|
54 | case $check1 in
|
---|
55 | 1) printprocesslog "INFO filling numevts.C was successfully for night "$runnumber" and table "$resulttable1" (check1=$check1)"
|
---|
56 | ;;
|
---|
57 | 0) printprocesslog "WARN connection to DB failed in numevts.C (check1=$check1)"
|
---|
58 | ;;
|
---|
59 | *) printprocesslog "ERROR numevts.C failed for night "$runnumber" and table "$resulttable1" (check1=$check1)"
|
---|
60 | ;;
|
---|
61 | esac
|
---|
62 | fi
|
---|
63 |
|
---|
64 | query="SELECT fSourceKEY FROM RunInfo WHERE fNight="$runnumber" AND fSourceKey > 0 AND fRunTypeKEY=1 GROUP BY fSourceKey "
|
---|
65 | sources=( `sendquery` )
|
---|
66 | # fill night-wise processing
|
---|
67 | for source in ${sources[@]}
|
---|
68 | do
|
---|
69 | if [ -d $anapath/ganymed_night/$source/$date ]
|
---|
70 | then
|
---|
71 | echo "run numevts.C for night "$runnumber" and source "$source" (night-wise processing) " >> $logfile 2>&1
|
---|
72 | printprocesslog "INFO run numevents.C for night "$runnumber" and source "$source" (night-wise processing) "
|
---|
73 | printprocesslog "DEBUG root -q -b -l fact/processing/numevents.C+\($runnumber\,"\"$anapath"\"\,"\"$resulttable2"\"\,kFALSE\,kTRUE\,$source\)"
|
---|
74 |
|
---|
75 | check1=`root -q -b -l fact/processing/numevents.C+\($runnumber\,"\"$anapath"\"\,"\"$resulttable2"\"\,kFALSE\,kTRUE\,$source\) | tee $logfile | intgrep`
|
---|
76 | case $check1 in
|
---|
77 | 1) printprocesslog "INFO filling numevts.C was successfully for night "$runnumber" and table "$resulttable2" (check1=$check1)"
|
---|
78 | ;;
|
---|
79 | 0) printprocesslog "WARN connection to DB failed in numevts.C (check1=$check1)"
|
---|
80 | ;;
|
---|
81 | *) printprocesslog "ERROR numevts.C failed for night "$runnumber" and table "$resulttable2" (check1=$check1)"
|
---|
82 | ;;
|
---|
83 | esac
|
---|
84 | fi
|
---|
85 | done
|
---|
86 | done
|
---|
87 |
|
---|
88 | finish
|
---|
89 |
|
---|
90 |
|
---|