source: trunk/www/dch/download.php@ 19634

Last change on this file since 19634 was 19097, checked in by Daniela Dorner, 6 years ago
changed from GET to POST and added storing of email-adress
File size: 18.7 KB
Line 
1<!DOCTYPE HTML>
2<html>
3<head>
4 <meta name="Author" content="The FACT Group" />
5 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6 <title>FACT Project</title>
7
8 <link rel="StyleSheet" type="text/css" href="../../style.css" />
9 <link rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
10 <script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
11</head>
12<body>
13<?php
14
15function print_popup($text)
16{
17 echo "<script type=\"text/javascript\" language=\"Javascript\">\n";
18 echo "alert(\"".$text."\")\n";
19 echo "</script>\n";
20}
21$maintenance=0;
22//$maintenance=1;
23
24if ($maintenance)
25{
26 echo "<hr>\n <p style='font-size:xx-large'> MAINTENANCE ONGOING </p>\n";
27 echo "<p>check again in a few hours...</p>\n<p>\n<hr>\n<p>\n<p>\n";
28}
29
30
31$tables=array(
32 "AnalysisResultsRunLP" => "QLA",
33 "AnalysisResultsRunISDC" => "ISDC",
34 );
35
36$times=array(
37 "timestamp" => "timestamp [YYYY-MM-DD HH:MM:SS]",
38 "unix" => "unix-timestamp [seconds]",
39 "mjd" => "modified julian date [days]",
40 );
41
42$zdcuts=array(
43 "all" => "all data",
44 "75" => "zd<75",
45 "45" => "zd<45",
46 "35" => "zd<35",
47 "30" => "zd<30",
48 );
49
50$thcuts=array(
51 "all" => "all data",
52 "550" => "th<550",
53 "350" => "th<350",
54 );
55$lights=array(
56 "all" => "all data",
57 "nomoon" => "no moon",
58 "dark" => "only dark night",
59 );
60
61
62$dchs=array(
63 "no" => "all data",
64 "yes" => "apply data check (R750)",
65 );
66
67$dusts=array(
68 "all" => "all data",
69 "20" => "dust<20",
70 "10" => "dust<10",
71 "1.0" => "dust<1",
72 );
73
74$timebins=array(
75 "5" => "5 minutes",
76 "10" => "10 minutes",
77 "20" => "20 minutes",
78 "30" => "30 minutes",
79 "40" => "40 minutes",
80 "60" => "1 hour",
81 "90" => "1.5 hours",
82 "120" => "2 hours",
83 "180" => "3 hours",
84 "240" => "4 hours",
85 "300" => "5 hours",
86 "360" => "6 hours",
87 "-1" => "1 night",
88 "-2" => "2 nights",
89 "-3" => "3 nights",
90 "-4" => "4 nights",
91 "-5" => "5 nights",
92 "-6" => "6 nights",
93 "-7" => "7 nights",
94 "-10" => "10 nights",
95 "00" => "period",
96 );
97
98$timebinsext=array(
99 "20" => "20 minutes",
100 "-1" => "1 night",
101 );
102
103// get/define initial values
104
105if (!empty($_POST["start"]))
106 $start=$_POST["start"];
107
108if (!empty($_POST["stop"]))
109 $stop=$_POST["stop"];
110
111if (!empty($_POST["dch"]))
112 $dch=$_POST["dch"];
113else
114 $dch="novalue";
115
116if (!empty($_POST["dust"]))
117 $dust=$_POST["dust"];
118else
119 $dust="novalue";
120
121if (!empty($_GET["expert"]))
122 $_POST["expert"]=$_GET["expert"];
123
124if (!empty($_POST["expert"]))
125 $expert=$_POST["expert"];
126else
127 $expert="no";
128
129if (!empty($_POST["email"]))
130 $email=$_POST["email"];
131else
132 $email="";
133
134if (!empty($_POST["light"]))
135 $light=$_POST["light"];
136else
137 $light="novalue";
138
139if (!empty($_POST["source"]))
140 $source=$_POST["source"];
141else
142 $source=-1;
143
144if (!empty($_POST["timebin"]))
145 $timebin=$_POST["timebin"];
146else
147 $timebin="novalue";
148
149if (!empty($_POST["time"]))
150 $time=$_POST["time"];
151else
152 $time="novalue";
153
154if (!empty($_POST["table"]))
155 $table=$_POST["table"];
156else
157 $table="AnalysisResultsRunLP";
158
159if (!empty($_POST["th"]))
160 $th=$_POST["th"];
161else
162 $th="novalue";
163
164if (!empty($_POST["zd"]))
165 $zd=$_POST["zd"];
166else
167 $zd="novalue";
168
169//variable for non-combinable date/source
170$warn="";
171
172
173include ("db.php");
174$db_id = mysql_connect($host, $user, $pw);
175mysql_select_db($db);
176
177ini_set("display_errors", "On");
178ini_set("mysql.trace_mode", "On");
179
180echo "<h1><u>FACT Quick Look Analysis - Download Area</u></h1>\n";
181//echo "<hr>\n";
182echo "<h2>Data Usage Policy</h2>\n";
183
184if ($expert=="yes")
185{
186 echo "As a member or associated member of the FACT Collaboration, you have access to internal information.<br>\n";
187 echo "Any publication using FACT internal information has to have the full FACT author list.<br><br>\n";
188}
189else
190{
191 echo "<b>Using data from the FACT Quick Look Analysis, you agree to cite the FACT design paper (H. Anderhub et al. JINST 8 P6008) ";
192// echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/8/06/P06008'>FACT design paper</a>\n ";
193 echo "and the quick look analysis (https://fact-project.org/monitoring).</b>\n";
194 echo "<br><br>\n \n ";
195 echo "<u>References:</u>\n";
196 echo "<ul>\n";
197 echo "<li>Website Quick Look Analysis: <a target='_blank' href='https://fact-project.org/monitoring'>https://fact-project.org/monitoring </a></li>\n";
198 echo "<li>FACT Design Paper: H. Anderhub et al. JINST 8 P6008 <a target='_blank' href='http://adsabs.harvard.edu/abs/2013JInst...8P6008A'>ADS</a>\n ";
199 echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/8/06/P06008'>open access</a>\n</li>\n";
200 echo "<li>FACT Performance Paper: A. Biland et al. JINST 9 P10012 <a target='_blank' href='http://adsabs.harvard.edu/abs/2014JInst...9P0012B'>ADS</a>\n ";
201 echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/9/10/P10012/'>open access</a>\n</li>\n";
202 echo "<li>Information on the Quick Look Analysis: D. Dorner et al. Proceedings Fermi Symposium 2014 <a target='_blank' href='http://adsabs.harvard.edu/abs/2015arXiv150202582D'>ADS</a>\n ";
203 echo "<a target='_blank' href='https://arxiv.org/pdf/1502.02582v1.pdf'>open access</a>\n</li>\n";
204 echo "</ul>\n";
205}
206
207
208echo "If you intend to use data or information from this website, please let us know for reference.<br>\n";
209
210
211//echo "<hr>\n";
212echo "<form name='formular' action='download.php' METHOD='POST'>\n";
213
214//$query="SELECT fSourceKey, fSourceName, (SELECT COUNT(*) FROM ".$_POST["table"]." LEFT JOIN RunInfo USING(fNight, fRunID) WHERE fRunTypeKey=1 AND RunInfo.fSourceKey=Source.fSourceKey) AS num FROM Source WHERE fSourceTypeKey=1";
215$query="SELECT fSourceKey, fSourceName, COUNT(*) AS num FROM RunInfo LEFT JOIN Source USING(fSourceKey) WHERE fSourceTypeKey=1 AND fRunTypeKey=1 GROUP BY fSourceKey ORDER BY num DESC";
216//echo $query."<br>";
217
218$sources=array();
219$result=mysql_query($query);
220while ($row = mysql_fetch_row($result))
221 $sources[$row[0]]=$row[1];
222mysql_free_result($result);
223
224//$query="SELECT Min(fNight), Max(fNight) FROM ".$_POST["table"];
225$query="SELECT Min(fNight), Max(fNight) FROM RunInfo";
226//echo $query."<br>";
227
228$result=mysql_query($query);
229while ($row = mysql_fetch_row($result))
230{
231 if (empty($start))
232 $start=$row[0];
233 if (empty($stop))
234 $stop=$row[1];
235}
236mysql_free_result($result);
237
238if (strpos($email, "@")!= false && $source<0)
239 print_popup("Please select a source.");
240
241if (strpos($email, "@")!= false && $time=="novalue")
242 print_popup("Please select a time format.");
243
244if (strpos($email, "@")!= false && $timebin=="novalue")
245 print_popup("Please select a time binning.");
246
247if (empty($email) && $time!="novalue" && $timebin!="novalue" && $source>0)
248 print_popup("Please provide an email address.");
249
250if (empty($_POST["emailcopy"]))
251 print_popup("Please agree that a copy of the email is stored.");
252
253
254if (strpos($email, "@")!= false && $source>0 && !empty($_POST["emailcopy"]))
255{
256 //echo "<h2>Sending data...</h2>\n";
257 //print_popup("Sent email to ".$email." containing the data of ".$sources[$source]." from ".$start." till ".$stop." for ".$timebins[$timebin]." binning.");
258 print_popup("Email with data sent to ".$email);
259 if ($maintenance)
260 echo $start." ".$stop." ".$source." ".$timebin." ".$email." ".$table." ".$time." ".$expert." ".$dch." ".$zd." ".$th." ".$light." ".$dust."<br>\n";
261 $sent=shell_exec("/users/fact/SW.automatic.processing/DataCheck/Tools/get_data.sh ".$start." ".$stop." ".$source." ".$timebin." ".$email." ".$table." ".$time." ".$expert." ".$dch." ".$zd." ".$th." ".$light." ".$dust);
262 echo $sent;
263 if (!empty($_POST["newsletter"]))
264 {
265 $query_interested="SELECT * FROM memberlist.interested WHERE email='".$email."'";
266 $result_interested=mysql_query($query_interested);
267 //echo "num rows: ".mysql_num_rows($result_interested)."<br>\n";
268 //while ($row = mysql_fetch_row($result_interested))
269 // echo $row[0]." ".$row[1]." ".$row[2]." ".$row[3]."<br>\n";
270 if (mysql_num_rows($result_interested)>0)
271 $query_interested="UPDATE ";
272 else
273 $query_interested="INSERT ";
274 $query_interested.=" memberlist.interested SET date=NOW(), email='".$email."'";
275 if (mysql_num_rows($result_interested)>0)
276 $query_interested.=" WHERE email='".$email."'";
277 //echo $query_interested;
278 mysql_free_result($result_interested);
279 $result_interested=mysql_query($query_interested);
280 if ($maintenance)
281 echo "num affected rows: ".mysql_affected_rows()."<br>\n";
282 }
283}
284
285//#DFE6FA #CDD7F4
286echo "<br>\n<div style='background-color: #DFE6FA; padding-left: 20px; padding-right: 20px; padding-top: 1px; padding-bottom: 10px; border: 3px solid #394979; border-radius: 20px'>\n";
287echo "<h2>Select here the settings for your data sample:</h2>\n";
288
289// SOURCE
290echo "<select name='source' size='1'>\n";
291if ($source == -1)
292 printf("<option value='-1' selected>Select Source</option>\n");
293else
294 printf("<option value='-1'>Select Source</option>\n");
295foreach ($sources as $key => $sourcename)
296{
297 if ($source==$key)
298 printf("<option value='%s' selected>%s</option>\n", $key, $sourcename);
299 else
300 printf("<option value='%s'>%s</option>\n", $key, $sourcename);
301}
302echo "</select><sup>*</sup>\n";
303
304// Time Format
305echo "<select name='time' size='1'>\n";
306if ($time == "")
307 printf("<option value='novalue' selected>Select Time Format</option>\n");
308else
309 printf("<option value='novalue'>Select Time Format</option>\n");
310foreach ($times as $key => $name)
311{
312 if ($time == $key)
313 printf("<option value='%s' selected>%s</option>\n", $key, $name);
314 else
315 printf("<option value='%s'>%s</option>\n", $key, $name);
316}
317echo "</select><sup>*</sup>\n ";
318
319// Binning
320echo "<select name='timebin' size='1'>\n";
321if ($timebin == "novalue")
322 printf("<option value='novalue' selected>Select Binning</option>\n");
323else
324 printf("<option value='novalue'>Select Binning</option>\n");
325if ($expert != "yes")
326 $timebins=$timebinsext;
327foreach ($timebins as $key => $name)
328{
329 if ($timebin == $key)
330 printf("<option value='%s' selected>%s</option>\n", $key, $name);
331 else
332 printf("<option value='%s'>%s</option>\n", $key, $name);
333}
334echo "</select><sup>*</sup>\n";
335echo "<br>\n";
336
337printf("Time Range: from <input name='start' type='text' size='8' maxlength='8' value='%s'> \n", $start);
338printf("to <input name='stop' type='text' size='8' maxlength='8' value='%s'> \n ", $stop);
339//echo "<input class='Width' type='button' value='Reset' onClick='self.location.href=\"download.php\"'><br>\n";
340echo "<input class='Width' type='button' value='Reset' onClick='self.location.href=\"download.php";
341if ($expert == "yes")
342 echo "?expert=yes";
343echo "\"'><br>\n";
344
345if ($expert == "yes")
346{
347 echo "<h2>Further settings for internal use: </h2>\n";
348 echo "<input type='hidden' name='expert' value='yes'>\n";
349
350 echo "Select Analysis: <select name='table' size='1'>\n";
351 foreach ($tables as $key => $name)
352 {
353 if ($table == $key)
354 printf("<option value='%s' selected>%s</option>\n", $key, $name);
355 else
356 printf("<option value='%s'>%s</option>\n", $key, $name);
357 }
358 echo "</select><br>\n";
359
360 echo "Cuts: \n";
361 //DATACHECK
362 echo "<select name='dch' size='1'>\n";
363 if ($dch == "novalue")
364 printf("<option value='novalue' selected>Select DataCheck</option>\n");
365 else
366 printf("<option value='novalue'>Select DataCheck</option>\n");
367 foreach ($dchs as $key => $name)
368 {
369 if ($dch == $key)
370 printf("<option value='%s' selected>%s</option>\n", $key, $name);
371 else
372 printf("<option value='%s'>%s</option>\n", $key, $name);
373 }
374 echo "</select>\n ";
375
376 //DUST
377 echo "<select name='dust' size='1'>\n";
378 if ($dust == "novalue")
379 printf("<option value='novalue' selected>Select Calima-Cut</option>\n");
380 else
381 printf("<option value='novalue'>Select Calima-Cut</option>\n");
382 foreach ($dusts as $key => $name)
383 {
384 if ($dust == $key)
385 printf("<option value='%s' selected>%s</option>\n", $key, $name);
386 else
387 printf("<option value='%s'>%s</option>\n", $key, $name);
388 }
389 echo "</select>\n ";
390
391 //ZD
392 echo "<select name='zd' size='1'>\n";
393 if ($zd == "novalue")
394 printf("<option value='novalue' selected>Select Zd-Cut</option>\n");
395 else
396 printf("<option value='novalue'>Select Zd-Cut</option>\n");
397 foreach ($zdcuts as $key => $name)
398 {
399 if ($zd == $key)
400 printf("<option value='%s' selected>%s</option>\n", $key, $name);
401 else
402 printf("<option value='%s'>%s</option>\n", $key, $name);
403 }
404 echo "</select>\n ";
405
406 //TH
407 echo "<select name='th' size='1'>\n";
408 if ($th == "novalue")
409 printf("<option value='novalue' selected>Select Threshold-Cut</option>\n");
410 else
411 printf("<option value='novalue'>Select Threshold-Cut</option>\n");
412 foreach ($thcuts as $key => $name)
413 {
414 if ($th == $key)
415 printf("<option value='%s' selected>%s</option>\n", $key, $name);
416 else
417 printf("<option value='%s'>%s</option>\n", $key, $name);
418 }
419 echo "</select>\n ";
420
421 echo "<select name='light' size='1'>\n";
422 if ($light == "novalue")
423 printf("<option value='novalue' selected>Select Light-Condition-Cut</option>\n");
424 else
425 printf("<option value='novalue'>Select Light-Condition-Cut</option>\n");
426 foreach ($lights as $key => $name)
427 {
428 if ($light == $key)
429 printf("<option value='%s' selected>%s</option>\n", $key, $name);
430 else
431 printf("<option value='%s'>%s</option>\n", $key, $name);
432 }
433 echo "</select>\n <br>\n";
434}
435
436echo "<h2>Get data:</h2>\n";
437
438echo "Provide your email address to receive the data: \n";
439printf("<input name='email' type='text' size='20' maxlength='50' value='%s'><sup>*</sup>\n<br>\n", $email);
440
441if (empty($_POST["emailcopy"]))
442 echo "<input type='checkbox' name='emailcopy'><sup>*</sup> I agree that a copy of the email is stored for the statistical evaluation of data requests.<br>\n";
443else
444 echo "<input type='checkbox' name='emailcopy' checked><sup>*</sup> I agree that a copy of the email is stored for the statistical evaluation of data requests.<br>\n";
445if (empty($_POST["newsletter"]))
446 echo "<input type='checkbox' name='newsletter'> I would like to receive updates on the data and agree that my email address is stored for this purpose.<br><br>\n";
447else
448 echo "<input type='checkbox' name='newsletter' checked> I would like to receive updates on the data and agree that my email address is stored for this purpose.<br><br>\n";
449
450echo "Clicking on the button, you agree to the data usage policy: <br><br>\n";
451//echo "Clicking on the button, you agree to the data usage policy and that a copy of my email is stored: <br><br>\n";
452echo "<input type='button' style='width: 250px; height: 40px; font-size: 22px; ' value='Send data by Email' onClick='submit()'><br>\n";
453//border: 3px solid #394979; border-radius: 10px
454echo "<sup>*</sup> required<br>\n";
455
456
457echo "</form>\n";
458echo "</div>\n";
459//echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* required<br>\n";
460
461echo "<h2>Remarks:</h2> ";
462
463
464if ($expert=="yes")
465{
466 echo "<ul>\n";
467 echo "<li>The correction formula to correct the excess rate for the effects of zd and threshold is not yet final.</li>\n";
468 echo "<li>The CU conversion is currently only valid for QLA and until summer 2016.</li>\n";
469 echo "<li>The data quality selection based on the artificial trigger rate R750 might not work for all data (effect of lidar).</li>\n";
470 //echo "<li></li>\n";
471 echo "</ul>";
472}
473else
474{
475 echo "<ul>\n";
476 //echo "<li>The results shown on this page are <b><i>PRELIMINARY</i></b>.</li>";
477 echo "<li>These are the results of a <b>fast quick look analysis</b> on site, i.e. they are <b>preliminary</b>.</li>\n";
478 echo "<li>The quick look analysis includes all data, i.e. no data selection done.</li>\n";
479 //echo "<li><b>NO data check</b> is included in the analysis.</li>";
480 echo "<li>The shown curves are not fluxes but <b>excess rates</b> (number of excess events per effective ontime), \n";
481 echo "i.e. there is a dependence on trigger threshold and zenith distance of the observation (with the current \n";
482 echo "analysis for zenith distance > 40 degree and trigger threshold > 500 DAC counts).</li>\n";
483 //echo "i.e. a dependence on trigger threshold and zenith distance of the observation is expected ";
484 //echo "for zenith distance larger than 40 degree and very strong moon light.</li>";
485 //echo "<li><b>NO corrections</b> for the dependence on zenith distance and trigger threshold of the observation are applied so far.</li>";
486 //echo "<li>This webpage shows the <b>excess rates</b> (black), i.e. number of excess events ";
487 //echo "(signal minus background in the signal region) devided by the ontime of the observation, ";
488 //echo "and the <b>background rates</b> (blue), i.e. number of background events devided by ontime. </li>";
489 echo "<li>The curves are provided with 20 min binning and nightly binning.</li>\n";
490 echo "<li>In case, you need further details about the data or a different binning, please do not hesitate to contact us.</li>\n";
491 echo "<li>QLA results are available for the data since 12.12.2012. For older data, please contact us.</li>\n";
492 echo "<li>New software versions were introduced at the following dates: 24.5.2014</li>\n";
493 echo "</ul>\n";
494 echo "In case you are interested in more than the public data, please contact us.\n";
495}
496
497echo "<h2>Contact</h2>";
498echo "<i>qla&lt;at&gt;fact-project.org</i><br>";
499//echo "You acknowledge these regulations by clicking on the 'Show' button.</b></big> <br><br><br>";
500
501/*
502$ranges=array(
503// "5min" => " 5 min",
504// "10min" => "10 min",
505 "20min" => "20 min",
506 "30min" => "30 min",
507 "40min" => "40 min",
508 "60min" => "60 min",
509 "90min" => "90 min",
510 "120min" => "120 min",
511 "180min" => "180 min",
512 "240min" => "240 min",
513 "300min" => "300 min",
514 "360min" => "360 min",
515// "0001nights" => "1 night",
516// "0002nights" => "2 nights",
517// "0004nights" => "4 nights",
518// "0008nights" => "8 nights",
519// "0016nights" => "16 nights",
520 );
521
522echo "</body>";
523echo "</html>";
524*/
525//$dom = new DOMDocument();
526//$dom->loadHTML("download.php");
527//echo $dom->getElementById("logged");
528
529?>
530</body>
531</html>
Note: See TracBrowser for help on using the repository browser.