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

Last change on this file since 20115 was 19961, checked in by Daniela Dorner, 4 years ago
added datacheck and factorcut for binnings smaller than 1 night
  • Property svn:executable set to *
File size: 48.1 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 "AnalysisResultsRunLP")
171 zdfactor="(pow(cos(fZenithDistanceMean*PI()/180),3)+14.8/21.9*pow(sin(2*fZenithDistanceMean*PI()/180),5))"
172 #zdfactor="(1/(pow(cos(fZenithDistanceMean*PI()/180),3)+14.8/21.9*pow(sin(2*fZenithDistanceMean*PI()/180),5)))"
173 thfactor="(1-0.00124/1.21*(IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)-500)*(IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)>=500))"
174 # ETh: 1100 GeV
175 crabflux="1.81"
176 ;;
177 "AnalysisResultsRunISDC")
178 zdfactor="pow(cos(fZenithDistanceMean*PI()/180)*exp(1-cos(fZenithDistanceMean*PI()/180)),4.2)"
179 thfactor="(1.18-IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)*0.00062)"
180 # ETh: 1070 GeV
181 crabflux="1.89"
182 ;;
183 "AnalysisResultsRunCutsLC")
184 zdfactor="pow(cos(fZenithDistanceMean*PI()/180)*exp(1-cos(fZenithDistanceMean*PI()/180)),4.5)"
185 thfactor="(1.37-IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)*0.00118)"
186 # ETh: 785 GeV
187 crabflux="3.14"
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
469 queryend=" ORDER BY fRunStart) o GROUP BY block HAVING ontime>0.75*"$bin" ORDER BY 'time'"
470
471 # internal
472 queryint=$querystart
473 queryint=$queryint" "$excrate2", "$cu2", "$flux2", "$correxcrate2", "$cucor2", "$fluxcor2", "
474 queryint=$queryint" "$deltat2", "$ontime2", "
475 queryint=$queryint" "$excrateerr2", "$cuerr2", "$fluxerr2", "$correxcrateerr2", "$cucorerr2", "$fluxcorerr2", "
476 queryint=$queryint" "$significance2", "
477 #queryint=$queryint" avg(o.night) AS night, "
478 queryint=$queryint" min(o.night) AS nightmin, max(o.night) AS nightmax, "
479 queryint=$queryint" "$numexc2", "$numsig2", "$numbg2", "
480 queryint=$queryint" MIN(o.zdmin) AS zdmin, MAX(o.zdmax) AS zdmax, MIN(o.th) AS thmin, MAX(o.th) AS thmax, "
481 queryint=$queryint" ROUND(AVG(o.cufactor), 1) AS cufactor, ROUND(AVG(o.R750cor), 2) AS R750cor, ROUND(AVG(o.R750ref), 2) AS R750ref "
482 if [ "$factorcut" == "" ]
483 then
484 queryint=$queryint" "$querybase" "$querydch" "$queryend
485 else
486 queryint=$queryint" "$querybase" "$querydch" AND ("$zdfactor" * "$thfactor") > "$factorcut" "$queryend
487 fi
488 # for collaborators
489 querycol=$querystart
490 querycol=$querycol" "$excrate2", "$correxcrate2", "$cu2", "$fluxcor2", "
491 querycol=$querycol" "$deltat2", "$ontime2", "
492 querycol=$querycol" "$excrateerr2", "$correxcrateerr2", "$cuerr2", "$fluxcorerr2", "
493 querycol=$querycol" "$significance2
494 if [ "$factorcut" == "" ]
495 then
496 querycol=$querycol" "$querybase" "$querydch" "$queryend
497 else
498 querycol=$querycol" "$querybase" "$querydch" AND ("$zdfactor" * "$thfactor") > "$factorcut" "$queryend
499 fi
500
501 # external
502 # no datacheck applied for external files
503 queryext=$querystart" "$excrate2", "$deltat2", "$ontime2", "$excrateerr2" "$querybase" "$queryend
504
505 fi
506
507 # write file for externals only for allowed binnings
508 if [ $bin -eq 20 ] || [ $bin -eq -1 ]
509 then
510 fileext=$datapath"/FACT_preliminary_"$name"_external.dat"
511 if [ "$overwrite" = "yes" ]
512 then
513 if [ "$mode" != "auto" ]
514 then
515 echo "creating "$fileext" ..."
516 fi
517 echo "# This file was created at "`date` > $fileext
518 print_policy >> $fileext
519 fi
520 print_selection >> $fileext
521 headerext="# time["$timeunit"] start["$timeunit"] stop["$timeunit"] excess-rate[evts/h] (stop-start)/2["$timeunit"] excess-rate_error[evts/h] "
522 echo $headerext >> $fileext
523 #echo "$queryext"
524 mysql --defaults-file=$sqlpw -s -e "$queryext" >> $fileext
525 #mysql --defaults-file=$sqlpw -e "$queryext"
526 fi
527 if [ "$mode" == "auto" ] && [ "$expert" == "no" ]
528 then
529 return
530 fi
531
532 fileint=$datapath"/FACT_preliminary_"$name"_internal.dat"
533 if [ "$overwrite" = "yes" ]
534 then
535 if [ "$mode" != "auto" ]
536 then
537 echo "creating "$fileint" ..."
538 fi
539 echo "# This file was created at "`date` > $fileint
540 print_policy >> $fileint
541 fi
542 print_selection >> $fileint
543 echo "# The following query was used: " >> $fileint
544 echo "# $queryint" >> $fileint
545 echo "#" >> $fileint
546 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]"
547 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 "
548 headerint=$headerint" zdmin zdmax thmin thmax avg(cufactor) avg(zdfactor) avg(thfactor) avg(R750cor) avg(R750ref) "
549 echo $headerint >> $fileint
550 #echo "$queryint"
551 mysql --defaults-file=$sqlpw -s -e "$queryint" >> $fileint
552 #mysql --defaults-file=$sqlpw -e "$queryint"
553 if [ "$mode" == "auto" ]
554 then
555 return
556 fi
557
558 filecol=$datapath"/FACT_preliminary_"$name"_collaborators.dat"
559 if [ "$overwrite" = "yes" ]
560 then
561 echo "creating "$filecol" ..."
562 echo "# This file was created at "`date` > $filecol
563 print_policy >> $filecol
564 fi
565 print_selection >> $filecol
566 #echo "# The following query was used: " >> $filecol
567 #echo "# $querycol" >> $filecol
568 #echo "#" >> $filecol
569 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]"
570 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 "
571 echo $headercol >> $filecol
572 #echo "$querycol"
573 mysql --defaults-file=$sqlpw -s -e "$querycol" >> $filecol
574 #mysql --defaults-file=$sqlpw -e "$querycol
575}
576
577# evaluation of command line options (for usage with download.php)
578
579if [ ${#@} -eq 16 ]
580then
581 #get_data.sh $start $stop $source $timebin $email $table $time $expert $dch $zd $th $light $dust $rmemptyrows $factorcut
582 mode="auto"
583 overwrite="yes"
584 # setup for usage with download.php
585 datapath="/home/factwww/dch/data"
586 #datapath="./data"
587 sqlpw=/home/fact/.mysql.pw
588 #sqlpw=/home/fact/.mysql.pw2
589 #host=10.0.100.21
590 #dbname=factdata
591 nightmin=$1
592 nightmax=$2
593 source=$3
594 bin=$4
595 if [ "$bin" == "00" ]
596 then
597 bin=0
598 fi
599 email=$5
600 table=$6
601 timeunit=$7
602 expert=$8
603 usedch=$9 # novalue gives same result as no
604 if [ "${10}" != "novalue" ] && [ "${10}" != "all" ]
605 then
606 zdmax=${10}
607 fi
608 if [ "${11}" != "novalue" ] && [ "${11}" != "all" ]
609 then
610 thmax=${11}
611 fi
612 if [ "${12}" != "novalue" ] && [ "${12}" != "all" ]
613 then
614 light=${12}
615 fi
616 if [ "${13}" != "novalue" ] && [ "${13}" != "all" ]
617 then
618 dust=${13}
619 fi
620 rmemptyrows=${14}
621 if [ "${15}" != "novalue" ] && [ "${15}" != "all" ]
622 then
623 factorcut=${15}
624 fi
625 if [ "${16}" != "-" ]
626 then
627 crabfluxconv=${16}
628 fi
629 name=`echo $email | sed -e 's/@/-at-/'`
630 get_results
631
632 # sending email
633 if [ "$expert" == "yes" ]
634 then
635 cat $fileint | mail -s 'FACT internal data download' -b qla@fact-project.org -r qla@fact-project.org $email
636 else
637 cat $fileext | mail -s 'FACT data download' -b qla@fact-project.org -r qla@fact-project.org $email
638 fi
639
640 exit
641fi
642
643
644
645# -------------------------------------------------------------------------------------- #
646# SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP SETUP #
647# -------------------------------------------------------------------------------------- #
648# #
649# The lines below define the basic setup for the database and give examples and #
650# explanations for the various options available. #
651# The request of the data itself is done with a smaller setup further down. #
652# #
653# -------------------------------------------------------------------------------------- #
654#
655# ----------
656# DB SETUP
657# ----------
658# path to file with mysql setup (user, password, host, db-name)
659sqlpw=/home/$USER/.mysql.pw.local
660sqlpw=/home/$USER/.mysql.pw.ethz.fact
661#
662# -------------
663# BASIC SETUP
664# -------------
665# output path
666path=`dirname $0`
667datapath=$path"/data"
668# create directory for data files
669if ! [ -e $datapath ]
670then
671 mkdir $datapath
672fi
673# time unit
674#timeunit=timestamp # default
675#timeunit=unix
676timeunit=mjd
677# time binning
678# positive values: minutes
679# negative values: days
680# special case 0: period
681# for season binning choose -365 and according start date
682#bin=20 # minutes
683#bin=0 # period
684bin=-1 # nightly
685#bin=-365 # yearly
686# choose analysis
687#table="AnalysisResultsAllQLA" # N/A
688#table="AnalysisResultsRunLP" # QLA
689#table="AnalysisResultsRunISDC" # ISDC
690table="AnalysisResultsRunCutsLC" # CutsLC
691# time range
692nightmin=20111115
693nightmax=20201231
694# overwrite dataset file?
695# (useful to combine different binnings in one file -> set to "no")
696overwrite="yes"
697# optional: require minimal ontime per bin (default 20 min)
698# values given in seconds
699# option only valid for binnings >= 1 day
700#ontimelimit=1800 # 30 min
701ontimelimit= # default 20 min
702# data quality selection
703# if you explicitely don't want a datacheck, you can comment the following line
704usedch="yes"
705# use your own datacheck instead
706# use a line like the following defining your own data quality selection cut
707#dch=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 "
708# apply additional predefined cuts
709# light conditions
710#light="nomoon" # only data with no moon (but twilight allowed)
711#light="dark" # only dark night data
712# TNG dust - cut away data with calima
713#dust=1
714#dust=10
715# use different conversion from CU to fluxes
716#crabfluxconv="2.5"
717# remove lines which contain NULL (e.g. zd-corrected flux when zd=NULL)
718rmemptyrows="yes"
719rmemptyrows="no"
720# remove lines with zdfactor * thfactor > value
721factorcut=0.3
722
723
724# -------------------------------------------------------------------------------------- #
725# SETUP - GET YOUR DATA HERE - SETUP - GET YOUR DATA HERE - SETUP - GET YOUR DATA HERE #
726# -------------------------------------------------------------------------------------- #
727# #
728# Adapt the lines below to your needs. #
729# Overwrite default settings above. #
730# The data-request is sent with the line 'get_results'. #
731# Minumum setup: Define source key and name for file. #
732# The list of source keys can be found at #
733# https://fact-project.org/run_db/db/printtable.php?fTable=Source&fSortBy=fSourceKEY+ #
734# More examples can be found further down. #
735# #
736# -------------------------------------------------------------------------------------- #
737
738
739
740# LC for periodicity studies
741datapath=/home/dorner/analysis.FACT/flux.states.2020
742table="AnalysisResultsRunCutsLC" # CutsLC
743# nightly
744bin=-1
745nightmin=20111115
746nightmax=20201231
747# 0323
748name="0323_nightly"
749source=12
750get_results
751
752exit
753
754
755# LC for Mrk 421 paper with MAGIC - check IDV
756# from David: MJD 57030 - 57540 (i.e. 8.1.2015 - 1.6.2016)
757datapath=/home/dorner/analysis.FACT/421.IDV
758# include lidar data
759dch=" AND fR750Cor/fR750Ref > 0.93 "
760table="AnalysisResultsRunCutsLC" # CutsLC
761# conversion factor to fluxes for CutsLC
762# using slope of -3.35 -> threshold ~685 GeV
763# details: https://www.fact-project.org/logbook/showthread.php?tid=6994&pid=28902#pid28902
764crabfluxconv="3.64"
765# Mrk 421
766source=1
767# 20 min
768bin=20
769# time range of MAGIC paper
770nightmin=20141101
771nightmax=20160630
772name="Mrk421_20141101_20160630_20min_forMAGIC_DChLim"
773get_results
774# 30 min binning
775bin=30
776name="Mrk421_20141101_20160630_30min_forMAGIC_DChLim"
777get_results
778# 40 min binning
779bin=40
780name="Mrk421_20141101_20160630_40min_forMAGIC_DChLim"
781get_results
782# 60 min binning
783bin=60
784name="Mrk421_20141101_20160630_60min_forMAGIC_DChLim"
785get_results
786# 80 min binning
787bin=80
788name="Mrk421_20141101_20160630_80min_forMAGIC_DChLim"
789get_results
790# 90 min binning
791bin=90
792name="Mrk421_20141101_20160630_90min_forMAGIC_DChLim"
793get_results
794# 100 min binning
795bin=100
796name="Mrk421_20141101_20160630_100min_forMAGIC_DChLim"
797get_results
798# 120 min binning
799bin=120
800name="Mrk421_20141101_20160630_120min_forMAGIC_DChLim"
801get_results
802# all data
803nightmin=20111115
804nightmax=20201231
805bin=20
806name="Mrk421_all_20min_DChLim"
807get_results
808bin=30
809name="Mrk421_all_30min_DChLim"
810get_results
811bin=40
812name="Mrk421_all_40min_DChLim"
813get_results
814bin=60
815name="Mrk421_all_60min_DChLim"
816get_results
817bin=80
818name="Mrk421_all_80min_DChLim"
819get_results
820bin=90
821name="Mrk421_all_90min_DChLim"
822get_results
823bin=100
824name="Mrk421_all_100min_DChLim"
825get_results
826bin=120
827name="Mrk421_all_120min_DChLim"
828get_results
829
830
831
832exit
833
834
835# IDV LCs for Mrk 421 with MAGIC
836# Biswajit: MJD 56970-57560
837# = 2014-11-09 - 2016-06-21
838# is covered in check (below)
839# IDV in MAGIC: 2015-01-26
840# IDV in FACT: 2015-03-11
841# details: https://www.fact-project.org/logbook/showthread.php?tid=7297
842datapath=/home/dorner/analysis.FACT/corrected.lcs.for.collaborators/lcs
843table="AnalysisResultsRunCutsLC" # CutsLC
844# Mrk 421
845source=1
846# conversion factor to fluxes for CutsLC
847# using slope of -3.35 -> threshold ~685 GeV
848# details: https://www.fact-project.org/logbook/showthread.php?tid=6994&pid=28902#pid28902
849crabfluxconv="3.64"
850# 20 min
851bin=20
852nightmin=20150126
853nightmax=20150126
854name="Mrk421_20150126_20min_forMAGIC"
855get_results
856nightmin=20150311
857nightmax=20150311
858name="Mrk421_20150311_20min_forMAGIC"
859get_results
860
861
862
863
864# LC for Mrk 421 paper with MAGIC - check IDV
865# from David: MJD 57030 - 57540 (i.e. 8.1.2015 - 1.6.2016)
866datapath=/home/dorner/analysis.FACT/421.IDV
867table="AnalysisResultsRunCutsLC" # CutsLC
868# conversion factor to fluxes for CutsLC
869# using slope of -3.35 -> threshold ~685 GeV
870# details: https://www.fact-project.org/logbook/showthread.php?tid=6994&pid=28902#pid28902
871crabfluxconv="3.64"
872# Mrk 421
873source=1
874# 20 min
875bin=20
876# time range of MAGIC paper
877nightmin=20141101
878nightmax=20160630
879name="Mrk421_20141101_20160630_20min_forMAGIC"
880get_results
881# 30 min binning
882bin=30
883name="Mrk421_20141101_20160630_30min_forMAGIC"
884get_results
885# 40 min binning
886bin=40
887name="Mrk421_20141101_20160630_40min_forMAGIC"
888get_results
889# 60 min binning
890bin=60
891name="Mrk421_20141101_20160630_60min_forMAGIC"
892get_results
893# 80 min binning
894bin=80
895name="Mrk421_20141101_20160630_80min_forMAGIC"
896get_results
897# 90 min binning
898bin=90
899name="Mrk421_20141101_20160630_90min_forMAGIC"
900get_results
901# 100 min binning
902bin=100
903name="Mrk421_20141101_20160630_100min_forMAGIC"
904get_results
905# 120 min binning
906bin=120
907name="Mrk421_20141101_20160630_120min_forMAGIC"
908get_results
909# all data
910nightmin=20111115
911nightmax=20201231
912bin=20
913name="Mrk421_all_20min"
914get_results
915bin=30
916name="Mrk421_all_30min"
917get_results
918bin=40
919name="Mrk421_all_40min"
920get_results
921bin=60
922name="Mrk421_all_60min"
923get_results
924bin=80
925name="Mrk421_all_80min"
926get_results
927bin=90
928name="Mrk421_all_90min"
929get_results
930bin=100
931name="Mrk421_all_100min"
932get_results
933bin=120
934name="Mrk421_all_120min"
935get_results
936
937
938
939exit
940
941# LC for periodicity studies
942datapath=/home/dorner/analysis.FACT/corrected.lcs.for.collaborators/lcs/
943table="AnalysisResultsRunCutsLC" # CutsLC
944# nightly
945bin=-1
946nightmin=20111115
947nightmax=20201231
948# Mrk 421
949name="Mrk421_nightly_forPeriodicity"
950source=1
951get_results
952# 1959
953name="1ES1959_nightly_forPeriodicity"
954source=7
955get_results
956# Crab
957name="Crab_nightly_forPeriodicity"
958source=5
959get_results
960
961exit
962
963
964# check of Vitalii's BB
965datapath=/home/dorner/SW/bb/
966table="AnalysisResultsRunCutsLC" # CutsLC
967# nightly
968bin=-1
969nightmin=20111115
970nightmax=20201231
971# Mrk 421
972source=1
973name="Mrk421_nightly_forBB"
974get_results
975
976exit
977
978
979# LC for Fermi collaboration meeting
980datapath=/home/dorner/analysis.FACT/LC.incl.alerts
981table="AnalysisResultsRunCutsLC" # CutsLC
982# nightly
983bin=-1
984nightmin=20111115
985nightmax=20201231
986# Mrk 421
987source=1
988name="Mrk421_nightly_forFermiCM"
989get_results
990# Mrk 501
991name="Mrk501_nightly_forFermiCM"
992source=2
993get_results
994# 1959
995name="1959_nightly_forFermiCM"
996source=7
997get_results
998
999
1000exit
1001
1002# LC for Mrk 421 paper with MAGIC
1003# from David: MJD 57030 - 57540 (i.e. 8.1.2015 - 1.6.2016)
1004datapath=/home/dorner/FACT.analysis/corrected.lcs.for.collaborators/lcs/
1005table="AnalysisResultsRunCutsLC" # CutsLC
1006# nightly
1007bin=-1
1008nightmin=20141101
1009nightmax=20160630
1010# conversion factor to fluxes for CutsLC
1011# using slope of -3.35 -> threshold ~685 GeV
1012# details: https://www.fact-project.org/logbook/showthread.php?tid=6994&pid=28902#pid28902
1013crabfluxconv="3.64"
1014# Mrk 421
1015source=1
1016name="Mrk421_nightly_20141101_20160630_forMAGIC"
1017get_results
1018
1019
1020
1021exit
1022# LC for Gopal for periodicity study
1023datapath=/home/dorner/FACT.analysis/corrected.lcs.for.collaborators/lcs/
1024table="AnalysisResultsRunCutsLC" # CutsLC
1025# nightly
1026bin=-1
1027nightmin=20111115
1028nightmax=20201231
1029# Mrk 501
1030name="Mrk501_nightly"
1031source=2
1032get_results
1033
1034exit
1035
1036
1037# LC for Mrk 421 for crosscheck of BB
1038datapath=/home/dorner/SW/bb/
1039table="AnalysisResultsRunLP"
1040# nightly
1041bin=-1
1042nightmin=20130111
1043nightmax=20180515
1044thmax=560
1045zdmax=60
1046ontimelimit=1800
1047factorcut=
1048rmemptyrows="yes"
1049dch=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.2 AND fHumidityMean<80 "
1050# Mrk 421
1051source=1
1052name="Mrk421_nightly_BBXcheck"
1053get_results
1054
1055
1056
1057exit
1058
1059# LC for Mrk 421 paper with MAGIC
1060# from David: MJD 57030 - 57540 (i.e. 8.1.2015 - 1.6.2016)
1061datapath=/home/dorner/FACT.analysis/corrected.lcs.for.collaborators/lcs/
1062table="AnalysisResultsRunCutsLC" # CutsLC
1063# nightly
1064bin=-1
1065nightmin=20141101
1066nightmax=20160630
1067# conversion factor to fluxes for CutsLC
1068# using slope of -3.35 -> threshold 690 GeV
1069# details: https://www.fact-project.org/logbook/showthread.php?tid=6994&pid=28875#pid28875
1070crabfluxconv="0.57"
1071# Mrk 421
1072source=1
1073name="Mrk421_nightly_20141101_20160630_forMAGIC"
1074get_results
1075
1076
1077
1078exit
1079
1080# LCs for TeVPA poster
1081datapath=/home/dorner/FACT.analysis/tevpa2019
1082table="AnalysisResultsRunCutsLC" # CutsLC
1083# nightly
1084bin=-1
1085nightmin=20111115
1086nightmax=20201231
1087# Mrk 421
1088source=1
1089name="Mrk421_nightly"
1090get_results
1091# Mrk 501
1092name="Mrk501_nightly"
1093source=2
1094get_results
1095# 1959
1096name="1959_nightly"
1097source=7
1098get_results
1099# 2344
1100name="2344_nightly"
1101source=3
1102get_results
1103name="2344_monthly"
1104bin=0
1105get_results
1106name="2344_7d"
1107bin=7
1108get_results
1109usedch="no"
1110name="2344_nightly_nodch"
1111source=3
1112get_results
1113name="2344_monthly_nodch"
1114bin=0
1115get_results
1116name="2344_7d_nodch"
1117bin=7
1118get_results
1119usedch="yes"
1120# 1959
1121name="1959_mixed"
1122source=7
1123bin=0
1124nightmin=20111115
1125nightmax=20160331
1126get_results
1127overwrite="no"
1128nightmin=20160401
1129nightmax=20160815
1130bin=-1
1131get_results
1132bin=0
1133nightmin=20160816
1134nightmax=20201231
1135get_results
1136overwrite="yes"
1137
1138exit
1139
1140
1141datapath=/home/dorner/FACT.analysis/corrected.lcs.for.collaborators/lcs
1142
1143# put your data request here, examples below
1144
1145# LCs for 2344 XMM proposal
1146table="AnalysisResultsRunCutsLC"
1147# 2344
1148source=3
1149# monthly
1150bin=0
1151nightmin=20111115
1152nightmax=20191231
1153name="2344_period_XMM-proposal-2019"
1154get_results
1155
1156exit
1157
1158# LCs for 421 campaign with Astrosat Jan 2019 - crosscheck
1159table="AnalysisResultsRunLP"
1160# Mrk 421
1161source=1
1162# nightly
1163bin=-1
1164nightmin=20190109
1165nightmax=20190113
1166name="QLA_Mrk421_nightly_Astrosat-Jan-2019"
1167get_results
1168# 20min
1169bin=20
1170name="QLA_Mrk421_20min_Astrosat-Jan-2019"
1171get_results
1172# 30min
1173bin=30
1174name="QLA_Mrk421_30min_Astrosat-Jan-2019"
1175get_results
1176# 40min
1177bin=40
1178name="QLA_Mrk421_40min_Astrosat-Jan-2019"
1179get_results
1180# 60min
1181bin=60
1182name="QLA_Mrk421_60min_Astrosat-Jan-2019"
1183get_results
1184# 80min
1185bin=80
1186name="QLA_Mrk421_80min_Astrosat-Jan-2019"
1187get_results
1188# 90min
1189bin=90
1190name="QLA_Mrk421_90min_Astrosat-Jan-2019"
1191get_results
1192
1193
1194
1195
1196# LCs for SED project 2013
1197table="AnalysisResultsRunCutsLC" # CutsLC
1198# Mrk 421
1199source=1
1200# nightly
1201bin=-1
1202nightmin=20120901
1203nightmax=20130516
1204name="Mrk421_nightly_SED-project-2013"
1205get_results
1206
1207
1208
1209# LCs for XMM proposal
1210table="AnalysisResultsRunCutsLC" # CutsLC
1211# Mrk 421
1212source=1
1213# nightly
1214bin=-1
1215nightmin=20111115
1216nightmax=20201231
1217name="Mrk421_nightly_XMM-proposal-2019"
1218get_results
1219# Mrk 501
1220source=2
1221name="Mrk501_nightly_XMM-proposal-2019"
1222get_results
1223# 1959
1224source=7
1225name="1959_nightly_XMM-proposal-2019"
1226get_results
1227
1228
1229
1230# LCs for 421 campaign with Astrosat Jan 2019
1231table="AnalysisResultsRunCutsLC" # CutsLC
1232# Mrk 421
1233source=1
1234# nightly
1235bin=-1
1236nightmin=20190109
1237nightmax=20190113
1238name="Mrk421_nightly_Astrosat-Jan-2019"
1239get_results
1240# 20min
1241bin=20
1242name="Mrk421_20min_Astrosat-Jan-2019"
1243get_results
1244# 30min
1245bin=30
1246name="Mrk421_30min_Astrosat-Jan-2019"
1247get_results
1248# 40min
1249bin=40
1250name="Mrk421_40min_Astrosat-Jan-2019"
1251get_results
1252# 60min
1253bin=60
1254name="Mrk421_60min_Astrosat-Jan-2019"
1255get_results
1256# 80min
1257bin=80
1258name="Mrk421_80min_Astrosat-Jan-2019"
1259get_results
1260# 90min
1261bin=90
1262name="Mrk421_90min_Astrosat-Jan-2019"
1263get_results
1264
1265
1266
1267# LCs for flaring pattern project
1268table="AnalysisResultsRunCutsLC" # CutsLC
1269# Mrk 421
1270source=1
1271# nightly
1272bin=-1
1273nightmin=20111115
1274nightmax=20201231
1275name="Mrk421_nightly_Flaring-pattern-project"
1276get_results
1277# 2d
1278bin=-2
1279nightmin=20111115
1280nightmax=20201231
1281name="Mrk421_2day_Flaring-pattern-project"
1282get_results
1283
1284
1285
1286# LCs for ToO-Trigger project
1287table="AnalysisResultsRunCutsLC" # CutsLC
1288# Mrk 421
1289source=1
1290# nightly for 2019
1291bin=-1
1292nightmin=20190101
1293nightmax=20190630
1294name="Mrk421_nightly_20190101-20190630_ToO-project-2019"
1295get_results
1296# 20 min around flare
1297bin=20
1298nightmin=20190609
1299nightmax=20190612
1300name="Mrk421_20min_20190609-20190612_ToO-project-2019"
1301get_results
1302
1303exit
1304
1305table="AnalysisResultsRunLP" # QLA
1306# Mrk 421
1307source=1
1308# nightly for 2019
1309bin=-1
1310nightmin=20190101
1311nightmax=20190630
1312name="QLA_Mrk421_nightly_20190101-20190630_ToO-project-2019"
1313get_results
1314# 20 min around flare
1315bin=20
1316nightmin=20190609
1317nightmax=20190612
1318name="QLA_Mrk421_20min_20190609-20190612_ToO-project-2019"
1319get_results
1320
1321
1322table="AnalysisResultsRunISDC" # ISDC
1323# Mrk 421
1324source=1
1325# nightly for 2019
1326bin=-1
1327nightmin=20190101
1328nightmax=20190630
1329name="ISDC_Mrk421_nightly_20190101-20190630_ToO-project-2019"
1330get_results
1331# 20 min around flare
1332bin=20
1333nightmin=20190609
1334nightmax=20190612
1335name="ISDC_Mrk421_20min_20190609-20190612_ToO-project-2019"
1336get_results
1337
1338
1339exit
1340
1341# LC for ICRC
1342table="AnalysisResultsRunCutsLC" # CutsLC
1343bin=-1
1344# Mrk 421
1345source=1
1346name="Mrk421_all_nightly"
1347get_results
1348# Mrk 501
1349source=2
1350name="Mrk501_all_nightly"
1351get_results
1352# 1959
1353source=7
1354name="1959_all_nightly"
1355get_results
1356
1357# 2344
1358source=3
1359name="2344_all_nightly"
1360get_results
1361
1362# Crab
1363source=5
1364name="Crab_all_nightly"
1365get_results
1366
1367
1368exit
1369
1370# Mrk 501
1371source=2
1372zdmax=90
1373thmax=1500
1374# new analysis
1375table="AnalysisResultsRunCutsLC" # CutsLC
1376nightmin=20140520
1377nightmax=20140930
1378name="Mrk501_nightly_newAnalysis_forHESS"
1379bin=-1
1380get_results
1381name="Mrk501_7d_newAnalysis_forHESS"
1382bin=-7
1383get_results
1384nightmin=20140623
1385nightmax=20140623
1386name="Mrk501_5min_FlareNight_newAnalysis_forHESS"
1387bin=5
1388get_results
1389nightmin=20140622
1390nightmax=20140624
1391name="Mrk501_5min_Flare_newAnalysis_forHESS"
1392bin=5
1393get_results
1394
1395exit
1396
1397# LC for INTEGRAL Proposal
1398table="AnalysisResultsRunCutsLC" # CutsLC
1399bin=-1
1400# Mrk 421
1401source=1
1402name="Mrk421_all_nightly"
1403get_results
1404# Mrk 501
1405source=2
1406name="Mrk501_all_nightly"
1407get_results
1408# 1959
1409source=7
1410name="1959_all_nightly"
1411get_results
1412# for other INTEGRAL proposal
1413# Mrk 421
1414bin=0
1415source=1
1416name="Mrk421_all_period"
1417get_results
1418
1419exit
1420
1421
1422# Crab
1423source=5
1424nightmin=20121214
1425nightmax=20180418
1426table="AnalysisResultsRunCutsLC" # CutsLC
1427bin=-1
1428zdmax=30
1429thmax=330
1430name="testCrabnightlycheck"
1431get_results
1432
1433exit
1434
1435# Crab
1436source=5
1437nightmin=20121214
1438nightmax=20180418
1439table="AnalysisResultsRunCutsLC" # CutsLC
1440bin=20
1441name="testCrab20min"
1442get_results
1443
1444exit
1445
1446# Crab
1447source=5
1448nightmin=20121214
1449nightmax=20180418
1450table="AnalysisResultsRunCutsLC" # CutsLC
1451bin=-1
1452name="testCrabnightly"
1453get_results
1454
1455exit
1456
1457# Crab
1458source=5
1459#nightmin=20121214
1460#nightmax=20180418
1461table="AnalysisResultsRunCutsLC" # CutsLC
1462bin=-1
1463name="testCraball"
1464get_results
1465
1466exit
1467
1468
1469# Crab
1470source=5
1471nightmin=20121214
1472nightmax=20180418
1473table="AnalysisResultsRunCutsLC" # CutsLC
1474bin=60
1475name="testCrab"
1476get_results
1477
1478exit
1479
1480
1481# for 2344 paper with MAGIC
1482
1483source=3
1484zdmax=90
1485thmax=1500
1486
1487# new analysis
1488table="AnalysisResultsRunCutsLC" # CutsLC
1489nightmin=20160618
1490nightmax=20160815
1491name="2344_2016flare_newAnalysis"
1492bin=-7
1493get_results
1494overwrite="no"
1495bin=-28
1496nightmin=20160816
1497nightmax=20161031
1498get_results
1499overwrite="yes"
1500
1501# ISDC analysis
1502table="AnalysisResultsRunISDC"
1503nightmin=20160618
1504nightmax=20160815
1505name="2344_2016flare_stdAnalysis"
1506bin=-7
1507get_results
1508overwrite="no"
1509bin=-28
1510nightmin=20160816
1511nightmax=20161031
1512get_results
1513overwrite="yes"
1514
1515
1516usedch="no"
1517# new analysis
1518table="AnalysisResultsRunCutsLC" # CutsLC
1519nightmin=20160618
1520nightmax=20160815
1521name="2344_2016flare_newAnalysis_noDCh"
1522bin=-7
1523get_results
1524overwrite="no"
1525bin=-28
1526nightmin=20160816
1527nightmax=20161031
1528get_results
1529overwrite="yes"
1530
1531# ISDC analysis
1532table="AnalysisResultsRunISDC"
1533nightmin=20160618
1534nightmax=20160815
1535name="2344_2016flare_stdAnalysis_noDCh"
1536bin=-7
1537get_results
1538overwrite="no"
1539bin=-28
1540nightmin=20160816
1541nightmax=20161031
1542get_results
1543overwrite="yes"
1544
1545usedch="yes"
1546
1547
1548exit
1549
1550# Mrk 501
1551source=2
1552zdmax=90
1553thmax=1500
1554# new analysis
1555table="AnalysisResultsRunCutsLC" # CutsLC
1556nightmin=20140520
1557nightmax=20140930
1558name="Mrk501_nightly_newAnalysis_forHESS"
1559bin=-1
1560get_results
1561name="Mrk501_7d_newAnalysis_forHESS"
1562bin=-7
1563get_results
1564nightmin=20140623
1565nightmax=20140623
1566name="Mrk501_5min_FlareNight_newAnalysis_forHESS"
1567bin=5
1568get_results
1569# isdc analysis
1570thmax=850
1571table="AnalysisResultsRunISDC"
1572nightmin=20140520
1573nightmax=20140930
1574name="Mrk501_nightly_stdAnalysis_forHESS"
1575bin=-1
1576get_results
1577name="Mrk501_7d_stdAnalysis_forHESS"
1578bin=-7
1579get_results
1580nightmin=20140623
1581nightmax=20140623
1582name="Mrk501_5min_FlareNight_stdAnalysis_forHESS"
1583bin=5
1584get_results
1585# qla
1586thmax=500
1587table="AnalysisResultsRunLP"
1588nightmin=20140520
1589nightmax=20140930
1590name="Mrk501_nightly_QLA_forHESS"
1591bin=-1
1592get_results
1593
1594exit
1595
1596# 501 MAGIC
1597source=2
1598name="Mrk501_2014_forMAGIC"
1599bin=-1
1600crabfluxconv="2.87" # using threshold of 830GeV
1601crabfluxconv="3.01" # using threshold of 830GeV and MAGIC Crab spectrum
1602nightmin=20140714
1603nightmax=20140805
1604get_results
1605
1606name="Mrk501_2014_forMAGIC_20min"
1607bin=20
1608get_results
1609
1610
1611exit
1612
1613bin=30
1614name="Mrk501_2014_forMAGIC30"
1615get_results
1616
1617bin=0
1618name="P"
1619nightmin=20140501
1620nightmax=20140930
1621get_results
1622
1623bin=20
1624nightmin=20140623
1625nightmax=20140623
1626name="Mrk501_test"
1627get_results
1628
1629
1630# end script here
1631exit
1632
1633
1634
1635#
1636# more examples
1637#
1638
1639# Mrk 421
1640source=1
1641name="Mrk421_nightly"
1642bin=-1
1643get_results
1644name="Mrk421_20min"
1645bin=20
1646get_results
1647name="Mrk421_3d"
1648bin=-3
1649get_results
1650name="Mrk421_10d"
1651bin=-10
1652get_results
1653name="Mrk421_period"
1654bin=0
1655get_results
1656
1657
1658
1659# Mrk 501
1660source=2
1661name="Mrk501_nightly"
1662bin=-1
1663get_results
1664name="Mrk501_20min"
1665bin=20
1666get_results
1667name="Mrk501_3d"
1668bin=-3
1669get_results
1670name="Mrk501_10d"
1671bin=-10
1672get_results
1673name="Mrk501_period"
1674bin=0
1675get_results
1676
1677
1678
1679# 2344
1680source=3
1681name="2344_nightly"
1682bin=-1
1683get_results
1684name="2344_20min"
1685bin=20
1686get_results
1687name="2344_period"
1688bin=0
1689get_results
1690
1691
1692
1693# 1959
1694source=7
1695name="1959_nightly"
1696bin=-1
1697get_results
1698name="1959_20min"
1699bin=20
1700get_results
1701name="1959_period"
1702bin=0
1703get_results
1704
1705
1706
1707# 0323
1708source=12
1709name="0323_nightly"
1710bin=-1
1711get_results
1712name="0323_20min"
1713bin=20
1714get_results
1715name="0323_period"
1716bin=0
1717get_results
1718
1719
1720
1721# crab
1722source=5
1723name="Crab_nightly"
1724bin=-1
1725get_results
1726name="Crab_20min"
1727bin=20
1728get_results
1729name="Crab_period"
1730bin=0
1731get_results
1732name="Crab_season"
1733bin=-365
1734nightmin=20110716
1735nightmax=20180716
1736get_results
1737
1738
1739
1740name="1959_2016"
1741source=7
1742bin=-1
1743nightmin=20160201
1744nightmax=20161105
1745get_results
1746
1747name="1959_all_variable"
1748overwrite="no"
1749source=7
1750bin=-365
1751nightmin=20120201
1752nightmax=20130131
1753get_results
1754nightmin=20130201
1755nightmax=20140131
1756get_results
1757nightmin=20140201
1758nightmax=20150131
1759get_results
1760bin=0
1761nightmin=20150201
1762nightmax=20160131
1763get_results
1764bin=-1
1765nightmin=20160201
1766nightmax=20170131
1767get_results
1768bin=0
1769nightmin=20170201
1770nightmax=20180131
1771get_results
1772
1773
1774
1775overwrite="yes"
1776name="1959_all_variable2"
1777overwrite="no"
1778source=7
1779bin=-365
1780nightmin=20120201
1781nightmax=20130131
1782get_results
1783nightmin=20130201
1784nightmax=20140131
1785get_results
1786nightmin=20140201
1787nightmax=20150131
1788get_results
1789bin=0
1790nightmin=20150201
1791nightmax=20160131
1792get_results
1793bin=-1
1794nightmin=20160201
1795nightmax=20160817
1796get_results
1797bin=0
1798nightmin=20160818
1799nightmax=20180131
1800get_results
1801
1802
1803
1804overwrite="yes"
1805bin=0
1806source=3
1807name="2344period"
1808get_results
1809
1810
1811
1812# flare night (HESS)
1813name="Mrk501_10min_flarenight"
1814source=2
1815bin=10
1816nightmin=20140623
1817nightmax=20140623
1818get_results
1819
1820
1821
1822# flare night (HESS)
1823name="Mrk501_5min_flarenight"
1824source=2
1825bin=5
1826nightmin=20140623
1827nightmax=20140623
1828get_results
1829
1830
1831
1832
1833# full sample
1834name="Mrk421_all_nightly"
1835source=1
1836get_results
1837
1838name="Mrk501_all_nightly"
1839source=2
1840get_results
1841
1842name="1959_all_nightly"
1843source=7
1844get_results
1845
1846name="2344_all_nightly"
1847source=3
1848get_results
1849
1850
1851
1852name="HESE20160427"
1853source=19
1854nightmin=20160425
1855bin=-10
1856get_results
1857
1858name="AMON20160731"
1859source=21
1860nightmin=20160730
1861bin=-10
1862get_results
1863
1864
1865
Note: See TracBrowser for help on using the repository browser.