Ignore:
Timestamp:
04/19/13 20:52:05 (12 years ago)
Author:
Daniela Dorner
Message:
keep only run-wise processing, better naming of datasets and ganymed files
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/QuickLook/Step2b.sh

    r15310 r15382  
    1717   # getting all nights
    1818   printprocesslog "INFO get all nights for source "$source
    19    dirs=( `find $anapath/$source/datasets005min -maxdepth 3 -mindepth 3 -type d 2>/dev/null | sort` )
    20    nights=1
     19   dirs=( `find $anapath/$source/datasets_run -maxdepth 3 -mindepth 3 -type d 2>/dev/null | sort` )
     20   #nights=1
    2121   # write data set file
    22    dspath=$anapath/$source/datasets`printf %04d $nights`nights
     22   dspath=$anapath/$source/datasets_night
    2323   makedir $dspath
    2424   for (( i=1 ; i<=${#dirs[@]} ; i++ ))
    2525   do
    2626      numdsfiles=`find ${dirs[$i-1]} -type f | wc -l`
    27       imgpath=`echo ${dirs[$i-1]} | sed -e 's/datasets005min/star/'`
     27      imgpath=`echo ${dirs[$i-1]} | sed -e 's/datasets_run/star/'`
    2828      numimgfiles=`find $imgpath -type f -name '*_I.root' | wc -l`
    2929      echo ${dirs[$i-1]}" "$numdsfiles" "$numimgfiles
    30       dsfile=$dspath/dataset$i.txt
     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
    3136      printprocesslog "INFO writing dataset file "$dsfile
    3237      echo "INFO writing dataset file "$dsfile
     
    3540      # process only if ganymedlogfiles is not yet there
    3641      logfile=`echo $dsfile | sed -e 's/datasets/ganymed/' -e 's/dataset//' -e 's/[.]txt/-ganymed[.]log/'`
    37       if [ $numdsfiles -ne $numimgfiles ]
     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 ]
    3846      then
    3947         printprocesslog "INFO remove $logfiles (new files added to dataset) "
     
    4250      if ! ls $logfile >/dev/null 2>&1
    4351      then
     52         echo "`dirname $0`/RunGanymed.sh $source $dsfile"
    4453         `dirname $0`/RunGanymed.sh $source $dsfile
    4554         numganymeds=`echo " $numganymeds + 1 " | bc -l`
     
    4756   done
    4857   
    49    # get list of dataset files for 1 night as starting point
    50    printprocesslog "INFO get list of dataset files for "$nights" nights"
    51    files=( `find $dspath -type f -name 'dataset*.txt' | sort` )
    52    nightsold=1
    53    # loop over data set files
    54    # copy always 2 in one new file for double observation time
    55    while [ ${#files[@]} -gt 1 ]
    56    do
    57       # get double observation time and path for datasets
    58       nights=`echo " $nightsold + $nightsold " | bc -l `
    59       dspathold=$dspath
    60       dspath=$anapath"/"$source"/datasets"`printf %04d $nights`"nights"
    61       makedir $dspath
    62       # loop over already existing data set files
    63       for (( i=0 ; i<=${#files[@]} ; i++ ))
    64       do
    65          # number of 1st and 2nd old dataset file
    66          num1=`echo " $i + $i + 1" | bc -l `
    67          num2=`echo " $i + $i + 2 " | bc -l `
    68          # number of new dataset file
    69          dsnum=`echo " $i + 1 " | bc -l `
    70          # continue only if 2 dataset files are left
    71          if ! [ ${files[$num1]} ]
    72          then
    73             break
    74          fi
    75          ds1=$dspathold"/dataset"$num1".txt"
    76          ds2=$dspathold"/dataset"$num2".txt"
    77          dsfile=$dspath"/dataset"$dsnum".txt"
    78          # copy two old into one new dataset file
    79          printprocesslog "INFO writing dataset "$dsfile
    80          echo "INFO writing dataset "$dsfile
    81          cat $ds1 > $dsfile
    82          cat $ds2 >> $dsfile
    83          # process only if ganymedlogfiles is not yet there
    84          logfile=`echo $dsfile | sed -e 's/datasets/ganymed/' -e 's/dataset//' -e 's/[.]txt/-ganymed[.]log/'`
    85          if ! ls $logfile  >/dev/null 2>&1
    86          then
    87             `dirname $0`/RunGanymed.sh $source $dsfile
    88             numganymeds=`echo " $numganymeds + 1 " | bc -l`
    89          fi
    90       done
    91       # get list of new dataset files
    92       printprocesslog "INFO get list of dataset files for "$nights" nights"
    93       files=( `find $dspath -type f -name 'dataset*.txt' | sort` )
    94       nightsold=$nights
    95    done
    96    if [ $numganymeds -gt 0 ]
    97    then
    98        if ! ps aux | grep Step3 | grep -v grep >/dev/null 2>&1
    99        then
    100          `dirname $0`/Step3.sh nights &
    101        fi
    102       numganymeds=0
    103    fi
     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
    104115   
    105116done
Note: See TracChangeset for help on using the changeset viewer.