source: trunk/DataCheck/QuickLook/Step2a.sh@ 18099

Last change on this file since 18099 was 18099, checked in by Daniela Dorner, 10 years ago
adapted to changes of RunGanymed.sh from 4 weeks ago
  • Property svn:executable set to *
File size: 2.9 KB
Line 
1#!/bin/bash
2#
3source `dirname $0`/../Sourcefile.sh
4printprocesslog "INFO starting $0"
5
6# get dates
7if [ "$certaindate" != "" ]
8then
9 checkstring=`echo $certaindate | grep -E -o '^20[0-9][0-9]\/[01][0-9]\/[0-3][0-9]$'`
10 if [ "$checkstring" = "" ]
11 then
12 echo "Please give the variable certaindate in the correct format (YYYY/MM/DD)"
13 finish
14 fi
15 getdates $certaindate
16else
17 if [ "$1" = "" ]
18 then
19 # get all night
20 #getdates "all"
21 # get last 6 nights if hour between 7 and 19h, else only current night
22 getdates 6 7 19
23 else
24 getdates $1
25 fi
26fi
27
28
29
30for date in ${dates[@]}
31do
32 printprocesslog "INFO processing "$date
33 #echo "INFO processing "$date
34 night=`echo $date | sed -e 's/\///g'`
35
36 numganymeds=0
37 # getting all image files for this night
38 printprocesslog "INFO get file list for night "$date
39 files=( `find $anapath/star/$date -type f -name '*_I.root' 2>/dev/null | sort` )
40 if [ ${#files[@]} -eq 0 ]
41 then
42 printprocesslog "INFO no image files available for night "$date
43 continue
44 fi
45
46 for file in ${files[@]}
47 do
48 night=`basename $file | cut -d_ -f1`
49 run=`basename $file | cut -d_ -f2`
50 printprocesslog "INFO processing run "$run
51 # process only if merpp-log is available to make sure that star-file is complete
52 # at ISDC seq# != run# -> get seq#
53 if echo $resulttable1 | grep ISDC >/dev/null 2>&1
54 then
55 query="SELECT LPAD(fSequenceID, 3, 0) FROM RunInfo WHERE fNight="$night" AND fRunID="$run
56 seq=`sendquery`
57 merpplog=`dirname $file`"/"$night"_"$seq"-merpp.log"
58 else
59 merpplog=`echo $file | sed -e 's/_I.root/-merpp.log/'`
60 fi
61 # check if merpp is finished
62 stillrunning=`find $merpplog -mmin -1 2>/dev/null`
63 if ! [ -e $merpplog ] || [ "$stillrunning" != "" ]
64 then
65 printprocesslog "INFO merpp still running - wait with file "$file
66 continue
67 fi
68 # process only if ganymedlogfiles is not yet there
69 logfile=`echo $file | sed -e 's/star/ganymed_run/' -e 's/_I[.]root/-ganymed[.]log/'`
70 if ! ls $logfile >/dev/null 2>&1
71 then
72 printprocesslog "DEBUG `dirname $0`/RunGanymed.sh "$file
73 if [ "$qlasge" = "yes" ]
74 then
75 printprocesslog "$sgepath/qsub -b y -q fact_short -v AUTOMATIONSETUP=$AUTOMATIONSETUP -v starfile=$file -e bla.txt -o bla.txt `dirname $0`/RunGanymed.sh"
76 $sgepath/qsub -b y -q fact_short -v AUTOMATIONSETUP=$AUTOMATIONSETUP -v star=$file -e bla.txt -o bla.txt `dirname $0`/RunGanymed.sh
77 else
78 printprocesslog " INFO `dirname $0`/RunGanymed.sh $file"
79 `dirname $0`/RunGanymed.sh $file
80 echo "ganymed for "$file
81 fi
82 numganymeds=`echo " $numganymeds + 1 " | bc -l`
83 fi
84 done
85 printprocesslog "INFO found "$numganymeds" ganymeds."
86done
87
88finish
89
Note: See TracBrowser for help on using the repository browser.