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

Last change on this file since 18269 was 18066, checked in by Daniela Dorner, 10 years ago
adapted call of numevts.C
  • Property svn:executable set to *
File size: 3.4 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 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
22else
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
27fi
28
29
30printprocesslog "INFO processing the following night(s): "${dates[@]}
31echo `date`": processing the following night(s): "${dates[@]} >> $logfile 2>&1
32
33cd $mars
34
35# do filling of aux data
36for date in ${dates[@]}
37do
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
86done
87
88finish
89
90
Note: See TracBrowser for help on using the repository browser.