Changeset 18906
- Timestamp:
- 09/14/17 23:22:39 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/QuickLook/FlareAlerts.sh
r18859 r18906 3 3 4 4 # missing: 5 # implementDB-entries for being called5 # finalize DB-entries for being called 6 6 # prepare directly template for email 7 # use current value for CU in triggers8 # add note for values > 70 evts/h for X-ray triggers7 # add x-ray trigger as trigger type or 8 # add note for values > 70 evts/h for X-ray triggers 9 9 # 10 10 # add more information: … … 67 67 ontime="IF(ISNULL(fEffectiveOn), fOnTimeAfterCuts, TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)" 68 68 threshold="IF (ISNULL(fThresholdMinSet), fThresholdMedian, fThresholdMinSet)" 69 cu="20.0" 69 #cu="20.0" 70 cu="CUQLA(fNight)" 70 71 corr="1" 71 72 # missing: corrected excessrates 72 # missing: time-dependent CU73 73 74 74 … … 359 359 1) #echo "std trigger: criteria ( $exc >= $exclimit && $sig >= $siglimit && $higher )" 360 360 trigger=`echo " $exc >= $exclimit && $sig >= $siglimit && $higher " | bc -l` 361 limits=$exclimit"_"$siglimit 361 362 ;; 362 363 2) #echo "magic 501: criteria ( $exc >= $exclimit && $sig >= $siglimit && $higher )" 363 364 trigger=`echo " $exc >= $exclimit && $sig >= $siglimit && $higher " | bc -l` 365 limits=$exclimit"_"$siglimit 364 366 ;; 365 367 3) #echo "magic fast rise/decay" 366 368 #trigger=`echo " $slope >= $slopelimit && $slopeprev >= $slopelimit && $slope60 >= $slopelimit && $sig >= $siglimit " | bc -l` 367 369 trigger=`echo " ( ( $slope >= $slopelimit && $slopeprev >= $slopelimit && $slope60 >= $slopelimit ) || ( - $slope >= $slopelimit && - $slopeprev >= $slopelimit && - $slope60 >= $slopelimit ) ) && $sig >= $siglimit " | bc -l` 370 limits=$slopelimit"_"$siglimit 368 371 ;; 369 4) #echo "std trigger: criteria ( $exc >= $exclimit && $sig >= $siglimit && $higher )"372 5) #echo "std trigger: criteria ( $exc >= $exclimit && $sig >= $siglimit && $higher )" 370 373 trigger=`echo " $exc >= $exclimit && $sig >= $siglimit && $higher " | bc -l` 374 limits=$exclimit"_"$siglimit 371 375 ;; 372 376 *) echo $triggertype" not yet implemented" >> $logfile … … 389 393 # or check value if it's increasing? 390 394 # missing: get information from previous trigger + interpret 391 triggerfile=$flarealertspath"/"$night"-"$ exclimit"_"$siglimit"-source"$sourcekey".trigger"$triggertype395 triggerfile=$flarealertspath"/"$night"-"$limits"-source"$sourcekey".trigger"$triggertype 392 396 else 393 397 # smaller binning: check if trigger is identical 394 triggerfile=$flarealertspath"/"$night"_"`printf %03d $runid`"-"$exclimit"_"$siglimit"-source"$sourcekey".trigger"$triggertype 395 donetriggerfile=$triggerfile".done" 396 #ls $donetriggerfile 397 # write new file only if old files do not agree 398 if [ "$donetriggerfile" != "" ] && [ -e $donetriggerfile ] 398 triggerfile=$flarealertspath"/"$night"_"`printf %03d $runid`"-"$limits"-source"$sourcekey".trigger"$triggertype 399 fi 400 donetriggerfile=$triggerfile".done" 401 #ls $donetriggerfile 402 403 # check if nightly flux increased 404 if [ "$bin" = "" ] 405 then 406 trigger2=1 407 changedfiles=( `ls $donetriggerfile"-changed-"* 2>/dev/null` ) 408 if [ ${#changedfiles[@]} -gt 0 ] 409 then 410 oldnightlyexc=`grep "corr. cu: [0-9].[0-9] " ${changedfiles[@]} | grep -o -E ' [0-9].[0-9] ' | sort | tail -1` 411 trigger2=`echo " $exc > $oldnightlyexc " | bc -l` 412 echo "trigger2: "$trigger2" (exc: "$exc", oldexc: "$oldnightlyexc")" 413 echo "trigger2: "$trigger2" (exc: "$exc", oldexc: "$oldnightlyexc")" >> $logfile 414 fi 415 fi 416 417 # write new file only if old files do not agree 418 if [ -e $donetriggerfile ] 419 then 420 diff $donetriggerfile $triggerfile >/dev/null 421 checkstatus=`echo $?` 422 if [ $checkstatus -eq 0 ] 399 423 then 400 diff $donetriggerfile $triggerfile >/dev/null 401 checkstatus=`echo $?` 402 if [ $checkstatus -eq 0 ] 403 then 404 echo " alert already done "$donetriggerfile >> $logfile 405 i=`echo $i +1 | bc -l` 406 continue 407 fi 424 echo " alert already done "$donetriggerfile >> $logfile 425 i=`echo $i +1 | bc -l` 426 continue 408 427 fi 409 if [ -e $triggerfile ] 410 then 411 mv $triggerfile $donetriggerfile 412 fi 413 fi 428 fi 429 if [ -e $triggerfile ] 430 then 431 mv $triggerfile $donetriggerfile 432 fi 433 414 434 #echo $night"_"$runid" "$sourcekey" -> "$triggerfile 415 435 echo " writing "$triggerfile >> $logfile … … 418 438 echo "-------------- " >> $triggerfile 419 439 echo " type: "$triggertype >> $triggerfile 420 echo " excess limit: "$exclimit" evts/h" >> $triggerfile440 echo " excess limit: "$exclimit" CU" >> $triggerfile 421 441 echo " significance limit: "$siglimit" sigma" >> $triggerfile 422 442 if [ "$bin" = "" ] … … 468 488 fi 469 489 470 if [ "$donetriggerfile" != "" ] && [-e $donetriggerfile ]490 if [ -e $donetriggerfile ] 471 491 then 472 492 diff $donetriggerfile $triggerfile >/dev/null … … 482 502 483 503 # send email only of $donetriggerfile doesn't exists 484 if ! [ -e $donetriggerfile ] 504 if ! [ -e $donetriggerfile ] 485 505 then 506 query="INSERT FlareAlerts.FlareTriggers SET fTriggerInserted=Now(), fNight="$night", fRunID="$runid", fTriggerType="$triggertype 507 if [ "$bin" = "" ] 508 then 509 query=$query", fBinning=NULL" 510 else 511 query=$query", fBinning="$bin 512 fi 513 echo $query 514 sendquery >> $logfile 515 486 516 # AMON case: create VOEvent-File 487 if [ $triggertype -eq 4]517 if [ $triggertype -eq 5 ] 488 518 then 489 519 voeventfile=$voeventpath"/"`basename $triggerfile`".xml" … … 495 525 print_voevent_file > $voeventfile 496 526 # in amon-case no email needs to be sent 497 continue 527 else 528 if [ "$bin" = "" ] && [ $trigger2 -eq 0 ] 529 then 530 continue 531 fi 532 echo "sending["$triggertype"] "$triggerfile 533 echo "sending["$triggertype"] "$triggerfile >> $logfile 534 cat $triggerfile | mail -s 'test flare alert ' -b $emailfrom -r $emailfrom $emailto 535 #cat $triggerfile | mail -s "test flare alert for $sourcename " $emailto 536 # that's also the cases for making a call 537 # fill DB for shifthelper 498 538 fi 499 500 cat $triggerfile | mail -s 'test flare alert ' -b $emailfrom -r $emailfrom $emailto 501 fi 502 503 #cat $triggerfile | mail -s "test flare alert for $sourcename " $emailto 504 # that's also the cases for making a call 505 539 fi 506 540 fi 507 541 … … 570 604 printprocesslog "INFO Evaluation for $sourcename ... " 571 605 echo "Evaluation for $sourcename ... " >> $logfile 572 echo " average fluxes: "$avgfluxmonth"+-"$errormonth" "$avgfluxyear"+-"$erroryear" "$avgflux"+-"$error>> $logfile606 echo " average fluxes: "$avgfluxmonth"+-"$errormonth" evts/h (last month) "$avgfluxyear"+-"$erroryear" evts/h (last year) "$avgflux"+-"$error" evts/h (all)" >> $logfile 573 607 574 608 # missing: get limits from DB (structure needs to be defined) … … 649 683 fi 650 684 685 # X-ray ToO 686 triggertype=4 687 # to be added 688 651 689 # AMON - automatic triggers using VOEvent files 652 triggertype= 4690 triggertype=5 653 691 printprocesslog "INFO checking for [Trigger to AMON]" >> $logfile 654 692 echo "[Trigger to AMON]" >> $logfile
Note:
See TracChangeset
for help on using the changeset viewer.