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