source: trunk/DataCheck/QuickLook/Step2b.sh@ 16621

Last change on this file since 16621 was 15382, checked in by Daniela Dorner, 12 years ago
keep only run-wise processing, better naming of datasets and ganymed files
  • Property svn:executable set to *
File size: 4.1 KB
Line 
1#!/bin/bash
2#
3source `dirname $0`/../Sourcefile.sh
4printprocesslog "INFO starting $0"
5
6#root=/opt/root_svn/bin/thisroot.sh
7#source $root
8#factpath=/home/fact/FACT++.in-run-fad-loss
9
10#anapath=/loc_data/analysis
11
12sources=( 1 2 5 7 )
13numganymeds=0
14
15for source in ${sources[@]}
16do
17 # getting all nights
18 printprocesslog "INFO get all nights for source "$source
19 dirs=( `find $anapath/$source/datasets_run -maxdepth 3 -mindepth 3 -type d 2>/dev/null | sort` )
20 #nights=1
21 # write data set file
22 dspath=$anapath/$source/datasets_night
23 makedir $dspath
24 for (( i=1 ; i<=${#dirs[@]} ; i++ ))
25 do
26 numdsfiles=`find ${dirs[$i-1]} -type f | wc -l`
27 imgpath=`echo ${dirs[$i-1]} | sed -e 's/datasets_run/star/'`
28 numimgfiles=`find $imgpath -type f -name '*_I.root' | wc -l`
29 echo ${dirs[$i-1]}" "$numdsfiles" "$numimgfiles
30 night=`echo ${dirs[$i-1]} | cut -d/ -f6-8 | sed -e 's/\///g'`
31 echo $night
32 dsfile=$dspath"/dataset"$night".txt"
33 numold=`cat $dsfile | wc -l`
34 echo ${dirs[$i-1]}" "$numdsfiles" "$numimgfiles" "$numold
35 echo $dsfile
36 printprocesslog "INFO writing dataset file "$dsfile
37 echo "INFO writing dataset file "$dsfile
38 #cat ${dirs[$i-1]}/dataset*.txt
39 cat ${dirs[$i-1]}/dataset*.txt > $dsfile
40 # process only if ganymedlogfiles is not yet there
41 logfile=`echo $dsfile | sed -e 's/datasets/ganymed/' -e 's/dataset//' -e 's/[.]txt/-ganymed[.]log/'`
42 echo $logfile
43 # this does not work as there might be dataset files already pr
44 #if [ $numdsfiles -ne $numimgfiles ]
45 if [ $numold -lt $numimgfiles ]
46 then
47 printprocesslog "INFO remove $logfiles (new files added to dataset) "
48 rm $logfile
49 fi
50 if ! ls $logfile >/dev/null 2>&1
51 then
52 echo "`dirname $0`/RunGanymed.sh $source $dsfile"
53 `dirname $0`/RunGanymed.sh $source $dsfile
54 numganymeds=`echo " $numganymeds + 1 " | bc -l`
55 fi
56 done
57
58# # get list of dataset files for 1 night as starting point
59# printprocesslog "INFO get list of dataset files for "$nights" nights"
60# files=( `find $dspath -type f -name 'dataset*.txt' | sort` )
61# nightsold=1
62# # loop over data set files
63# # copy always 2 in one new file for double observation time
64# while [ ${#files[@]} -gt 1 ]
65# do
66# # get double observation time and path for datasets
67# nights=`echo " $nightsold + $nightsold " | bc -l `
68# dspathold=$dspath
69# dspath=$anapath"/"$source"/datasets"`printf %04d $nights`"nights"
70# makedir $dspath
71# # loop over already existing data set files
72# for (( i=0 ; i<=${#files[@]} ; i++ ))
73# do
74# # number of 1st and 2nd old dataset file
75# num1=`echo " $i + $i + 1" | bc -l `
76# num2=`echo " $i + $i + 2 " | bc -l `
77# # number of new dataset file
78# dsnum=`echo " $i + 1 " | bc -l `
79# # continue only if 2 dataset files are left
80# if ! [ ${files[$num1]} ]
81# then
82# break
83# fi
84# ds1=$dspathold"/dataset"$num1".txt"
85# ds2=$dspathold"/dataset"$num2".txt"
86# dsfile=$dspath"/dataset"$dsnum".txt"
87# # copy two old into one new dataset file
88# printprocesslog "INFO writing dataset "$dsfile
89# echo "INFO writing dataset "$dsfile
90# cat $ds1 > $dsfile
91# cat $ds2 >> $dsfile
92# # process only if ganymedlogfiles is not yet there
93# logfile=`echo $dsfile | sed -e 's/datasets/ganymed/' -e 's/dataset//' -e 's/[.]txt/-ganymed[.]log/'`
94# if ! ls $logfile >/dev/null 2>&1
95# then
96# `dirname $0`/RunGanymed.sh $source $dsfile
97# numganymeds=`echo " $numganymeds + 1 " | bc -l`
98# fi
99# done
100# # get list of new dataset files
101# printprocesslog "INFO get list of dataset files for "$nights" nights"
102# files=( `find $dspath -type f -name 'dataset*.txt' | sort` )
103# nightsold=$nights
104# done
105
106 echo "found "$numganymeds" ganymeds."
107 #if [ $numganymeds -gt 0 ]
108 #then
109 # if ! ps aux | grep Step3 | grep -v grep >/dev/null 2>&1
110 # then
111 # `dirname $0`/Step3.sh nights &
112 # fi
113 # numganymeds=0
114 #fi
115
116done
117
118finish
Note: See TracBrowser for help on using the repository browser.