Changeset 19731
- Timestamp:
- 10/07/19 12:57:31 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/Tools/get_data.sh
r19570 r19731 137 137 echo "# Calima Cut: dust < "$dust" ug/cm3" 138 138 fi 139 if [ "$factorcut" != "" ] 140 then 141 echo "# Factor Cut: zdfactor*thfactor > "$factorcut 142 fi 139 143 if [ "$usedch" == "yes" ] 140 144 then … … 175 179 zdfactor="(pow(cos(fZenithDistanceMean*PI()/180),3)+14.8/21.9*pow(sin(2*fZenithDistanceMean*PI()/180),5))" 176 180 #zdfactor="(1/(pow(cos(fZenithDistanceMean*PI()/180),3)+14.8/21.9*pow(sin(2*fZenithDistanceMean*PI()/180),5)))" 177 thfactor="(1-0.00124/1.21*(fThresholdMinSet-500)*(fThresholdMinSet>=500))" 181 thfactor="(1-0.00124/1.21*(fThresholdMinSet-500)*(fThresholdMinSet>=500))" 178 182 # ETh: 1100 GeV 179 183 crabflux="1.81" … … 207 211 cufactor="fCU" 208 212 # some calculations 209 excerr="ExcErr(Sum(fNumSigEvts), SUM(fNumBgEvts))" 213 #excerr="ExcErr(SUM(fNumSigEvts), SUM(fNumBgEvts))" 214 excerr="ExcErr(fNumSigEvts, fNumBgEvts)" 210 215 CU="SUM(fNumExcEvts/"$cufactor")/SUM("$ontimeif")*3600" 211 CUerr=$excerr"/SUM("$ontimeif")*3600*SUM(fNumExcEvts/"$cufactor")/SUM(fNumExcEvts)" 216 #CUerr=$excerr"/SUM("$ontimeif")*3600*SUM(fNumExcEvts/"$cufactor")/SUM(fNumExcEvts)" 217 CUerr="SQRT(SUM(POW("$excerr"/"$cufactor",2)))/SUM("$ontimeif")*3600" 212 218 CUcor="SUM("$correvts"/"$cufactor")/SUM("$ontimeif")*3600" 213 CUcorerr=$excerr"/SUM("$ontimeif")*3600*SUM("$correvts"/"$cufactor")/SUM(fNumExcEvts)" 214 excerr2="ExcErr(SUM(o.sigevts),SUM(o.bgevts))" 219 #CUcorerr=$excerr"/SUM("$ontimeif")*3600*SUM("$correvts"/"$cufactor")/SUM(fNumExcEvts)" 220 CUcorerr="SQRT(SUM(POW("$excerr"/"$cufactor"/"$zdfactor"/"$thfactor",2)))/SUM("$ontimeif")*3600" 221 #excerr2="ExcErr(SUM(o.sigevts),SUM(o.bgevts))" 222 excerr2="ExcErr(o.sigevts,o.bgevts)" 215 223 CU2="SUM((o.sigevts-o.bgevts)/o.cufactor)/SUM(o.ot)*3600" 216 CUerr2=$excerr2"/SUM(o.ot)*3600*SUM((o.sigevts-o.bgevts)/o.cufactor)/(SUM(o.sigevts)-SUM(o.bgevts))" 217 CUcor2="SUM(o.corevts/o.cufactor)/SUM(o.ot)*3600" 218 CUcorerr2=$excerr2"/SUM(o.ot)*3600*SUM(o.corevts/o.cufactor)/(SUM(o.sigevts)-SUM(o.bgevts))" 224 #CUerr2=$excerr2"/SUM(o.ot)*3600*SUM((o.sigevts-o.bgevts)/o.cufactor)/(SUM(o.sigevts)-SUM(o.bgevts))" 225 CUerr2="SQRT(SUM(POW("$excerr2"/o.cufactor,2)))/SUM(o.ot)*3600" 226 #CUcor2="SUM(o.corevts/o.cufactor)/SUM(o.ot)*3600" 227 CUcor2="SUM(o.excevts/o.zdfactor/o.thfactor/o.cufactor)/SUM(o.ot)*3600" 228 #CUcorerr2=$excerr2"/SUM(o.ot)*3600*SUM(o.corevts/o.cufactor)/(SUM(o.sigevts)-SUM(o.bgevts))" 229 CUcorerr2="SQRT(SUM(POW("$excerr2"/o.cufactor/o.zdfactor/o.thfactor,2)))/SUM(o.ot)*3600" 230 231 #"ROUND(SQRT(SUM(POW(ExcErr(fNumSigEvts, fNumBgEvts)/pow(cos(fZenithDistanceMean*PI()/180)*exp(1-cos(fZenithDistanceMean*PI()/180)),4.5)/(1.37-IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)*0.00118), 2)))/SUM( IF(ISNULL(fEffectiveOn), fOnTimeAfterCuts , TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn ) )*3600, 1)" 219 232 220 233 # columns to be selected … … 223 236 excrate=" ROUND(SUM(fNumExcEvts)/SUM("$ontimeif")*3600, 1) AS excrate" 224 237 significance="ROUND(LiMa(Sum(fNumSigEvts), SUM(fNumBgEvts)), 1) AS significance" 225 numexc="Sum(fNumExcEvts) AS numexc" 226 numsig="Sum(fNumSigEvts) AS numsig" 227 numbg="Sum(fNumBgEvts) AS numbg" 228 excrateerr=" ROUND("$excerr"/SUM("$ontimeif")*3600, 1) AS excrateerr" 238 numexc="SUM(fNumExcEvts) AS numexc" 239 numsig="SUM(fNumSigEvts) AS numsig" 240 numbg="SUM(fNumBgEvts) AS numbg" 241 #excrateerr=" ROUND("$excerr"/SUM("$ontimeif")*3600, 1) AS excrateerr" 242 excrateerr=" ROUND(ExcErr(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM("$ontimeif")*3600, 1) AS excrateerr" 229 243 correxcrate=" ROUND(SUM("$correvts")/SUM("$ontimeif")*3600, 1) AS correxcrate" 230 correxcrateerr=" ROUND("$excerr"/SUM("$ontimeif")*3600*SUM("$correvts")/SUM(fNumExcEvts), 1) AS correxcrateerr" 244 #correxcrateerr=" ROUND("$excerr"/SUM("$ontimeif")*3600*SUM("$correvts")/SUM(fNumExcEvts), 1) AS correxcrateerr" 245 correxcrateerr=" ROUND(SQRT(SUM(POW("$excerr"/"$zdfactor"/"$thfactor", 2)))/SUM("$ontimeif")*3600, 1) AS correxcrateerr" 231 246 cu=" ROUND("$CU", 2) AS cu" 232 247 cuerr=" ROUND("$CUerr", 2) AS cuerr" 233 248 cucor=" ROUND("$CUcor", 2) AS cucor" 234 cucorerr=" ROUND("$CUcorerr", 2) AS cucorerr"249 cucorerr=" ROUND("$CUcorerr", 2) AS 'cucorerr'" 235 250 flux="ROUND("$CU" * "$crabflux", 2) AS flux" 236 251 fluxerr="ROUND("$CUerr" * "$crabflux", 2) AS fluxerr" … … 239 254 # for minute binning 240 255 ontime2=" ROUND(SUM(o.ot)/60., 1) AS ontime" 241 excrate2=" ROUND((SUM(o.sigevts)-SUM(o.bgevts))/SUM(o.ot)*3600, 1) AS excrate" 256 #excrate2=" ROUND((SUM(o.sigevts)-SUM(o.bgevts))/SUM(o.ot)*3600, 1) AS excrate" 257 excrate2=" ROUND((SUM(o.excevts))/SUM(o.ot)*3600, 1) AS excrate" 242 258 significance2=" ROUND(LiMa(SUM(o.sigevts),SUM(o.bgevts)), 1) AS significance" 243 numexc2="Sum(o.sigevts-o.bgevts) AS numexc" 244 numsig2="Sum(o.sigevts) AS numsig" 245 numbg2="Sum(o.bgevts) AS numbg" 246 excrateerr2=" ROUND("$excerr2"/SUM(o.ot)*3600, 1) AS excrateerr" 247 correxcrate2=" ROUND(SUM(o.corevts)/SUM(o.ot)*3600, 1) AS correxcrate" 248 correxcrateerr2=" ROUND("$excerr2"/SUM(o.ot)*3600*SUM(o.corevts)/(SUM(o.sigevts)-SUM(o.bgevts)), 1) AS correxcrateerr" 259 #numexc2="Sum(o.sigevts-o.bgevts) AS numexc" 260 numexc2="SUM(o.excevts) AS numexc" 261 numsig2="SUM(o.sigevts) AS numsig" 262 numbg2="SUM(o.bgevts) AS numbg" 263 excrateerr2=" ROUND(ExcErr(SUM(o.sigevts),SUM(o.bgevts))/SUM(o.ot)*3600, 1) AS excrateerr" 264 correxcrate2=" ROUND(SUM(o.excevts/o.zdfactor/o.thfactor)/SUM(o.ot)*3600, 1) AS correxcrate" 265 #correxcrateerr2=" ROUND("$excerr2"/SUM(o.ot)*3600*SUM(o.corevts)/(SUM(o.sigevts)-SUM(o.bgevts)), 1) AS correxcrateerr" 266 correxcrateerr2=" ROUND(SQRT(SUM(POW("$excerr2"/o.zdfactor/o.thfactor,2)))/SUM(o.ot)*3600,1) AS correxcrateerr" 249 267 cu2=" ROUND("$CU2", 2) AS cu" 250 268 cuerr2=" ROUND("$CUerr2", 2) AS cuerr" 251 269 cucor2=" ROUND("$CUcor2", 2) AS cucor" 252 cucorerr2=" ROUND("$CUcorerr2", 2) AS cucorerr"270 cucorerr2=" ROUND("$CUcorerr2", 2) AS 'cucorerr'" 253 271 flux2="ROUND("$CU2" * "$crabflux", "$fluxprec") AS flux" 254 272 fluxerr2="ROUND("$CUerr2" *"$crabflux", "$fluxprec") AS fluxerr" … … 306 324 # some sanity checks 307 325 where=$where" AND fRunTypeKey=1 " 326 # remove empty rows 327 if [ "$rmemptyrows" == "yes" ] 328 then 329 where=$where" AND NOT ISNULL(fZenithDistanceMean) AND (NOT ISNULL(fThresholdMinSet) OR NOT ISNULL(fThresholdMedian)) AND NOT ISNULL(fCU) " 330 fi 308 331 # zd cut 309 332 if [ "$zdmax" != "" ] … … 334 357 where=$where" AND "$lightcut 335 358 fi 359 # if [ "$factorcut" != "" ] 360 # then 361 # where=$where" AND ( ("$zdfactor") * ("$thfactor")) > "$factorcut" " 362 # fi 336 363 querybase=$from$where 337 364 … … 358 385 if [ $bin -eq 0 ] 359 386 then 360 orderby=" fPeriod "387 orderby=" ORDER BY fPeriod " 361 388 #querystart=$querystart" fPeriod AS num, " 362 389 queryend=" GROUP BY fPeriod " 363 390 else 364 391 num=" FLOOR((Mjd(fRunStart)-Mjd("$nightmin")-0.5)/"`echo $bin | sed -e 's/-//'`".) " 365 orderby= $num392 orderby=" ORDER BY "$num 366 393 #querystart=$querystart" FLOOR((Mjd(fRunStart)-Mjd("$nightmin")-0.5)/"`echo $bin | sed -e 's/-//'`".) AS num, " 367 394 queryend=" GROUP BY "$num … … 370 397 if [ "$ontimelimit" = "" ] 371 398 then 372 queryend=$queryend" HAVING SUM("$ontimeif")>1200 ORDER BY "$orderby399 queryend=$queryend" HAVING SUM("$ontimeif")>1200 " 373 400 else 374 queryend=$queryend" HAVING SUM("$ontimeif")>"$ontimelimit " ORDER BY "$orderby401 queryend=$queryend" HAVING SUM("$ontimeif")>"$ontimelimit 375 402 fi 403 # if [ "$ontimelimit" = "" ] 404 # then 405 # queryend=$queryend" HAVING abs(cucorerr) < 1 AND SUM("$ontimeif")>1200 ORDER BY "$orderby 406 # else 407 # queryend=$queryend" HAVING abs(cucorerr) < 1 AND SUM("$ontimeif")>"$ontimelimit" ORDER BY "$orderby 408 # fi 376 409 377 410 # internal … … 385 418 queryint=$queryint" MIN("$zenith"Min) AS zdmin, MAX("$zenith"Max) AS zdmax, " 386 419 queryint=$queryint" MIN("$thresh") AS thmin, MAX("$thresh") AS thmax, " 387 queryint=$queryint" ROUND(AVG("$cufactor"), 1) AS cufactor, ROUND(AVG(fR750Cor), 2) AS R750cor, ROUND(AVG(fR750Ref), 2) AS R750ref " 388 queryint=$queryint" "$querybase" "$querydch" "$queryend 420 queryint=$queryint" ROUND(AVG("$cufactor"), 1) AS cufactor, ROUND(AVG("$zdfactor"), 1) AS zdfactor, ROUND(AVG("$thfactor"), 1) AS thfactor, " 421 queryint=$queryint" ROUND(AVG(fR750Cor), 2) AS R750cor, ROUND(AVG(fR750Ref), 2) AS R750ref " 422 if [ "$factorcut" == "" ] 423 then 424 queryint=$queryint" "$querybase" "$querydch" "$queryend" "$orderby 425 else 426 # queryint=$queryint" "$querybase" "$querydch" "$queryend" "$orderby 427 queryint=$queryint" "$querybase" "$querydch" "$queryend" AND ( zdfactor * thfactor > "$factorcut") "$orderby 428 fi 389 429 390 430 # for collaborators … … 394 434 querycol=$querycol" "$excrateerr", "$correxcrateerr", "$cucorerr", "$fluxcorerr", " 395 435 querycol=$querycol" "$significance 396 querycol=$querycol" "$querybase" "$querydch" "$queryend 436 if [ "$factorcut" == "" ] 437 then 438 querycol=$querycol" "$querybase" "$querydch" "$queryend" "$orderby 439 else 440 # querycol=$querycol" "$querybase" "$querydch" "$queryend" "$orderby 441 querycol=$querycol" "$querybase" "$querydch" "$queryend" AND (AVG("$zdfactor") * AVG("$thfactor") > "$factorcut") "$orderby 442 fi 397 443 398 444 # external 399 445 # no datacheck applied for external files 400 queryext=$querystart" "$excrate", "$deltat", "$excrateerr" "$querybase" "$queryend 446 # no cut on factors 447 queryext=$querystart" "$excrate", "$deltat", "$excrateerr" "$querybase" "$queryend" "$orderby 401 448 402 449 else … … 408 455 querybase=" FROM (SELECT fNight, fZenithDistanceMin AS zdmin, fZenithDistanceMax AS zdmax, "$thresh" AS th, " 409 456 querybase=$querybase" fR750Cor AS R750cor, fR750Ref AS R750ref, "$cufactor" AS cufactor, " 457 querybase=$querybase" "$zdfactor" AS zdfactor, "$thfactor" AS thfactor, " 410 458 querybase=$querybase" @ot:="$ontimeif" AS ot, fRunStart AS start, fRunStop AS stop, " 411 querybase=$querybase" fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, "$correvts" AS corevts, " 459 #querybase=$querybase" fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, "$correvts" AS corevts, " 460 querybase=$querybase" fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, fNumExcEvts AS excevts, " 412 461 querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @bl, @bl := @bl + 1) AS block, " 413 462 querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @os:=@os + @ot, @os := @ot) AS os, @night :=fNight AS night " … … 421 470 queryint=$queryint" "$excrateerr2", "$cuerr2", "$fluxerr2", "$correxcrateerr2", "$cucorerr2", "$fluxcorerr2", " 422 471 queryint=$queryint" "$significance2", " 423 queryint=$queryint" avg(o.night) AS night, " 472 #queryint=$queryint" avg(o.night) AS night, " 473 queryint=$queryint" min(o.night) AS nightmin, max(o.night) AS nightmax, " 424 474 queryint=$queryint" "$numexc2", "$numsig2", "$numbg2", " 425 475 queryint=$queryint" MIN(o.zdmin) AS zdmin, MAX(o.zdmax) AS zdmax, MIN(o.th) AS thmin, MAX(o.th) AS thmax, " … … 480 530 echo "#" >> $fileint 481 531 headerint="# time["$timeunit"] start["$timeunit"] stop["$timeunit"] excess-rate[evts/h] flux[CU] flux[e-11ph/cm2/s] corrected_excess-rate[evts/h] corrected_flux[CU] corrected_flux[e-11ph/cm2/s] (stop-start)/2["$timeunit"] ontime[min]" 482 headerint=$headerint" excess-rate_error[evts/h] flux_error[CU] flux_error[e-11ph/cm2/s] corrected_excess-rate_error[evts/h] corrected_flux_error[CU] corrected_flux_error[e-11/cm2/s] significance night num_exc num_sig num_bg "483 headerint=$headerint" zdmin zdmax thmin thmax avg(cufactor) avg( R750cor) avg(R750ref) "532 headerint=$headerint" excess-rate_error[evts/h] flux_error[CU] flux_error[e-11ph/cm2/s] corrected_excess-rate_error[evts/h] corrected_flux_error[CU] corrected_flux_error[e-11/cm2/s] significance nightmin nightmax num_exc num_sig num_bg " 533 headerint=$headerint" zdmin zdmax thmin thmax avg(cufactor) avg(zdfactor) avg(thfactor) avg(R750cor) avg(R750ref) " 484 534 echo $headerint >> $fileint 485 535 #echo "$queryint" … … 639 689 # use different conversion from CU to fluxes 640 690 #crabfluxconv="2.5" 691 # remove lines which contain NULL (e.g. zd-corrected flux when zd=NULL) 692 rmemptyrows="yes" 693 # remove lines with zdfactor * thfactor > value 694 factorcut=0.3 641 695 642 696 … … 655 709 # -------------------------------------------------------------------------------------- # 656 710 657 # some test 658 table="AnalysisResultsRunCutsLC" # CutsLC 659 bin=0 711 712 datapath=/home/dorner/FACT.analysis/corrected.lcs.for.collaborators/lcs 713 714 # put your data request here, examples below 715 716 # LCs for 421 campaign with Astrosat Jan 2019 717 table="AnalysisResultsRunLP" 718 # Mrk 421 719 source=1 720 # nightly 721 bin=-1 722 nightmin=20190109 723 nightmax=20190113 724 name="QLA_Mrk421_nightly_Astrosat-Jan-2019" 725 get_results 726 # 20min 727 bin=20 728 name="QLA_Mrk421_20min_Astrosat-Jan-2019" 729 get_results 730 # 30min 731 bin=30 732 name="QLA_Mrk421_30min_Astrosat-Jan-2019" 733 get_results 734 # 40min 735 bin=40 736 name="QLA_Mrk421_40min_Astrosat-Jan-2019" 737 get_results 738 # 60min 739 bin=60 740 name="QLA_Mrk421_60min_Astrosat-Jan-2019" 741 get_results 742 # 80min 743 bin=80 744 name="QLA_Mrk421_80min_Astrosat-Jan-2019" 745 get_results 746 # 90min 747 bin=90 748 name="QLA_Mrk421_90min_Astrosat-Jan-2019" 749 get_results 750 751 752 753 754 exit 755 756 # LCs for SED project 2013 757 table="AnalysisResultsRunCutsLC" # CutsLC 758 # Mrk 421 759 source=1 760 # nightly 761 bin=-1 762 nightmin=20120901 763 nightmax=20130516 764 name="Mrk421_nightly_SED-project-2013" 765 get_results 766 767 768 769 # LCs for XMM proposal 770 table="AnalysisResultsRunCutsLC" # CutsLC 771 # Mrk 421 772 source=1 773 # nightly 774 bin=-1 775 nightmin=20111115 776 nightmax=20201231 777 name="Mrk421_nightly_XMM-proposal-2019" 778 get_results 660 779 # Mrk 501 661 780 source=2 662 name="Mrk501_all_P" 663 get_results 664 665 #exit 781 name="Mrk501_nightly_XMM-proposal-2019" 782 get_results 783 # 1959 784 source=7 785 name="1959_nightly_XMM-proposal-2019" 786 get_results 787 788 789 790 # LCs for 421 campaign with Astrosat Jan 2019 791 table="AnalysisResultsRunCutsLC" # CutsLC 792 # Mrk 421 793 source=1 794 # nightly 795 bin=-1 796 nightmin=20190109 797 nightmax=20190113 798 name="Mrk421_nightly_Astrosat-Jan-2019" 799 get_results 800 # 20min 801 bin=20 802 name="Mrk421_20min_Astrosat-Jan-2019" 803 get_results 804 # 30min 805 bin=30 806 name="Mrk421_30min_Astrosat-Jan-2019" 807 get_results 808 # 40min 809 bin=40 810 name="Mrk421_40min_Astrosat-Jan-2019" 811 get_results 812 # 60min 813 bin=60 814 name="Mrk421_60min_Astrosat-Jan-2019" 815 get_results 816 # 80min 817 bin=80 818 name="Mrk421_80min_Astrosat-Jan-2019" 819 get_results 820 # 90min 821 bin=90 822 name="Mrk421_90min_Astrosat-Jan-2019" 823 get_results 824 825 826 827 # LCs for flaring pattern project 828 table="AnalysisResultsRunCutsLC" # CutsLC 829 # Mrk 421 830 source=1 831 # nightly 832 bin=-1 833 nightmin=20111115 834 nightmax=20201231 835 name="Mrk421_nightly_Flaring-pattern-project" 836 get_results 837 # 2d 838 bin=-2 839 nightmin=20111115 840 nightmax=20201231 841 name="Mrk421_2day_Flaring-pattern-project" 842 get_results 843 844 845 846 # LCs for ToO-Trigger project 847 table="AnalysisResultsRunCutsLC" # CutsLC 848 # Mrk 421 849 source=1 850 # nightly for 2019 851 bin=-1 852 nightmin=20190101 853 nightmax=20190630 854 name="Mrk421_nightly_20190101-20190630_ToO-project-2019" 855 get_results 856 # 20 min around flare 857 bin=20 858 nightmin=20190609 859 nightmax=20190612 860 name="Mrk421_20min_20190609-20190612_ToO-project-2019" 861 get_results 862 863 exit 864 865 table="AnalysisResultsRunLP" # QLA 866 # Mrk 421 867 source=1 868 # nightly for 2019 869 bin=-1 870 nightmin=20190101 871 nightmax=20190630 872 name="QLA_Mrk421_nightly_20190101-20190630_ToO-project-2019" 873 get_results 874 # 20 min around flare 875 bin=20 876 nightmin=20190609 877 nightmax=20190612 878 name="QLA_Mrk421_20min_20190609-20190612_ToO-project-2019" 879 get_results 880 881 882 table="AnalysisResultsRunISDC" # ISDC 883 # Mrk 421 884 source=1 885 # nightly for 2019 886 bin=-1 887 nightmin=20190101 888 nightmax=20190630 889 name="ISDC_Mrk421_nightly_20190101-20190630_ToO-project-2019" 890 get_results 891 # 20 min around flare 892 bin=20 893 nightmin=20190609 894 nightmax=20190612 895 name="ISDC_Mrk421_20min_20190609-20190612_ToO-project-2019" 896 get_results 897 898 899 exit 666 900 667 901 # LC for ICRC … … 692 926 693 927 694 #exit928 exit 695 929 696 930 # Mrk 501
Note:
See TracChangeset
for help on using the changeset viewer.