1 | <?php
|
---|
2 |
|
---|
3 | include("db.php");
|
---|
4 |
|
---|
5 | // ini_set("display_errors", "On");
|
---|
6 | // ini_set("mysql.trace_mode", "On");
|
---|
7 |
|
---|
8 |
|
---|
9 | if (isset($_GET['db']))
|
---|
10 | $database = $_GET['db'];
|
---|
11 |
|
---|
12 | $error_con = "";
|
---|
13 |
|
---|
14 | $db = new mysqli($host, $user, $pw, $database);
|
---|
15 | if ($db->connect_error)
|
---|
16 | {
|
---|
17 | header("HTTP/1.0 500 Internal server error");
|
---|
18 | $error_con = $db->connect_error;
|
---|
19 | //die("mysqli_connect: ".$db->connect_errno." ".$db->connect_error);
|
---|
20 | }
|
---|
21 |
|
---|
22 | if (isset($_GET["short"]) && !$db->connect_error)
|
---|
23 | {
|
---|
24 | $query = "SELECT URL from ShortURL.ShortURL WHERE `Key`=(".base62_decode($_GET["short"]).")";
|
---|
25 | if ($result = $db->query($query))
|
---|
26 | {
|
---|
27 | $uri = $_SERVER['REQUEST_URI'];
|
---|
28 | $pos = strpos($uri, '?');
|
---|
29 | $uri = $pos===FALSE ? $uri : substr($uri, 0, $pos);
|
---|
30 |
|
---|
31 | $row = $result->fetch_assoc();
|
---|
32 | $result->free();
|
---|
33 |
|
---|
34 | $url = $row['URL'];
|
---|
35 |
|
---|
36 | $tiny = $_SERVER['HTTP_HOST'].$uri.'?'.$url;
|
---|
37 |
|
---|
38 | if (isset($_GET["print"]) &&
|
---|
39 | strstr($url, "?print")==FALSE &&
|
---|
40 | strstr($url, "&print")==FALSE)
|
---|
41 | $tiny .= "&print";
|
---|
42 |
|
---|
43 | header('Location: //'.$tiny);
|
---|
44 | die("");
|
---|
45 | }
|
---|
46 | }
|
---|
47 |
|
---|
48 | $hidden = isset($_GET["print"]) ? "*{visibility:hidden;}.print{position:fixed;left:0;top:0;}.print *{visibility:visible;}" : "";
|
---|
49 | $begin = isset($_GET["b"]) ? $_GET["b"] : "";
|
---|
50 | $end = isset($_GET["e"]) ? $_GET["e"] : "";
|
---|
51 | $source = isset($_GET["s"]) ? intval($_GET["s"]) : 0;
|
---|
52 | $group = isset($_GET["g"]) ? intval($_GET["g"]) : 1;
|
---|
53 | $table = isset($_GET["t"]) ? $_GET["t"] : "LP";
|
---|
54 | $cut = isset($_GET["cut"]) ? trim($_GET["cut"]) : "";
|
---|
55 | $having = isset($_GET["hav"]) ? trim($_GET["hav"]) : "";
|
---|
56 | $vmin = isset($_GET["min"]) ? "minValue:".intval($_GET["min"])."," : "";
|
---|
57 | $vmax = isset($_GET["max"]) ? "maxValue:".intval($_GET["max"])."," : "";
|
---|
58 | $width = isset($_GET["w"]) ? floatval($_GET["w"]) : 1;
|
---|
59 | $sql_x = isset($_GET["x"]) ? trim($_GET["x"]) : "";
|
---|
60 | $sql_y = isset($_GET["y"]) ? trim($_GET["y"]) : "";
|
---|
61 | $sql_err= isset($_GET["err"]) ? trim($_GET["err"]) : "";
|
---|
62 | $rate = isset($_GET["r"]) ? intval($_GET["r"]) : 6;
|
---|
63 | $offset = isset($_GET["o"]) ? floatval($_GET["o"]) : 0;
|
---|
64 | $nohist = isset($_GET["no-hist"]) ? 1 : 0;
|
---|
65 | $noerr = isset($_GET["no-errors"]) ? 1 : 0;
|
---|
66 | $ontime = isset($_GET["on"]) ? floatval($_GET["on"]) : -1;
|
---|
67 | //$clean = isset($_GET["clean"]) ? "AND fEffectiveOn>0.015" : "";
|
---|
68 |
|
---|
69 | if (!empty($sql_x))
|
---|
70 | $group = 42;
|
---|
71 |
|
---|
72 | if ($width<=0)
|
---|
73 | $width = 1;
|
---|
74 |
|
---|
75 | if (empty($offset))
|
---|
76 | $offset = 0;
|
---|
77 |
|
---|
78 | switch($table)
|
---|
79 | {
|
---|
80 | case "LP":
|
---|
81 | $zdfactor="(pow(cos(fZenithDistanceMean*PI()/180),3)+14.8/21.9*pow(sin(2*fZenithDistanceMean*PI()/180),5))";
|
---|
82 | $thfactor="(1-0.00124/1.21*(fThresholdMinSet-500)*(fThresholdMinSet>=500))";
|
---|
83 | // ETh: 715 GeV
|
---|
84 | $crabflux="3.6";
|
---|
85 | break;
|
---|
86 | case "ISDC":
|
---|
87 | $zdfactor="pow(cos(fZenithDistanceMean*PI()/180)*exp(1-cos(fZenithDistanceMean*PI()/180)),4.2)";
|
---|
88 | $thfactor="(1.18-IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)*0.00062)";
|
---|
89 | // ETh: 764 GeV
|
---|
90 | $crabflux="3.3";
|
---|
91 | case "CutsLC":
|
---|
92 | $zdfactor="pow(cos(fZenithDistanceMean*PI()/180)*exp(1-cos(fZenithDistanceMean*PI()/180)),4.5)";
|
---|
93 | $thfactor="(1.37-IF(ISNULL(fThresholdMinSet),fThresholdMedian,fThresholdMinSet)*0.00118)";
|
---|
94 | // ETh: 543 GeV
|
---|
95 | $crabflux="5.7";
|
---|
96 | default:
|
---|
97 | $zdfactor="0";
|
---|
98 | $thfactor="0";
|
---|
99 | $crabflux="0";
|
---|
100 | break;
|
---|
101 | }
|
---|
102 |
|
---|
103 |
|
---|
104 | /*
|
---|
105 | $join = isset($_GET["join"]) ? "LEFT JOIN ".$_GET["join"]." USING(fNight,fRunID)" : "";
|
---|
106 |
|
---|
107 | if (isset($_GET["x"]))
|
---|
108 | $group = 42;
|
---|
109 |
|
---|
110 | if (isset($_GET["y"]))
|
---|
111 | $rate = 44;
|
---|
112 |
|
---|
113 | // Backward compatibility
|
---|
114 | if (isset($_GET["avg"]))
|
---|
115 | {
|
---|
116 | $y = $_GET["avg"];
|
---|
117 | $rate = 42;
|
---|
118 | }
|
---|
119 |
|
---|
120 | if (isset($_GET["sum"]))
|
---|
121 | {
|
---|
122 | $y = $_GET["sum"];
|
---|
123 | $rate = 43;
|
---|
124 | }
|
---|
125 |
|
---|
126 | if (isset($_GET["hist"]))
|
---|
127 | {
|
---|
128 | $x = $_GET["hist"];
|
---|
129 | $rate = 45;
|
---|
130 | $group = 42;
|
---|
131 | }
|
---|
132 |
|
---|
133 | */
|
---|
134 |
|
---|
135 | $good = "";
|
---|
136 | if (isset($_GET["good"]))
|
---|
137 | {
|
---|
138 | $g = $_GET["good"];
|
---|
139 |
|
---|
140 | if ($g&0x1) $good .= " AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 ";
|
---|
141 | if ($g&0x2) $good .= " AND fZenithDistance < 45 ";
|
---|
142 | if ($g&0x4) $good .= " AND IF (ISNULL(fThresholdMinSet), fThresholdMedian, fThresholdMinSet) < 550 ";
|
---|
143 | if ($g&0x8) $good .= " AND fTNGDust<10 ";
|
---|
144 | }
|
---|
145 |
|
---|
146 | $sqlbegin = !empty($begin) ? "AND (DATE(fNight)>='".$begin."')" : "";
|
---|
147 | $sqlend = !empty($end) ? "AND (DATE(fNight)<='".$end."')" : "";
|
---|
148 | $sqlcut = !empty($cut) ? "AND (".$cut.") " : "";
|
---|
149 | $sqlhaving = !empty($having)? "AND (".$having.") " : "";
|
---|
150 |
|
---|
151 | // --------------------------------------------------------------------
|
---|
152 |
|
---|
153 | $query2 = <<<EOT
|
---|
154 |
|
---|
155 | SELECT
|
---|
156 | COLUMN_NAME
|
---|
157 | FROM
|
---|
158 | INFORMATION_SCHEMA.COLUMNS
|
---|
159 | WHERE
|
---|
160 | TABLE_SCHEMA='$database' AND
|
---|
161 | TABLE_NAME in ('RunInfo','AnalysisResultsRun$table')
|
---|
162 | GROUP BY
|
---|
163 | COLUMN_NAME
|
---|
164 | ORDER BY
|
---|
165 | COLUMN_NAME
|
---|
166 |
|
---|
167 | EOT;
|
---|
168 |
|
---|
169 | $error2 = "";
|
---|
170 | $columns = "";
|
---|
171 |
|
---|
172 | $result2 = $db->connect_error ? FALSE : $db->query($query2);
|
---|
173 | if ($result2)
|
---|
174 | {
|
---|
175 | while ($row = $result2->fetch_assoc())
|
---|
176 | $columns .= '"'.$row['COLUMN_NAME'].'",'."\n";
|
---|
177 | $result2->free();
|
---|
178 | }
|
---|
179 | else
|
---|
180 | {
|
---|
181 | $error2 .= $db->error;
|
---|
182 | }
|
---|
183 |
|
---|
184 | // --------------------------------------------------------------------
|
---|
185 |
|
---|
186 | $query1 = <<<EOT
|
---|
187 |
|
---|
188 | SELECT
|
---|
189 | fSourceKEY AS k,
|
---|
190 | fSourceName AS name,
|
---|
191 | fRightAscension AS ra
|
---|
192 | FROM Source
|
---|
193 | WHERE fSourceTypeKey=1
|
---|
194 | ORDER BY k
|
---|
195 |
|
---|
196 | EOT;
|
---|
197 |
|
---|
198 | $error1 = "";
|
---|
199 |
|
---|
200 | $sources = array();
|
---|
201 | $sourceoptions = "";
|
---|
202 |
|
---|
203 | $result1 = $db->connect_error ? FALSE : $db->query($query1);
|
---|
204 | if ($result1)
|
---|
205 | {
|
---|
206 | while ($row = $result1->fetch_assoc())
|
---|
207 | {
|
---|
208 | $sources[$row['k']] = $row;
|
---|
209 | $sourceoptions .= "<option value='".$row['k']."'>".$row['name']."</option>\n";
|
---|
210 | }
|
---|
211 | $result1->free();
|
---|
212 | }
|
---|
213 | else
|
---|
214 | {
|
---|
215 | $error1 .= $db->error;
|
---|
216 | }
|
---|
217 |
|
---|
218 | $sourcename = $source==0 ? "All" : $sources[$source]['name'];
|
---|
219 | $ra = $source==0 ? 0 : $sources[$source]['ra'];
|
---|
220 | $sqlsource = $source==0 ? "" : "AND fSourceKey=".$source;
|
---|
221 |
|
---|
222 | // --------------------------------------------------------------------
|
---|
223 |
|
---|
224 | $unitx = "";
|
---|
225 |
|
---|
226 | switch ($group)
|
---|
227 | {
|
---|
228 | case 1:
|
---|
229 | $selectx="fPeriod";
|
---|
230 | $titlex="Period";
|
---|
231 | $axistype="number";
|
---|
232 | $mintime=60;
|
---|
233 | break;
|
---|
234 | case 2:
|
---|
235 | //$selectx="FROM_UNIXTIME(UNIX_TIMESTAMP(fRunStart)+(UNIX_TIMESTAMP(fRunStop)-UNIX_TIMESTAMP(fRunStart))/2)";
|
---|
236 | $selectx="STR_TO_DATE(fNight, '%Y%m%d')";
|
---|
237 | $titlex="Night";
|
---|
238 | $axistype="date";
|
---|
239 | $mintime=20;
|
---|
240 | break;
|
---|
241 | case 3:
|
---|
242 | $selectx="YEAR(fNight)";//"SUBSTR(fNight,1,4)";
|
---|
243 | $titlex="Year";
|
---|
244 | $axistype="date";
|
---|
245 | $mintime=60;
|
---|
246 | break;
|
---|
247 | case 4:
|
---|
248 | $selectx="ADDDATE(DATE(CONCAT(YEAR(ADDDATE(DATE(fNight), INTERVAL - (".$ra."/24.*365+80) DAY)), '-01-01')), INTERVAL + (".$ra."/24.*365+80+365/2) DAY)"; // FIXME shift back to get the center!
|
---|
249 | //$selectx="ADDDATE(DATE(YEAR(ADDDATE(DATE(fNight), INTERVAL - (".$ra."/24.*365+80) DAY))), INTERVAL + (".$ra."/24.*365+80) DAY)";
|
---|
250 | $titlex="Season";
|
---|
251 | $axistype="date";
|
---|
252 | $mintime=60;
|
---|
253 | break;
|
---|
254 | case 5:
|
---|
255 | $selectx="FROM_UNIXTIME((UNIX_TIMESTAMP(fRunStop)+UNIX_TIMESTAMP(fRunStart))/2)";
|
---|
256 | $titlex="Time";
|
---|
257 | $axistype="date";
|
---|
258 | $mintime=0.5;
|
---|
259 | break;
|
---|
260 | case 6:
|
---|
261 | $bin = isset($width) ? $width : 5;
|
---|
262 | $selectx="FLOOR(fZenithDistanceMean/".$bin.")*".$bin."+".$bin."/2";
|
---|
263 | $titlex="Zd [deg]";
|
---|
264 | $axistype="number";
|
---|
265 | $mintime=0.5;
|
---|
266 | break;
|
---|
267 | case 7:
|
---|
268 | $bin = isset($width) ? $width : 50;
|
---|
269 | $selectx="FLOOR(fThresholdMinSet/".$bin.")*".$bin."+".$bin."/2";
|
---|
270 | $titlex="Threshold";
|
---|
271 | $axistype="number";
|
---|
272 | $mintime=0.5;
|
---|
273 | break;
|
---|
274 | case 8:
|
---|
275 | $bin = isset($width) ? $width : 5;
|
---|
276 | $selectx="FLOOR(fCurrentsMedMean/".$bin.")*".$bin."+".$bin."/2";
|
---|
277 | $titlex="Current [\u00B5A/pix]"; // \u00B5 = µ
|
---|
278 | $axistype="number";
|
---|
279 | $mintime=0.5;
|
---|
280 | break;
|
---|
281 | case 9:
|
---|
282 | $selectx="MONTH(fNight)";//"SUBSTR(fNight,1,4)";
|
---|
283 | $titlex="Month";
|
---|
284 | $axistype="date";
|
---|
285 | $mintime=60;
|
---|
286 | break;
|
---|
287 | case 42:
|
---|
288 | $bin = isset($width) ? $width : 1;
|
---|
289 | $selectx="FLOOR(((".$sql_x.")-".$offset.")/".$bin.")*".$bin."+".$bin."/2+".$offset;
|
---|
290 | $titlex=addslashes($sql_x)." / ".$bin;
|
---|
291 | $axistype="number";
|
---|
292 | $mintime=0.5;
|
---|
293 | break;
|
---|
294 |
|
---|
295 | default:
|
---|
296 | $selectx="fPeriod";
|
---|
297 | $titlex="Period";
|
---|
298 | $axistype="number";
|
---|
299 | $mintime=60;
|
---|
300 | break;
|
---|
301 | }
|
---|
302 |
|
---|
303 | if ($ontime>=0)
|
---|
304 | $mintime = $ontime;
|
---|
305 |
|
---|
306 | // --------------------------------------------------------------------
|
---|
307 |
|
---|
308 | $isnull = "";
|
---|
309 | $unity = "[Hz]";
|
---|
310 | $selecterr="1";
|
---|
311 |
|
---|
312 | $vminval = 0;
|
---|
313 | $errors = 0;
|
---|
314 | $histogram = 0;
|
---|
315 |
|
---|
316 | switch ($rate)
|
---|
317 | {
|
---|
318 | case 1:
|
---|
319 | $selecty="AVG(fTriggerRateMedian)";
|
---|
320 | $isnull="AND NOT ISNULL(fTriggerRateMedian)";
|
---|
321 | $titley="Average TriggerRate";
|
---|
322 | break;
|
---|
323 | case 21:
|
---|
324 | $selecty="SUM(fNumPhysicsTrigger)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
325 | $isnull="AND NOT ISNULL(fNumPhysicsTrigger)";
|
---|
326 | $titley="PhysicsTriggerRate";
|
---|
327 | break;
|
---|
328 | case 22:
|
---|
329 | //$selecty="(SUM(fNumPhysicsTrigger)-SUM(fNum27Sec))/SUM(fOnTime)";
|
---|
330 | $selecty="SUM(fNumPhysicsTrigger*1.0-fNum27Sec*1.0)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
331 | $isnull="AND NOT ISNULL(fNumPhysicsTrigger) AND NOT ISNULL(fNum27Sec)";
|
---|
332 | $titley="PhysicsTrigger-27Sec";
|
---|
333 | break;
|
---|
334 | case 2:
|
---|
335 | $selecty="SUM(fNumEvtsAfterCleaning)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
336 | $isnull="AND NOT ISNULL(fNumEvtsAfterCleaning)";
|
---|
337 | $titley="Rate after Cleaning";
|
---|
338 | break;
|
---|
339 | case 23:
|
---|
340 | $selecty="SUM(fNumEvtsAfterCleaning*1.0-fNum27Sec*1.0)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
341 | $isnull="AND NOT ISNULL(fNumEvtsAfterCleaning) AND NOT ISNULL(fNum27Sec)";
|
---|
342 | $titley="Rate after Cleaning-27Sec";
|
---|
343 | break;
|
---|
344 | case 20:
|
---|
345 | //$selecty="SUM((fNumEvtsAfterCleaning*1.0-fNum27Sec*1.0)/(1-(22.3-6)/22.5/0.4*(LOG10(fThresholdMinSet)-2.5))/(cos(fZenithDistanceMean*PI()/180)+0.18*pow(sin(2*fZenithDistanceMean*PI()/180),3)))/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
346 | $selecty="SUM((fNumEvtsAfterCleaning*1.0-fNum27Sec*1.0)/((-2381.1+2766.3*LOG10(fThresholdMinSet)-1049.9*POW(LOG10(fThresholdMinSet),2)+131.05*POW(LOG10(fThresholdMinSet),3))/21.15)/(COS(fZenithDistanceMean*PI()/180)+0.179*POW(SIN(1.89*fZenithDistanceMean*PI()/180),5)))/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
347 | $isnull="AND NOT ISNULL(fNumEvtsAfterCleaning) AND LOG10(fThresholdMinSet)<2.8 AND NOT ISNULL(fZenithDistanceMean) AND fThresholdMinSet>0 ";
|
---|
348 | $titley="Rate after cleaning (Zd/TH/27s corrected)";
|
---|
349 | break;
|
---|
350 | case 3:
|
---|
351 | $selecty="SUM(fNumEvtsAfterQualCuts)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
352 | $isnull="AND NOT ISNULL(fNumEvtsAfterQualCuts)";
|
---|
353 | $titley="Rate after Quality Cuts";
|
---|
354 | break;
|
---|
355 | case 4:
|
---|
356 | $selecty="SUM(fNumEvtsAfterBgCuts)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
357 | $isnull="AND NOT ISNULL(fNumEvtsAfterBgCuts)";
|
---|
358 | $titley="Rate after Background Cuts";
|
---|
359 | break;
|
---|
360 | case 24:
|
---|
361 | $selecty="SUM(fNumEvtsAfterBgCuts/(1.41*POW(fZenithDistanceMean*PI()/180,2)+0.975)/(-7.53e-12*POW(10, LOG10(fThresholdMinSet)*3.69)+1.035) )/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
362 | $isnull="AND NOT ISNULL(fNumEvtsAfterBgCuts) AND NOT ISNULL(fZenithDistanceMean) AND NOT ISNULL(fThresholdMinSet)";
|
---|
363 | $titley="BgRate (corrected)";
|
---|
364 | break;
|
---|
365 | case 28:
|
---|
366 | $selecty="SUM(fNumExcEvts/((1.41*POW(fZenithDistanceMean*PI()/180,2)+0.975)/(-7.53e-12*POW(10, LOG10(fThresholdMinSet)*3.69)+1.035) ))/SUM(fNumExcEvts)";
|
---|
367 | $isnull="AND NOT ISNULL(fNumExcEvts) AND NOT ISNULL(fZenithDistanceMean) AND NOT ISNULL(fThresholdMinSet)";
|
---|
368 | $titley="Ratio Corrected(fNumEvtsAfterBgCuts) Exc / Exc";
|
---|
369 | break;
|
---|
370 | case 25:
|
---|
371 | $selecty="SUM(fNumEvtsAfterQualCuts/(cos(fZenithDistanceMean*PI()/180)+0.179*pow(sin(1.89*fZenithDistanceMean*PI()/180),5))/((8598.9- 13181*log10(fThresholdMinSet)+7567.4*pow(log10(fThresholdMinSet),2)-1925.2*pow(log10(fThresholdMinSet),3)+183*pow(log10(fThresholdMinSet),4))/9.2 ))/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
372 | $isnull="AND NOT ISNULL(fNumEvtsAfterQualCuts) AND NOT ISNULL(fZenithDistanceMean) AND NOT ISNULL(fThresholdMinSet)";
|
---|
373 | $titley="QualCutRate (corrected)";
|
---|
374 | break;
|
---|
375 | case 29:
|
---|
376 | $selecty="SUM(fNumExcEvts/(cos(fZenithDistanceMean*PI()/180)+0.179*pow(sin(1.89*fZenithDistanceMean*PI()/180),5))/((8598.9- 13181*log10(fThresholdMinSet)+7567.4*pow(log10(fThresholdMinSet),2)-1925.2*pow(log10(fThresholdMinSet),3)+183*pow(log10(fThresholdMinSet),4))/9.2 ))/SUM(fNumExcEvts)";
|
---|
377 | $isnull="AND NOT ISNULL(fNumEvtsAfterQualCuts) AND NOT ISNULL(fZenithDistanceMean) AND NOT ISNULL(fThresholdMinSet)";
|
---|
378 | $titley="Ratio Corrected(fNumEvtsAfterQualCuts) Exc / Exc";
|
---|
379 | break;
|
---|
380 | case 30:
|
---|
381 | $selecty="SUM(fNumExcEvts/(pow(cos(fZenithDistanceMean*PI()/180),3)+14.8/21.9*pow(sin(2*fZenithDistanceMean*PI()/180),5))/(1-0.00124/1.21*(fThresholdMinSet-500)*(fThresholdMinSet>=500)))/SUM(fNumExcEvts)";
|
---|
382 | $isnull="AND NOT ISNULL(fNumEvtsAfterQualCuts) AND NOT ISNULL(fZenithDistanceMean) AND NOT ISNULL(fThresholdMinSet)";
|
---|
383 | $titley="Ratio Corrected(fNumExcEvts) Exc / Exc";
|
---|
384 | break;
|
---|
385 | case 17:
|
---|
386 | $selecty="SUM(fNumSigEvts)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
387 | $isnull="AND NOT ISNULL(fNumSigEvts)";
|
---|
388 | $titley="Signal rate";
|
---|
389 | break;
|
---|
390 | case 5:
|
---|
391 | $selecty="SUM(fNumBgEvts)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
392 | $isnull="AND NOT ISNULL(fNumBgEvts)";
|
---|
393 | $titley="Background rate";
|
---|
394 | break;
|
---|
395 | case 6:
|
---|
396 | $selecty="SUM(fNumExcEvts)*3600/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
397 | $selecterr="EXCERR(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)*3600";
|
---|
398 | $isnull="AND NOT ISNULL(fNumExcEvts) AND NOT ISNULL(fEffectiveOn)";
|
---|
399 | $titley="Excess rate";
|
---|
400 | $unity="[1/h]";
|
---|
401 | $errors = $noerr ? 0 : 1;
|
---|
402 | break;
|
---|
403 | case 31:
|
---|
404 | $selecty="SUM(fNumExcEvts/".$zdfactor."/".$thfactor.")*3600/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
405 | $selecterr="EXCERR(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)*3600*SUM(fNumExcEvts/".$zdfactor."/".$thfactor.")/SUM(fNumExcEvts)";
|
---|
406 | $isnull="AND NOT ISNULL(fNumExcEvts) AND NOT ISNULL(fEffectiveOn) AND NOT ISNULL(fZenithDistanceMean) AND NOT (ISNULL(fThresholdMinSet) AND ISNULL(fThresholdMedian)) ";
|
---|
407 | $sqlhaving=" AND e < 1000 ";
|
---|
408 | $titley="Corrected excess rate";
|
---|
409 | $unity="[1/h]";
|
---|
410 | $errors = $noerr ? 0 : 1;
|
---|
411 | break;
|
---|
412 | case 32:
|
---|
413 | $selecty="SUM(fNumExcEvts/".$zdfactor."/".$thfactor."/fCU)*3600/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
414 | $selecterr="EXCERR(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)*3600*SUM(fNumExcEvts/".$zdfactor."/".$thfactor."/fCU)/SUM(fNumExcEvts)";
|
---|
415 | $isnull="AND NOT ISNULL(fNumExcEvts) AND NOT ISNULL(fEffectiveOn) AND NOT ISNULL(fZenithDistanceMean) AND NOT (ISNULL(fThresholdMinSet) AND ISNULL(fThresholdMedian)) ";
|
---|
416 | $sqlhaving=" AND e < 1000 ";
|
---|
417 | $titley="Flux";
|
---|
418 | $unity="[CU]";
|
---|
419 | $errors = $noerr ? 0 : 1;
|
---|
420 | break;
|
---|
421 | case 33:
|
---|
422 | $selecty=$crabflux." * SUM(fNumExcEvts/".$zdfactor."/".$thfactor."/fCU)*3600/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
423 | $selecterr=$crabflux." * EXCERR(SUM(fNumSigEvts), SUM(fNumBgEvts))/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)*3600*SUM(fNumExcEvts/".$zdfactor."/".$thfactor."/fCU)/SUM(fNumExcEvts)";
|
---|
424 | $isnull="AND NOT ISNULL(fNumExcEvts) AND NOT ISNULL(fEffectiveOn) AND NOT ISNULL(fZenithDistanceMean) AND NOT (ISNULL(fThresholdMinSet) AND ISNULL(fThresholdMedian)) ";
|
---|
425 | $sqlhaving=" AND e < 1000 ";
|
---|
426 | $titley="Flux";
|
---|
427 | $unity="[10^-11/cm2/s]";
|
---|
428 | $errors = $noerr ? 0 : 1;
|
---|
429 | break;
|
---|
430 | case 7:
|
---|
431 | $selecty="SUM(fNum27Sec)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
432 | $isnull="AND NOT ISNULL(fNum27Sec)";
|
---|
433 | $titley="27sec Rate";
|
---|
434 | break;
|
---|
435 | case 8:
|
---|
436 | $selecty="SUM(fNumThreshold500)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
437 | $isnull="AND NOT ISNULL(fNumThreshold500)";
|
---|
438 | $titley="Threshold 500 Rate";
|
---|
439 | break;
|
---|
440 | case 9:
|
---|
441 | $selecty="SUM(fNumThreshold750)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
442 | $isnull="AND NOT ISNULL(fNumThreshold750)";
|
---|
443 | $titley="Threshold 750 Rate";
|
---|
444 | break;
|
---|
445 | case 10:
|
---|
446 | $selecty="SUM(fNumThreshold1000)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
447 | $isnull="AND NOT ISNULL(fNumThreshold1000)";
|
---|
448 | $titley="Threshold 1000 Rate";
|
---|
449 | break;
|
---|
450 | case 11:
|
---|
451 | $selecty="SUM(fNumThreshold1250)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
452 | $isnull="AND NOT ISNULL(fNumThreshold1250)";
|
---|
453 | $titley="Threshold 1250 Rate";
|
---|
454 | break;
|
---|
455 | case 12:
|
---|
456 | $selecty="SUM(fNumThreshold2500)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
457 | $isnull="AND NOT ISNULL(fNumThreshold2500)";
|
---|
458 | $titley="Threshold 2500 Rate";
|
---|
459 | break;
|
---|
460 | case 13:
|
---|
461 | $selecty="SUM(fNumThreshold5000)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
462 | $isnull="AND NOT ISNULL(fNumThreshold5000)";
|
---|
463 | $titley="Threshold 5000 Rate";
|
---|
464 | break;
|
---|
465 | case 14:
|
---|
466 | $selecty="SUM(fNumThreshold10000)/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
467 | $isnull="AND NOT ISNULL(fNumThreshold10000)";
|
---|
468 | $titley="Threshold 10000 Rate";
|
---|
469 | break;
|
---|
470 | case 15:
|
---|
471 | $selecty="AVG(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn-fOnTime)";
|
---|
472 | $isnull="AND NOT ISNULL(fOnTime) AND NOT ISNULL(fRunStop) AND NOT ISNULL(fRunStart) AND NOT fRunStop='0000-00-00 00:00:00' AND NOT fRunStart='0000-00-00 00:00:00'";
|
---|
473 | $titley="Ontime difference";
|
---|
474 | $sqlhaving.="AND y>0";
|
---|
475 | $unity="[s]";
|
---|
476 | break;
|
---|
477 | case 26:
|
---|
478 | $selecty="AVG(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn-fOnTimeAfterCuts)";
|
---|
479 | $isnull="AND NOT ISNULL(fOnTime) AND NOT ISNULL(fOnTimeAfterCuts) AND NOT ISNULL(fRunStop) AND NOT ISNULL(fRunStart) AND NOT fRunStop='0000-00-00 00:00:00' AND NOT fRunStart='0000-00-00 00:00:00'";
|
---|
480 | $titley="Calculated ontime minus ontime after cuts";
|
---|
481 | $unity="[s]";
|
---|
482 | break;
|
---|
483 | case 27:
|
---|
484 | $selecty="AVG(fOnTime-fOnTimeAfterCuts)";
|
---|
485 | $isnull="AND NOT ISNULL(fOnTime) AND NOT ISNULL(fOnTimeAfterCuts) AND NOT ISNULL(fRunStop) AND NOT ISNULL(fRunStart) AND NOT fRunStop='0000-00-00 00:00:00' AND NOT fRunStart='0000-00-00 00:00:00'";
|
---|
486 | $titley="Average difference between ontime and ontime after cuts";
|
---|
487 | $unity="[s]";
|
---|
488 | break;
|
---|
489 | case 18:
|
---|
490 | $selecty="AVG(fEffectiveOn)";
|
---|
491 | $isnull="AND NOT ISNULL(fEffectiveOn)";
|
---|
492 | $titley="Average (On time / elapsed time)";
|
---|
493 | $unity="";
|
---|
494 | $vminval=0.8;
|
---|
495 | break;
|
---|
496 | case 19:
|
---|
497 | $selecty="SUM(fOnTime)/SUM(fOnTime/fEffectiveOn)";
|
---|
498 | $isnull="AND NOT ISNULL(fOnTime) AND NOT ISNULL(fEffectiveOn)";
|
---|
499 | $titley="SUM(On time) / SUM(Elapsed time)";
|
---|
500 | $unity="";
|
---|
501 | $vminval=0.8;
|
---|
502 | break;
|
---|
503 | case 16:
|
---|
504 | $selecty="SUM(fNumThreshold750/(cos(fZenithDistanceMean*PI()/180)+0.179*pow(sin(1.89*fZenithDistanceMean*PI()/180),5)))/SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)";
|
---|
505 | $isnull="AND NOT ISNULL(fOnTime) AND NOT ISNULL(fRunStop) AND NOT ISNULL(fRunStart) AND NOT fRunStop='0000-00-00 00:00:00' AND NOT fRunStart='0000-00-00 00:00:00' AND NOT ISNULL(fZenithDistanceMean) AND NOT ISNULL(fNumThreshold750)";
|
---|
506 | $titley="Threshold 750 Rate (Zd corrected)";
|
---|
507 | break;
|
---|
508 | case 42:
|
---|
509 | $selecty="AVG(".$sql_y.")";
|
---|
510 | $isnull="AND NOT ISNULL(".$sql_y.")";
|
---|
511 | $titley="Average ".$sql_y;
|
---|
512 | $unity="";
|
---|
513 | //$vmin ="";
|
---|
514 | $histogram = 1;//$nohist ? 0 : 1;
|
---|
515 | break;
|
---|
516 | case 43:
|
---|
517 | $selecty="SUM(".$sql_y.")";
|
---|
518 | $isnull="AND NOT ISNULL(".$sql_y.")";
|
---|
519 | $titley="Sum of ".$sql_y;
|
---|
520 | $unity="";
|
---|
521 | //$vmin ="";
|
---|
522 | $histogram = 1;//$nohist ? 0 : 1;
|
---|
523 | break;
|
---|
524 | case 44:
|
---|
525 | $selecty=$sql_y;
|
---|
526 | $titley=$sql_y;
|
---|
527 | $unity="";
|
---|
528 | //$vmin ="";
|
---|
529 | $histogram = 1;//$nohist ? 0 : 1;
|
---|
530 | break;
|
---|
531 | case 45:
|
---|
532 | $selecty="COUNT(".(empty($sql_y)?"*":$sql_y).")";
|
---|
533 | $titley="Counts";
|
---|
534 | $unity="";
|
---|
535 | //$vmin ="";
|
---|
536 | $histogram = 1;//$nohist ? 0 : 1;
|
---|
537 | break;
|
---|
538 | case 46:
|
---|
539 | $selecty="LOG10(COUNT(".(empty($sql_y)?"*":$sql_y)."))";
|
---|
540 | $titley="log10(Counts)";
|
---|
541 | $unity="";
|
---|
542 | //$vmin ="";
|
---|
543 | $histogram = 1;//$nohist ? 0 : 1;
|
---|
544 | break;
|
---|
545 | default:
|
---|
546 | $selecty="AVG(fTriggerRateMedian)";
|
---|
547 | $isnull="AND NOT ISNULL(fNumExcEvts) AND NOT ISNULL(fNumBgEvts) AND NOT ISNULL(fNumSigEvts)";
|
---|
548 | $titley="TriggerRate";
|
---|
549 | break;
|
---|
550 | }
|
---|
551 |
|
---|
552 | // --------------------------------------------------------------------
|
---|
553 | /*
|
---|
554 | SELECT
|
---|
555 | o.night,
|
---|
556 | MIN(o.start),
|
---|
557 | MAX(o.stop),
|
---|
558 | SUM(o.sigevts),
|
---|
559 | SUM(o.bgevts),
|
---|
560 | ROUND(SUM(o.ot)/60.,1)
|
---|
561 | FROM
|
---|
562 | (
|
---|
563 | SELECT
|
---|
564 | fNight,
|
---|
565 | fRunID,
|
---|
566 | fOnTimeAfterCuts AS ot,
|
---|
567 | fRunStart AS start,
|
---|
568 | fRunStop AS stop,
|
---|
569 | fNumSigEvts AS sigevts,
|
---|
570 | fNumBgEvts AS bgevts,
|
---|
571 | if (
|
---|
572 | @night=fNight AND FLOOR((@os+fOnTimeAfterCuts)/20./60.)<1,
|
---|
573 | @bl,
|
---|
574 | @bl := @bl + 1
|
---|
575 | ) as block,
|
---|
576 | if (
|
---|
577 | @night=fNight AND FLOOR((@os+fOnTimeAfterCuts)/20./60.)<1,
|
---|
578 | @os := @os + fOnTimeAfterCuts,
|
---|
579 | @os := fOnTimeAfterCuts
|
---|
580 | ) as os,
|
---|
581 | @os/20./60. AS a,
|
---|
582 | FLOOR(@os/20./60.) AS b,
|
---|
583 | @night := fNight AS night
|
---|
584 | FROM RunInfo
|
---|
585 | LEFT JOIN AnalysisResultsRunLP USING(fNight,fRunID)
|
---|
586 | CROSS JOIN
|
---|
587 | (
|
---|
588 | SELECT
|
---|
589 | @night := 0,
|
---|
590 | @os := 0,
|
---|
591 | @bl := 0
|
---|
592 | ) PARAMS
|
---|
593 | WHERE
|
---|
594 | fNight BETWEEN 20130414 AND 20130415
|
---|
595 | AND fRunTypeKey=1
|
---|
596 | AND fSourceKey=1
|
---|
597 | ) o
|
---|
598 |
|
---|
599 | GROUP BY block
|
---|
600 | */
|
---|
601 |
|
---|
602 | // --------------------------------------------------------------------
|
---|
603 |
|
---|
604 | $query0 = <<<EOT
|
---|
605 |
|
---|
606 | SELECT
|
---|
607 | ($selectx) AS x,
|
---|
608 | ($selecty) AS y,
|
---|
609 | (SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn)/60) AS ontime,
|
---|
610 | ($selecterr) AS e,
|
---|
611 | (LIMA(SUM(fNumSigEvts), SUM(fNumBgEvts))) AS s,
|
---|
612 | (MIN(fRunStart)) as start,
|
---|
613 | (MAX(fRunStop)) as stop,
|
---|
614 | (MIN(fZenithDistanceMin)) as zdmin,
|
---|
615 | (MAX(fZenithDistanceMax)) as zdmax,
|
---|
616 | (MIN(fAzimuthMin)) as azmin,
|
---|
617 | (MAX(fAzimuthMax)) as azmax,
|
---|
618 | (MIN(fThresholdMinSet)) as thmin,
|
---|
619 | (MAX(fThresholdMInSet)) as thmax
|
---|
620 | FROM RunInfo
|
---|
621 | LEFT JOIN AnalysisResultsRun$table USING(fNight,fRunID)
|
---|
622 | WHERE
|
---|
623 | fRunTypeKey=1 $sqlsource
|
---|
624 | $sqlbegin $sqlend
|
---|
625 | $isnull
|
---|
626 | $good
|
---|
627 | $sqlcut
|
---|
628 | GROUP BY x
|
---|
629 | HAVING
|
---|
630 | (ontime>$mintime)
|
---|
631 | $sqlhaving
|
---|
632 |
|
---|
633 | EOT;
|
---|
634 | /*
|
---|
635 | # SUM(fNumExcEvts)/SUM(fOnTimeAfterCuts)*3600 AS y,
|
---|
636 | AND NOT ISNULL(fNumSigEvts)
|
---|
637 | AND NOT ISNULL(fNumExcEvts)
|
---|
638 | AND NOT ISNULL(fNumBgEvts)
|
---|
639 | */
|
---|
640 |
|
---|
641 | $var0 = "";
|
---|
642 | $error0 = "";
|
---|
643 | $data = "<table id='list'>\n <tr><th>X</th><th>Y</th><th>E</th><th>OnTime</th><th>Start</th><th>Stop</th><th>Zdmin</th><th>Zdmax</th><th>Azmin</th><th>Azmax</th><th>THmin</th><th>THmax</th></tr>\n";
|
---|
644 |
|
---|
645 | $timeStart = microtime(true);
|
---|
646 | $result0 = $db->connect_error ? FALSE : $db->query($query0);
|
---|
647 | $timeMeasured = number_format((microtime(true)-$timeStart)*1000, 2, ".", "");
|
---|
648 | if ($result0)
|
---|
649 | {
|
---|
650 | while ($row = $result0->fetch_assoc())
|
---|
651 | {
|
---|
652 | $data .= " <tr><td>".$row['x']."</td><td>".$row['y']."</td><td>".$row['e']."</td><td>".$row['ontime']."</td><td>".$row['start']."</td><td>".$row['stop']."</td><td>".$row['zdmin']."</td><td>".$row['zdmax']."</td><td>".$row['azmin']."</td><td>".$row['azmax']."</td><td>".$row['thmin']."</td><td>".$row['thmax']."</td></tr>\n";
|
---|
653 |
|
---|
654 | switch ($group)
|
---|
655 | {
|
---|
656 | case 3: // Year
|
---|
657 | $x = "new Date('".$row['x']."-07-01')";
|
---|
658 | $xtext = $titlex." ".$row['x'];
|
---|
659 | break;
|
---|
660 | case 9: // Month
|
---|
661 | $x = "new Date('2000-".$row['x']."-15')";
|
---|
662 | $xtext = $titlex." ".$row['x'];
|
---|
663 | break;
|
---|
664 | case 2: // Night
|
---|
665 | case 4: // Season
|
---|
666 | case 5: // Run
|
---|
667 | $x = "new Date('".$row['x']."')";
|
---|
668 | $xtext = $titlex." ".$row['x'];
|
---|
669 | break;
|
---|
670 | default:
|
---|
671 | $x = $row['x'];
|
---|
672 | $xtext = $titlex." ".$row['x']." ".$unitx;
|
---|
673 | }
|
---|
674 |
|
---|
675 | $y = $row['y'];
|
---|
676 | $ymin = $row['y']-$row['e'];
|
---|
677 | $ymax = $row['y']+$row['e'];
|
---|
678 | $s = round($row['s'], 2);
|
---|
679 | $sr = round($row['s']/sqrt($row['ontime']/60), 1);
|
---|
680 | $t = round($row['ontime'], 2);
|
---|
681 | $time = $t>60 ? round($row['ontime']/60,2).' h' : round($row['ontime'],1).' min';
|
---|
682 | $start= $row['start'];
|
---|
683 | $stop = $row['stop'];
|
---|
684 | $zdmin= $row['zdmin'];
|
---|
685 | $zdmax= $row['zdmax'];
|
---|
686 | $azmin= $row['azmin'];
|
---|
687 | $azmax= $row['azmax'];
|
---|
688 | $thmin= $row['thmin'];
|
---|
689 | $thmax= $row['thmax'];
|
---|
690 |
|
---|
691 | // <entry>
|
---|
692 | $var0 .= "[";
|
---|
693 | $var0 .= $x.",";
|
---|
694 | $var0 .= $y.",";
|
---|
695 |
|
---|
696 | if ($histogram==1 && !$nohist)
|
---|
697 | $var0 .= $y.",0,0,";
|
---|
698 |
|
---|
699 | if ($errors==1)
|
---|
700 | {
|
---|
701 | $var0 .= $y.",";
|
---|
702 | $var0 .= $ymin.",";
|
---|
703 | $var0 .= $ymax.",";
|
---|
704 | }
|
---|
705 |
|
---|
706 | // <tooltip>
|
---|
707 | $var0 .= "'<p>".addslashes($xtext);
|
---|
708 |
|
---|
709 | if ($errors==1)
|
---|
710 | {
|
---|
711 | $var0 .= "<p>".round($y,1)." ± ".round($row['e'],1);
|
---|
712 | $var0 .= "<p>".$s." σ";
|
---|
713 | $var0 .= "<p>".$sr." σ/√h";
|
---|
714 | }
|
---|
715 | else
|
---|
716 | $var0 .= "<p>".round($y,3);
|
---|
717 |
|
---|
718 | $var0 .= "<p>".$time;
|
---|
719 | $var0 .= "<p>".$start." – ".$stop;
|
---|
720 | $var0 .= "<p>Zd=[".$zdmin.";".$zdmax."] Az=[".$azmin.";".$azmax."]";
|
---|
721 | $var0 .= "<p>TH=[".$thmin.";".$thmax."]";
|
---|
722 | $var0 .= "'";
|
---|
723 | // </tooltip>
|
---|
724 |
|
---|
725 | $var0 .= "],\n";
|
---|
726 | // </entry>
|
---|
727 | }
|
---|
728 |
|
---|
729 | $result0->free();
|
---|
730 | }
|
---|
731 | else
|
---|
732 | {
|
---|
733 | $error0 .= $db->error;
|
---|
734 | }
|
---|
735 |
|
---|
736 | // --------------------------------------------------------------------
|
---|
737 |
|
---|
738 | if (!isset($_GET['list']) && !isset($_GET['list-only']))
|
---|
739 | $data="";
|
---|
740 | else
|
---|
741 | $data.="</table>\n<hr>\n";
|
---|
742 |
|
---|
743 | $querycol0 = colorize($query0);
|
---|
744 | $querycol1 = colorize($query1);
|
---|
745 | $errorcol_con = !empty($error_con) ? colorize($error_con) : "";
|
---|
746 | $errorcol2 = !empty($error2) ? colorize($error2) ."\n\n".$querycol2 : "";
|
---|
747 | $errorcol1 = !empty($error1) ? colorize($error1) ."\n\n".$querycol1 : "";
|
---|
748 | $errorcol0 = !empty($error0) ? colorize($error0) ."\n\n".$querycol0 : "";
|
---|
749 | $has_error = empty($error_con) && empty($error0) && empty($error1) && empty($error2) ? 0 : 1;
|
---|
750 |
|
---|
751 | $intervalStyle = $histogram==1 && !$nohist ? 'boxes' : 'bars';
|
---|
752 | $pointSize = $histogram==1 && !$nohist ? 'pointSize:0,' : '';
|
---|
753 | $boxWidth = $histogram==1 && !$nohist ? 1.6 : 0;
|
---|
754 |
|
---|
755 | // boxWidth: Could be used as x error bar for equidistant points
|
---|
756 |
|
---|
757 |
|
---|
758 | $uri = $_SERVER['REQUEST_URI'];
|
---|
759 | $pos = strpos($uri, '?');
|
---|
760 | $arg = $pos===FALSE ? "" : substr($uri, $pos+1);
|
---|
761 | $uri = $pos===FALSE ? $uri : substr($uri, 0, $pos);
|
---|
762 | $min = isset($_GET["min"]) ? intval($_GET["min"]) : "";
|
---|
763 | $max = isset($_GET["max"]) ? intval($_GET["max"]) : "";
|
---|
764 | $listonly = isset($_GET["list-only"]) ? 1 : 0;
|
---|
765 |
|
---|
766 | $hiddenBeg = isset($_GET['bx']) ? $_GET['bx'] : "";
|
---|
767 | $hiddenEnd = isset($_GET['ex']) ? $_GET['ex'] : "";
|
---|
768 |
|
---|
769 | $hiddenInput ="";
|
---|
770 | if (isset($_GET["t"]))
|
---|
771 | $hiddenInput .= "<input type='hidden' name='t' value='".$_GET["t"]."'>\n";
|
---|
772 | if (isset($_GET["db"]))
|
---|
773 | $hiddenInput .= "<input type='hidden' name='db' value='".$_GET["db"]."'>\n";
|
---|
774 | if (isset($_GET["good"]))
|
---|
775 | $hiddenInput .= "<input type='hidden' name='good' value='".$_GET["good"]."'>\n";
|
---|
776 |
|
---|
777 |
|
---|
778 | // --------------------------------------------------------------------
|
---|
779 | /*
|
---|
780 | $curl = curl_init();
|
---|
781 | curl_setopt($curl, CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$uri);
|
---|
782 | curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
|
---|
783 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
|
---|
784 | $tinyurl = curl_exec($curl);
|
---|
785 | curl_close($curl);
|
---|
786 | */
|
---|
787 |
|
---|
788 | // --------------------------------------------------------------------
|
---|
789 |
|
---|
790 | /*
|
---|
791 | [9:51:32 PM] Lamouette: mysql> explain ShortURL;
|
---|
792 | +----------+------------------+------+-----+-------------------+-----------------------------+
|
---|
793 | | Field | Type | Null | Key | Default | Extra |
|
---|
794 | +----------+------------------+------+-----+-------------------+-----------------------------+
|
---|
795 | | Key | int(10) unsigned | NO | PRI | NULL | auto_increment |
|
---|
796 | | URL | varchar(1024) | NO | | NULL | |
|
---|
797 | | UserName | varchar(50) | NO | | NULL | |
|
---|
798 | | LastUpd | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
|
---|
799 | +----------+------------------+------+-----+-------------------+-----------------------------+
|
---|
800 | 4 rows in set (0.00 sec)
|
---|
801 | */
|
---|
802 |
|
---|
803 | /*
|
---|
804 | */
|
---|
805 |
|
---|
806 |
|
---|
807 | $tinyurl = "";
|
---|
808 | if ($has_error==0 && strlen($arg)>16 && empty($print) && !$db->connect_error)
|
---|
809 | {
|
---|
810 | $query2 = "INSERT INTO ShortURL.ShortURL (URL) VALUES ('".$arg."') ON DUPLICATE KEY UPDATE `Key`=LAST_INSERT_ID(`Key`) ";
|
---|
811 | if ($result2 = $db->query($query2))
|
---|
812 | {
|
---|
813 | $tiny = $_SERVER['HTTP_HOST'].$uri."?short=".base62_encode($db->insert_id);
|
---|
814 | $tinyurl = "<tt style='padding:2px;background:#eef;'>Short URL: <A HREF=//".$tiny.">".$tiny."</A></tt>";
|
---|
815 | }
|
---|
816 | }
|
---|
817 |
|
---|
818 | // --------------------------------------------------------------------
|
---|
819 |
|
---|
820 | echo <<<EOT
|
---|
821 |
|
---|
822 | <!DOCTYPE HTML>
|
---|
823 | <html lang="en">
|
---|
824 | <head>
|
---|
825 | <meta charset="utf-8">
|
---|
826 | <title>Database Explorer</title>
|
---|
827 | <script src="https://code.jquery.com/jquery-2.2.1.min.js" integrity="sha256-gvQgAFzTH6trSrAWoH1iPo9Xc96QxSZ3feW6kem+O00=" crossorigin="anonymous"></script>
|
---|
828 | <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js" integrity="sha256-xNjb53/rY+WmG+4L6tTl9m6PpqknWZvRt0rO1SRnJzw=" crossorigin="anonymous"></script>
|
---|
829 |
|
---|
830 | <link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
|
---|
831 |
|
---|
832 | <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
---|
833 | <script type="text/javascript">
|
---|
834 | if ($listonly==0)
|
---|
835 | {
|
---|
836 | google.charts.load('current', {packages: ['corechart']});
|
---|
837 | google.charts.setOnLoadCallback(drawAxisTickColors);
|
---|
838 | }
|
---|
839 |
|
---|
840 | $(function() {
|
---|
841 |
|
---|
842 | $(document).tooltip();
|
---|
843 |
|
---|
844 | var availableTags = [
|
---|
845 | "ABS(",
|
---|
846 | "ACOS(",
|
---|
847 | "ADDDATE(",
|
---|
848 | "ADDTIME(",
|
---|
849 | "AND ",
|
---|
850 | "ASIN(",
|
---|
851 | "ATAN(",
|
---|
852 | "ATAN2(",
|
---|
853 | "AVG(",
|
---|
854 | "CEIL(",
|
---|
855 | "CONCAT(",
|
---|
856 | "COS(",
|
---|
857 | "COUNT(",
|
---|
858 | "DATE(",
|
---|
859 | "DAY(",
|
---|
860 | "DEGREES(",
|
---|
861 | "EXCERR(",
|
---|
862 | "EXP(",
|
---|
863 | "FLOOR(",
|
---|
864 | "FROM_UNIXTIME(",
|
---|
865 | "INTERVAL ",
|
---|
866 | "ISNULL(",
|
---|
867 | "LIMA(",
|
---|
868 | "LN(",
|
---|
869 | "LOG(",
|
---|
870 | "LOG10(",
|
---|
871 | "LOG2(",
|
---|
872 | "MAX(",
|
---|
873 | "MIN(",
|
---|
874 | "MINUTE(",
|
---|
875 | "MONTH(",
|
---|
876 | "OR ",
|
---|
877 | "PI()",
|
---|
878 | "POW(",
|
---|
879 | "RADIANS(",
|
---|
880 | "RAND(",
|
---|
881 | "ROUND(",
|
---|
882 | "SIGN(",
|
---|
883 | "SIN(",
|
---|
884 | "SUM(",
|
---|
885 | "SQRT(",
|
---|
886 | "TAN(",
|
---|
887 | "TIME_TO_SEC(",
|
---|
888 | "TIMEDIFF(",
|
---|
889 | "TRUNCATE(",
|
---|
890 | "UNIX_TIMESTAMP(",
|
---|
891 | "YEAR(",
|
---|
892 | $columns
|
---|
893 | ];
|
---|
894 |
|
---|
895 | function acSource( request, response )
|
---|
896 | {
|
---|
897 | //var pos = $($(this)).get(0).selectionStart;
|
---|
898 | var pos = this.element[0].selectionStart;
|
---|
899 | var t = request.term.substr(0, pos);
|
---|
900 | var l = t.match(/\w*$/);
|
---|
901 | response( $.ui.autocomplete.filter(availableTags, String(l)));
|
---|
902 | }
|
---|
903 | function acSelect ( event, ui )
|
---|
904 | {
|
---|
905 | // $(this)[0] === this
|
---|
906 | // "this" was $($(this)).get(0)
|
---|
907 | var pos = this.selectionStart;
|
---|
908 | var idx = this.value.substr(0, pos).match(/\w*$/).index;
|
---|
909 | this.value = this.value.substr(0, idx)+ui.item.value+this.value.substr(pos);
|
---|
910 | this.selectionStart = idx+ui.item.value.length;
|
---|
911 | this.selectionEnd = idx+ui.item.value.length;
|
---|
912 | return false;
|
---|
913 | }
|
---|
914 | function acFocus(event, ui) { event.preventDefault(); return false; }
|
---|
915 |
|
---|
916 |
|
---|
917 | $( "#input_x" ).autocomplete( {source: acSource, minLength:1, select: acSelect, focus: acFocus });
|
---|
918 | $( "#input_y" ).autocomplete( {source: acSource, minLength:1, select: acSelect, focus: acFocus });
|
---|
919 | $( "#input_err").autocomplete({source: acSource, minLength:1, select: acSelect, focus: acFocus });
|
---|
920 | $( "#sql_cut" ).autocomplete( {source: acSource, minLength:1, select: acSelect, focus: acFocus });
|
---|
921 | $( "#having" ).autocomplete( {source: acSource, minLength:1, select: acSelect, focus: acFocus });
|
---|
922 |
|
---|
923 | $( "#button_submit" ).button();
|
---|
924 | $( "#button_submit" ).button({
|
---|
925 | icons: {
|
---|
926 | primary: "ui-icon-image"
|
---|
927 | },
|
---|
928 | text: true
|
---|
929 | });
|
---|
930 |
|
---|
931 | $("#input_x").prop('disabled', $group!=42);
|
---|
932 |
|
---|
933 | $( "#select_x" ).selectmenu({
|
---|
934 | change: function( event, data ) {
|
---|
935 | console.log(JSON.stringify(data));
|
---|
936 | $("#input_x").prop('disabled', data.item.value!=42);
|
---|
937 | $("#width").spinner(data.item.value!=42 && data.item.value!=7 && data.item.value!=8 ? "disable" : "enable");
|
---|
938 | $("#offset").spinner(data.item.value!=42 && data.item.value!=7 && data.item.value!=8 ? "disable" : "enable");
|
---|
939 | $("#nohist").prop('disabled', data.item.value<42);
|
---|
940 | }
|
---|
941 | });
|
---|
942 |
|
---|
943 | $( "#select_y" ).selectmenu({
|
---|
944 | change: function( event, data ) {
|
---|
945 | console.log(JSON.stringify(data));
|
---|
946 | $("#input_y").prop('disabled', data.item.value<42);
|
---|
947 | $("#input_err").prop('disabled', data.item.value<42);
|
---|
948 | //$("#noerr").prop('disabled', data.item.value<42);
|
---|
949 | }
|
---|
950 | });
|
---|
951 |
|
---|
952 | $( "#source" ).selectmenu();
|
---|
953 | $( "#table" ).selectmenu();
|
---|
954 |
|
---|
955 | $("#input_y").prop('disabled', $rate<42);
|
---|
956 | $("#input_err").prop('disabled', $rate<42);
|
---|
957 |
|
---|
958 | $('#select_x').val($group).selectmenu("refresh");
|
---|
959 | $('#select_y').val($rate).selectmenu("refresh");
|
---|
960 | $('#source').val($source).selectmenu("refresh");
|
---|
961 | $('#table').val('$table').selectmenu("refresh");
|
---|
962 | $('#sql_cut').val("$cut");
|
---|
963 | $('#input_x').val("$sql_x");
|
---|
964 | $('#input_y').val("$sql_y");
|
---|
965 | $('#input_err').val("$sql_err");
|
---|
966 | $('#having').val("$having");
|
---|
967 |
|
---|
968 | $( "#date_beg" ).datepicker();
|
---|
969 | $( "#date_end" ).datepicker();
|
---|
970 |
|
---|
971 | var date_opt =
|
---|
972 | {
|
---|
973 | dateFormat: 'yy-mm-dd',
|
---|
974 | minDate: '2011-10-10',
|
---|
975 | maxDate: '+1',
|
---|
976 | showButtonPanel: true,
|
---|
977 | showOtherMonths: true,
|
---|
978 | selectOtherMonths: true,
|
---|
979 | changeYear: true,
|
---|
980 | autoSize: true,
|
---|
981 | /*inline: true,*/
|
---|
982 | }
|
---|
983 |
|
---|
984 | $( "#width" ).val($width);
|
---|
985 | $( "#offset" ).val($offset);
|
---|
986 | $('#min').val($min);
|
---|
987 | $('#max').val($max);
|
---|
988 | $('#ontime').val($mintime);
|
---|
989 |
|
---|
990 | $( "#width" ).spinner();
|
---|
991 | $( "#offset" ).spinner();
|
---|
992 | $( '#min' ).spinner();
|
---|
993 | $( '#max' ).spinner();
|
---|
994 | $( '#ontime' ).spinner();
|
---|
995 |
|
---|
996 | $("#offset").spinner($group!=42 && $group!=6 && $group!=7 && $group!=8 ? "disable" : "enable");
|
---|
997 | $("#width").spinner( $group!=42 && $group!=6 && $group!=7 && $group!=8 ? "disable" : "enable");
|
---|
998 | $("#width").spinner('option', { min: 0} );
|
---|
999 |
|
---|
1000 | $('#min').spinner("$min"=="" ? "disable" : "enable");
|
---|
1001 | $('#max').spinner("$max"=="" ? "disable" : "enable");
|
---|
1002 | $('#ontime').spinner("$ontime"=="-1" ? "disable" : "enable");
|
---|
1003 |
|
---|
1004 | $( "#enable_min" ).prop('checked', "$min"!="");
|
---|
1005 | $( "#enable_max" ).prop('checked', "$max"!="");
|
---|
1006 | $( "#enable_ontime" ).prop('checked', "$ontime"!="-1");
|
---|
1007 |
|
---|
1008 | if ($has_error)
|
---|
1009 | {
|
---|
1010 | $( "#shorturl" ).hide();
|
---|
1011 | $( "#chart_area" ).hide();
|
---|
1012 | $( "#error" ).show();
|
---|
1013 | }
|
---|
1014 |
|
---|
1015 | $( "#date_beg" ).datepicker('option', 'disabled', "$begin"=="");
|
---|
1016 | $( "#date_end" ).datepicker('option', 'disabled', "$end"=="");
|
---|
1017 |
|
---|
1018 | $( "#date_beg" ).datepicker('option', date_opt);
|
---|
1019 | $( "#date_end" ).datepicker('option', date_opt);
|
---|
1020 |
|
---|
1021 | $( "#date_beg" ).datepicker("setDate", "$begin"=="" ? "2011-10-10" : "$begin");
|
---|
1022 | $( "#date_end" ).datepicker("setDate", "$end"=="" ? "+1d" : "$end");
|
---|
1023 |
|
---|
1024 | $( "#enable_beg" ).prop('checked', "$begin"!="");
|
---|
1025 | $( "#enable_end" ).prop('checked', "$end"!="");
|
---|
1026 |
|
---|
1027 | $( "#date_beg" ).datepicker('option', 'altField', '#hidden_beg');
|
---|
1028 | $( "#date_end" ).datepicker('option', 'altField', '#hidden_end');
|
---|
1029 |
|
---|
1030 | $( "#nohist" ).prop('checked', $nohist==1);
|
---|
1031 | $( "#noerr" ).prop('checked', $noerr==1);
|
---|
1032 |
|
---|
1033 | $( "#enable_beg" ).change(function(event,data) { $("#date_beg").datepicker('option', 'disabled', !$(this).prop('checked') ); } );
|
---|
1034 | $( "#enable_end" ).change(function(event,data) { $("#date_end").datepicker('option', 'disabled', !$(this).prop('checked') ); } );
|
---|
1035 | $( "#enable_min" ).change(function(event,data) { $("#min").spinner('option', 'disabled', !$(this).prop('checked') ); } );
|
---|
1036 | $( "#enable_max" ).change(function(event,data) { $("#max").spinner('option', 'disabled', !$(this).prop('checked') ); } );
|
---|
1037 | $( "#enable_ontime" ).change(function(event,data) { $("#ontime").spinner('option', 'disabled', !$(this).prop('checked') ); } );
|
---|
1038 |
|
---|
1039 | $( "#nohist" ).prop('disabled', !$histogram);
|
---|
1040 | //$( "#noerr" ).prop('disabled', $histogram);
|
---|
1041 |
|
---|
1042 | if ($listonly==1)
|
---|
1043 | $( "#chart_area" ).hide();
|
---|
1044 | });
|
---|
1045 |
|
---|
1046 | /*
|
---|
1047 | alert(
|
---|
1048 | (new Date("2012-10-10"))+"\\n"+ // 2h +0200
|
---|
1049 | (new Date(2012,10-1,10))+"\\n"+ // 0h +0200
|
---|
1050 | (new Date("2012-10-10 03:00:00"))+"\\n"+ // 3h +0200
|
---|
1051 | (new Date("2012-10-10 03:00:00 UTC"))+"\\n"+ // 5h +0200
|
---|
1052 | (new Date("2012-10-10 03:00:00 +0000"))+"\\n"+ // 5h +0200
|
---|
1053 | (new Date(2012,10-1,10,3,0,0)) // 3h +0200
|
---|
1054 | );
|
---|
1055 | */
|
---|
1056 |
|
---|
1057 | function drawAxisTickColors()
|
---|
1058 | {
|
---|
1059 | var data = new google.visualization.DataTable();
|
---|
1060 | try
|
---|
1061 | {
|
---|
1062 | data.addColumn('$axistype', 'x');
|
---|
1063 | data.addColumn('number', 'excessrate');
|
---|
1064 | if ($errors==1 || ($histogram==1 && $nohist==0))
|
---|
1065 | {
|
---|
1066 | data.addColumn({id:'val', type:'number', role:'interval'});
|
---|
1067 | data.addColumn({id:'min', type:'number', role:'interval'});
|
---|
1068 | data.addColumn({id:'max', type:'number', role:'interval'});
|
---|
1069 | }
|
---|
1070 | data.addColumn({id:'tooltip', type:'string', role:'tooltip', p:{html:true}});
|
---|
1071 | data.addRows([
|
---|
1072 | $var0
|
---|
1073 | ]);
|
---|
1074 | }
|
---|
1075 | catch (e)
|
---|
1076 | {
|
---|
1077 | $( "#error" ).html(e);
|
---|
1078 | $( "#shorturl" ).hide();
|
---|
1079 | $( "#chart_area" ).hide();
|
---|
1080 | $( "#error" ).show();
|
---|
1081 | return;
|
---|
1082 | }
|
---|
1083 |
|
---|
1084 | var options = {
|
---|
1085 | tooltip: {isHtml: true},
|
---|
1086 | lineWidth: 0,
|
---|
1087 | title: "$titley vs $titlex [$sourcename]",
|
---|
1088 | height: 400,
|
---|
1089 | width:'90%',
|
---|
1090 | hAxis: {
|
---|
1091 | title: '$titlex $unitx',
|
---|
1092 | gridlines: {
|
---|
1093 | //count: "-1",
|
---|
1094 | units: {
|
---|
1095 | months: { format: [ "MMM" ] },
|
---|
1096 | minutes: { format: [ "HH:mm" ] },
|
---|
1097 | hours: { format: [ "MM/dd HH:mm" ] }, // MM/dd HH:mm
|
---|
1098 | days: { format: [ "MM/dd" ] } // yyyy/MM/dd
|
---|
1099 | },
|
---|
1100 | },
|
---|
1101 | minorGridlines: {
|
---|
1102 | units: {
|
---|
1103 | hours: { format: [ "HH" ] },
|
---|
1104 | //days: { format: [ "dd" ] },
|
---|
1105 | }
|
---|
1106 | },
|
---|
1107 | },
|
---|
1108 | vAxis: {
|
---|
1109 | title: '$titley $unity',
|
---|
1110 | $vmin
|
---|
1111 | $vmax
|
---|
1112 | //chartArea: {left:60,top:40,bottom:40,width:'90%'},
|
---|
1113 | },
|
---|
1114 | legend: 'none',
|
---|
1115 | $pointSize
|
---|
1116 | intervals: {
|
---|
1117 | // Normal error bars
|
---|
1118 | style: '$intervalStyle',
|
---|
1119 | barWidth: 0.5,
|
---|
1120 | lineWidth: 1,
|
---|
1121 | boxWidth: $boxWidth,
|
---|
1122 | },
|
---|
1123 | interval: {
|
---|
1124 | val: {
|
---|
1125 | style: 'boxes',
|
---|
1126 | fillOpacity: 0.5,
|
---|
1127 | color: '#BBB'
|
---|
1128 | },
|
---|
1129 | },
|
---|
1130 | explorer: {
|
---|
1131 | keepInBound:true,
|
---|
1132 | actions:['dragToZoom','rightClickToReset'],
|
---|
1133 | maxZoomIn: 0.000001,
|
---|
1134 | },
|
---|
1135 | };
|
---|
1136 |
|
---|
1137 | var chart0 = new google.visualization.ScatterChart(document.getElementById('chart_div'));
|
---|
1138 | chart0.draw(data, options);
|
---|
1139 | document.getElementById('print_chart').innerHTML = '<a href="' + chart0.getImageURI() + '">Print</a>';
|
---|
1140 |
|
---|
1141 | console.log("Google.chart.ready");
|
---|
1142 | }
|
---|
1143 | </script>
|
---|
1144 | <style>
|
---|
1145 | $hidden
|
---|
1146 |
|
---|
1147 | /* Configration of jQuery UI */
|
---|
1148 | span.ui-selectmenu-text { padding: 0 5px 0 5px !important; }
|
---|
1149 | .hasDatepicker { padding: 0 5px 0 5px !important; }
|
---|
1150 | .ui-widget { font-size:16px;}
|
---|
1151 | span.ui-button-text { padding-top: 3px !important; padding-bottom: 3px !important; }
|
---|
1152 | // span.ui-button-text { text-color: black !important; }
|
---|
1153 |
|
---|
1154 | /* Configuration for debug table */
|
---|
1155 | table { color: #333; font-family: Helvetica, Arial, sans-serif; width: 640px; border-collapse: collapse; border-spacing: 0; }
|
---|
1156 | td, th { border: 2px solid white; transition: all 0.3s; white-space: nowrap; padding: 3px; }
|
---|
1157 | #list th { background: #DFDFDF; font-weight: bold; }
|
---|
1158 | #list td { background: #FAFAFA; text-align: center; }
|
---|
1159 | #list tr:nth-child(even) td { background: #F1F1F1; }
|
---|
1160 | #list tr:nth-child(odd) td { background: #FEFEFE; }
|
---|
1161 | #list tr td:hover { background: #666; color: #FFF; }
|
---|
1162 |
|
---|
1163 | /* Configuration for tooltip */
|
---|
1164 | div.google-visualization-tooltip { font-family: Sans; font-size: 12px; }
|
---|
1165 | div.google-visualization-tooltip p { margin-top: 0px; margin: 0.5ex 1ex 0.5ex 1ex; }
|
---|
1166 | div.google-visualization-tooltip p:nth-child(1) { color: blue; font-weight: bold; font-style: italic; }
|
---|
1167 | div.google-visualization-tooltip p:nth-child(2) { font-weight: bold; }
|
---|
1168 | div.google-visualization-tooltip p:last-child { font-style: italic; }
|
---|
1169 |
|
---|
1170 | </style>
|
---|
1171 | </head>
|
---|
1172 |
|
---|
1173 | <body>
|
---|
1174 |
|
---|
1175 | <div class="ui-widget">
|
---|
1176 | <form action="#">
|
---|
1177 |
|
---|
1178 | <fieldset>
|
---|
1179 | <label for="enbale_beg">From</label>
|
---|
1180 | <input type="checkbox" id="enable_beg" title="Enable a lower date limit">
|
---|
1181 | <input type="text" name="b" id="date_beg">
|
---|
1182 | <!--<input type="hidden" name="bx" id="hidden_beg">-->
|
---|
1183 |
|
---|
1184 | <label for="enbale_end">To</label>
|
---|
1185 | <input type="checkbox" id="enable_end" title="Enable an upper date limit">
|
---|
1186 | <input type="text" name="e" id="date_end">
|
---|
1187 | <!--<input type="hidden" name="ex" id="hidden_end">-->
|
---|
1188 |
|
---|
1189 | <label for="width" title="Width of the range in which data is grouped together">Bin width:</label>
|
---|
1190 | <input id="width" name="w" style="width:4em">
|
---|
1191 |
|
---|
1192 | <label for="offset" title="Normally binning starts at 0. This allows an artificial shift of the bins.">Bin shift:</label>
|
---|
1193 | <input id="offset" name="o" style="width:5em">
|
---|
1194 |
|
---|
1195 | <label for="nohist">Nohist:</label>
|
---|
1196 | <input type="checkbox" id="nohist" name ="no-hist" title="Disable display as histogram">
|
---|
1197 |
|
---|
1198 | <label for="noerr">Noerr:</label>
|
---|
1199 | <input type="checkbox" id="noerr" name="no-errors" title="Disable error bars">
|
---|
1200 |
|
---|
1201 | <p style="margin-top: 16px">
|
---|
1202 |
|
---|
1203 | <label for="select_x">Select x</label>
|
---|
1204 | <select name="g" id="select_x">
|
---|
1205 | <optgroup label="User defined">
|
---|
1206 | <option value="42">User defined</option>
|
---|
1207 | </optgroup>
|
---|
1208 | <optgroup label="By time">
|
---|
1209 | <option value="5">Run</option>
|
---|
1210 | <option value="2">Night</option>
|
---|
1211 | <option value="1">Period</option>
|
---|
1212 | <option value="4">Season</option>
|
---|
1213 | <option value="9">Month</option>
|
---|
1214 | <option value="3">Year</option>
|
---|
1215 | </optgroup>
|
---|
1216 | <optgroup label="Pre defined">
|
---|
1217 | <option value="6">Zenith angle</option>
|
---|
1218 | <option value="7">Threshold</option>
|
---|
1219 | <option value="8">Current</option>
|
---|
1220 | </optgroup>
|
---|
1221 | </select>
|
---|
1222 |
|
---|
1223 | <label for="select_y">Select y</label>
|
---|
1224 | <select name="r" id="select_y">
|
---|
1225 | <optgroup label="User defined">
|
---|
1226 | <option value="44">User defined</option>
|
---|
1227 | </optgroup>
|
---|
1228 | <optgroup label="Pre defined">
|
---|
1229 | <option value="45">Counts</option>
|
---|
1230 | <option value="46">log10(Counts)</option>
|
---|
1231 | <option value="43">Sum</option>
|
---|
1232 | <option value="42">Average</option>
|
---|
1233 | </optgroup>
|
---|
1234 | <optgroup label="Light curves">
|
---|
1235 | <option value="6">Excess rate</option>
|
---|
1236 | <option value="31">Corrected excess rate (Zd/TH)</option>
|
---|
1237 | <option value="32">Flux [CU]</option>
|
---|
1238 | <option value="33">Flux [10^-11/cm2/s]</option>
|
---|
1239 | </optgroup>
|
---|
1240 | <optgroup label="Analysis event rates [Eff. ontime]">
|
---|
1241 | <option value="5">Background rate</option>
|
---|
1242 | <option value="17">Signal rate</option>
|
---|
1243 | <option value="6">Excess rate</option>
|
---|
1244 | </optgroup>
|
---|
1245 | <optgroup label="Raw event rates [Eff. ontime]">
|
---|
1246 | <option value="21">Physics trigger</option>
|
---|
1247 | <option value="22">Physics trigger minus 27s events</option>
|
---|
1248 | <option value="2">Events after cleaning</option>
|
---|
1249 | <option value="23">Events after cleaning minus 27s events</option>
|
---|
1250 | <option value="3">Events after quality cuts</option>
|
---|
1251 | <option value="4">Events after background cuts</option>
|
---|
1252 | <option value="6">Excess events</option>
|
---|
1253 | </optgroup>
|
---|
1254 |
|
---|
1255 | <!--
|
---|
1256 | <optgroup label="Corrected [Zd/TH] event rates [Eff. ontime]">
|
---|
1257 | <option value="20">Events after cleaning minus 27s events</option>
|
---|
1258 | <option value="24">Events after background cuts</option>
|
---|
1259 | <option value="25">Events after quality cuts</option>
|
---|
1260 | <option value="16">Artifical trigger TH750</option>
|
---|
1261 | </optgroup>
|
---|
1262 | -->
|
---|
1263 | <optgroup label="Artificial trigger rates [Eff. ontime]">
|
---|
1264 | <option value="7">27s events</option>
|
---|
1265 | <option value="8">TH500</option>
|
---|
1266 | <option value="9">TH750</option>
|
---|
1267 | <option value="10">TH1000</option>
|
---|
1268 | <option value="11">TH1250</option>
|
---|
1269 | <option value="12">TH2500</option>
|
---|
1270 | <option value="13">TH5000</option>
|
---|
1271 | <option value="14">TH10000</option>
|
---|
1272 | </optgroup>
|
---|
1273 |
|
---|
1274 | <optgroup label="On time comparison">
|
---|
1275 | <option value="15">Avg Eff. ontime minus Stop-Start time</option>
|
---|
1276 | <option value="26">Avg Eff. ontime minus OnTimeAfterCuts</option>
|
---|
1277 | <option value="27">Avg Stop-Start time minus OnTimeAfterCuts</option>
|
---|
1278 | <option value="18">Avg FTM effective on time</option>
|
---|
1279 | <option value="19">Sum(FTM ontime) / Sum(FTM elapsed time)</option>
|
---|
1280 | </optgroup>
|
---|
1281 |
|
---|
1282 | <!--
|
---|
1283 | <optgroup label="Others">
|
---|
1284 | <option value="28">Excess rate correction factor (fNumEvtsAfterBgCuts / PRELIMINARY)</option>
|
---|
1285 | <option value="29">Excess rate correction factor (fNumEvtsAfterQualCuts / PRELIMINARY)</option>
|
---|
1286 | <option value="30">Excess rate correction factor (fNumExcEvts / PRELIMINARY)</option>
|
---|
1287 | </optgroup>
|
---|
1288 | -->
|
---|
1289 | </select>
|
---|
1290 |
|
---|
1291 | <label for="source">Source</label>
|
---|
1292 | <select name="s" id="source">
|
---|
1293 | <optgroup label="All data">
|
---|
1294 | <option value="0">All data</option>
|
---|
1295 | </optgroup>
|
---|
1296 | <optgroup label="Sources">
|
---|
1297 | $sourceoptions
|
---|
1298 | </optgroup>
|
---|
1299 | </select>
|
---|
1300 |
|
---|
1301 | <label for="table">Analysis</label>
|
---|
1302 | <select name="t" id="table">
|
---|
1303 | <optgroup label="Online Analysis">
|
---|
1304 | <option value="LP">QLA</option>
|
---|
1305 | </optgroup>
|
---|
1306 | <optgroup label="Offline Analyses">
|
---|
1307 | <option value="ISDC">ISDC</option>
|
---|
1308 | <option value="CutsLC">CutsLC</option>
|
---|
1309 | </optgroup>
|
---|
1310 | </select>
|
---|
1311 |
|
---|
1312 | <table style='width:100%'>
|
---|
1313 | <tr>
|
---|
1314 | <td align="right" width="1%">
|
---|
1315 | <label for="input_x">X: </label>
|
---|
1316 | </td>
|
---|
1317 | <td>
|
---|
1318 | <!--<input id="input_x" name="x" style="width:100%">-->
|
---|
1319 | <textarea id="input_x" name="x" style="width:100%" rows="1" maxlength="10000" wrap="soft"></textarea>
|
---|
1320 | </td>
|
---|
1321 | </tr>
|
---|
1322 | <tr>
|
---|
1323 | <td align="right" width="1%">
|
---|
1324 | <label for="input_y">Y: </label>
|
---|
1325 | </td>
|
---|
1326 | <td>
|
---|
1327 | <!--<input id="input_y" name="y" style="width:100%">-->
|
---|
1328 | <textarea id="input_y" name="y" style="width:100%" rows="1" maxlength="10000" wrap="soft"></textarea>
|
---|
1329 | </td>
|
---|
1330 | </tr>
|
---|
1331 | <!-- <tr>
|
---|
1332 | <td align="right" width="1%">
|
---|
1333 | <label for="input_err">E: </label>
|
---|
1334 | </td>
|
---|
1335 | <td>
|
---|
1336 | <textarea id="input_err" name="err" style="width:100%" rows="1" maxlength="10000" wrap="soft"></textarea>
|
---|
1337 | </td>
|
---|
1338 | </tr>
|
---|
1339 | --> <tr>
|
---|
1340 | <td align="right" width="1%">
|
---|
1341 | <label for="sql_cut">Cut: </label>
|
---|
1342 | </td>
|
---|
1343 | <td>
|
---|
1344 | <!--<input id="sql_cut" name="cut" style="width:100%">-->
|
---|
1345 | <textarea id="sql_cut" name="cut" style="width:100%" rows="1" maxlength="10000" wrap="soft"></textarea>
|
---|
1346 | </td>
|
---|
1347 | </tr>
|
---|
1348 | <tr>
|
---|
1349 | <td align="right" width="1%">
|
---|
1350 | <label for="having">Hav: </label>
|
---|
1351 | </td>
|
---|
1352 | <td>
|
---|
1353 | <textarea id="having" name="hav" style="width:100%" rows="1" maxlength="10000" wrap="soft"></textarea>
|
---|
1354 | </td>
|
---|
1355 | </tr>
|
---|
1356 | </table>
|
---|
1357 |
|
---|
1358 | <br>
|
---|
1359 |
|
---|
1360 | <button id="button_submit">Plot!</button>
|
---|
1361 | <!--<button id="button_tinyurl">Tiny URL</button>-->
|
---|
1362 |
|
---|
1363 | <label for="min" title="Minimum y-axis value (only if outside of the data range)">Min:</label>
|
---|
1364 | <input type="checkbox" id="enable_min">
|
---|
1365 | <input id="min" name="min" style="width:4em">
|
---|
1366 |
|
---|
1367 | <label for="max" title="Maximum y-axis value (only if outside of the data range)">Max:</label>
|
---|
1368 | <input type="checkbox" id="enable_max">
|
---|
1369 | <input id="max" name="max" style="width:4em">
|
---|
1370 |
|
---|
1371 | <label for="ontime" title="To avoid outliers, this can be used to limit the ontime for which a bin is displayed [min]">On-time limit:</label>
|
---|
1372 | <input type="checkbox" id="enable_ontime">
|
---|
1373 | <input id="ontime" name="on" style="width:3em"> min
|
---|
1374 |
|
---|
1375 | $hiddenInput
|
---|
1376 |
|
---|
1377 | </fieldset>
|
---|
1378 | </form>
|
---|
1379 | </div>
|
---|
1380 |
|
---|
1381 | <hr>
|
---|
1382 |
|
---|
1383 | <div class="ui-state-error ui-corner-all" id="error" style="padding: 5px;display:none;">
|
---|
1384 | <span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
|
---|
1385 | <strong>SQL Error:</strong>
|
---|
1386 | <pre>
|
---|
1387 | $errorcol_con$errorcol1$errorcol0
|
---|
1388 | </pre>
|
---|
1389 | </p>
|
---|
1390 | </div>
|
---|
1391 |
|
---|
1392 | <div id="chart_area" style='position:relative'>
|
---|
1393 | <div id='chart_div' class="print" style="height:400px;width:99%;margin-left:0.5%;"></div>
|
---|
1394 | <div id='print_chart' style='position:absolute;top:10px;right:40px;'></div>
|
---|
1395 | </div>
|
---|
1396 |
|
---|
1397 | <div id="shorturl" align="right">
|
---|
1398 | $tinyurl
|
---|
1399 | </div>
|
---|
1400 |
|
---|
1401 | <hr>
|
---|
1402 |
|
---|
1403 | <input type="button" onclick="$('#spoiler0').toggle(300);" value="Legend"/>
|
---|
1404 | <div id="spoiler0" style="display:none">
|
---|
1405 | <dl>
|
---|
1406 | <dt>&r = 1</dt><dd>trigger rate</dd>
|
---|
1407 | <dt>&r = 2</dt><dd>rate after cleaning</dd>
|
---|
1408 | <dt>&r = 3</dt><dd>rate after quality cuts</dd>
|
---|
1409 | <dt>&r = 4</dt><dd>rate after background cuts</dd>
|
---|
1410 | <dt>&r = 5</dt><dd>background rate (fOnTimeAfterCuts)</dd>
|
---|
1411 | <dt>&r = 6</dt><dd>excess rate</dd>
|
---|
1412 | <dt>&r = 7</dt><dd>27 second events</dd>
|
---|
1413 | <dt>&r = 8</dt><dd>threshold 500</dd>
|
---|
1414 | <dt>&r = 9</dt><dd>threshold 750</dd>
|
---|
1415 | <dt>&r = 10</dt><dd>threshold 1000</dd>
|
---|
1416 | <dt>&r = 11</dt><dd>threshold 1250</dd>
|
---|
1417 | <dt>&r = 12</dt><dd>threshod 2500</dd>
|
---|
1418 | <dt>&r = 13</dt><dd>threshold 5000</dd>
|
---|
1419 | <dt>&r = 14</dt><dd>threshold 10000</dd>
|
---|
1420 | <dt>&r = 15</dt><dd>Average of calculated EffOnTime and FTM OnTime</dd>
|
---|
1421 | <dt>&r = 16</dt><dd>Zenith angle corrected R750</dd>
|
---|
1422 | <dt>&r = 17</dt><dd>Event rate after background cuts (Total caclulated ontime)</dd>
|
---|
1423 | <dt>&r = 18</dt><dd>Average of FTM effective on time</dd>
|
---|
1424 | <dt>&r = 19</dt><dd>Sum of FTM OnTime divided by sum of FTM Elapsed time</dd>
|
---|
1425 | <dt>&r = 20</dt><dd>Rate after cleaning corrected for 27sec events run-wise corrected for zenith angle and threshold</dd>
|
---|
1426 | <dt>&r = 21</dt><dd>Physics trigger rate</dd>
|
---|
1427 | <dt>&r = 22</dt><dd>Physics trigger rate corrected for 27sec events</dd>
|
---|
1428 | <dt>&r = 23</dt><dd>Rate after cleaning corrected for 27sec events</dd>
|
---|
1429 | <dt>&r = 24</dt><dd>Rate after background cuts runwise corrected for zenith angle and threshold</dd>
|
---|
1430 | <dt>&r = 25</dz><dd>Rate after quallity cuts runwise corrected for zenith angle and threshold</dd>
|
---|
1431 | <dt>&r = 31</dt><dd>corrected excess rate</dd>
|
---|
1432 | <dt>&r = 32</dt><dd>flux [CU]</dd>
|
---|
1433 | <dt>&r = 33</dt><dd>flux [10^-11/cm2/s]</dd>
|
---|
1434 | <dt>&r = 42</dz><dd>Plot average of &y=... (profile histogram with &y as weights)</dd>
|
---|
1435 | <dt>&r = 43</dz><dd>Plot sum of &y=... (histogram with &y as weights)</dd>
|
---|
1436 | <dt>&r = 44</dz><dd>Plot user defined variable &y=...</dd>
|
---|
1437 | <dt>&r = 45</dz><dd>Plot a histogram (counts) [&y=... can be used to specify what is counted != NULL, if omitted COUNT(*)]</dd>
|
---|
1438 | <dt>&r = 46</dz><dd>Plot a histogram (log10(counts)) [&y=... can be used to specify what is counted != NULL, if omitted COUNT(*)]</dd>
|
---|
1439 | <P>
|
---|
1440 | <dt>&g = 1</dt><dd>Binning in moon periods</dd>
|
---|
1441 | <dt>&g = 2</dt><dd>Nightly binning</dd>
|
---|
1442 | <dt>&g = 3</dt><dd>Yearly binning</dd>
|
---|
1443 | <dt>&g = 4</dt><dd>Season binning (lower culmination to lower culmination)</dd>
|
---|
1444 | <dt>&g = 5</dt><dd>Run wise display (might be slow!)</dd>
|
---|
1445 | <dt>&g = 6</dt><dd>Binning in fZenithDistanceMean [default bin-width: 5]</dd>
|
---|
1446 | <dt>&g = 7</dt><dd>Binning in ThresholdMinSet [default bin-width: 50]</dd>
|
---|
1447 | <dt>&g = 42</dt><dd>Use &x=... for x-axis binning [default bin-width: 1]</dd>
|
---|
1448 | <P>
|
---|
1449 | <dt>&b=...</dt><dd>Restrict data range (begin) [eg. &b=2011-10-01]</dd>
|
---|
1450 | <dt>&e=...</dt><dd>Restrict data range (end) [eg. &e=2011-10-01]</dd>
|
---|
1451 | <dt>&print</dt><dd>Show the plot only [&print] </dd>
|
---|
1452 | <dt>&s=...</dt><dd>Restrict to given source id [eg. &s=5] </dd>
|
---|
1453 | <dt>&t=...</dt><dd>Choose table with analysis results (CutsLC, ISDC, LP:default) [eg. &t=CutsLC] </dd>
|
---|
1454 | <dt>&cut=...</dt><dd>Additional where statement to be added with AND [eg. &cut=fZenithDistance<35]</dd>
|
---|
1455 | <dt>&min=...</dt><dd>y-axis minimum [eg. &min=0]</dd>
|
---|
1456 | <dt>&max=...</dt><dd>y-axis maximum [eg. &max=0]</dd>
|
---|
1457 | <dt>&no-errors</dt><dd>suppress error bars [eg. &no-errors]</dd>
|
---|
1458 | <dt>&no-hist</dt><dd>do not show histogram as bars [eg. &no-hist]</dd>
|
---|
1459 | <dt>&x=...</dt><dd>A x-axis binned in ... [forces &g=42, eg. &x=fZenithDistance]</dd>
|
---|
1460 | <dt>&w=...</dt><dd>Bin width for &g=6/7/42 [eg. &w=2]</dd>
|
---|
1461 | <dt>&y=...</dt><dd>x-axis variable, to be used with &r=42/43/44[/45] [eg. &y=fOnTime]</dd>
|
---|
1462 | <dt>&avg=...</dt><dd>short for &y=... [forces &r=42, eg. &y=fOnTime]</dd>
|
---|
1463 | <dt>&sum=...</dt><dd>short for &y=... [forces &r=43, eg. &y=fOnTime]</dd>
|
---|
1464 | <dt>&hist=...</dt><dd>short for &x=... [forces &r=45, eg. &y=fOnTime]</dd>
|
---|
1465 | <dt>&good=...</dt><dd>some predefined data quality selection: 1 (standard datacheck with R750), 2 (zd<45), 3 (TH<550), 4 (Dust<10), values can be combined [eg. &good=14]</dd>
|
---|
1466 | </dl>
|
---|
1467 | </div>
|
---|
1468 |
|
---|
1469 | <hr>
|
---|
1470 |
|
---|
1471 | <input type="button" onclick="$('#spoiler1').toggle(300);" value="SQL Query"/>
|
---|
1472 | <div id="spoiler1" style="display:none">
|
---|
1473 | <pre>
|
---|
1474 | Database = $database
|
---|
1475 | <hr>
|
---|
1476 | $querycol1
|
---|
1477 |
|
---|
1478 | <hr>
|
---|
1479 | $querycol0
|
---|
1480 |
|
---|
1481 | <tt><font color="blue"><b>Roundtrip query time:</B></font> $timeMeasured ms</tt>
|
---|
1482 | </pre>
|
---|
1483 | </div>
|
---|
1484 |
|
---|
1485 | <hr>
|
---|
1486 |
|
---|
1487 | $data
|
---|
1488 |
|
---|
1489 | </body>
|
---|
1490 | </html>
|
---|
1491 | EOT;
|
---|
1492 |
|
---|
1493 | ?>
|
---|