source: trunk/DataCheck/Tools/get_data.sh@ 19938

Last change on this file since 19938 was 19938, checked in by Daniela Dorner, 5 years ago
fixed bug in query for QLA (th-factor could be NULL)
  • Property svn:executable set to *
File size: 41.6 KB
Line 
1#!/bin/bash
2
3# ---------------------------------------------------------------- #
4# README README README README README README README README README #
5# ---------------------------------------------------------------- #
6# #
7# To use this script, you need #
8# - a computer with access to the FACT database in La Palma #
9# - a file with the password of a valid mysql-user #
10# - to define the setup below for #
11# a) the DB access #
12# b) the data you want to have #
13# #
14# To define the setup, search for SETUP in this script and #
15# read the details there #
16# #
17# Per data request, you get up to 3 files: #
18# *_internal.dat #
19# *_collaborators.dat #
20# *_external.dat (only if binning is 20min or nightly) #
21# #
22# Please have in mind that this started as a tool for myself, then #
23# others started using it. Also the script is not yet finalized. #
24# In case you find problems and/or have a feature request, please #
25# send and email to dorner@astro.uni-wuerzburg.de #
26# #
27# ---------------------------------------------------------------- #
28# README README README README README README README README README #
29# ---------------------------------------------------------------- #
30
31
32
33# ToDo (notes DD):
34# ----------------
35# - do conversion to fluxes using FACT Crab spectrum
36# - add < 20121212 data for QLA
37# - new version of zd/th-correction and CU from Aachen when ready
38# nice-to-have
39# - add E2dNdE
40# - functionality to determine start time for seaon-binning
41# - file as attachment to email for download.php
42
43#
44# content of files (wish list):
45# -----------------------------
46# REMARK: keep order of columns to allow for reading with TGraph directly from file: X Y EX EY
47#
48# internal
49# --------
50# time: time, delta time, start, stop, ontime
51# flux: excrate, excerr, CU, CUerr, flux, fluxerr corrate, corerr, CUcor CUcorerr, fluxcor, fluxcorerr,
52# other info on flux: signif, cu-factor, num exc, num sig, num bg
53# other info: zd th R750cor R750ref
54#
55# external (allow only 20min and nightly binning)
56# --------
57# time: time, delta time, start, stop
58# flux: excrate, excerr
59#
60# collaborators
61# -------------
62# time: time, delta time, start, stop, ontime
63# flux: excrate, excerr, corrate, corerr, CUcor CUcorerr, fluxcor, fluxcorrerr, significance
64#
65# additional information to put:
66# ------------------------------
67# timestamp of creation
68# query (for debugging / answering questions)
69# policy (adapted for internal/collaborators/external) [define in files to be used also by Send_Data*.sh
70#
71
72
73function print_policy()
74{
75 echo "#"
76 echo "# Data Usage Policy: "
77 if [ "$expert" == "no" ]
78 then
79 echo "# Using data from the FACT Quick Look Analysis, you agree to cite the FACT design"
80 echo "# paper (H. Anderhub et al. JINST 8 P6008) and the quick look analysis website "
81 echo "# (https://fact-project.org/monitoring)."
82 echo "#"
83 echo "# References: "
84 echo "# FACT design paper: http://adsabs.harvard.edu/abs/2013JInst...8P6008A"
85 echo "# http://iopscience.iop.org/1748-0221/8/06/P06008 "
86 echo "# FACT Performance Paper: http://adsabs.harvard.edu/abs/2014JInst...9P0012B"
87 echo "# http://iopscience.iop.org/1748-0221/9/10/P10012"
88 echo "# FACT quick look analysis: https://fact-project.org/monitoring"
89 echo "# http://adsabs.harvard.edu/abs/2015arXiv150202582D"
90 echo "# If you intend to use data or information from this website, please let us know for reference."
91 else
92 echo "# As a member, associated member or collaborator of the FACT Collaboration, you have access to internal information."
93 echo "# Any publication using FACT internal information has to have the full FACT author list."
94 fi
95 echo "#"
96}
97
98print_selection()
99{
100 echo "#"
101 echo "# Your Selection: "
102 sourcename=`mysql --defaults-file=$sqlpw -s -e "SELECT fSourceName FROM Source WHERE fSourceKey="$source`
103 echo "# Source: "$sourcename
104 echo "# Time range: "$nightmin"-"$nightmax
105 echo "# Time format: "$timeunit
106 if [ $bin -lt 0 ]
107 then
108 unit="night(s)"
109 else
110 if [ $bin -eq 0 ]
111 then
112 unit="periods"
113 else
114 unit="minutes"
115 fi
116 fi
117 binning=`echo $bin | sed -e 's/-//'`" "$unit
118 echo "# Binning: "$binning
119 if [ "$expert" != "no" ]
120 then
121 echo "# Additional Internal Selection: "
122 echo "# "`echo $table | sed -e 's/AnalysisResultsRun//'`"-Analysis was used."
123 if [ "$zdmax" != "" ]
124 then
125 echo "# Maximum Zenith Distance: "$zdmax" degree"
126 fi
127 if [ "$thmax" != "" ]
128 then
129 echo "# Maximum Trigger Threshold: "$thmax" DAC counts"
130 fi
131 if [ "$light" != "" ]
132 then
133 echo "# Light Condition Cut: "$lightcut
134 fi
135 if [ "$dust" != "" ]
136 then
137 echo "# Calima Cut: dust < "$dust" ug/cm3"
138 fi
139 if [ "$factorcut" != "" ]
140 then
141 echo "# Factor Cut: zdfactor*thfactor > "$factorcut
142 fi
143 if [ "$usedch" == "yes" ]
144 then
145 echo "# Data quality selection was applied. "
146 if [ "$dch" == "" ]
147 then
148 echo "# Standard data check based on cosmic-ray rate: "$dchstd
149 else
150 echo "# You selected a custom datacheck: "$dch
151 fi
152 fi
153 if [ "$crabfluxconv" != "" ]
154 then
155 echo "# You set a custom conversion to fluxes: "$crabfluxconv" [10^-11 ph/s/cm2]"
156 fi
157 fi
158 echo "#"
159}
160
161function get_results()
162{
163 # some query parts
164
165 # these values use the Crab spectrum from HESS 2006
166 # hess 2006 http://www.aanda.org/articles/aa/pdf/2006/39/aa5351-06.pdf
167 # PL.SetParameter(1,-2.63);
168 # PL.SetParameter(0, 3.45e-11);
169 case "$table" in
170 "AnalysisResultsRunISDC")
171 zdfactor="pow(cos(fZenithDistanceMean*PI()/180)*exp(1-cos(fZenithDistanceMean*PI()/180)),4.2)"
172 thfactor="(1.18-IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)*0.00062)"
173 # ETh: 1070 GeV
174 crabflux="1.89"
175 ;;
176 "AnalysisResultsRunCutsLC")
177 zdfactor="pow(cos(fZenithDistanceMean*PI()/180)*exp(1-cos(fZenithDistanceMean*PI()/180)),4.5)"
178 thfactor="(1.37-IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)*0.00118)"
179 # ETh: 785 GeV
180 crabflux="3.14"
181 ;;
182 "AnalysisResultsRunLP")
183 zdfactor="(pow(cos(fZenithDistanceMean*PI()/180),3)+14.8/21.9*pow(sin(2*fZenithDistanceMean*PI()/180),5))"
184 #zdfactor="(1/(pow(cos(fZenithDistanceMean*PI()/180),3)+14.8/21.9*pow(sin(2*fZenithDistanceMean*PI()/180),5)))"
185 thfactor="(1-0.00124/1.21*(IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)-500)*(IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)>=500))"
186 # ETh: 1100 GeV
187 crabflux="1.81"
188 ;;
189 "*")
190 zdfactor="0"
191 thfactor="0"
192 crabflux="0"
193 ;;
194 esac
195
196 # conversion from crab units to fluxes (if a different value is given in setup
197 if [ "$crabfluxconv" != "" ]
198 then
199 crabflux=$crabfluxconv #e-11
200 fi
201 #echo "crabflux: "$crabflux
202 fluxprec=2
203
204 # some names and definitions needed several times below
205 # ontime
206 ontime1=" TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn "
207 ontime2=" fOnTimeAfterCuts "
208 ontimeif=" IF(ISNULL(fEffectiveOn), "$ontime2", "$ontime1") "
209 # zd and threshold
210 zenith="fZenithDistance"
211 thresh="IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)"
212 # correction for zd- and th-dependence
213 correvts=" fNumExcEvts/"$zdfactor"/"$thfactor
214 # conversion to CU - stored in each result-table (determined by DD Feb 2019)
215 cufactor="fCU"
216 # some calculations
217 #excerr="ExcErr(SUM(fNumSigEvts), SUM(fNumBgEvts))"
218 excerr="ExcErr(fNumSigEvts, fNumBgEvts)"
219 CU="SUM(fNumExcEvts/"$cufactor")/SUM("$ontimeif")*3600"
220 #CUerr=$excerr"/SUM("$ontimeif")*3600*SUM(fNumExcEvts/"$cufactor")/SUM(fNumExcEvts)"
221 CUerr="SQRT(SUM(POW("$excerr"/"$cufactor",2)))/SUM("$ontimeif")*3600"
222 CUcor="SUM("$correvts"/"$cufactor")/SUM("$ontimeif")*3600"
223 #CUcorerr=$excerr"/SUM("$ontimeif")*3600*SUM("$correvts"/"$cufactor")/SUM(fNumExcEvts)"
224 CUcorerr="SQRT(SUM(POW("$excerr"/"$cufactor"/"$zdfactor"/"$thfactor",2)))/SUM("$ontimeif")*3600"
225 #excerr2="ExcErr(SUM(o.sigevts),SUM(o.bgevts))"
226 excerr2="ExcErr(o.sigevts,o.bgevts)"
227 CU2="SUM((o.sigevts-o.bgevts)/o.cufactor)/SUM(o.ot)*3600"
228 #CUerr2=$excerr2"/SUM(o.ot)*3600*SUM((o.sigevts-o.bgevts)/o.cufactor)/(SUM(o.sigevts)-SUM(o.bgevts))"
229 CUerr2="SQRT(SUM(POW("$excerr2"/o.cufactor,2)))/SUM(o.ot)*3600"
230 #CUcor2="SUM(o.corevts/o.cufactor)/SUM(o.ot)*3600"
231 CUcor2="SUM(o.excevts/o.zdfactor/o.thfactor/o.cufactor)/SUM(o.ot)*3600"
232 #CUcorerr2=$excerr2"/SUM(o.ot)*3600*SUM(o.corevts/o.cufactor)/(SUM(o.sigevts)-SUM(o.bgevts))"
233 CUcorerr2="SQRT(SUM(POW("$excerr2"/o.cufactor/o.zdfactor/o.thfactor,2)))/SUM(o.ot)*3600"
234
235 #"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)"
236
237 # columns to be selected
238 # for night-binning
239 ontime=" ROUND(SUM("$ontimeif")/60., 1) AS ontime"
240 excrate=" ROUND(SUM(fNumExcEvts)/SUM("$ontimeif")*3600, 1) AS excrate"
241 significance="ROUND(LiMa(Sum(fNumSigEvts), SUM(fNumBgEvts)), 1) AS significance"
242 numexc="SUM(fNumExcEvts) AS numexc"
243 numsig="SUM(fNumSigEvts) AS numsig"
244 numbg="SUM(fNumBgEvts) AS numbg"
245 #excrateerr=" ROUND("$excerr"/SUM("$ontimeif")*3600, 1) AS excrateerr"
246 excrateerr=" ROUND(ExcErr(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM("$ontimeif")*3600, 1) AS excrateerr"
247 correxcrate=" ROUND(SUM("$correvts")/SUM("$ontimeif")*3600, 1) AS correxcrate"
248 #correxcrateerr=" ROUND("$excerr"/SUM("$ontimeif")*3600*SUM("$correvts")/SUM(fNumExcEvts), 1) AS correxcrateerr"
249 correxcrateerr=" ROUND(SQRT(SUM(POW("$excerr"/"$zdfactor"/"$thfactor", 2)))/SUM("$ontimeif")*3600, 1) AS correxcrateerr"
250 cu=" ROUND("$CU", 2) AS cu"
251 cuerr=" ROUND("$CUerr", 2) AS cuerr"
252 cucor=" ROUND("$CUcor", 2) AS cucor"
253 cucorerr=" ROUND("$CUcorerr", 2) AS 'cucorerr'"
254 flux="ROUND("$CU" * "$crabflux", 2) AS flux"
255 fluxerr="ROUND("$CUerr" * "$crabflux", 2) AS fluxerr"
256 fluxcor="ROUND("$CUcor" * "$crabflux", 2) AS fluxcor"
257 fluxcorerr="ROUND("$CUcorerr" * "$crabflux", 2) AS fluxcorerr"
258 # for minute binning
259 ontime2=" ROUND(SUM(o.ot)/60., 1) AS ontime"
260 #excrate2=" ROUND((SUM(o.sigevts)-SUM(o.bgevts))/SUM(o.ot)*3600, 1) AS excrate"
261 excrate2=" ROUND((SUM(o.excevts))/SUM(o.ot)*3600, 1) AS excrate"
262 significance2=" ROUND(LiMa(SUM(o.sigevts),SUM(o.bgevts)), 1) AS significance"
263 #numexc2="Sum(o.sigevts-o.bgevts) AS numexc"
264 numexc2="SUM(o.excevts) AS numexc"
265 numsig2="SUM(o.sigevts) AS numsig"
266 numbg2="SUM(o.bgevts) AS numbg"
267 excrateerr2=" ROUND(ExcErr(SUM(o.sigevts),SUM(o.bgevts))/SUM(o.ot)*3600, 1) AS excrateerr"
268 correxcrate2=" ROUND(SUM(o.excevts/o.zdfactor/o.thfactor)/SUM(o.ot)*3600, 1) AS correxcrate"
269 #correxcrateerr2=" ROUND("$excerr2"/SUM(o.ot)*3600*SUM(o.corevts)/(SUM(o.sigevts)-SUM(o.bgevts)), 1) AS correxcrateerr"
270 correxcrateerr2=" ROUND(SQRT(SUM(POW("$excerr2"/o.zdfactor/o.thfactor,2)))/SUM(o.ot)*3600,1) AS correxcrateerr"
271 cu2=" ROUND("$CU2", 2) AS cu"
272 cuerr2=" ROUND("$CUerr2", 2) AS cuerr"
273 cucor2=" ROUND("$CUcor2", 2) AS cucor"
274 cucorerr2=" ROUND("$CUcorerr2", 2) AS 'cucorerr'"
275 flux2="ROUND("$CU2" * "$crabflux", "$fluxprec") AS flux"
276 fluxerr2="ROUND("$CUerr2" *"$crabflux", "$fluxprec") AS fluxerr"
277 fluxcor2="ROUND("$CUcor2" * "$crabflux", "$fluxprec") AS fluxcor"
278 fluxcorerr2="ROUND("$CUcorerr2" *"$crabflux", "$fluxprec") AS fluxcorerr"
279
280 case $timeunit in
281 mjd) delta="(Mjd(MAX(fRunStop))-Mjd(MIN(fRunStart)))/2"
282 start=" Mjd(MIN(fRunStart)) AS start"
283 stop=" Mjd(MAX(fRunStop)) AS stop"
284 deltat=$delta" AS deltat"
285 time=" Mjd(MIN(fRunStart))+"$delta" AS time"
286 delta2="(Mjd(MAX(o.stop))-Mjd(MIN(o.start)))/2"
287 start2=" Mjd(MIN(o.start)) AS start"
288 stop2=" Mjd(MAX(o.stop)) AS stop"
289 deltat2=$delta2" AS deltat"
290 time2=" Mjd(MIN(o.start))+"$delta2" AS time"
291 ;;
292 unix) delta="(Unix_timestamp(CONVERT_TZ(MAX(fRunStop), '+00:00', 'SYSTEM')) - Unix_timestamp(CONVERT_TZ(MIN(fRunStart), '+00:00', 'SYSTEM')))/2"
293 start="Unix_timestamp(CONVERT_TZ(MIN(fRunStart), '+00:00', 'SYSTEM')) AS start"
294 stop="Unix_timestamp(CONVERT_TZ(MAX(fRunStop), '+00:00', 'SYSTEM')) AS stop"
295 deltat=$delta" AS deltat"
296 time=" Unix_timestamp(CONVERT_TZ(MIN(fRunStart), '+00:00', 'SYSTEM'))+"$delta" AS time"
297 delta2="(Unix_timestamp(CONVERT_TZ(MAX(o.stop), '+00:00', 'SYSTEM')) - Unix_timestamp(CONVERT_TZ(MIN(o.start), '+00:00', 'SYSTEM')))/2"
298 start2=" Unix_timestamp(CONVERT_TZ(MIN(o.start), '+00:00', 'SYSTEM')) AS start"
299 stop2=" Unix_timestamp(CONVERT_TZ(MAX(o.stop), '+00:00', 'SYSTEM')) AS stop"
300 deltat2=$delta2" AS deltat"
301 time2=" Unix_timestamp(CONVERT_TZ(MIN(o.start), '+00:00', 'SYSTEM'))+"$delta2" AS time"
302 ;;
303 *) delta="sec_to_time(time_to_sec(timediff(MAX(fRunStop), MIN(fRunStart)))/2)"
304 start=" MIN(fRunStart) AS start"
305 stop=" MAX(fRunStop) AS stop"
306 deltat=$delta" AS deltat"
307 time=" addtime(MIN(fRunStart), "$delta") AS time"
308 delta2="sec_to_time(time_to_sec(timediff(MAX(o.stop), MIN(o.start)))/2)"
309 start2=" MIN(o.start) AS start"
310 stop2=" MAX(o.stop) AS stop"
311 deltat2=$delta2" AS deltat"
312 time2=" addtime(MIN(o.start), "$delta2") AS time"
313 ;;
314 esac
315
316 # from and join of query
317 from=" FROM RunInfo LEFT JOIN "$table" USING (fNight, fRunID) "
318
319 # data check based on artificial trigger rate
320 # details see https://www.fact-project.org/logbook/showthread.php?tid=5790
321 #dch=" AND fR750Cor/fR750Ref >0.93 "
322 dchstd=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 "
323
324 # put together where-clause of query
325 # time range and source
326 where=" WHERE fSourceKey="$source" AND fNight BETWEEN "$nightmin" AND "$nightmax
327 where=$where" AND NOT ISNULL(fNumExcEvts) "
328 # some sanity checks
329 where=$where" AND fRunTypeKey=1 "
330 # remove empty rows
331 if [ "$rmemptyrows" == "yes" ]
332 then
333 where=$where" AND NOT ISNULL(fZenithDistanceMean) AND (NOT ISNULL(fThresholdMinSet) OR NOT ISNULL(fThresholdMedian)) AND NOT ISNULL(fCU) "
334 fi
335 # zd cut
336 if [ "$zdmax" != "" ]
337 then
338 where=$where" AND fZenithDistanceMax < "$zdmax
339 fi
340 # th cut
341 if [ "$thmax" != "" ]
342 then
343 where=$where" AND "$thresh" < "$thmax
344 fi
345 # dust cut
346 if [ "$dust" != "" ]
347 then
348 where=$where" AND fTNGDust<"$dust
349 fi
350 # light condition cut
351 if [ "$light" == "nomoon" ]
352 then
353 lightcut=" fZenithDistanceMoon>90"
354 fi
355 if [ "$light" == "dark" ]
356 then
357 lightcut=" fMoonZenithDistance>90 AND fSunZenithDistance>108 "
358 fi
359 if [ "$light" != "" ]
360 then
361 where=$where" AND "$lightcut
362 fi
363# if [ "$factorcut" != "" ]
364# then
365# where=$where" AND ( ("$zdfactor") * ("$thfactor")) > "$factorcut" "
366# fi
367 querybase=$from$where
368
369 if [ "$usedch" == "yes" ]
370 then
371 if [ "$dch" == "" ]
372 then
373 querydch=$dchstd
374 else
375 echo "you are using for datacheck: "$dch
376 querydch=$dch
377 fi
378 else
379 querydch=
380 fi
381
382
383 if [ $bin -le 0 ]
384 then
385 # first part of the query
386 querystart="SELECT "
387 querystart=$querystart" "$time", "$start", "$stop", "
388 # final part of the query
389 if [ $bin -eq 0 ]
390 then
391 orderby=" ORDER BY fPeriod "
392 #querystart=$querystart" fPeriod AS num, "
393 queryend=" GROUP BY fPeriod "
394 else
395 num=" FLOOR((Mjd(fRunStart)-Mjd("$nightmin")-0.5)/"`echo $bin | sed -e 's/-//'`".) "
396 orderby=" ORDER BY "$num
397 #querystart=$querystart" FLOOR((Mjd(fRunStart)-Mjd("$nightmin")-0.5)/"`echo $bin | sed -e 's/-//'`".) AS num, "
398 queryend=" GROUP BY "$num
399 fi
400 #queryend=" GROUP BY num "
401 if [ "$ontimelimit" = "" ]
402 then
403 queryend=$queryend" HAVING SUM("$ontimeif")>1200 "
404 else
405 queryend=$queryend" HAVING SUM("$ontimeif")>"$ontimelimit
406 fi
407# if [ "$ontimelimit" = "" ]
408# then
409# queryend=$queryend" HAVING abs(cucorerr) < 1 AND SUM("$ontimeif")>1200 ORDER BY "$orderby
410# else
411# queryend=$queryend" HAVING abs(cucorerr) < 1 AND SUM("$ontimeif")>"$ontimelimit" ORDER BY "$orderby
412# fi
413
414 # internal
415 queryint=$querystart
416 queryint=$queryint" "$excrate", "$cu", "$flux", "$correxcrate", "$cucor", "$fluxcor", "
417 queryint=$queryint" "$deltat", "$ontime", "
418 queryint=$queryint" "$excrateerr", "$cuerr", "$fluxerr", "$correxcrateerr", "$cucorerr", "$fluxcorerr", "
419 queryint=$queryint" "$significance", "
420 queryint=$queryint" MIN(fNight) AS nightmin, MAX(fNight) AS nightmax, "
421 queryint=$queryint" "$numexc", "$numsig", "$numbg", "
422 queryint=$queryint" MIN("$zenith"Min) AS zdmin, MAX("$zenith"Max) AS zdmax, "
423 queryint=$queryint" MIN("$thresh") AS thmin, MAX("$thresh") AS thmax, "
424 queryint=$queryint" ROUND(AVG("$cufactor"), 1) AS cufactor, ROUND(AVG("$zdfactor"), 1) AS zdfactor, ROUND(AVG("$thfactor"), 1) AS thfactor, "
425 queryint=$queryint" ROUND(AVG(fR750Cor), 2) AS R750cor, ROUND(AVG(fR750Ref), 2) AS R750ref "
426 if [ "$factorcut" == "" ]
427 then
428 queryint=$queryint" "$querybase" "$querydch" "$queryend" "$orderby
429 else
430# queryint=$queryint" "$querybase" "$querydch" "$queryend" "$orderby
431 queryint=$queryint" "$querybase" "$querydch" "$queryend" AND ( zdfactor * thfactor > "$factorcut") "$orderby
432 fi
433
434 # for collaborators
435 querycol=$querystart
436 querycol=$querycol" "$excrate", "$correxcrate", "$cucor", "$fluxcor", "
437 querycol=$querycol" "$deltat", "$ontime", "
438 querycol=$querycol" "$excrateerr", "$correxcrateerr", "$cucorerr", "$fluxcorerr", "
439 querycol=$querycol" "$significance
440 if [ "$factorcut" == "" ]
441 then
442 querycol=$querycol" "$querybase" "$querydch" "$queryend" "$orderby
443 else
444# querycol=$querycol" "$querybase" "$querydch" "$queryend" "$orderby
445 querycol=$querycol" "$querybase" "$querydch" "$queryend" AND (AVG("$zdfactor") * AVG("$thfactor") > "$factorcut") "$orderby
446 fi
447
448 # external
449 # no datacheck applied for external files
450 # no cut on factors
451 queryext=$querystart" "$excrate", "$deltat", "$excrateerr" "$querybase" "$queryend" "$orderby
452
453 else
454 # first part of the query
455 querystart="SELECT "
456 querystart=$querystart" "$time2", "$start2", "$stop2", "
457
458 # final part of the query
459 querybase=" FROM (SELECT fNight, fZenithDistanceMin AS zdmin, fZenithDistanceMax AS zdmax, "$thresh" AS th, "
460 querybase=$querybase" fR750Cor AS R750cor, fR750Ref AS R750ref, "$cufactor" AS cufactor, "
461 querybase=$querybase" "$zdfactor" AS zdfactor, "$thfactor" AS thfactor, "
462 querybase=$querybase" @ot:="$ontimeif" AS ot, fRunStart AS start, fRunStop AS stop, "
463 #querybase=$querybase" fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, "$correvts" AS corevts, "
464 querybase=$querybase" fNumSigEvts AS sigevts, fNumBgEvts AS bgevts, fNumExcEvts AS excevts, "
465 querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @bl, @bl := @bl + 1) AS block, "
466 querybase=$querybase" IF (@night=fNight AND FLOOR((@os+@ot)/"$bin"./60.)<1, @os:=@os + @ot, @os := @ot) AS os, @night :=fNight AS night "
467 querybase=$querybase$from" CROSS JOIN (SELECT @night :=0, @ot :=0, @os :=0, @bl:=0) PARAMS "
468 querybase=$querybase$where" ORDER BY fRunStart) o GROUP BY block HAVING ontime>0.75*"$bin" ORDER BY 'time'"
469
470 # internal
471 queryint=$querystart
472 queryint=$queryint" "$excrate2", "$cu2", "$flux2", "$correxcrate2", "$cucor2", "$fluxcor2", "
473 queryint=$queryint" "$deltat2", "$ontime2", "
474 queryint=$queryint" "$excrateerr2", "$cuerr2", "$fluxerr2", "$correxcrateerr2", "$cucorerr2", "$fluxcorerr2", "
475 queryint=$queryint" "$significance2", "
476 #queryint=$queryint" avg(o.night) AS night, "
477 queryint=$queryint" min(o.night) AS nightmin, max(o.night) AS nightmax, "
478 queryint=$queryint" "$numexc2", "$numsig2", "$numbg2", "
479 queryint=$queryint" MIN(o.zdmin) AS zdmin, MAX(o.zdmax) AS zdmax, MIN(o.th) AS thmin, MAX(o.th) AS thmax, "
480 queryint=$queryint" ROUND(AVG(o.cufactor), 1) AS cufactor, ROUND(AVG(o.R750cor), 2) AS R750cor, ROUND(AVG(o.R750ref), 2) AS R750ref "
481 queryint=$queryint" "$querybase
482
483 # for collaborators
484 querycol=$querystart
485 querycol=$querycol" "$excrate2", "$correxcrate2", "$cu2", "$fluxcor2", "
486 querycol=$querycol" "$deltat2", "$ontime2", "
487 querycol=$querycol" "$excrateerr2", "$correxcrateerr2", "$cuerr2", "$fluxcorerr2", "
488 querycol=$querycol" "$significance2
489 querycol=$querycol" "$querybase
490
491 # external
492 queryext=$querystart" "$excrate2", "$deltat2", "$ontime2", "$excrateerr2" "$querybase
493
494 fi
495
496 # write file for externals only for allowed binnings
497 if [ $bin -eq 20 ] || [ $bin -eq -1 ]
498 then
499 fileext=$datapath"/FACT_preliminary_"$name"_external.dat"
500 if [ "$overwrite" = "yes" ]
501 then
502 if [ "$mode" != "auto" ]
503 then
504 echo "creating "$fileext" ..."
505 fi
506 echo "# This file was created at "`date` > $fileext
507 print_policy >> $fileext
508 fi
509 print_selection >> $fileext
510 headerext="# time["$timeunit"] start["$timeunit"] stop["$timeunit"] excess-rate[evts/h] (stop-start)/2["$timeunit"] excess-rate_error[evts/h] "
511 echo $headerext >> $fileext
512 #echo "$queryext"
513 mysql --defaults-file=$sqlpw -s -e "$queryext" >> $fileext
514 #mysql --defaults-file=$sqlpw -e "$queryext"
515 fi
516 if [ "$mode" == "auto" ] && [ "$expert" == "no" ]
517 then
518 return
519 fi
520
521 fileint=$datapath"/FACT_preliminary_"$name"_internal.dat"
522 if [ "$overwrite" = "yes" ]
523 then
524 if [ "$mode" != "auto" ]
525 then
526 echo "creating "$fileint" ..."
527 fi
528 echo "# This file was created at "`date` > $fileint
529 print_policy >> $fileint
530 fi
531 print_selection >> $fileint
532 echo "# The following query was used: " >> $fileint
533 echo "# $queryint" >> $fileint
534 echo "#" >> $fileint
535 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]"
536 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 "
537 headerint=$headerint" zdmin zdmax thmin thmax avg(cufactor) avg(zdfactor) avg(thfactor) avg(R750cor) avg(R750ref) "
538 echo $headerint >> $fileint
539 #echo "$queryint"
540 mysql --defaults-file=$sqlpw -s -e "$queryint" >> $fileint
541 #mysql --defaults-file=$sqlpw -e "$queryint"
542 if [ "$mode" == "auto" ]
543 then
544 return
545 fi
546
547 filecol=$datapath"/FACT_preliminary_"$name"_collaborators.dat"
548 if [ "$overwrite" = "yes" ]
549 then
550 echo "creating "$filecol" ..."
551 echo "# This file was created at "`date` > $filecol
552 print_policy >> $filecol
553 fi
554 print_selection >> $filecol
555 #echo "# The following query was used: " >> $filecol
556 #echo "# $querycol" >> $filecol
557 #echo "#" >> $filecol
558 headercol="# time["$timeunit"] start["$timeunit"] stop["$timeunit"] excess-rate[evts/h] corrected_excess-rate[evts/h] corrected_flux[CU] corrected_flux[e-11ph/cm2/s] (stop-start)/2["$timeunit"] ontime[min]"
559 headercol=$headercol" excess-rate_error[evts/h] corrected_excess-rate_error[evts/h] corrected_flux_error[CU] corrected_flux_error[e-11ph/cm2/s] significance "
560 echo $headercol >> $filecol
561 #echo "$querycol"
562 mysql --defaults-file=$sqlpw -s -e "$querycol" >> $filecol
563 #mysql --defaults-file=$sqlpw -e "$querycol
564}
565
566# evaluation of command line options (for usage with download.php)
567
568if [ ${#@} -eq 16 ]
569then
570 #get_data.sh $start $stop $source $timebin $email $table $time $expert $dch $zd $th $light $dust $rmemptyrows $factorcut
571 mode="auto"
572 overwrite="yes"
573 # setup for usage with download.php
574 datapath="/home/factwww/dch/data"
575 #datapath="./data"
576 sqlpw=/home/fact/.mysql.pw
577 #sqlpw=/home/fact/.mysql.pw2
578 #host=10.0.100.21
579 #dbname=factdata
580 nightmin=$1
581 nightmax=$2
582 source=$3
583 bin=$4
584 if [ "$bin" == "00" ]
585 then
586 bin=0
587 fi
588 email=$5
589 table=$6
590 timeunit=$7
591 expert=$8
592 usedch=$9 # novalue gives same result as no
593 if [ "${10}" != "novalue" ] && [ "${10}" != "all" ]
594 then
595 zdmax=${10}
596 fi
597 if [ "${11}" != "novalue" ] && [ "${11}" != "all" ]
598 then
599 thmax=${11}
600 fi
601 if [ "${12}" != "novalue" ] && [ "${12}" != "all" ]
602 then
603 light=${12}
604 fi
605 if [ "${13}" != "novalue" ] && [ "${13}" != "all" ]
606 then
607 dust=${13}
608 fi
609 rmemptyrows=${14}
610 if [ "${15}" != "novalue" ] && [ "${15}" != "all" ]
611 then
612 factorcut=${15}
613 fi
614 if [ "${16}" != "-" ]
615 then
616 crabfluxconv=${16}
617 fi
618 name=`echo $email | sed -e 's/@/-at-/'`
619 get_results
620
621 # sending email
622 if [ "$expert" == "yes" ]
623 then
624 cat $fileint | mail -s 'FACT internal data download' -b qla@fact-project.org -r qla@fact-project.org $email
625 else
626 cat $fileext | mail -s 'FACT data download' -b qla@fact-project.org -r qla@fact-project.org $email
627 fi
628
629 exit
630fi
631
632
633
634# -------------------------------------------------------------------------------------- #
635# SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP #
636# -------------------------------------------------------------------------------------- #
637# #
638# The lines below define the basic setup for the database and give examples and #
639# explanations for the various options available. #
640# The request of the data itself is done with a smaller setup further down. #
641# #
642# -------------------------------------------------------------------------------------- #
643#
644# ----------
645# DB SETUP
646# ----------
647# path to file with mysql setup (user, password, host, db-name)
648sqlpw=/home/$USER/.mysql.pw.local
649sqlpw=/home/$USER/.mysql.pw.ethz.fact
650#
651# -------------
652# BASIC SETUP
653# -------------
654# output path
655path=`dirname $0`
656datapath=$path"/data"
657# create directory for data files
658if ! [ -e $datapath ]
659then
660 mkdir $datapath
661fi
662# time unit
663#timeunit=timestamp # default
664#timeunit=unix
665timeunit=mjd
666# time binning
667# positive values: minutes
668# negative values: days
669# special case 0: period
670# for season binning choose -365 and according start date
671#bin=20 # minutes
672#bin=0 # period
673bin=-1 # nightly
674#bin=-365 # yearly
675# choose analysis
676#table="AnalysisResultsAllQLA" # N/A
677#table="AnalysisResultsRunLP" # QLA
678#table="AnalysisResultsRunISDC" # ISDC
679table="AnalysisResultsRunCutsLC" # CutsLC
680# time range
681nightmin=20111115
682nightmax=20201231
683# overwrite dataset file?
684# (useful to combine different binnings in one file -> set to "no")
685overwrite="yes"
686# optional: require minimal ontime per bin (default 20 min)
687#ontimelimit=1800 # 30 min
688ontimelimit= # default 20 min
689# data quality selection
690# if you explicitely don't want a datacheck, you can comment the following line
691usedch="yes"
692# use your own datacheck instead
693# use a line like the following defining your own data quality selection cut
694#dch=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 "
695# apply additional predefined cuts
696# light conditions
697#light="nomoon" # only data with no moon (but twilight allowed)
698#light="dark" # only dark night data
699# TNG dust - cut away data with calima
700#dust=1
701#dust=10
702# use different conversion from CU to fluxes
703#crabfluxconv="2.5"
704# remove lines which contain NULL (e.g. zd-corrected flux when zd=NULL)
705rmemptyrows="yes"
706rmemptyrow="no"
707# remove lines with zdfactor * thfactor > value
708factorcut=0.3
709
710
711# -------------------------------------------------------------------------------------- #
712# SETUP - GET YOUR DATA HERE - SETUP - GET YOUR DATA HERE - SETUP - GET YOUR DATA HERE #
713# -------------------------------------------------------------------------------------- #
714# #
715# Adapt the lines below to your needs. #
716# Overwrite default settings above. #
717# The data-request is sent with the line 'get_results'. #
718# Minumum setup: Define source key and name for file. #
719# The list of source keys can be found at #
720# https://fact-project.org/run_db/db/printtable.php?fTable=Source&fSortBy=fSourceKEY+ #
721# More examples can be found further down. #
722# #
723# -------------------------------------------------------------------------------------- #
724
725
726# LC for Mrk 421 for crosscheck of BB
727datapath=/home/dorner/SW/bb/
728table="AnalysisResultsRunLP"
729# nightly
730bin=-1
731nightmin=20130111
732nightmax=20180515
733thmax=560
734zdmax=60
735ontimelimit=1800
736factorcut=
737rmemptyrows="yes"
738dch=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.2 AND fHumidityMean<80 "
739# Mrk 421
740source=1
741name="Mrk421_nightly_BBXcheck"
742get_results
743
744
745
746exit
747
748# LC for Mrk 421 paper with MAGIC
749# from David: MJD 57030 - 57540 (i.e. 8.1.2015 - 1.6.2016)
750datapath=/home/dorner/FACT.analysis/corrected.lcs.for.collaborators/lcs/
751table="AnalysisResultsRunCutsLC" # CutsLC
752# nightly
753bin=-1
754nightmin=20141101
755nightmax=20160630
756# conversion factor to fluxes for CutsLC
757# using slope of -3.35 -> threshold 690 GeV
758# details: https://www.fact-project.org/logbook/showthread.php?tid=6994&pid=28875#pid28875
759crabfluxconv="0.57"
760# Mrk 421
761source=1
762name="Mrk421_nightly_20141101_20160630_forMAGIC"
763get_results
764
765
766
767exit
768
769# LCs for TeVPA poster
770datapath=/home/dorner/FACT.analysis/tevpa2019
771table="AnalysisResultsRunCutsLC" # CutsLC
772# nightly
773bin=-1
774nightmin=20111115
775nightmax=20201231
776# Mrk 421
777source=1
778name="Mrk421_nightly"
779get_results
780# Mrk 501
781name="Mrk501_nightly"
782source=2
783get_results
784# 1959
785name="1959_nightly"
786source=7
787get_results
788# 2344
789name="2344_nightly"
790source=3
791get_results
792name="2344_monthly"
793bin=0
794get_results
795name="2344_7d"
796bin=7
797get_results
798usedch="no"
799name="2344_nightly_nodch"
800source=3
801get_results
802name="2344_monthly_nodch"
803bin=0
804get_results
805name="2344_7d_nodch"
806bin=7
807get_results
808usedch="yes"
809# 1959
810name="1959_mixed"
811source=7
812bin=0
813nightmin=20111115
814nightmax=20160331
815get_results
816overwrite="no"
817nightmin=20160401
818nightmax=20160815
819bin=-1
820get_results
821bin=0
822nightmin=20160816
823nightmax=20201231
824get_results
825overwrite="yes"
826
827exit
828
829
830datapath=/home/dorner/FACT.analysis/corrected.lcs.for.collaborators/lcs
831
832# put your data request here, examples below
833
834# LCs for 2344 XMM proposal
835table="AnalysisResultsRunCutsLC"
836# 2344
837source=3
838# monthly
839bin=0
840nightmin=20111115
841nightmax=20191231
842name="2344_period_XMM-proposal-2019"
843get_results
844
845exit
846
847# LCs for 421 campaign with Astrosat Jan 2019 - crosscheck
848table="AnalysisResultsRunLP"
849# Mrk 421
850source=1
851# nightly
852bin=-1
853nightmin=20190109
854nightmax=20190113
855name="QLA_Mrk421_nightly_Astrosat-Jan-2019"
856get_results
857# 20min
858bin=20
859name="QLA_Mrk421_20min_Astrosat-Jan-2019"
860get_results
861# 30min
862bin=30
863name="QLA_Mrk421_30min_Astrosat-Jan-2019"
864get_results
865# 40min
866bin=40
867name="QLA_Mrk421_40min_Astrosat-Jan-2019"
868get_results
869# 60min
870bin=60
871name="QLA_Mrk421_60min_Astrosat-Jan-2019"
872get_results
873# 80min
874bin=80
875name="QLA_Mrk421_80min_Astrosat-Jan-2019"
876get_results
877# 90min
878bin=90
879name="QLA_Mrk421_90min_Astrosat-Jan-2019"
880get_results
881
882
883
884
885# LCs for SED project 2013
886table="AnalysisResultsRunCutsLC" # CutsLC
887# Mrk 421
888source=1
889# nightly
890bin=-1
891nightmin=20120901
892nightmax=20130516
893name="Mrk421_nightly_SED-project-2013"
894get_results
895
896
897
898# LCs for XMM proposal
899table="AnalysisResultsRunCutsLC" # CutsLC
900# Mrk 421
901source=1
902# nightly
903bin=-1
904nightmin=20111115
905nightmax=20201231
906name="Mrk421_nightly_XMM-proposal-2019"
907get_results
908# Mrk 501
909source=2
910name="Mrk501_nightly_XMM-proposal-2019"
911get_results
912# 1959
913source=7
914name="1959_nightly_XMM-proposal-2019"
915get_results
916
917
918
919# LCs for 421 campaign with Astrosat Jan 2019
920table="AnalysisResultsRunCutsLC" # CutsLC
921# Mrk 421
922source=1
923# nightly
924bin=-1
925nightmin=20190109
926nightmax=20190113
927name="Mrk421_nightly_Astrosat-Jan-2019"
928get_results
929# 20min
930bin=20
931name="Mrk421_20min_Astrosat-Jan-2019"
932get_results
933# 30min
934bin=30
935name="Mrk421_30min_Astrosat-Jan-2019"
936get_results
937# 40min
938bin=40
939name="Mrk421_40min_Astrosat-Jan-2019"
940get_results
941# 60min
942bin=60
943name="Mrk421_60min_Astrosat-Jan-2019"
944get_results
945# 80min
946bin=80
947name="Mrk421_80min_Astrosat-Jan-2019"
948get_results
949# 90min
950bin=90
951name="Mrk421_90min_Astrosat-Jan-2019"
952get_results
953
954
955
956# LCs for flaring pattern project
957table="AnalysisResultsRunCutsLC" # CutsLC
958# Mrk 421
959source=1
960# nightly
961bin=-1
962nightmin=20111115
963nightmax=20201231
964name="Mrk421_nightly_Flaring-pattern-project"
965get_results
966# 2d
967bin=-2
968nightmin=20111115
969nightmax=20201231
970name="Mrk421_2day_Flaring-pattern-project"
971get_results
972
973
974
975# LCs for ToO-Trigger project
976table="AnalysisResultsRunCutsLC" # CutsLC
977# Mrk 421
978source=1
979# nightly for 2019
980bin=-1
981nightmin=20190101
982nightmax=20190630
983name="Mrk421_nightly_20190101-20190630_ToO-project-2019"
984get_results
985# 20 min around flare
986bin=20
987nightmin=20190609
988nightmax=20190612
989name="Mrk421_20min_20190609-20190612_ToO-project-2019"
990get_results
991
992exit
993
994table="AnalysisResultsRunLP" # QLA
995# Mrk 421
996source=1
997# nightly for 2019
998bin=-1
999nightmin=20190101
1000nightmax=20190630
1001name="QLA_Mrk421_nightly_20190101-20190630_ToO-project-2019"
1002get_results
1003# 20 min around flare
1004bin=20
1005nightmin=20190609
1006nightmax=20190612
1007name="QLA_Mrk421_20min_20190609-20190612_ToO-project-2019"
1008get_results
1009
1010
1011table="AnalysisResultsRunISDC" # ISDC
1012# Mrk 421
1013source=1
1014# nightly for 2019
1015bin=-1
1016nightmin=20190101
1017nightmax=20190630
1018name="ISDC_Mrk421_nightly_20190101-20190630_ToO-project-2019"
1019get_results
1020# 20 min around flare
1021bin=20
1022nightmin=20190609
1023nightmax=20190612
1024name="ISDC_Mrk421_20min_20190609-20190612_ToO-project-2019"
1025get_results
1026
1027
1028exit
1029
1030# LC for ICRC
1031table="AnalysisResultsRunCutsLC" # CutsLC
1032bin=-1
1033# Mrk 421
1034source=1
1035name="Mrk421_all_nightly"
1036get_results
1037# Mrk 501
1038source=2
1039name="Mrk501_all_nightly"
1040get_results
1041# 1959
1042source=7
1043name="1959_all_nightly"
1044get_results
1045
1046# 2344
1047source=3
1048name="2344_all_nightly"
1049get_results
1050
1051# Crab
1052source=5
1053name="Crab_all_nightly"
1054get_results
1055
1056
1057exit
1058
1059# Mrk 501
1060source=2
1061zdmax=90
1062thmax=1500
1063# new analysis
1064table="AnalysisResultsRunCutsLC" # CutsLC
1065nightmin=20140520
1066nightmax=20140930
1067name="Mrk501_nightly_newAnalysis_forHESS"
1068bin=-1
1069get_results
1070name="Mrk501_7d_newAnalysis_forHESS"
1071bin=-7
1072get_results
1073nightmin=20140623
1074nightmax=20140623
1075name="Mrk501_5min_FlareNight_newAnalysis_forHESS"
1076bin=5
1077get_results
1078nightmin=20140622
1079nightmax=20140624
1080name="Mrk501_5min_Flare_newAnalysis_forHESS"
1081bin=5
1082get_results
1083
1084exit
1085
1086# LC for INTEGRAL Proposal
1087table="AnalysisResultsRunCutsLC" # CutsLC
1088bin=-1
1089# Mrk 421
1090source=1
1091name="Mrk421_all_nightly"
1092get_results
1093# Mrk 501
1094source=2
1095name="Mrk501_all_nightly"
1096get_results
1097# 1959
1098source=7
1099name="1959_all_nightly"
1100get_results
1101# for other INTEGRAL proposal
1102# Mrk 421
1103bin=0
1104source=1
1105name="Mrk421_all_period"
1106get_results
1107
1108exit
1109
1110
1111# Crab
1112source=5
1113nightmin=20121214
1114nightmax=20180418
1115table="AnalysisResultsRunCutsLC" # CutsLC
1116bin=-1
1117zdmax=30
1118thmax=330
1119name="testCrabnightlycheck"
1120get_results
1121
1122exit
1123
1124# Crab
1125source=5
1126nightmin=20121214
1127nightmax=20180418
1128table="AnalysisResultsRunCutsLC" # CutsLC
1129bin=20
1130name="testCrab20min"
1131get_results
1132
1133exit
1134
1135# Crab
1136source=5
1137nightmin=20121214
1138nightmax=20180418
1139table="AnalysisResultsRunCutsLC" # CutsLC
1140bin=-1
1141name="testCrabnightly"
1142get_results
1143
1144exit
1145
1146# Crab
1147source=5
1148#nightmin=20121214
1149#nightmax=20180418
1150table="AnalysisResultsRunCutsLC" # CutsLC
1151bin=-1
1152name="testCraball"
1153get_results
1154
1155exit
1156
1157
1158# Crab
1159source=5
1160nightmin=20121214
1161nightmax=20180418
1162table="AnalysisResultsRunCutsLC" # CutsLC
1163bin=60
1164name="testCrab"
1165get_results
1166
1167exit
1168
1169
1170# for 2344 paper with MAGIC
1171
1172source=3
1173zdmax=90
1174thmax=1500
1175
1176# new analysis
1177table="AnalysisResultsRunCutsLC" # CutsLC
1178nightmin=20160618
1179nightmax=20160815
1180name="2344_2016flare_newAnalysis"
1181bin=-7
1182get_results
1183overwrite="no"
1184bin=-28
1185nightmin=20160816
1186nightmax=20161031
1187get_results
1188overwrite="yes"
1189
1190# ISDC analysis
1191table="AnalysisResultsRunISDC"
1192nightmin=20160618
1193nightmax=20160815
1194name="2344_2016flare_stdAnalysis"
1195bin=-7
1196get_results
1197overwrite="no"
1198bin=-28
1199nightmin=20160816
1200nightmax=20161031
1201get_results
1202overwrite="yes"
1203
1204
1205usedch="no"
1206# new analysis
1207table="AnalysisResultsRunCutsLC" # CutsLC
1208nightmin=20160618
1209nightmax=20160815
1210name="2344_2016flare_newAnalysis_noDCh"
1211bin=-7
1212get_results
1213overwrite="no"
1214bin=-28
1215nightmin=20160816
1216nightmax=20161031
1217get_results
1218overwrite="yes"
1219
1220# ISDC analysis
1221table="AnalysisResultsRunISDC"
1222nightmin=20160618
1223nightmax=20160815
1224name="2344_2016flare_stdAnalysis_noDCh"
1225bin=-7
1226get_results
1227overwrite="no"
1228bin=-28
1229nightmin=20160816
1230nightmax=20161031
1231get_results
1232overwrite="yes"
1233
1234usedch="yes"
1235
1236
1237exit
1238
1239# Mrk 501
1240source=2
1241zdmax=90
1242thmax=1500
1243# new analysis
1244table="AnalysisResultsRunCutsLC" # CutsLC
1245nightmin=20140520
1246nightmax=20140930
1247name="Mrk501_nightly_newAnalysis_forHESS"
1248bin=-1
1249get_results
1250name="Mrk501_7d_newAnalysis_forHESS"
1251bin=-7
1252get_results
1253nightmin=20140623
1254nightmax=20140623
1255name="Mrk501_5min_FlareNight_newAnalysis_forHESS"
1256bin=5
1257get_results
1258# isdc analysis
1259thmax=850
1260table="AnalysisResultsRunISDC"
1261nightmin=20140520
1262nightmax=20140930
1263name="Mrk501_nightly_stdAnalysis_forHESS"
1264bin=-1
1265get_results
1266name="Mrk501_7d_stdAnalysis_forHESS"
1267bin=-7
1268get_results
1269nightmin=20140623
1270nightmax=20140623
1271name="Mrk501_5min_FlareNight_stdAnalysis_forHESS"
1272bin=5
1273get_results
1274# qla
1275thmax=500
1276table="AnalysisResultsRunLP"
1277nightmin=20140520
1278nightmax=20140930
1279name="Mrk501_nightly_QLA_forHESS"
1280bin=-1
1281get_results
1282
1283exit
1284
1285# 501 MAGIC
1286source=2
1287name="Mrk501_2014_forMAGIC"
1288bin=-1
1289crabfluxconv="2.87" # using threshold of 830GeV
1290crabfluxconv="3.01" # using threshold of 830GeV and MAGIC Crab spectrum
1291nightmin=20140714
1292nightmax=20140805
1293get_results
1294
1295name="Mrk501_2014_forMAGIC_20min"
1296bin=20
1297get_results
1298
1299
1300exit
1301
1302bin=30
1303name="Mrk501_2014_forMAGIC30"
1304get_results
1305
1306bin=0
1307name="P"
1308nightmin=20140501
1309nightmax=20140930
1310get_results
1311
1312bin=20
1313nightmin=20140623
1314nightmax=20140623
1315name="Mrk501_test"
1316get_results
1317
1318
1319# end script here
1320exit
1321
1322
1323
1324#
1325# more examples
1326#
1327
1328# Mrk 421
1329source=1
1330name="Mrk421_nightly"
1331bin=-1
1332get_results
1333name="Mrk421_20min"
1334bin=20
1335get_results
1336name="Mrk421_3d"
1337bin=-3
1338get_results
1339name="Mrk421_10d"
1340bin=-10
1341get_results
1342name="Mrk421_period"
1343bin=0
1344get_results
1345
1346
1347
1348# Mrk 501
1349source=2
1350name="Mrk501_nightly"
1351bin=-1
1352get_results
1353name="Mrk501_20min"
1354bin=20
1355get_results
1356name="Mrk501_3d"
1357bin=-3
1358get_results
1359name="Mrk501_10d"
1360bin=-10
1361get_results
1362name="Mrk501_period"
1363bin=0
1364get_results
1365
1366
1367
1368# 2344
1369source=3
1370name="2344_nightly"
1371bin=-1
1372get_results
1373name="2344_20min"
1374bin=20
1375get_results
1376name="2344_period"
1377bin=0
1378get_results
1379
1380
1381
1382# 1959
1383source=7
1384name="1959_nightly"
1385bin=-1
1386get_results
1387name="1959_20min"
1388bin=20
1389get_results
1390name="1959_period"
1391bin=0
1392get_results
1393
1394
1395
1396# 0323
1397source=12
1398name="0323_nightly"
1399bin=-1
1400get_results
1401name="0323_20min"
1402bin=20
1403get_results
1404name="0323_period"
1405bin=0
1406get_results
1407
1408
1409
1410# crab
1411source=5
1412name="Crab_nightly"
1413bin=-1
1414get_results
1415name="Crab_20min"
1416bin=20
1417get_results
1418name="Crab_period"
1419bin=0
1420get_results
1421name="Crab_season"
1422bin=-365
1423nightmin=20110716
1424nightmax=20180716
1425get_results
1426
1427
1428
1429name="1959_2016"
1430source=7
1431bin=-1
1432nightmin=20160201
1433nightmax=20161105
1434get_results
1435
1436name="1959_all_variable"
1437overwrite="no"
1438source=7
1439bin=-365
1440nightmin=20120201
1441nightmax=20130131
1442get_results
1443nightmin=20130201
1444nightmax=20140131
1445get_results
1446nightmin=20140201
1447nightmax=20150131
1448get_results
1449bin=0
1450nightmin=20150201
1451nightmax=20160131
1452get_results
1453bin=-1
1454nightmin=20160201
1455nightmax=20170131
1456get_results
1457bin=0
1458nightmin=20170201
1459nightmax=20180131
1460get_results
1461
1462
1463
1464overwrite="yes"
1465name="1959_all_variable2"
1466overwrite="no"
1467source=7
1468bin=-365
1469nightmin=20120201
1470nightmax=20130131
1471get_results
1472nightmin=20130201
1473nightmax=20140131
1474get_results
1475nightmin=20140201
1476nightmax=20150131
1477get_results
1478bin=0
1479nightmin=20150201
1480nightmax=20160131
1481get_results
1482bin=-1
1483nightmin=20160201
1484nightmax=20160817
1485get_results
1486bin=0
1487nightmin=20160818
1488nightmax=20180131
1489get_results
1490
1491
1492
1493overwrite="yes"
1494bin=0
1495source=3
1496name="2344period"
1497get_results
1498
1499
1500
1501# flare night (HESS)
1502name="Mrk501_10min_flarenight"
1503source=2
1504bin=10
1505nightmin=20140623
1506nightmax=20140623
1507get_results
1508
1509
1510
1511# flare night (HESS)
1512name="Mrk501_5min_flarenight"
1513source=2
1514bin=5
1515nightmin=20140623
1516nightmax=20140623
1517get_results
1518
1519
1520
1521
1522# full sample
1523name="Mrk421_all_nightly"
1524source=1
1525get_results
1526
1527name="Mrk501_all_nightly"
1528source=2
1529get_results
1530
1531name="1959_all_nightly"
1532source=7
1533get_results
1534
1535name="2344_all_nightly"
1536source=3
1537get_results
1538
1539
1540
1541name="HESE20160427"
1542source=19
1543nightmin=20160425
1544bin=-10
1545get_results
1546
1547name="AMON20160731"
1548source=21
1549nightmin=20160730
1550bin=-10
1551get_results
1552
1553
1554
Note: See TracBrowser for help on using the repository browser.