Changeset 19521 for trunk


Ignore:
Timestamp:
05/28/19 11:39:09 (5 years ago)
Author:
Daniela Dorner
Message:
added new alert type for incoming alerts
File:
1 edited

Legend:

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

    r19503 r19521  
    7070#cu="20.0"
    7171#cu="CUQLA(fNight)"
    72 cu="Avg(fCU)"
     72cu="fCU"
    7373corr="1"
    7474# missing: corrected excessrates
     
    9292   query=$query"ROUND(ExcErr(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM("$ontime")*3600*SUM(fNumExcEvts)/SUM(fNumExcEvts*"$corr"), 2) AS corexcrateerr, " # correctionfactor = exc / exc_cor, put here correction factor
    9393   query=$query"ROUND(LiMa(SUM(fNumSigEvts), SUM(fNumBgEvts)),2) AS signif, "
    94    query=$query"ROUND(SUM(fNumExcEvts)/SUM("$ontime")*3600/"$cu",2) AS cu, "
    95    query=$query"ROUND(ExcErr(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM("$ontime")*3600/"$cu", 2) AS cuerr, " # make value time dependent
    96    query=$query"ROUND(SUM(fNumExcEvts*"$corr")/SUM("$ontime")*3600/"$cu",2) as corcu, " # make value time dependent # put here correction factor
    97    query=$query"ROUND(ExcErr(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM("$ontime")*3600*SUM(fNumExcEvts)/SUM(fNumExcEvts*"$corr")/"$cu", 2) AS corcuerr, " # correctionfactor = exc / exc_cor # make value time dependent # put here correction factor
     94   query=$query"ROUND(SUM(fNumExcEvts)/SUM("$ontime")*3600/AVG("$cu"),2) AS cu, "
     95   query=$query"ROUND(ExcErr(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM("$ontime")*3600/AVG("$cu"), 2) AS cuerr, " # make value time dependent
     96   query=$query"ROUND(SUM(fNumExcEvts*"$corr")/SUM("$ontime")*3600/AVG("$cu"),2) as corcu, " # make value time dependent # put here correction factor
     97   query=$query"ROUND(ExcErr(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM("$ontime")*3600*SUM(fNumExcEvts)/SUM(fNumExcEvts*"$corr")/AVG("$cu"), 2) AS corcuerr, " # correctionfactor = exc / exc_cor # make value time dependent # put here correction factor
    9898   query=$query"MIN(fZenithDistanceMin) as zdmin, MAX(fZenithDistanceMax) as zdmax, "
    9999   query=$query"MIN("$threshold") as thmin, MAX("$threshold") as thmax "
     
    720720   evaluate_result
    721721   
     722   # Automatic Follow-Ups
     723   triggertype=6
     724   printprocesslog "INFO check for [Automatic Follow-Ups]"
     725   query="SELECT Count(*) FROM Schedule WHERE fSTART BETWEEN DATE_ADD(DATE_FORMAT("$night", '%Y-%m-%d'), INTERVAL +18 HOUR)"
     726   query=$query" AND DATE_ADD(DATE_FORMAT("$night", '%Y-%m-%d'), INTERVAL +35 HOUR) AND fUser='ToO' AND fSourceKey="$sourcekey
     727   #echo $query
     728   numtoo=`sendquery`
     729   if [ $numtoo -gt 0 ]
     730   then
     731      echo "Found "$numtoo" ToO(s) for "$sourcename >> $logfile
     732      case $sourcekey in
     733        1|2|7) echo "standard monitoring source ("$sourcekey")" >> $logfile
     734               ;;
     735        [0-9][0-9][0-9][0-9]) echo "new source ("$sourcekey")" >> $logfile
     736               ;;
     737        *)     echo "some other source ("$sourcekey")" >> $logfile
     738               ;;
     739      esac
     740      triggerfile=$flarealertspath"/"$night"-"$numtoo"-source"$sourcekey".trigger"$triggertype
     741      donetriggerfile=$triggerfile".done"
     742      touch $triggerfile
     743      echo "Found "$numtoo" ToOs." > $triggerfile
     744      # write new file only if old files do not agree
     745      if [ -e $donetriggerfile ]
     746      then
     747         diff $donetriggerfile $triggerfile >/dev/null
     748         checkstatus=`echo $?`
     749         if [ $checkstatus -eq 0 ]
     750         then
     751            echo "  alert already done "$donetriggerfile >> $logfile
     752            i=`echo $i +1 | bc -l`
     753            continue
     754         fi
     755      fi
     756      if ! [ -e $donetriggerfile ]
     757      then
     758         query="INSERT FlareAlerts.FlareTriggers SET fTriggerInserted=Now(), fNight="$night", fRunID="$numtoo", fTriggerType="$triggertype", fSourceKey="$sourcekey", fBinning=NULL"
     759         echo $query
     760         sendquery >> $logfile
     761         mv $triggerfile $donetriggerfile
     762      fi
     763   fi
     764   
    722765   echo "" >> $logfile
    723766   echo "" >> $logfile
Note: See TracChangeset for help on using the changeset viewer.