Changeset 19029
- Timestamp:
- 06/26/18 23:50:49 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/Tools/get_data.sh
r19028 r19029 1 1 #!/bin/bash 2 2 3 # add: 4 # - fkt f dch value? 5 # - function for correction factor 6 # - x-day binning 7 # < 20121212 data 8 # zd, th for internal 9 10 # todo: check cu-factor for <20121212) 11 12 # comparison: 13 # function with select/table: 18.4 sec 14 # function with if: 5.7 sec 15 # function with if: 16 # vorteil: schneller 17 # nachteil: keine history 18 # nachteil: es braucht 2 fkt (qla, isdc) 19 20 # create function CU(night int, ana tinyint) returns double(4,1) deterministic begin declare cu double; set cu=0; select fCU into cu from CU where fValid=1 and fAnalysis=ana and fNight<night order by fNight desc limit 0,1; return cu; end $$ 21 22 # floor((mjd(timestamp)-mjd(startnight)+0.5)/numdays) 23 # floor((mjd(timestamp)-mjd(startnight)-0.5)/numdays) 24 3 # todo 4 # - update function for correction 5 # - update CU for QLA 6 # - add CU for ISDC analysis 7 # - add zd, th for internal 8 # - add < 20121212 data for QLA 9 # - check crab flux 10 # - add E2dNdE? 25 11 26 12 function get_results() … … 51 37 crabflux="3.37" 52 38 fluxprec=2 53 # crabflux="2.8e-11"54 # crabflux="3.9e-11"55 # range of crab fluxes:56 # Dortmund: 2.8e-1157 # HESS: 3.37e-1158 # HAWC: 3.01e-1159 # Wue: 3.39e-11 - 3.9e-11 (ISDC analysis)60 # 15-20% difference61 39 62 40 case $timeunit in … … 128 106 flux2="$cu2*"$crabflux 129 107 fluxerr2="$cuerr2*"$crabflux 130 131 # order information such that it is easily readable by tgraph132 # tgraph: X, Y133 # tgraph errors: X, Y, EX, EY134 108 135 109 # internal … … 148 122 # 149 123 # 150 # exter 124 # external 151 125 # -------- 152 126 # time, delta time, start, stop … … 175 149 queryint=$queryint" "$numsig" as numsig, " 176 150 queryint=$queryint" "$numbg" as numbg " 177 #queryint=$queryint" now() as now "178 151 179 152 queryext="SELECT " … … 189 162 queryext=$queryext" round("$correxcrateerr", 1) as correxcrateerr, round($fluxerr, "$fluxprec") as fluxerr, " 190 163 queryext=$queryext" round("$significance", 1) as significance " 191 #queryext=$queryext" now() as now "192 164 193 165 querybase=$from$where 194 #if [ $bin -eq -1 ]195 #then196 # querybase=$querybase" GROUP BY fNight "197 #fi198 #querybase=$querybase" GROUP BY FLOOR((Mjd(fRunStart)-Mjd("$nightmin")-0.5)/"`echo $bin | sed -e 's/-//'`".)"199 166 querybase=$querybase" GROUP BY num " 200 #echo "-----------------"$querybase201 167 if [ "$ontimelimit" = "" ] 202 168 then 203 querybase=$querybase" HAVING SUM("$ontimeif")>1200 AND NOT SUM(fNumBgEvts)=SUM(fNumSigEvts)ORDER BY num " # 20 min169 querybase=$querybase" HAVING SUM("$ontimeif")>1200 ORDER BY num " # 20 min 204 170 else 205 querybase=$querybase" HAVING SUM("$ontimeif")>"$ontimelimit" AND NOT SUM(fNumBgEvts)=SUM(fNumSigEvts)ORDER BY num "171 querybase=$querybase" HAVING SUM("$ontimeif")>"$ontimelimit" ORDER BY num " 206 172 fi 207 173 … … 221 187 queryint=$queryint" "$numsig2" as numsig, " 222 188 queryint=$queryint" "$numbg2" as numbg " 223 #queryint=$queryint" now() as now "224 189 225 190 queryext="SELECT " … … 229 194 queryext=$queryext" round("$correxcrateerr2", 1) as correxcrateerr, round("$fluxerr2", "$fluxprec") as fluxerr, " 230 195 queryext=$queryext" round("$significance2", 1) as significance " 231 #queryext=$queryext" now() as now "232 196 233 197 querybase=" FROM (SELECT fNight, @ot:="$ontimeif" AS ot, fRunStart AS start, fRunStop AS stop, fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, " … … 236 200 querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @os:=@os + @ot, @os := @ot) AS os, @night :=fNight AS night " 237 201 querybase=$querybase$from" CROSS JOIN (SELECT @night :=0, @ot :=0, @os :=0, @bl:=0) PARAMS " 238 querybase=$querybase$where" ORDER BY fRunStart) o GROUP BY block HAVING NOT sum(o.bgevts)=sum(o.sigevts) AND ontime>0.75*"$bin 239 # AND NOT SUM(fNumBgEvts)=SUM(fNumSigEvts) 202 querybase=$querybase$where" ORDER BY fRunStart) o GROUP BY block HAVING ontime>0.75*"$bin 240 203 241 204 queryint=$queryint" "$querybase" order by 'time'"
Note:
See TracChangeset
for help on using the changeset viewer.