source: trunk/Mars/datacenter/db/sequence.php@ 13341

Last change on this file since 13341 was 9548, checked in by Daniela Dorner, 15 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 28.0 KB
Line 
1<?php
2{
3 function CreateQuery($_GET)
4 {
5 $query0 = "SELECT ";
6 //main (0-18)
7 $query0 .= " Sequences.fSequenceFirst, fSequenceLast, ";//0,1
8 $query0 .= " fSourceName, fProjectName, ";//2,3
9 $query0 .= " fRunStart, fRunTime, fNumEvents, ";//4,5,6
10 $query0 .= " fZenithDistanceMin, fZenithDistanceMax, ";//7,8
11 $query0 .= " fAzimuthMin, fAzimuthMax, ";//9,10
12 $query0 .= " fHvSettingsName, fDiscriminatorThresholdTableName, ";//11,12
13 $query0 .= " fL1TriggerTableName, fL2TriggerTableName, ";//13,14
14 $query0 .= " fTriggerDelayTableName, fTestFlagName, ";//15,16
15 $query0 .= " fLightConditionsName, fManuallyChangedName, ";//17,18
16 //steps (19-24)
17 $query0 .= " fSequenceFileWritten, fAllFilesAvail, ";//19,20
18 $query0 .= " fCallisto, fFillCallisto, ";//21,22
19 $query0 .= " fStar, fFillStar, ";//23,24
20 //calibration (25-42)
21 $query0 .= " fUnsuitableInner, fUnsuitableOuter, ";//25,26
22 $query0 .= " fUnreliableInner, fUnreliableOuter, ";//27,28
23 $query0 .= " fIsolatedInner, fIsolatedOuter, fIsolatedMaxCluster, ";//29,30,31
24 $query0 .= " fArrTimeMeanInner, fArrTimeMeanOuter, ";//32,33
25 $query0 .= " fArrTimeRmsInner, fArrTimeRmsOuter, ";//34,35
26 $query0 .= " fConvFactorInner, fConvFactorOuter, ";//36,37
27 $query0 .= " fMeanPedRmsInner, fMeanPedRmsOuter, ";//38,39
28 $query0 .= " fMeanSignalInner, fMeanSignalOuter, ";//40,41
29 $query0 .= " fPulsePosMean, ";//42
30 //myon,star (43-51)
31 $query0 .= " fPSF, fRatio, fMuonRate, ";//43,44,45
32 $query0 .= " fMuonNumber, fEffOnTime, fDataRate, ";//46,47,48
33 $query0 .= " fMaxHumidity, fMeanNumberIslands, fInhomogeneity, fEffOnTime/fRunTime, ";//49,50,51,52
34 $query0 .= " CONCAT('<a href=\"http://www.astro.uni-wuerzburg.de/datacenter/callisto/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), 'callisto', LPAD(CONCAT(Sequences.fSequenceFirst , '.html'), 13,'0') , '\">cal-log</A>') as 'CalLink', ";//53
35 $query0 .= " CONCAT('<a href=\"http://www.astro.uni-wuerzburg.de/datacenter/star/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), 'star', LPAD(CONCAT(Sequences.fSequenceFirst , '.html'), 13,'0') , '\">star-log</A>') as 'StarLink', ";//54
36 $query0 .= " CONCAT('<a href=\"http://www.astro.uni-wuerzburg.de/datacenter/sequences/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/sequence', LPAD(CONCAT(Sequences.fSequenceFirst , '.txt'), 12,'0') , '\">', 'sequ-file</a>') as 'SequLink' ";//55
37
38 $query0 .= " FROM Sequences ";
39
40 $query0 .= " LEFT JOIN Source USING(fSourceKEY) ";
41 $query0 .= " LEFT JOIN Project USING(fProjectKEY) ";
42 $query0 .= " LEFT JOIN HvSettings USING(fHvSettingsKEY) ";
43 $query0 .= " LEFT JOIN DiscriminatorThresholdTable USING(fDiscriminatorThresholdTableKEY) ";
44 $query0 .= " LEFT JOIN L1TriggerTable USING(fL1TriggerTableKEY) ";
45 $query0 .= " LEFT JOIN L2TriggerTable USING(fL2TriggerTableKEY) ";
46 $query0 .= " LEFT JOIN TriggerDelayTable USING(fTriggerDelayTableKEY) ";
47 $query0 .= " LEFT JOIN TestFlag USING(fTestFlagKEY) ";
48 $query0 .= " LEFT JOIN LightConditions USING(fLightConditionsKEY) ";
49 $query0 .= " LEFT JOIN ManuallyChanged USING(fManuallyChangedKEY) ";
50 $query0 .= " LEFT JOIN SequenceProcessStatus USING(fSequenceFirst,fTelescopeNumber) ";
51 $query0 .= " LEFT JOIN Calibration USING(fSequenceFirst,fTelescopeNumber) ";
52 $query0 .= " LEFT JOIN Star USING(fSequenceFirst,fTelescopeNumber) ";
53
54
55 if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
56 $query0 .= " WHERE Sequences.fSequenceFirst between " . $_GET["fRunMin"] . " and " . $_GET["fRunMax"] ;
57 if (!empty($_GET["fSequenceNo"]))
58 {
59 if (strpos($query0, " WHERE ")==FALSE)
60 $query0 .= " WHERE ";
61 else
62 $query0 .= " AND ";
63 $query0 .= " Sequences.fSequenceFirst='" . $_GET["fSequenceNo"] . "'";
64 }
65 if (!empty($_GET["fSourceN"]))
66 {
67 if (strpos($query0, " WHERE ")==FALSE)
68 $query0 .= " WHERE ";
69 else
70 $query0 .= " AND ";
71 $query0 .= " fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" ";
72 }
73 $query0 .= " ORDER BY Sequences.fSequenceFirst ";
74
75 return $query0;
76 }
77
78 function InitGet($_GET)
79 {
80 // Find out whether it is the first call to the php script
81 $first = empty($_GET["fRunMin"]) && empty($_GET["fRunMax"]);
82
83 if (empty($_GET["fNumResults"]))
84 $_GET["fNumResults"]="20";
85
86 if (empty($_GET["fAll"]))
87 $_GET["fAll"]=$first?"On":"";
88
89 }
90
91 function PrintForm($_GET, $host, $user, $pw, $db)
92 {
93 printf("<center>\n");
94 printf("<form action=\"sequence.php\" METHOD=\"GET\">\n");
95
96 printf("Sequ#&nbsp;<input name=\"fSequenceNo\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"");
97 if (!empty($_GET["fSequenceNo"]))
98 printf("%s", $_GET["fSequenceNo"]);
99 printf("\">&nbsp;&nbsp;&nbsp;\n");
100// printf("Sequence&nbsp;&nbsp;<input name=\"fSequence\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"\">&nbsp;&nbsp;\n");
101
102 if (empty($_GET["fRunMin"]))
103 $min = GetMin("fSequenceFirst", "Sequences", $host, $user, $pw, $db);
104 else
105 $min = $_GET["fRunMin"];
106
107 if (empty($_GET["fRunMax"]))
108 $max = GetMax("fSequenceFirst", "Sequences", $host, $user, $pw, $db);
109 else
110 $max = $_GET["fRunMax"];
111
112 printf("Sequences&nbsp;from&nbsp;<input name=\"fRunMin\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\">\n", $min);
113 printf("to&nbsp;<input name=\"fRunMax\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\">&nbsp;&nbsp;&nbsp;\n", $max);
114
115 if ($_GET["fAll"]=="On")
116 $checked = "checked";
117 else
118 $checked = "";
119 printf("<input type=\"checkbox\" name=\"fAll\" value=\"On\" %s>all information\n", $checked);
120
121 printf(" <P>\n");
122
123 printf("Source&nbsp;(<A HREF=\"regexp.html\">regexp</A>)&nbsp;<input name=\"fSourceN\" type=\"text\" size=\"15\" maxlength=\"15\" value=\"");
124 if (!empty($_GET["fSourceN"]))
125 printf("%s", $_GET["fSourceN"]);
126 printf("\">&nbsp;&nbsp;&nbsp;\n");
127
128
129 ini_set("mysql.trace_mode", "Off");
130 ini_set("display_errors", "Off");
131
132 printf("<input class='Width' type='submit' value='Query Table'>&nbsp;&nbsp;&nbsp;\n");
133 printf("<input class='Width' type='button' value='Reset' onClick='self.location.href=\"sequence.php\"'>&nbsp;&nbsp;&nbsp;\n");
134// if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
135// printf("<input class='Width' type='button' value='Get .txt' onClick='self.location.href=\"%s&fSendTxt=1\"'>&nbsp;&nbsp;&nbsp;\n", $_SERVER["REQUEST_URI"]);
136 if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
137 printf("<input class='Width' type='button' value='Print' onClick='self.location.href=\"%s&fPrintTable=1\"'>&nbsp;&nbsp;&nbsp;\n", $_SERVER["REQUEST_URI"]);
138 printf("</form>\n");
139 printf("</center>\n");
140 printf("</td>\n");
141 printf("</tr>\n");
142 printf("<tr class='Block'>\n");
143 printf("<td>\n");
144 }
145
146 function GetStatus($step)
147 {
148 if (is_null($step))
149 return "<font color='#FF0000'>not done</font>";
150 else
151 {
152 if (strpos($step, "1970-01-01 00:00:00")==FALSE)
153 return "done";
154 else
155 return "not to be done";
156 }
157 return "there is an error -> tell Dani";
158 }
159
160 function GetCulm($azmin, $azmax)
161 {
162 $cul1=0;
163 $cul2=180;
164 if (($azmin < $cul1 && $azmax > $cul1) || ($azmin < $cul2 && $azmax > $cul2))
165 return "<font color='#FF0000'>yes</font>";
166 else
167 return "no";
168 }
169
170 function QueryRuns($type, $sequ, $db_id, $db)
171 {
172 $query1 = "SELECT fRunNumber, fCalibrationScriptName FROM RunData ";
173 $query1 .= " LEFT JOIN RunType USING(fRunTypeKEY) ";
174 $query1 .= " LEFT JOIN CalibrationScript USING(fCalibrationScriptKEY) ";
175 $query1 .= " WHERE fSequenceFirst=" . $sequ . " AND fRunTypeName='" . $type . "'";
176
177 mysql_select_db($db);
178 $runs = mysql_query($query1, $db_id);
179 $numruns = mysql_num_rows($runs);
180 $calscript=mysql_result($runs, 0, 1);
181 printf(" <td align='left'>");
182 for ($i=0 ; $i<$numruns ; $i++)
183 {
184 $run=mysql_result($runs, $i, 0);
185 if ($i!=0)
186 printf(", ");
187 printf(" %s ", $run);
188 }
189 printf(" </td>\n");
190 printf(" <td> %s ", $calscript);
191 printf(" </td>\n");
192 }
193
194 function QueryMissingFiles($column, $sequ, $db_id, $db)
195 {
196 $query2 = "SELECT RunData.fRunNumber FROM RunData ";
197 $query2 .= " LEFT JOIN RunProcessStatus USING(fRunNumber,fTelescopeNumber,fFileNumber) ";
198 $query2 .= " WHERE fSequenceFirst=" . $sequ . " AND IsNull(" . $column . ")";
199
200 mysql_select_db($db);
201 $files = mysql_query($query2, $db_id);
202 $numfiles = mysql_num_rows($files);
203 printf(" <td align='left'>");
204 for ($i=0 ; $i<$numfiles ; $i++)
205 {
206 $file=mysql_result($files, $i, 0);
207 if ($i!=0)
208 printf(", ");
209 printf(" %s ", $file);
210 }
211 printf(" </td>\n");
212 }
213
214
215 function PrintSequenceInfo($result0, $db_id, $db, $calibtabs, $signaltabs, $startabs)
216 {
217 $numres = mysql_num_rows($result0);
218
219 printf("<center>");
220 printf("<table BORDER=\"0\">\n");
221 printf("<tr><td>");
222 printf("# of Sequences: %d ", $numres);
223 printf("</td></tr>");
224
225 for ($i=0 ; $i<$numres ; $i++)
226 {
227 $firstrun=mysql_result($result0, $i, 0);
228 $num=sprintf("%08d",$firstrun);
229 $num2=substr($num,0,4);
230 $lastrun=mysql_result($result0, $i, 1);
231 $source=mysql_result($result0, $i, 2);
232 $project=mysql_result($result0, $i, 3);
233 $starttime=mysql_result($result0, $i, 4);
234 $duration=mysql_result($result0, $i, 5);
235 $numevents=mysql_result($result0, $i, 6);
236 $zdmin=mysql_result($result0, $i, 7);
237 $zdmax=mysql_result($result0, $i, 8);
238 $azmin=mysql_result($result0, $i, 9);
239 $azmax=mysql_result($result0, $i, 10);
240 $hv=mysql_result($result0, $i, 11);
241 $dt=mysql_result($result0, $i, 12);
242 $l1tt=mysql_result($result0, $i, 13);
243 $l2tt=mysql_result($result0, $i, 14);
244 $td=mysql_result($result0, $i, 15);
245 $testflag=mysql_result($result0, $i, 16);
246 $lightcond=mysql_result($result0, $i, 17);
247 $manuallychanged=mysql_result($result0, $i, 18);
248 $sequfile=mysql_result($result0, $i, 19);
249 $filesavail=mysql_result($result0, $i, 20);
250 $callisto=mysql_result($result0, $i, 21);
251 $star=mysql_result($result0, $i, 22);
252 $fillcallisto=mysql_result($result0, $i, 23);
253 $fillstar=mysql_result($result0, $i, 24);
254 $unsi=mysql_result($result0, $i, 25);
255 $unso=mysql_result($result0, $i, 26);
256 $unri=mysql_result($result0, $i, 27);
257 $unro=mysql_result($result0, $i, 28);
258 $isoi=mysql_result($result0, $i, 29);
259 $isoo=mysql_result($result0, $i, 30);
260 $imc=mysql_result($result0, $i, 31);
261 $arrtimei=mysql_result($result0, $i, 32);
262 $arrtimeo=mysql_result($result0, $i, 33);
263 $arrtimermsi=mysql_result($result0, $i, 34);
264 $arrtimermso=mysql_result($result0, $i, 35);
265 $convi=mysql_result($result0, $i, 36);
266 $convo=mysql_result($result0, $i, 37);
267 $meanpedrmsi=mysql_result($result0, $i, 38);
268 $meanpedrmso=mysql_result($result0, $i, 39);
269 $meansignali=mysql_result($result0, $i, 40);
270 $meansignalo=mysql_result($result0, $i, 41);
271 $pulsposmean=mysql_result($result0, $i, 42);
272 $psf=mysql_result($result0, $i, 43);
273 $ratio=mysql_result($result0, $i, 44);
274 $muonrate=mysql_result($result0, $i, 45);
275 $muonnum=mysql_result($result0, $i, 46);
276 $effontime=mysql_result($result0, $i, 47);
277 $datarate=mysql_result($result0, $i, 48);
278 $maxhum=mysql_result($result0, $i, 49);
279 $meannumislands=mysql_result($result0, $i, 50);
280 $inhom=mysql_result($result0, $i, 51);
281 $relontime=mysql_result($result0, $i, 52);
282 $callink=mysql_result($result0, $i, 53);
283 $starlink=mysql_result($result0, $i, 54);
284 $sequlink=mysql_result($result0, $i, 55);
285
286 printf("<tr><td>");
287
288 printf(" <table BORDER=\"1\">");
289 printf(" <tr BGCOLOR='#C0C0C0'>\n");
290 printf(" <th>Sequence#: <a href=\"http://www.astro.uni-wuerzburg.de/datacenter/sequences/%s/sequence%s.txt\">%s</a> </th>", $num2, $num, $firstrun);
291 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='left'>\n");
292 printf(" <th> %s, %s, zd: %s&deg;-%s&deg;, %.2fmin ",
293 $source, $starttime, $zdmin, $zdmax, $duration/60);
294 if (!is_null($star))
295 printf(", <font color='green'>image files available</font> ");
296 printf(" </td>\n");
297 printf(" </tr><tr>\n");
298 printf(" <td>\n");
299
300 printf("</td></tr><tr><td>\n");
301
302 printf(" <table BORDER=\"1\">");
303 printf(" <tr BGCOLOR='#C0C0C0'>\n");
304 printf(" <th colspan=\"4\">conditions</th>");
305 printf(" <th colspan=\"3\">muon parameter</th>\n");
306 printf(" </tr><tr BGCOLOR='#E0E0E0'>\n");
307 printf(" <td>light</td>\n");
308 printf(" <td>max hum</td>\n");
309 printf(" <td>zd</td>\n");
310 printf(" <td>culmination</td>");
311 if (!is_null($fillstar))
312 {
313 printf(" <td>muon rate</td>\n");
314 printf(" <td>ratio</td>\n");
315 printf(" <td>psf</td>\n");
316 }
317 printf(" </tr><tr BGCOLOR='#E0E0E0' align='right'>");
318 printf(" <td>%s</td>\n", $lightcond);
319 printf(" <td>%s %%</td>\n", $maxhum);
320 printf(" <td>%s&deg;-%s&deg;</td>\n", $zdmin, $zdmax);
321 printf(" <td>%s</td>\n", GetCulm($azmin, $azmax));
322 if (!is_null($fillstar))
323 {
324 printf(" <td> %sHz </td>\n", $muonrate);
325 printf(" <td> %s </td>\n", $ratio);
326 printf(" <td> %smm </td>\n", $psf);
327 }
328 printf(" </tr></table>");
329
330
331 if ($_GET["fAll"]=="On")
332 {
333 printf("</td></tr><tr><td>\n");
334 printf("</td></tr><tr><td>\n");
335
336 printf(" <table BORDER=\"1\">");
337 printf(" <tr BGCOLOR='#C0C0C0'>\n");
338 printf(" <th colspan=\"6\">general information</th>");
339 printf(" </tr>\n");
340 printf(" <tr BGCOLOR='#E0E0E0'>\n");
341 printf(" <td>source name</td>\n");
342 printf(" <td># events</td>\n");
343 printf(" <td>project name</td>\n");
344 printf(" <td>light conditions</td>\n");
345 printf(" <td>manually changed</td>\n");
346 printf(" <td>test flag</td>");
347 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
348 printf(" <td> %s </td>\n", $source);
349 printf(" <td> %s </td>\n", $numevents);
350 printf(" <td> %s </td>\n", $project);
351 printf(" <td> %s </td>\n", $lightcond);
352 printf(" <td> %s </td>\n", $manuallychanged);
353 printf(" <td> %s </td>\n", $testflag);
354 printf(" </tr></table>");
355
356 printf("</td></tr><tr><td>\n");
357
358 printf(" <table BORDER=\"1\">");
359 printf(" <tr BGCOLOR='#C0C0C0'>\n");
360 printf(" <th colspan=\"5\">trigger & camera</th>");
361 printf(" </tr>\n");
362 printf(" <tr BGCOLOR='#E0E0E0'>\n");
363 printf(" <td>l1 trigger</td>\n");
364 printf(" <td>l2 trigger</td>\n");
365 printf(" <td>trigger delay</td>\n");
366 printf(" <td>HvSettings</td>\n");
367 printf(" <td>DT</td>");
368 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
369 printf(" <td> %s </td>\n", $l1tt);
370 printf(" <td> %s </td>\n", $l2tt);
371 printf(" <td> %s </td>\n", $td);
372 printf(" <td> %s </td>\n", $hv);
373 printf(" <td> %s </td>\n", $dt);
374 printf(" </tr></table>");
375
376 printf("</td></tr><tr><td>\n");
377
378 printf(" <table BORDER=\"1\">");
379 printf(" <tr BGCOLOR='#C0C0C0'>\n");
380 printf(" <th colspan=\"6\">steps</th>");
381 printf(" </tr>\n");
382 printf(" <tr BGCOLOR='#E0E0E0' align='center'>\n");
383 printf(" <td>sequencefile</td>\n");
384 printf(" <td>files avail</td>\n");
385 printf(" <td>callisto</td>\n");
386 printf(" <td>fillcal</td>\n");
387 printf(" <td>star</td>");
388 printf(" <td>fillstar</td>");
389 printf(" </tr><tr BGCOLOR='#E0E0E0' align='right'>");
390 printf(" <td> %s </td>\n", GetStatus($sequfile));
391 printf(" <td> %s </td>\n", GetStatus($filesavail));
392 printf(" <td> %s </td>\n", GetStatus($callisto));
393 printf(" <td> %s </td>\n", GetStatus($fillcallisto));
394 printf(" <td> %s </td>\n", GetStatus($star));
395 printf(" <td> %s </td>\n", GetStatus($fillstar));
396 printf(" </tr>\n");
397 printf(" <tr BGCOLOR='#E0E0E0' align='center'>\n");
398 printf(" <td>%s</td>\n", $sequlink);
399 printf(" <td><br></td>\n");
400 printf(" <td>%s</td>\n", $callink);
401 printf(" <td><br></td>\n");
402 printf(" <td>%s</td>", $starlink);
403 printf(" <td><br></td>");
404 printf(" </tr></table>");
405
406 printf("</td></tr><tr><td>\n");
407
408 if (!is_null($fillcallisto))
409 {
410 printf(" <table BORDER=\"1\">");
411 printf(" <tr BGCOLOR='#D0D0D0'>");
412 printf(" <th BGCOLOR='#C0C0C0'>calibration (<a href=\"reference.html\">ref</a>)</th>\n");
413 printf(" <td>inner</td>\n");
414 printf(" <td>outer</td>");
415 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
416 printf(" <td>unsuitable pixel</td>\n");
417 printf(" <td align='right'> %s </td>\n", $unsi);
418 printf(" <td align='right'> %s </td>\n", $unso);
419 printf(" </tr><tr BGCOLOR='#D0D0D0'>");
420 printf(" <td>unreliable pixel</td>\n");
421 printf(" <td align='right'> %s </td>\n", $unri);
422 printf(" <td align='right'> %s </td>\n", $unro);
423 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
424 printf(" <td>isolated pixel</td>\n");
425 printf(" <td align='right'> %s </td>\n", $isoi);
426 printf(" <td align='right'> %s </td>\n", $isoo);
427 printf(" </tr><tr BGCOLOR='#D0D0D0'>");
428 printf(" <td>isolated max cluster</td>\n");
429 printf(" <td colspan=\"2\" align='right'> %s </td>\n", $imc);
430 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
431 printf(" <td>arrival time</td>\n");
432 printf(" <td align='right'> %s &plusmn; %s </td>\n", $arrtimei, $arrtimermsi);
433 printf(" <td align='right'> %s &plusmn; %s </td>\n", $arrtimeo, $arrtimermso);
434 printf(" </tr><tr BGCOLOR='#D0D0D0'>");
435 printf(" <td>conversion factor</td>\n");
436 printf(" <td align='right'> %s </td>\n", $convi);
437 printf(" <td align='right'> %s </td>\n", $convo);
438 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
439 printf(" <td>mean ped rms</td>\n");
440 printf(" <td align='right'> %s </td>\n", $meanpedrmsi);
441 printf(" <td align='right'> %s </td>\n", $meanpedrmso);
442 printf(" </tr><tr BGCOLOR='#D0D0D0'>");
443 printf(" <td>mean signal</td>\n");
444 printf(" <td align='right'> %s </td>\n", $meansignali);
445 printf(" <td align='right'> %s </td>\n", $meansignalo);
446 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
447 printf(" <td>mean pulse pos</td>\n");
448 printf(" <td colspan=\"2\" align='right'> %s </td>\n", $pulsposmean);
449 printf(" </tr>");
450 printf(" </table>");
451
452 printf("</td></tr><tr><td>\n");
453 }
454
455 if (!is_null($fillstar))
456 {
457 printf(" <table BORDER=\"1\">");
458 printf(" <tr BGCOLOR='#C0C0C0'>");
459 printf(" <th colspan=\"9\">star</th>\n");
460 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
461 printf(" <td># islands</td>\n");
462 printf(" <td># muons</td>\n");
463 printf(" <td>effontime</td>\n");
464 printf(" <td>datarate</td>\n");
465 printf(" <td>muon rate</td>\n");
466 printf(" <td>ratio</td>\n");
467 printf(" <td>psf</td>\n");
468 printf(" <td>inhom</td>\n");
469 printf(" <td>rel. ontime</td>\n");
470 printf(" <tr BGCOLOR='#E0E0E0' ALIGN='right'>");
471 printf(" <td> %s </td>\n", $meannumislands);
472 printf(" <td> %s </td>\n", $muonnum);
473 printf(" <td> %ss </td>\n", $effontime);
474 printf(" <td> %sHz </td>\n", $datarate);
475 printf(" <td> %sHz </td>\n", $muonrate);
476 printf(" <td> %s </td>\n", $ratio);
477 printf(" <td> %smm </td>\n", $psf);
478 printf(" <td> %s </td>\n", $inhom);
479 printf(" <td> %s </td>\n", $relontime);
480 printf(" </tr>");
481 printf(" </table>");
482
483 printf("</td></tr><tr><td>");
484 }
485
486
487 printf(" <table BORDER=\"1\">");
488 printf(" <tr BGCOLOR='#C0C0C0'>");
489 printf(" <th>plots</th>\n");
490 printf(" <tr><td>calib: ");
491 foreach($calibtabs as $key => $element)
492 if (!$key==0)
493 printf("<a href=\"http://www.astro.uni-wuerzburg.de/datacenter/callisto/%s/%s/calib%s-tab%s.png\">%s</a> ", $num2, $num, $num, $key, $element);
494 printf("</td></tr>");
495 printf(" <tr><td>signal: ");
496 foreach($signaltabs as $key => $element)
497 if (!$key==0)
498 printf("<a href=\"http://www.astro.uni-wuerzburg.de/datacenter/callisto/%s/%s/signal%s-tab%s.png\">%s</a> ", $num2, $num, $num, $key, $element);
499 printf("</td></tr>");
500 printf(" <tr><td>star: ");
501 foreach($startabs as $key => $element)
502 if (!$key==0)
503 printf("<a href=\"http://www.astro.uni-wuerzburg.de/datacenter/star/%s/%s/star%s-tab%s.png\">%s</a> ", $num2, $num, $num, $key, $element);
504 printf("</td></tr>");
505
506 printf(" </tr>");
507 printf(" </table>");
508
509 printf(" <table BORDER=\"1\">");
510 printf(" <tr BGCOLOR='#C0C0C0'>");
511 printf(" <th><A HREF=\"runinfo.php?fRunStart=On&fZenithDistance=On&fRunMin=%s&fMeanTriggerRate=On&fRunTypeName=On&fRunMax=%s&fNumEvents=On&fSourceName=On&fExcludedFDAKEY=1&fSequenceFirst=On&fRawFileAvail=On&fCCFileAvail=On&fCaCoFileAvail=On&fNumResults=500\">runs</A></th>", $firstrun, $lastrun);
512 printf(" <td>runs</td>\n");
513 printf(" <td>calscript</td>\n");
514 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
515 printf(" <td>dataruns</td>\n");
516 QueryRuns("Data", $firstrun, $db_id, $db);
517 printf(" </tr><tr BGCOLOR='#E0E0E0' ALIGN='center'>");
518 printf(" <td>pedruns</td>\n");
519 QueryRuns("Pedestal", $firstrun, $db_id, $db);
520 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
521 printf(" <td>calruns</td>\n");
522 QueryRuns("Calibration", $firstrun, $db_id, $db);
523 printf(" </tr>");
524 printf(" </table>");
525
526 if (is_null($filesavail))
527 {
528 printf(" <table BORDER=\"1\">");
529 printf(" <tr BGCOLOR='#C0C0C0'>");
530 printf(" <th>missing files</th>");
531 printf(" <td>run# of missing files</td>\n");
532 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
533 printf(" <td>rawfiles</td>\n");
534 QueryMissingFiles("fRawFileAvail", $firstrun, $db_id, $db);
535 printf(" </tr><tr BGCOLOR='#E0E0E0' ALIGN='center'>");
536 printf(" <td>ccfiles</td>\n");
537 QueryMissingFiles("fCCFileAvail", $firstrun, $db_id, $db);
538 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
539 printf(" <td>cacofiles</td>\n");
540 QueryMissingFiles("fCaCoFileAvail", $firstrun, $db_id, $db);
541 printf(" </tr>");
542 printf(" </table>");
543 }
544
545
546 }
547 printf(" </table>");
548 printf("</td></tr><tr><td><br></td></tr>");
549
550 }
551 printf("</table>\n");
552
553 printf("</center>\n");
554 printf("</tr><tr class='Block'><td>\n");
555 }
556
557 function PrintPage($html, $host, $user, $pw, $db, $calibtabs, $signaltabs, $startabs)
558 {
559 $db_id = mysql_connect($host, $user, $pw);
560 if ($db_id==FALSE)
561 {
562 printf("mysql_connect returned the following error: %s\n", mysql_error());
563 die("");
564 }
565 mysql_select_db($db);
566
567 $query0 = CreateQuery($_GET);
568
569 $result0 = mysql_query($query0, $db_id);
570
571 if ($result0)
572 {
573 if ($html=="1" || $html=="2")
574 PrintSequenceInfo($result0, $db_id, $db, $calibtabs, $signaltabs, $startabs);
575 else
576 PrintText($result0);
577
578 mysql_free_result($result0);
579 }
580 mysql_close($db_id);
581
582 if ($html=="1")
583 PrintSubmittedQuery($query0, $db, "old");
584 }
585
586 include ("include.php");
587 include ("db.php");
588 include ("tabs.php");
589
590 ini_set("display_errors", "On");
591 ini_set("mysql.trace_mode", "On");
592
593 if (!empty($_GET["fSendTxt"]))
594 {
595 header("Content-type: application/octet");
596 header("Content-Disposition: attachment; filename=query-result.txt");
597
598 PrintPage("0", $host, $user, $pw, $db, $calibtabs, $signaltabs, $startabs);
599 }
600 else
601 {
602 if (empty($_GET["fPrintTable"]))
603 echo (file_get_contents("index-header.html"));
604
605 $environment = sizeof($_GET);
606
607 InitGet($_GET);
608 if (empty($_GET["fPrintTable"]))
609 PrintForm($_GET, $host, $user, $pw, $db);
610
611 if ($environment==0)
612 printf("No query submitted yet.<BR>");
613 else
614 {
615 if (empty($_GET["fPrintTable"]))
616 PrintPage("1", $host, $user, $pw, $db, $calibtabs, $signaltabs, $startabs);
617 else
618 PrintPage("2", $host, $user, $pw, $db, $calibtabs, $signaltabs, $startabs);
619 }
620
621 if (empty($_GET["fPrintTable"]))
622 echo (file_get_contents("index-footer.html"));
623 }
624
625 ini_set("display_errors", "Off");
626 ini_set("mysql.trace_mode", "Off");
627}
628?>
Note: See TracBrowser for help on using the repository browser.