Ignore:
Timestamp:
04/20/13 19:32:07 (11 years ago)
Author:
Daniela Dorner
Message:
rewritten completely, adapted to new concept and structure
File:
1 edited

Legend:

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

    r15308 r15390  
    77#source $root
    88#factpath=/home/fact/FACT++.in-run-fad-loss
    9 export LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH
     9#export LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH
    1010
     11mars=/home/fact/Mars
    1112cd $mars
     13pwd
     14# use macro from different mars version until versions are sorted out
     15mars2=/home/fact/SW.automatic.processing/Mars.svn.2013.04.12
    1216
    13 if ! [ "$1" = "min" ] && ! [ "$1" = "nights" ]
     17if ! [ "$1" = "run" ] && ! [ "$1" = "night" ]
    1418then
    15    echo "wrong option "$1" (only min and nights valid)."
     19   #echo "wrong option "$1" (only min and nights valid)."
     20   echo "wrong option "$1" (only run and night valid)."
    1621   finish
    1722fi
    1823
    19 if [ "$1" = "min" ]
     24if [ "$1" = "run" ]
    2025then
    21    date=`date --date="-18HOUR" +%Y/%m/%d`
     26   tablenam=$resulttable1
    2227fi
    2328
    24 #anapath=/loc_data/analysis
     29if [ "$1" = "night" ]
     30then
     31   tablenam=$resulttable2
     32fi
     33
     34# get last 3, 6 or 9 nights
     35dates=( `date +%Y/%m/%d --date="-12hour"` `date +%Y/%m/%d --date="-36hour"` `date +%Y/%m/%d --date="-60hour"` \
     36#        `date +%Y/%m/%d --date="-84hour"` `date +%Y/%m/%d --date="-108hour"` `date +%Y/%m/%d --date="-132hour"` \
     37#        `date +%Y/%m/%d --date="-156hour"` `date +%Y/%m/%d --date="-180hour"` `date +%Y/%m/%d --date="-204hour"` \
     38        )
     39#dates=( `find -L $ziprawdata -mindepth 3 -type d | sort -r | sed "s/\${ziprawdata_for_sed}//g" | sed -e 's/^\///'` ) #all available dates in /loc_data/zipraw
     40
     41dates=( "2013/04/19" )
    2542
    2643# source info on daq in /loc_data/analysis/sources.txt
    2744#    (dump of DB scheduling.sources)
    28 sources=( 1 2 5 7 11 )
    2945
    30 for source in ${sources[@]}
     46timebins=( 5 10 20 30 40 60 90 120 180 240 300 360 )
     47
     48for date in ${dates[@]}
    3149do
    32    dirs=( `find $anapath/$source/ganymed*$1 -maxdepth 0 -type d 2>/dev/null` )
    33    if [ ${#dirs[@]} -eq 0 ]
    34    then
    35       printprocesslog "INFO no directories ("$1") found for source "$source
    36       continue
    37    fi
    38    for dir in ${dirs[@]}
     50   date2=`echo $date | sed -e 's/\///g'`
     51   query="SELECT fSourceKEY FROM RunInfo WHERE fNight="$date2" AND fSourceKey > 0 AND fRunTypeKEY=1 GROUP BY fSourceKey "
     52   sources=( `sendquery` )
     53   for source in ${sources[@]}
    3954   do
    40       printprocesslog "INFO processing files in "$dir
    41       inpath=$dir
    42       outpath=`echo $dir | sed -e 's/ganymed/lightcurve/'`
    43       logfile=$outpath/lightcurve.log
     55      echo $source
     56      printprocesslog "INFO processing files for source "$source
     57      outpath=$anapath/lightcurves/$date
    4458      makedir $outpath
    45       printprocesslog "INFO starting lightcurve.C+ for path "$inpath
     59
     60      for timebin in ${timebins[@]}
     61      do
     62         # doing the plots for one night
     63         logfile=$outpath"/lightcurve"$source"_"$timebin"min_"$date2".log"
     64         outfile=$outpath"/lightcurve"$source"_"$timebin"min_"$date2".root"
     65         echo $outfile
     66         printprocesslog "INFO starting lightcurve.C+ for source "$source" timebin "$timebin" night "$date2
    4667     
    47       check1=`root -q -b $anapath/lightcurve.C+\("\"$inpath\""\,"\"$outpath\"","\"$date\""\) | tee $logfile | intgrep`
     68         check1=`root -q -b $mars2/fact/analysis/lightcurve.C+\($source\,$date2\\,$date2\,$timebin\,"\"$resulttable1"\"\,"\"$outfile\""\) | tee $logfile | intgrep`
    4869     
    49       case $check1 in
    50          0)   printprocesslog "INFO lightcurve.C was successful for path "$inpath" (check1=$check1)"
    51               ./showplot -b --save-as-png $outpath/lc.root
    52               ;;
    53          *)   printprocesslog "ERROR lightcurve.C failed for dataset "$inpath" (check1=$check1)"
    54               ;;
    55       esac
     70         case $check1 in
     71            0)   printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2" (check1=$check1)"
     72                 ./showplot -b --save-as-png $outfile
     73                 ;;
     74            1)   printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2", but nothing to plot (check1=$check1)"
     75                 ;;
     76            *)   printprocesslog "ERROR lightcurve.C failed for source "$source" timebin "$timebin" night "$date2" (check1=$check1)"
     77                 ;;
     78         esac
     79
     80         # doing the plots for all nights
     81         logfile=$outpath"/lightcurve"$source"_"$timebin"min_all.log"
     82         outfile=$outpath"/lightcurve"$source"_"$timebin"min_all.root"
     83         echo $outfile
     84         printprocesslog "INFO starting lightcurve.C+ for source "$source" timebin "$timebin" night "$date2" all nights"
     85     
     86         check1=`root -q -b $mars2/fact/analysis/lightcurve.C+\($source\,$firstnight\\,$date2\,$timebin\,"\"$resulttable1"\"\,"\"$outfile\""\) | tee $logfile | intgrep`
     87     
     88         case $check1 in
     89            0)   printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2" all nights (check1=$check1)"
     90                 ./showplot -b --save-as-png $outfile
     91                 ;;
     92            1)   printprocesslog "INFO lightcurve.C was successful for source "$source" timebin "$timebin" night "$date2" all nights, but nothing to plot (check1=$check1)"
     93                 ;;
     94            *)   printprocesslog "ERROR lightcurve.C failed for source "$source" timebin "$timebin" night "$date2" all nights (check1=$check1)"
     95                 ;;
     96         esac
     97      done
    5698   done
    5799   printprocesslog "INFO rsync output of source "$source" to gate."
    58    rsync -av $anapath/$source/lightcurve* gate:/home/factwww/lightcurves/$source/
     100   rsync -av $anapath/lightcurves/ gate:/home/factwww/lightcurves
    59101done
    60102
Note: See TracChangeset for help on using the changeset viewer.