Changeset 19446 for trunk/DataCheck


Ignore:
Timestamp:
03/12/19 14:36:12 (6 years ago)
Author:
Daniela Dorner
Message:
added correction and conversion factors for ISDC and new analysis
File:
1 edited

Legend:

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

    r19066 r19446  
    3131
    3232
    33 
    34 
    3533# ToDo (notes DD):
    3634# ----------------
    37 # - finalize policy and references
    38 # must-have
    39 # - update function for zd/th-correction
    40 # - update CU for QLA
    41 # - add CU for ISDC analysis
     35# - check ETh and crabflux factor for QLA
     36# - do conversion to fluxes using FACT Crab spectrum
    4237# - add < 20121212 data for QLA
    43 # - check crab flux
     38# - new version of zd/th-correction and CU from Aachen when ready
    4439# nice-to-have
    4540# - add E2dNdE
    4641# - functionality to determine start time for seaon-binning
    47 # - offer several predefined datachecks?
    48 # - file as attachment to email ofr download.php
     42# - file as attachment to email for download.php
    4943
    5044#
     
    9791      echo "# If you intend to use data or information from this website, please let us know for reference."
    9892   else
    99       echo "#   As a member or associated member of the FACT Collaboration, you have access to internal information."
     93      echo "#   As a member, associated member or collaborator of the FACT Collaboration, you have access to internal information."
    10094      echo "#   Any publication using FACT internal information has to have the full FACT author list."
    10195   fi
     
    107101   echo "#"
    108102   echo "# Your Selection: "
    109    sourcename=`mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "SELECT fSourceName FROM Source WHERE fSourceKey="$source`
     103   sourcename=`mysql --defaults-file=$sqlpw -s -e "SELECT fSourceName FROM Source WHERE fSourceKey="$source`
    110104   echo "#   Source: "$sourcename
    111105   echo "#   Time range: "$nightmin"-"$nightmax
     
    124118   binning=`echo $bin | sed -e 's/-//'`" "$unit
    125119   echo "#   Binning: "$binning
    126    if [ "$expert" = "yes" ]
     120   if [ "$expert" != "no" ]
    127121   then
    128122      echo "# Additional Internal Selection: "
     
    146140      if [ "$usedch" == "yes" ]
    147141      then
    148          echo "#   Data quality selection based on the cosmic ray rate was applied."
     142         echo "#   Data quality selection was applied. "
     143         if [ "$dch" == "" ]
     144         then
     145            echo "#      Standard data check based on cosmic-ray rate: "$dchstd
     146         else
     147            echo "#      You selected a custom datacheck: "$dch
     148         fi
    149149      fi
    150150   fi
     
    155155{
    156156   # some query parts
    157 
    158    # some numbers for flux calculation
    159    crabflux="3.37e-11"
    160    fluxprec=13
    161    crabflux="3.37"
     157   
     158   # these values use the Crab spectrum from HESS 2006
     159   case "$table" in
     160   "AnalysisResultsRunISDC")
     161      zdfactor="pow(cos(fZenithDistanceMean*PI()/180)*exp(1-cos(fZenithDistanceMean*PI()/180)),4.2)"
     162      thfactor="(1.18-IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)*0.00062)"
     163      # ETh: 764 GeV
     164      crabflux="3.3"
     165      ;;
     166   "AnalysisResultsRunCutsLC")
     167      zdfactor="pow(cos(fZenithDistanceMean*PI()/180)*exp(1-cos(fZenithDistanceMean*PI()/180)),4.5)"
     168      thfactor="(1.37-IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)*0.00118)"
     169      # ETh: 543 GeV
     170      crabflux="5.7"
     171      ;;
     172   "AnalysisResultsRunLP")
     173      zdfactor="(pow(cos(fZenithDistanceMean*PI()/180),3)+14.8/21.9*pow(sin(2*fZenithDistanceMean*PI()/180),5))"
     174      #zdfactor="(1/(pow(cos(fZenithDistanceMean*PI()/180),3)+14.8/21.9*pow(sin(2*fZenithDistanceMean*PI()/180),5)))"
     175      thfactor="(1-0.00124/1.21*(fThresholdMinSet-500)*(fThresholdMinSet>=500))"                                 
     176      # ETh: 750 GeV ----> CHECK
     177      crabflux="3.37"
     178      ;;
     179   "*")
     180      zdfactor="0"
     181      thfactor="0"
     182      crabflux="0"
     183      ;;
     184   esac
     185
     186   # conversion from crab units to fluxes (if a different value is given in setup
     187   if [ "$crabfluxconv" != "" ]
     188   then
     189      crabflux=$crabfluxconv #e-11
     190   fi
     191   #echo "crabflux: "$crabflux
    162192   fluxprec=2
    163193   
     
    170200   zenith="fZenithDistance"
    171201   thresh="IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)"
    172    # correction factor for excess rate (formula by TB)
    173    correvts=" fNumExcEvts*(pow(cos("$zenith"Mean*PI()/180),3)+14.8/21.9*pow(sin(2*"$zenith"Mean*PI()/180),5))/((1-0.00124/1.21*("$thresh"-500)*("$thresh">=500))) "
    174    # conversion to CU (determined by DD for QLA)
    175    # https://www.fact-project.org/logbook/showthread.php?tid=4927
    176    cufactor="CUQLA(fNight)" # missing: ISDC analysis
     202   # correction for zd- and th-dependence
     203   correvts=" fNumExcEvts/"$zdfactor"/"$thfactor
     204   # conversion to CU - stored in each result-table (determined by DD Feb 2019)
     205   cufactor="fCU"
    177206   # some calculations
    178207   excerr="ExcErr(Sum(fNumSigEvts), SUM(fNumBgEvts))"
     
    412441      echo $headerext >> $fileext
    413442      #echo "$queryext"
    414       mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$queryext" >> $fileext
    415       #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryext"
     443      mysql --defaults-file=$sqlpw -s -e "$queryext" >> $fileext
     444      #mysql --defaults-file=$sqlpw -e "$queryext"
    416445   fi
    417446   if [ "$mode" == "auto" ] && [ "$expert" == "no" ]
     
    439468   echo $headerint >> $fileint
    440469   #echo "$queryint"
    441    mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$queryint" >> $fileint
    442    #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryint"
     470   mysql --defaults-file=$sqlpw -s -e "$queryint" >> $fileint
     471   #mysql --defaults-file=$sqlpw -e "$queryint"
    443472   if [ "$mode" == "auto" ]
    444473   then
     
    453482      print_policy >> $filecol
    454483      print_selection >> $filecol
    455       echo "# The following query was used: " >> $filecol
    456       echo "# "$querycol >> $filecol
    457       echo "#" >> $filecol
     484      #echo "# The following query was used: " >> $filecol
     485      #echo "# "$querycol >> $filecol
     486      #echo "#" >> $filecol
    458487   fi
    459488   headercol="# time["$timeunit"] start["$timeunit"] stop["$timeunit"] excess-rate[evts/h] corrected_excess-rate[evts/h] flux[CU] flux[e-11/cm2/s] (stop-start)/2["$timeunit"] ontime[min]"
     
    461490   echo $headercol >> $filecol
    462491   #echo "$querycol"
    463    mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$querycol" >> $filecol
    464    #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$querycol
     492   mysql --defaults-file=$sqlpw -s -e "$querycol" >> $filecol
     493   #mysql --defaults-file=$sqlpw -e "$querycol
    465494}
    466495
     
    472501   mode="auto"
    473502   overwrite="yes"
    474    # setup
     503   # setup for usage with download.php
    475504   datapath="/home/factwww/dch/data"
    476505   #datapath="./data"
    477506   sqlpw=/home/fact/.mysql.pw
    478    #sqlpw=/home/fact/.mysql.pw2 
    479    host=10.0.100.21
    480    dbname=factdata
     507   #sqlpw=/home/fact/.mysql.pw2
     508   #host=10.0.100.21
     509   #dbname=factdata
    481510   nightmin=$1
    482511   nightmax=$2
     
    537566#  DB SETUP
    538567# ----------
    539 # path to file with mysql password
    540 sqlpw=/home/$USER/.mysql.pw
    541 # host of mysql server with FACT DB
    542 #host=lp-fact # ISDC
    543 host=10.0.100.21 # LP or LP via vpn
    544 #host=localhost # your local machine in case you have a copy of DB
    545 # name of database
    546 dbname=factdata
     568# path to file with mysql setup (user, password, host, db-name)
     569sqlpw=/home/$USER/.mysql.pw.local
    547570#
    548571# -------------
     
    572595# choose analysis
    573596#table="AnalysisResultsAllQLA" # N/A
    574 table="AnalysisResultsRunLP" # QLA
     597#table="AnalysisResultsRunLP" # QLA
    575598#table="AnalysisResultsRunISDC"  # ISDC
     599table="AnalysisResultsRunCutsLC" # CutsLC
    576600# time range
    577601nightmin=20111115
     
    596620#dust=1
    597621#dust=10
     622# use different conversion from CU to fluxes
     623#crabfluxconv="2.5"
    598624
    599625
     
    604630# Adapt the lines below to your needs.                                                   #
    605631# Overwrite default settings above.                                                      #
    606 # The  data-request is sent with the line 'get_results.'                                 #
     632# The  data-request is sent with the line 'get_results'.                                 #
    607633# Minumum setup: Define source key and name for file.                                    #
    608634# The list of source keys can be found at                                                #
     
    610636# More examples can be found further down.                                               #
    611637#                                                                                        #
    612 # REMARKS:                                                                               #
    613 # - correction of effect of zd and threshold not yet finalized and only valid for QLA    #
    614 # - no CU-conversion available for ISDC-analysis so far (that for QLA is used instead)   #
    615 #                                                                                        #
    616638# -------------------------------------------------------------------------------------- #
     639
     640#expert="yes"
     641
     642# Mrk 501
     643source=2
     644zdmax=90
     645thmax=1500
     646# new analysis
     647table="AnalysisResultsRunCutsLC" # CutsLC
     648nightmin=20140520
     649nightmax=20140930
     650name="Mrk501_nightly_newAnalysis_forHESS"
     651bin=-1
     652get_results
     653name="Mrk501_7d_newAnalysis_forHESS"
     654bin=-7
     655get_results
     656nightmin=20140623
     657nightmax=20140623
     658name="Mrk501_5min_FlareNight_newAnalysis_forHESS"
     659bin=5
     660get_results
     661# isdc analysis
     662thmax=850
     663table="AnalysisResultsRunISDC"
     664nightmin=20140520
     665nightmax=20140930
     666name="Mrk501_nightly_stdAnalysis_forHESS"
     667bin=-1
     668get_results
     669name="Mrk501_7d_stdAnalysis_forHESS"
     670bin=-7
     671get_results
     672nightmin=20140623
     673nightmax=20140623
     674name="Mrk501_5min_FlareNight_stdAnalysis_forHESS"
     675bin=5
     676get_results
     677# qla
     678thmax=500
     679table="AnalysisResultsRunLP"
     680nightmin=20140520
     681nightmax=20140930
     682name="Mrk501_nightly_QLA_forHESS"
     683bin=-1
     684get_results
     685
     686exit
    617687
    618688# 501 MAGIC
     
    620690name="Mrk501_2014_forMAGIC"
    621691bin=-1
     692crabfluxconv="2.87" # using threshold of 830GeV
     693crabfluxconv="3.01" # using threshold of 830GeV and MAGIC Crab spectrum
    622694nightmin=20140714
    623695nightmax=20140805
    624696get_results
     697
     698name="Mrk501_2014_forMAGIC_20min"
     699bin=20
     700get_results
     701
     702
     703exit
    625704
    626705bin=30
Note: See TracChangeset for help on using the changeset viewer.