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

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