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