Changeset 19035 for trunk/DataCheck


Ignore:
Timestamp:
06/29/18 10:46:29 (6 years ago)
Author:
Daniela Dorner
Message:
added zd and th for min-binned queries to internal file, allow external file only for 20min and nightly binning
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Tools/get_data.sh

    r19033 r19035  
    3535# ToDo (notes DD):
    3636# ----------------
    37 # - limit creation of file for externals to nightly and 20 min
    38 # - add zd, th for internal for minute binning (daily done)
    3937# - update function for correction
    4038# - update CU for QLA
     
    238236     
    239237      # final part of the query
    240       querybase=" FROM (SELECT fNight, @ot:="$ontimeif" AS ot, fRunStart AS start, fRunStop AS stop, fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, "
     238      querybase=" FROM (SELECT fNight, fZenithDistanceMin AS zdmin, fZenithDistanceMax AS zdmax, "$thresh" AS th, "
     239      querybase=$querybase" @ot:="$ontimeif" AS ot, fRunStart AS start, fRunStop AS stop, fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, "
    241240      querybase=$querybase" "$correvts" AS corevts, CUQLA(fNight) AS cu, "
    242241      querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @bl, @bl := @bl + 1) AS block, "
    243242      querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @os:=@os + @ot, @os := @ot) AS os, @night :=fNight AS night "
     243#      querybase=$querybase" IF (@zdmin<fZenithDistanceMin, @zdmin:=@zdmin, @zdmin:=fZenithDistanceMin) as zdmin, "
     244#      querybase=$querybase" IF (@zdmin>fZenithDistanceMax, @zdmax:=@zdmax, @zdmax:=fZenithDistanceMax) as zdmax, "
     245#      querybase=$querybase" IF (@thmin<"$thresh", @thmin:=@thmin, @thmin:="$thresh") as thmin, "
     246#      querybase=$querybase" IF (@thmax>"$thresh", @thmax:=@thmax, @thmax:="$thresh") as thmax, "
     247#      querybase=$querybase" fZenithDistanceMin as zdmin, fZenithDistanceMax as zdmax, "$thresh" as thmin, "$thresh" as thmax "
    244248      querybase=$querybase$from" CROSS JOIN (SELECT @night :=0, @ot :=0, @os :=0, @bl:=0) PARAMS "
    245249      querybase=$querybase$where" ORDER BY fRunStart) o GROUP BY block HAVING ontime>0.75*"$bin" ORDER BY 'time'"
     
    252256      queryint=$queryint" "$significance2", "
    253257      queryint=$queryint" avg(o.night) AS night, "
    254       queryint=$queryint" "$numexc2", "$numsig2", "$numbg2" "
     258      queryint=$queryint" "$numexc2", "$numsig2", "$numbg2", "
     259      queryint=$queryint" Min(o.zdmin) AS zdmin, Max(o.zdmax) AS zdmax, Min(o.th) AS thmin, Max(o.th) AS thmax "
    255260      queryint=$queryint" "$querybase
    256261     
     
    272277   if [ "$overwrite" = "yes" ]
    273278   then
    274       echo "internal: "$fileint
     279      echo "creating "$fileint" ..."
    275280      echo "# This file was created at "`date` > $fileint
    276281      # add query and policy here
     
    283288   #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryint"
    284289   
    285    
    286    fileext=$datapath"/FACT_preliminary_"$name"_external.dat"
    287    if [ "$overwrite" = "yes" ]
    288    then
    289       echo "external: "$fileext
    290       echo "# This file was created at "`date` > $fileext
    291       # add query and policy here
    292    fi
    293    headerext="# "$num" time["$timeunit"] start["$timeunit"] stop["$timeunit"] excrate[evts/h] delta_time["$timeunit"] excrate_err[evts/h] "
    294    echo $headerext >> $fileext
    295    #echo "$queryext"
    296    mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$queryext" >> $fileext
    297    #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryext"
    298 
    299290   filecol=$datapath"/FACT_preliminary_"$name"_collaborators.dat"
    300291   if [ "$overwrite" = "yes" ]
    301292   then
    302       echo "collaborators: "$filecol
     293      echo "creating "$filecol" ..."
    303294      echo "# This file was created at "`date` > $filecol
    304295      # add query and policy here
     
    310301   mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$querycol" >> $filecol
    311302   #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$querycol
     303   
     304   # write file for externals only for allowed binnings
     305   if [ $bin -eq 20 ] || [ $bin -eq -1 ]
     306   then
     307      fileext=$datapath"/FACT_preliminary_"$name"_external.dat"
     308      if [ "$overwrite" = "yes" ]
     309      then
     310         echo "creating "$fileext" ..."
     311         echo "# This file was created at "`date` > $fileext
     312         # add query and policy here
     313      fi
     314      headerext="# "$num" time["$timeunit"] start["$timeunit"] stop["$timeunit"] excrate[evts/h] delta_time["$timeunit"] excrate_err[evts/h] "
     315      echo $headerext >> $fileext
     316      #echo "$queryext"
     317      mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$queryext" >> $fileext
     318      #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryext"
     319   fi
    312320}
    313321
     
    399407nightmin=20140714
    400408nightmax=20140805
    401 get_results
    402 #bin=20
    403 #name="Mrk501_2014_forMAGIC20"
     409#get_results
     410
     411bin=20
     412nightmin=20140623
     413nightmax=20140623
     414name="Mrk501_test"
     415get_results
     416
     417#bin=30
     418#name="Mrk501_2014_forMAGIC30"
    404419#get_results
    405420
Note: See TracChangeset for help on using the changeset viewer.