Changeset 19035 for trunk/DataCheck/Tools/get_data.sh
- Timestamp:
- 06/29/18 10:46:29 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/Tools/get_data.sh
r19033 r19035 35 35 # ToDo (notes DD): 36 36 # ---------------- 37 # - limit creation of file for externals to nightly and 20 min38 # - add zd, th for internal for minute binning (daily done)39 37 # - update function for correction 40 38 # - update CU for QLA … … 238 236 239 237 # final part of the query 240 querybase=" FROM (SELECT fNight, @ot:="$ontimeif" AS ot, fRunStart AS start, fRunStop AS stop, fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, " 238 querybase=" FROM (SELECT fNight, fZenithDistanceMin AS zdmin, fZenithDistanceMax AS zdmax, "$thresh" AS th, " 239 querybase=$querybase" @ot:="$ontimeif" AS ot, fRunStart AS start, fRunStop AS stop, fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, " 241 240 querybase=$querybase" "$correvts" AS corevts, CUQLA(fNight) AS cu, " 242 241 querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @bl, @bl := @bl + 1) AS block, " 243 242 querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @os:=@os + @ot, @os := @ot) AS os, @night :=fNight AS night " 243 # querybase=$querybase" IF (@zdmin<fZenithDistanceMin, @zdmin:=@zdmin, @zdmin:=fZenithDistanceMin) as zdmin, " 244 # querybase=$querybase" IF (@zdmin>fZenithDistanceMax, @zdmax:=@zdmax, @zdmax:=fZenithDistanceMax) as zdmax, " 245 # querybase=$querybase" IF (@thmin<"$thresh", @thmin:=@thmin, @thmin:="$thresh") as thmin, " 246 # querybase=$querybase" IF (@thmax>"$thresh", @thmax:=@thmax, @thmax:="$thresh") as thmax, " 247 # querybase=$querybase" fZenithDistanceMin as zdmin, fZenithDistanceMax as zdmax, "$thresh" as thmin, "$thresh" as thmax " 244 248 querybase=$querybase$from" CROSS JOIN (SELECT @night :=0, @ot :=0, @os :=0, @bl:=0) PARAMS " 245 249 querybase=$querybase$where" ORDER BY fRunStart) o GROUP BY block HAVING ontime>0.75*"$bin" ORDER BY 'time'" … … 252 256 queryint=$queryint" "$significance2", " 253 257 queryint=$queryint" avg(o.night) AS night, " 254 queryint=$queryint" "$numexc2", "$numsig2", "$numbg2" " 258 queryint=$queryint" "$numexc2", "$numsig2", "$numbg2", " 259 queryint=$queryint" Min(o.zdmin) AS zdmin, Max(o.zdmax) AS zdmax, Min(o.th) AS thmin, Max(o.th) AS thmax " 255 260 queryint=$queryint" "$querybase 256 261 … … 272 277 if [ "$overwrite" = "yes" ] 273 278 then 274 echo " internal: "$fileint279 echo "creating "$fileint" ..." 275 280 echo "# This file was created at "`date` > $fileint 276 281 # add query and policy here … … 283 288 #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryint" 284 289 285 286 fileext=$datapath"/FACT_preliminary_"$name"_external.dat"287 if [ "$overwrite" = "yes" ]288 then289 echo "external: "$fileext290 echo "# This file was created at "`date` > $fileext291 # add query and policy here292 fi293 headerext="# "$num" time["$timeunit"] start["$timeunit"] stop["$timeunit"] excrate[evts/h] delta_time["$timeunit"] excrate_err[evts/h] "294 echo $headerext >> $fileext295 #echo "$queryext"296 mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$queryext" >> $fileext297 #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryext"298 299 290 filecol=$datapath"/FACT_preliminary_"$name"_collaborators.dat" 300 291 if [ "$overwrite" = "yes" ] 301 292 then 302 echo "c ollaborators: "$filecol293 echo "creating "$filecol" ..." 303 294 echo "# This file was created at "`date` > $filecol 304 295 # add query and policy here … … 310 301 mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$querycol" >> $filecol 311 302 #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$querycol 303 304 # write file for externals only for allowed binnings 305 if [ $bin -eq 20 ] || [ $bin -eq -1 ] 306 then 307 fileext=$datapath"/FACT_preliminary_"$name"_external.dat" 308 if [ "$overwrite" = "yes" ] 309 then 310 echo "creating "$fileext" ..." 311 echo "# This file was created at "`date` > $fileext 312 # add query and policy here 313 fi 314 headerext="# "$num" time["$timeunit"] start["$timeunit"] stop["$timeunit"] excrate[evts/h] delta_time["$timeunit"] excrate_err[evts/h] " 315 echo $headerext >> $fileext 316 #echo "$queryext" 317 mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -s -e "$queryext" >> $fileext 318 #mysql --defaults-file=$sqlpw -u factread --host=$host $dbname -e "$queryext" 319 fi 312 320 } 313 321 … … 399 407 nightmin=20140714 400 408 nightmax=20140805 401 get_results 402 #bin=20 403 #name="Mrk501_2014_forMAGIC20" 409 #get_results 410 411 bin=20 412 nightmin=20140623 413 nightmax=20140623 414 name="Mrk501_test" 415 get_results 416 417 #bin=30 418 #name="Mrk501_2014_forMAGIC30" 404 419 #get_results 405 420
Note:
See TracChangeset
for help on using the changeset viewer.