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

Last change on this file since 19948 was 19943, checked in by Daniela Dorner, 5 years ago
clarification in setup comments
  • Property svn:executable set to *
File size: 43.5 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" 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# values given in seconds
688# option only valid for binnings >= 1 day
689#ontimelimit=1800 # 30 min
690ontimelimit= # default 20 min
691# data quality selection
692# if you explicitely don't want a datacheck, you can comment the following line
693usedch="yes"
694# use your own datacheck instead
695# use a line like the following defining your own data quality selection cut
696#dch=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 "
697# apply additional predefined cuts
698# light conditions
699#light="nomoon" # only data with no moon (but twilight allowed)
700#light="dark" # only dark night data
701# TNG dust - cut away data with calima
702#dust=1
703#dust=10
704# use different conversion from CU to fluxes
705#crabfluxconv="2.5"
706# remove lines which contain NULL (e.g. zd-corrected flux when zd=NULL)
707rmemptyrows="yes"
708rmemptyrows="no"
709# remove lines with zdfactor * thfactor > value
710factorcut=0.3
711
712
713# -------------------------------------------------------------------------------------- #
714# SETUP - GET YOUR DATA HERE - SETUP - GET YOUR DATA HERE - SETUP - GET YOUR DATA HERE #
715# -------------------------------------------------------------------------------------- #
716# #
717# Adapt the lines below to your needs. #
718# Overwrite default settings above. #
719# The data-request is sent with the line 'get_results'. #
720# Minumum setup: Define source key and name for file. #
721# The list of source keys can be found at #
722# https://fact-project.org/run_db/db/printtable.php?fTable=Source&fSortBy=fSourceKEY+ #
723# More examples can be found further down. #
724# #
725# -------------------------------------------------------------------------------------- #
726
727
728# LC for periodicity studies
729datapath=/home/dorner/analysis.FACT/corrected.lcs.for.collaborators/lcs/
730table="AnalysisResultsRunCutsLC" # CutsLC
731# nightly
732bin=-1
733nightmin=20111115
734nightmax=20201231
735# Mrk 421
736name="Mrk421_nightly_forPeriodicity"
737source=1
738get_results
739# 1959
740name="1ES1959_nightly_forPeriodicity"
741source=7
742get_results
743# Crab
744name="Crab_nightly_forPeriodicity"
745source=5
746get_results
747
748exit
749
750
751# check of Vitalii's BB
752datapath=/home/dorner/SW/bb/
753table="AnalysisResultsRunCutsLC" # CutsLC
754# nightly
755bin=-1
756nightmin=20111115
757nightmax=20201231
758# Mrk 421
759source=1
760name="Mrk421_nightly_forBB"
761get_results
762
763exit
764
765
766# LC for Fermi collaboration meeting
767datapath=/home/dorner/analysis.FACT/LC.incl.alerts
768table="AnalysisResultsRunCutsLC" # CutsLC
769# nightly
770bin=-1
771nightmin=20111115
772nightmax=20201231
773# Mrk 421
774source=1
775name="Mrk421_nightly_forFermiCM"
776get_results
777# Mrk 501
778name="Mrk501_nightly_forFermiCM"
779source=2
780get_results
781# 1959
782name="1959_nightly_forFermiCM"
783source=7
784get_results
785
786
787exit
788
789# LC for Mrk 421 paper with MAGIC
790# from David: MJD 57030 - 57540 (i.e. 8.1.2015 - 1.6.2016)
791datapath=/home/dorner/FACT.analysis/corrected.lcs.for.collaborators/lcs/
792table="AnalysisResultsRunCutsLC" # CutsLC
793# nightly
794bin=-1
795nightmin=20141101
796nightmax=20160630
797# conversion factor to fluxes for CutsLC
798# using slope of -3.35 -> threshold ~685 GeV
799# details: https://www.fact-project.org/logbook/showthread.php?tid=6994&pid=28902#pid28902
800crabfluxconv="3.64"
801# Mrk 421
802source=1
803name="Mrk421_nightly_20141101_20160630_forMAGIC"
804get_results
805
806
807
808exit
809# LC for Gopal for periodicity study
810datapath=/home/dorner/FACT.analysis/corrected.lcs.for.collaborators/lcs/
811table="AnalysisResultsRunCutsLC" # CutsLC
812# nightly
813bin=-1
814nightmin=20111115
815nightmax=20201231
816# Mrk 501
817name="Mrk501_nightly"
818source=2
819get_results
820
821exit
822
823
824# LC for Mrk 421 for crosscheck of BB
825datapath=/home/dorner/SW/bb/
826table="AnalysisResultsRunLP"
827# nightly
828bin=-1
829nightmin=20130111
830nightmax=20180515
831thmax=560
832zdmax=60
833ontimelimit=1800
834factorcut=
835rmemptyrows="yes"
836dch=" AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.2 AND fHumidityMean<80 "
837# Mrk 421
838source=1
839name="Mrk421_nightly_BBXcheck"
840get_results
841
842
843
844exit
845
846# LC for Mrk 421 paper with MAGIC
847# from David: MJD 57030 - 57540 (i.e. 8.1.2015 - 1.6.2016)
848datapath=/home/dorner/FACT.analysis/corrected.lcs.for.collaborators/lcs/
849table="AnalysisResultsRunCutsLC" # CutsLC
850# nightly
851bin=-1
852nightmin=20141101
853nightmax=20160630
854# conversion factor to fluxes for CutsLC
855# using slope of -3.35 -> threshold 690 GeV
856# details: https://www.fact-project.org/logbook/showthread.php?tid=6994&pid=28875#pid28875
857crabfluxconv="0.57"
858# Mrk 421
859source=1
860name="Mrk421_nightly_20141101_20160630_forMAGIC"
861get_results
862
863
864
865exit
866
867# LCs for TeVPA poster
868datapath=/home/dorner/FACT.analysis/tevpa2019
869table="AnalysisResultsRunCutsLC" # CutsLC
870# nightly
871bin=-1
872nightmin=20111115
873nightmax=20201231
874# Mrk 421
875source=1
876name="Mrk421_nightly"
877get_results
878# Mrk 501
879name="Mrk501_nightly"
880source=2
881get_results
882# 1959
883name="1959_nightly"
884source=7
885get_results
886# 2344
887name="2344_nightly"
888source=3
889get_results
890name="2344_monthly"
891bin=0
892get_results
893name="2344_7d"
894bin=7
895get_results
896usedch="no"
897name="2344_nightly_nodch"
898source=3
899get_results
900name="2344_monthly_nodch"
901bin=0
902get_results
903name="2344_7d_nodch"
904bin=7
905get_results
906usedch="yes"
907# 1959
908name="1959_mixed"
909source=7
910bin=0
911nightmin=20111115
912nightmax=20160331
913get_results
914overwrite="no"
915nightmin=20160401
916nightmax=20160815
917bin=-1
918get_results
919bin=0
920nightmin=20160816
921nightmax=20201231
922get_results
923overwrite="yes"
924
925exit
926
927
928datapath=/home/dorner/FACT.analysis/corrected.lcs.for.collaborators/lcs
929
930# put your data request here, examples below
931
932# LCs for 2344 XMM proposal
933table="AnalysisResultsRunCutsLC"
934# 2344
935source=3
936# monthly
937bin=0
938nightmin=20111115
939nightmax=20191231
940name="2344_period_XMM-proposal-2019"
941get_results
942
943exit
944
945# LCs for 421 campaign with Astrosat Jan 2019 - crosscheck
946table="AnalysisResultsRunLP"
947# Mrk 421
948source=1
949# nightly
950bin=-1
951nightmin=20190109
952nightmax=20190113
953name="QLA_Mrk421_nightly_Astrosat-Jan-2019"
954get_results
955# 20min
956bin=20
957name="QLA_Mrk421_20min_Astrosat-Jan-2019"
958get_results
959# 30min
960bin=30
961name="QLA_Mrk421_30min_Astrosat-Jan-2019"
962get_results
963# 40min
964bin=40
965name="QLA_Mrk421_40min_Astrosat-Jan-2019"
966get_results
967# 60min
968bin=60
969name="QLA_Mrk421_60min_Astrosat-Jan-2019"
970get_results
971# 80min
972bin=80
973name="QLA_Mrk421_80min_Astrosat-Jan-2019"
974get_results
975# 90min
976bin=90
977name="QLA_Mrk421_90min_Astrosat-Jan-2019"
978get_results
979
980
981
982
983# LCs for SED project 2013
984table="AnalysisResultsRunCutsLC" # CutsLC
985# Mrk 421
986source=1
987# nightly
988bin=-1
989nightmin=20120901
990nightmax=20130516
991name="Mrk421_nightly_SED-project-2013"
992get_results
993
994
995
996# LCs for XMM proposal
997table="AnalysisResultsRunCutsLC" # CutsLC
998# Mrk 421
999source=1
1000# nightly
1001bin=-1
1002nightmin=20111115
1003nightmax=20201231
1004name="Mrk421_nightly_XMM-proposal-2019"
1005get_results
1006# Mrk 501
1007source=2
1008name="Mrk501_nightly_XMM-proposal-2019"
1009get_results
1010# 1959
1011source=7
1012name="1959_nightly_XMM-proposal-2019"
1013get_results
1014
1015
1016
1017# LCs for 421 campaign with Astrosat Jan 2019
1018table="AnalysisResultsRunCutsLC" # CutsLC
1019# Mrk 421
1020source=1
1021# nightly
1022bin=-1
1023nightmin=20190109
1024nightmax=20190113
1025name="Mrk421_nightly_Astrosat-Jan-2019"
1026get_results
1027# 20min
1028bin=20
1029name="Mrk421_20min_Astrosat-Jan-2019"
1030get_results
1031# 30min
1032bin=30
1033name="Mrk421_30min_Astrosat-Jan-2019"
1034get_results
1035# 40min
1036bin=40
1037name="Mrk421_40min_Astrosat-Jan-2019"
1038get_results
1039# 60min
1040bin=60
1041name="Mrk421_60min_Astrosat-Jan-2019"
1042get_results
1043# 80min
1044bin=80
1045name="Mrk421_80min_Astrosat-Jan-2019"
1046get_results
1047# 90min
1048bin=90
1049name="Mrk421_90min_Astrosat-Jan-2019"
1050get_results
1051
1052
1053
1054# LCs for flaring pattern project
1055table="AnalysisResultsRunCutsLC" # CutsLC
1056# Mrk 421
1057source=1
1058# nightly
1059bin=-1
1060nightmin=20111115
1061nightmax=20201231
1062name="Mrk421_nightly_Flaring-pattern-project"
1063get_results
1064# 2d
1065bin=-2
1066nightmin=20111115
1067nightmax=20201231
1068name="Mrk421_2day_Flaring-pattern-project"
1069get_results
1070
1071
1072
1073# LCs for ToO-Trigger project
1074table="AnalysisResultsRunCutsLC" # CutsLC
1075# Mrk 421
1076source=1
1077# nightly for 2019
1078bin=-1
1079nightmin=20190101
1080nightmax=20190630
1081name="Mrk421_nightly_20190101-20190630_ToO-project-2019"
1082get_results
1083# 20 min around flare
1084bin=20
1085nightmin=20190609
1086nightmax=20190612
1087name="Mrk421_20min_20190609-20190612_ToO-project-2019"
1088get_results
1089
1090exit
1091
1092table="AnalysisResultsRunLP" # QLA
1093# Mrk 421
1094source=1
1095# nightly for 2019
1096bin=-1
1097nightmin=20190101
1098nightmax=20190630
1099name="QLA_Mrk421_nightly_20190101-20190630_ToO-project-2019"
1100get_results
1101# 20 min around flare
1102bin=20
1103nightmin=20190609
1104nightmax=20190612
1105name="QLA_Mrk421_20min_20190609-20190612_ToO-project-2019"
1106get_results
1107
1108
1109table="AnalysisResultsRunISDC" # ISDC
1110# Mrk 421
1111source=1
1112# nightly for 2019
1113bin=-1
1114nightmin=20190101
1115nightmax=20190630
1116name="ISDC_Mrk421_nightly_20190101-20190630_ToO-project-2019"
1117get_results
1118# 20 min around flare
1119bin=20
1120nightmin=20190609
1121nightmax=20190612
1122name="ISDC_Mrk421_20min_20190609-20190612_ToO-project-2019"
1123get_results
1124
1125
1126exit
1127
1128# LC for ICRC
1129table="AnalysisResultsRunCutsLC" # CutsLC
1130bin=-1
1131# Mrk 421
1132source=1
1133name="Mrk421_all_nightly"
1134get_results
1135# Mrk 501
1136source=2
1137name="Mrk501_all_nightly"
1138get_results
1139# 1959
1140source=7
1141name="1959_all_nightly"
1142get_results
1143
1144# 2344
1145source=3
1146name="2344_all_nightly"
1147get_results
1148
1149# Crab
1150source=5
1151name="Crab_all_nightly"
1152get_results
1153
1154
1155exit
1156
1157# Mrk 501
1158source=2
1159zdmax=90
1160thmax=1500
1161# new analysis
1162table="AnalysisResultsRunCutsLC" # CutsLC
1163nightmin=20140520
1164nightmax=20140930
1165name="Mrk501_nightly_newAnalysis_forHESS"
1166bin=-1
1167get_results
1168name="Mrk501_7d_newAnalysis_forHESS"
1169bin=-7
1170get_results
1171nightmin=20140623
1172nightmax=20140623
1173name="Mrk501_5min_FlareNight_newAnalysis_forHESS"
1174bin=5
1175get_results
1176nightmin=20140622
1177nightmax=20140624
1178name="Mrk501_5min_Flare_newAnalysis_forHESS"
1179bin=5
1180get_results
1181
1182exit
1183
1184# LC for INTEGRAL Proposal
1185table="AnalysisResultsRunCutsLC" # CutsLC
1186bin=-1
1187# Mrk 421
1188source=1
1189name="Mrk421_all_nightly"
1190get_results
1191# Mrk 501
1192source=2
1193name="Mrk501_all_nightly"
1194get_results
1195# 1959
1196source=7
1197name="1959_all_nightly"
1198get_results
1199# for other INTEGRAL proposal
1200# Mrk 421
1201bin=0
1202source=1
1203name="Mrk421_all_period"
1204get_results
1205
1206exit
1207
1208
1209# Crab
1210source=5
1211nightmin=20121214
1212nightmax=20180418
1213table="AnalysisResultsRunCutsLC" # CutsLC
1214bin=-1
1215zdmax=30
1216thmax=330
1217name="testCrabnightlycheck"
1218get_results
1219
1220exit
1221
1222# Crab
1223source=5
1224nightmin=20121214
1225nightmax=20180418
1226table="AnalysisResultsRunCutsLC" # CutsLC
1227bin=20
1228name="testCrab20min"
1229get_results
1230
1231exit
1232
1233# Crab
1234source=5
1235nightmin=20121214
1236nightmax=20180418
1237table="AnalysisResultsRunCutsLC" # CutsLC
1238bin=-1
1239name="testCrabnightly"
1240get_results
1241
1242exit
1243
1244# Crab
1245source=5
1246#nightmin=20121214
1247#nightmax=20180418
1248table="AnalysisResultsRunCutsLC" # CutsLC
1249bin=-1
1250name="testCraball"
1251get_results
1252
1253exit
1254
1255
1256# Crab
1257source=5
1258nightmin=20121214
1259nightmax=20180418
1260table="AnalysisResultsRunCutsLC" # CutsLC
1261bin=60
1262name="testCrab"
1263get_results
1264
1265exit
1266
1267
1268# for 2344 paper with MAGIC
1269
1270source=3
1271zdmax=90
1272thmax=1500
1273
1274# new analysis
1275table="AnalysisResultsRunCutsLC" # CutsLC
1276nightmin=20160618
1277nightmax=20160815
1278name="2344_2016flare_newAnalysis"
1279bin=-7
1280get_results
1281overwrite="no"
1282bin=-28
1283nightmin=20160816
1284nightmax=20161031
1285get_results
1286overwrite="yes"
1287
1288# ISDC analysis
1289table="AnalysisResultsRunISDC"
1290nightmin=20160618
1291nightmax=20160815
1292name="2344_2016flare_stdAnalysis"
1293bin=-7
1294get_results
1295overwrite="no"
1296bin=-28
1297nightmin=20160816
1298nightmax=20161031
1299get_results
1300overwrite="yes"
1301
1302
1303usedch="no"
1304# new analysis
1305table="AnalysisResultsRunCutsLC" # CutsLC
1306nightmin=20160618
1307nightmax=20160815
1308name="2344_2016flare_newAnalysis_noDCh"
1309bin=-7
1310get_results
1311overwrite="no"
1312bin=-28
1313nightmin=20160816
1314nightmax=20161031
1315get_results
1316overwrite="yes"
1317
1318# ISDC analysis
1319table="AnalysisResultsRunISDC"
1320nightmin=20160618
1321nightmax=20160815
1322name="2344_2016flare_stdAnalysis_noDCh"
1323bin=-7
1324get_results
1325overwrite="no"
1326bin=-28
1327nightmin=20160816
1328nightmax=20161031
1329get_results
1330overwrite="yes"
1331
1332usedch="yes"
1333
1334
1335exit
1336
1337# Mrk 501
1338source=2
1339zdmax=90
1340thmax=1500
1341# new analysis
1342table="AnalysisResultsRunCutsLC" # CutsLC
1343nightmin=20140520
1344nightmax=20140930
1345name="Mrk501_nightly_newAnalysis_forHESS"
1346bin=-1
1347get_results
1348name="Mrk501_7d_newAnalysis_forHESS"
1349bin=-7
1350get_results
1351nightmin=20140623
1352nightmax=20140623
1353name="Mrk501_5min_FlareNight_newAnalysis_forHESS"
1354bin=5
1355get_results
1356# isdc analysis
1357thmax=850
1358table="AnalysisResultsRunISDC"
1359nightmin=20140520
1360nightmax=20140930
1361name="Mrk501_nightly_stdAnalysis_forHESS"
1362bin=-1
1363get_results
1364name="Mrk501_7d_stdAnalysis_forHESS"
1365bin=-7
1366get_results
1367nightmin=20140623
1368nightmax=20140623
1369name="Mrk501_5min_FlareNight_stdAnalysis_forHESS"
1370bin=5
1371get_results
1372# qla
1373thmax=500
1374table="AnalysisResultsRunLP"
1375nightmin=20140520
1376nightmax=20140930
1377name="Mrk501_nightly_QLA_forHESS"
1378bin=-1
1379get_results
1380
1381exit
1382
1383# 501 MAGIC
1384source=2
1385name="Mrk501_2014_forMAGIC"
1386bin=-1
1387crabfluxconv="2.87" # using threshold of 830GeV
1388crabfluxconv="3.01" # using threshold of 830GeV and MAGIC Crab spectrum
1389nightmin=20140714
1390nightmax=20140805
1391get_results
1392
1393name="Mrk501_2014_forMAGIC_20min"
1394bin=20
1395get_results
1396
1397
1398exit
1399
1400bin=30
1401name="Mrk501_2014_forMAGIC30"
1402get_results
1403
1404bin=0
1405name="P"
1406nightmin=20140501
1407nightmax=20140930
1408get_results
1409
1410bin=20
1411nightmin=20140623
1412nightmax=20140623
1413name="Mrk501_test"
1414get_results
1415
1416
1417# end script here
1418exit
1419
1420
1421
1422#
1423# more examples
1424#
1425
1426# Mrk 421
1427source=1
1428name="Mrk421_nightly"
1429bin=-1
1430get_results
1431name="Mrk421_20min"
1432bin=20
1433get_results
1434name="Mrk421_3d"
1435bin=-3
1436get_results
1437name="Mrk421_10d"
1438bin=-10
1439get_results
1440name="Mrk421_period"
1441bin=0
1442get_results
1443
1444
1445
1446# Mrk 501
1447source=2
1448name="Mrk501_nightly"
1449bin=-1
1450get_results
1451name="Mrk501_20min"
1452bin=20
1453get_results
1454name="Mrk501_3d"
1455bin=-3
1456get_results
1457name="Mrk501_10d"
1458bin=-10
1459get_results
1460name="Mrk501_period"
1461bin=0
1462get_results
1463
1464
1465
1466# 2344
1467source=3
1468name="2344_nightly"
1469bin=-1
1470get_results
1471name="2344_20min"
1472bin=20
1473get_results
1474name="2344_period"
1475bin=0
1476get_results
1477
1478
1479
1480# 1959
1481source=7
1482name="1959_nightly"
1483bin=-1
1484get_results
1485name="1959_20min"
1486bin=20
1487get_results
1488name="1959_period"
1489bin=0
1490get_results
1491
1492
1493
1494# 0323
1495source=12
1496name="0323_nightly"
1497bin=-1
1498get_results
1499name="0323_20min"
1500bin=20
1501get_results
1502name="0323_period"
1503bin=0
1504get_results
1505
1506
1507
1508# crab
1509source=5
1510name="Crab_nightly"
1511bin=-1
1512get_results
1513name="Crab_20min"
1514bin=20
1515get_results
1516name="Crab_period"
1517bin=0
1518get_results
1519name="Crab_season"
1520bin=-365
1521nightmin=20110716
1522nightmax=20180716
1523get_results
1524
1525
1526
1527name="1959_2016"
1528source=7
1529bin=-1
1530nightmin=20160201
1531nightmax=20161105
1532get_results
1533
1534name="1959_all_variable"
1535overwrite="no"
1536source=7
1537bin=-365
1538nightmin=20120201
1539nightmax=20130131
1540get_results
1541nightmin=20130201
1542nightmax=20140131
1543get_results
1544nightmin=20140201
1545nightmax=20150131
1546get_results
1547bin=0
1548nightmin=20150201
1549nightmax=20160131
1550get_results
1551bin=-1
1552nightmin=20160201
1553nightmax=20170131
1554get_results
1555bin=0
1556nightmin=20170201
1557nightmax=20180131
1558get_results
1559
1560
1561
1562overwrite="yes"
1563name="1959_all_variable2"
1564overwrite="no"
1565source=7
1566bin=-365
1567nightmin=20120201
1568nightmax=20130131
1569get_results
1570nightmin=20130201
1571nightmax=20140131
1572get_results
1573nightmin=20140201
1574nightmax=20150131
1575get_results
1576bin=0
1577nightmin=20150201
1578nightmax=20160131
1579get_results
1580bin=-1
1581nightmin=20160201
1582nightmax=20160817
1583get_results
1584bin=0
1585nightmin=20160818
1586nightmax=20180131
1587get_results
1588
1589
1590
1591overwrite="yes"
1592bin=0
1593source=3
1594name="2344period"
1595get_results
1596
1597
1598
1599# flare night (HESS)
1600name="Mrk501_10min_flarenight"
1601source=2
1602bin=10
1603nightmin=20140623
1604nightmax=20140623
1605get_results
1606
1607
1608
1609# flare night (HESS)
1610name="Mrk501_5min_flarenight"
1611source=2
1612bin=5
1613nightmin=20140623
1614nightmax=20140623
1615get_results
1616
1617
1618
1619
1620# full sample
1621name="Mrk421_all_nightly"
1622source=1
1623get_results
1624
1625name="Mrk501_all_nightly"
1626source=2
1627get_results
1628
1629name="1959_all_nightly"
1630source=7
1631get_results
1632
1633name="2344_all_nightly"
1634source=3
1635get_results
1636
1637
1638
1639name="HESE20160427"
1640source=19
1641nightmin=20160425
1642bin=-10
1643get_results
1644
1645name="AMON20160731"
1646source=21
1647nightmin=20160730
1648bin=-10
1649get_results
1650
1651
1652
Note: See TracBrowser for help on using the repository browser.