source: trunk/MagicSoft/Mars/datacenter/db/sequence.php@ 7578

Last change on this file since 7578 was 7578, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 28.3 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, ";//49,50,51
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', ";//52
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', ";//53
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' ";//54
37
38 $query0 .= " FROM Sequences ";
39
40 $query0 .= " LEFT JOIN Source ON Sequences.fSourceKEY=Source.fSourceKEY ";
41 $query0 .= " LEFT JOIN Project ON Sequences.fProjectKEY=Project.fProjectKEY ";
42 $query0 .= " LEFT JOIN HvSettings ON Sequences.fHvSettingsKEY=HvSettings.fHvSettingsKEY ";
43 $query0 .= " LEFT JOIN DiscriminatorThresholdTable ON Sequences.fDiscriminatorThresholdTableKEY=DiscriminatorThresholdTable.fDiscriminatorThresholdTableKEY ";
44 $query0 .= " LEFT JOIN L1TriggerTable ON Sequences.fL1TriggerTableKEY=L1TriggerTable.fL1TriggerTableKEY ";
45 $query0 .= " LEFT JOIN L2TriggerTable ON Sequences.fL2TriggerTableKEY=L2TriggerTable.fL2TriggerTableKEY ";
46 $query0 .= " LEFT JOIN TriggerDelayTable ON Sequences.fTriggerDelayTableKEY=TriggerDelayTable.fTriggerDelayTableKEY ";
47 $query0 .= " LEFT JOIN TestFlag ON Sequences.fTestFlagKEY=TestFlag.fTestFlagKEY ";
48 $query0 .= " LEFT JOIN LightConditions ON Sequences.fLightConditionsKEY=LightConditions.fLightConditionsKEY ";
49 $query0 .= " LEFT JOIN ManuallyChanged ON Sequences.fManuallyChangedKEY=ManuallyChanged.fManuallyChangedKEY ";
50 $query0 .= " LEFT JOIN SequenceProcessStatus ON Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst ";
51 $query0 .= " LEFT JOIN Calibration ON Sequences.fSequenceFirst=Calibration.fSequenceFirst ";
52 $query0 .= " LEFT JOIN Star ON Sequences.fSequenceFirst=Star.fSequenceFirst ";
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 ON RunData.fRunTypeKEY=RunType.fRunTypeKEY ";
174 $query1 .= " LEFT JOIN CalibrationScript ON RunData.fCalibrationScriptKEY=CalibrationScript.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 ON RunData.fRunNumber=RunProcessStatus.fRunNumber ";
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 $callink=mysql_result($result0, $i, 52);
282 $starlink=mysql_result($result0, $i, 53);
283 $sequlink=mysql_result($result0, $i, 54);
284
285 printf("<tr><td>");
286
287 printf(" <table BORDER=\"1\">");
288 printf(" <tr BGCOLOR='#C0C0C0'>\n");
289 printf(" <th>Sequence#: <a href=\"http://www.astro.uni-wuerzburg.de/datacenter/sequences/%s/sequence%s.txt\">%s</a> </th>", $num2, $num, $firstrun);
290 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='left'>\n");
291 printf(" <th> %s, %s, zd: %s&deg;-%s&deg;, %.2fmin ",
292 $source, $starttime, $zdmin, $zdmax, $duration/60);
293 if (!is_null($star))
294 printf(", <font color='green'>image files available</font> ");
295 printf(" </td>\n");
296 printf(" </tr><tr>\n");
297 printf(" <td>\n");
298
299 printf("</td></tr><tr><td>\n");
300
301 printf(" <table BORDER=\"1\">");
302 printf(" <tr BGCOLOR='#C0C0C0'>\n");
303 printf(" <th colspan=\"4\">conditions</th>");
304 printf(" <th colspan=\"3\">muon parameter</th>\n");
305 printf(" </tr><tr BGCOLOR='#E0E0E0'>\n");
306 printf(" <td>light</td>\n");
307 printf(" <td>max hum</td>\n");
308 printf(" <td>zd</td>\n");
309 printf(" <td>culmination</td>");
310 if (!is_null($fillstar))
311 {
312 printf(" <td>muon rate</td>\n");
313 printf(" <td>ratio</td>\n");
314 printf(" <td>psf</td>\n");
315 }
316 printf(" </tr><tr BGCOLOR='#E0E0E0' align='right'>");
317 printf(" <td>%s</td>\n", $lightcond);
318 printf(" <td>%s %%</td>\n", $maxhum);
319 printf(" <td>%s&deg;-%s&deg;</td>\n", $zdmin, $zdmax);
320 printf(" <td>%s</td>\n", GetCulm($azmin, $azmax));
321 if (!is_null($fillstar))
322 {
323 printf(" <td> %sHz </td>\n", $muonrate);
324 printf(" <td> %s </td>\n", $ratio);
325 printf(" <td> %smm </td>\n", $psf);
326 }
327 printf(" </tr></table>");
328
329
330 if ($_GET["fAll"]=="On")
331 {
332 printf("</td></tr><tr><td>\n");
333 printf("</td></tr><tr><td>\n");
334
335 printf(" <table BORDER=\"1\">");
336 printf(" <tr BGCOLOR='#C0C0C0'>\n");
337 printf(" <th colspan=\"6\">general information</th>");
338 printf(" </tr>\n");
339 printf(" <tr BGCOLOR='#E0E0E0'>\n");
340 printf(" <td>source name</td>\n");
341 printf(" <td># events</td>\n");
342 printf(" <td>project name</td>\n");
343 printf(" <td>light conditions</td>\n");
344 printf(" <td>manually changed</td>\n");
345 printf(" <td>test flag</td>");
346 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
347 printf(" <td> %s </td>\n", $source);
348 printf(" <td> %s </td>\n", $numevents);
349 printf(" <td> %s </td>\n", $project);
350 printf(" <td> %s </td>\n", $lightcond);
351 printf(" <td> %s </td>\n", $manuallychanged);
352 printf(" <td> %s </td>\n", $testflag);
353 printf(" </tr></table>");
354
355 printf("</td></tr><tr><td>\n");
356
357 printf(" <table BORDER=\"1\">");
358 printf(" <tr BGCOLOR='#C0C0C0'>\n");
359 printf(" <th colspan=\"5\">trigger & camera</th>");
360 printf(" </tr>\n");
361 printf(" <tr BGCOLOR='#E0E0E0'>\n");
362 printf(" <td>l1 trigger</td>\n");
363 printf(" <td>l2 trigger</td>\n");
364 printf(" <td>trigger delay</td>\n");
365 printf(" <td>HvSettings</td>\n");
366 printf(" <td>DT</td>");
367 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
368 printf(" <td> %s </td>\n", $l1tt);
369 printf(" <td> %s </td>\n", $l2tt);
370 printf(" <td> %s </td>\n", $td);
371 printf(" <td> %s </td>\n", $hv);
372 printf(" <td> %s </td>\n", $dt);
373 printf(" </tr></table>");
374
375 printf("</td></tr><tr><td>\n");
376
377 printf(" <table BORDER=\"1\">");
378 printf(" <tr BGCOLOR='#C0C0C0'>\n");
379 printf(" <th colspan=\"6\">steps</th>");
380 printf(" </tr>\n");
381 printf(" <tr BGCOLOR='#E0E0E0' align='center'>\n");
382 printf(" <td>sequencefile</td>\n");
383 printf(" <td>files avail</td>\n");
384 printf(" <td>callisto</td>\n");
385 printf(" <td>fillcal</td>\n");
386 printf(" <td>star</td>");
387 printf(" <td>fillstar</td>");
388 printf(" </tr><tr BGCOLOR='#E0E0E0' align='right'>");
389 printf(" <td> %s </td>\n", GetStatus($sequfile));
390 printf(" <td> %s </td>\n", GetStatus($filesavail));
391 printf(" <td> %s </td>\n", GetStatus($callisto));
392 printf(" <td> %s </td>\n", GetStatus($fillcallisto));
393 printf(" <td> %s </td>\n", GetStatus($star));
394 printf(" <td> %s </td>\n", GetStatus($fillstar));
395 printf(" </tr>\n");
396 printf(" <tr BGCOLOR='#E0E0E0' align='center'>\n");
397 printf(" <td>%s</td>\n", $sequlink);
398 printf(" <td><br></td>\n");
399 printf(" <td>%s</td>\n", $callink);
400 printf(" <td><br></td>\n");
401 printf(" <td>%s</td>", $starlink);
402 printf(" <td><br></td>");
403 printf(" </tr></table>");
404
405 printf("</td></tr><tr><td>\n");
406
407 if (!is_null($fillcallisto))
408 {
409 printf(" <table BORDER=\"1\">");
410 printf(" <tr BGCOLOR='#D0D0D0'>");
411 printf(" <th BGCOLOR='#C0C0C0'>calibration (<a href=\"reference.html\">ref</a>)</th>\n");
412 printf(" <td>inner</td>\n");
413 printf(" <td>outer</td>");
414 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
415 printf(" <td>unsuitable pixel</td>\n");
416 printf(" <td align='right'> %s </td>\n", $unsi);
417 printf(" <td align='right'> %s </td>\n", $unso);
418 printf(" </tr><tr BGCOLOR='#D0D0D0'>");
419 printf(" <td>unreliable pixel</td>\n");
420 printf(" <td align='right'> %s </td>\n", $unri);
421 printf(" <td align='right'> %s </td>\n", $unro);
422 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
423 printf(" <td>isolated pixel</td>\n");
424 printf(" <td align='right'> %s </td>\n", $isoi);
425 printf(" <td align='right'> %s </td>\n", $isoo);
426 printf(" </tr><tr BGCOLOR='#D0D0D0'>");
427 printf(" <td>isolated max cluster</td>\n");
428 printf(" <td colspan=\"2\" align='right'> %s </td>\n", $imc);
429 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
430 printf(" <td>arrival time</td>\n");
431 printf(" <td align='right'> %s &plusmn; %s </td>\n", $arrtimei, $arrtimermsi);
432 printf(" <td align='right'> %s &plusmn; %s </td>\n", $arrtimeo, $arrtimermso);
433 printf(" </tr><tr BGCOLOR='#D0D0D0'>");
434 printf(" <td>conversion factor</td>\n");
435 printf(" <td align='right'> %s </td>\n", $convi);
436 printf(" <td align='right'> %s </td>\n", $convo);
437 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
438 printf(" <td>mean ped rms</td>\n");
439 printf(" <td align='right'> %s </td>\n", $meanpedrmsi);
440 printf(" <td align='right'> %s </td>\n", $meanpedrmso);
441 printf(" </tr><tr BGCOLOR='#D0D0D0'>");
442 printf(" <td>mean signal</td>\n");
443 printf(" <td align='right'> %s </td>\n", $meansignali);
444 printf(" <td align='right'> %s </td>\n", $meansignalo);
445 printf(" </tr><tr BGCOLOR='#E0E0E0'>");
446 printf(" <td>mean pulse pos</td>\n");
447 printf(" <td colspan=\"2\" align='right'> %s </td>\n", $pulsposmean);
448 printf(" </tr>");
449 printf(" </table>");
450
451 printf("</td></tr><tr><td>\n");
452 }
453
454 if (!is_null($fillstar))
455 {
456 printf(" <table BORDER=\"1\">");
457 printf(" <tr BGCOLOR='#C0C0C0'>");
458 printf(" <th colspan=\"8\">star</th>\n");
459 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
460 printf(" <td># islands</td>\n");
461 printf(" <td># muons</td>\n");
462 printf(" <td>effontime</td>\n");
463 printf(" <td>datarate</td>\n");
464 printf(" <td>muon rate</td>\n");
465 printf(" <td>ratio</td>\n");
466 printf(" <td>psf</td>\n");
467 printf(" <td>inhom</td>\n");
468 printf(" <tr BGCOLOR='#E0E0E0' ALIGN='right'>");
469 printf(" <td> %s </td>\n", $meannumislands);
470 printf(" <td> %s </td>\n", $muonnum);
471 printf(" <td> %ss </td>\n", $effontime);
472 printf(" <td> %sHz </td>\n", $datarate);
473 printf(" <td> %sHz </td>\n", $muonrate);
474 printf(" <td> %s </td>\n", $ratio);
475 printf(" <td> %smm </td>\n", $psf);
476 printf(" <td> %s </td>\n", $inhom);
477 printf(" </tr>");
478 printf(" </table>");
479
480 printf("</td></tr><tr><td>");
481 }
482
483
484 printf(" <table BORDER=\"1\">");
485 printf(" <tr BGCOLOR='#C0C0C0'>");
486 printf(" <th>plots</th>\n");
487 printf(" <tr><td>calib: ");
488 foreach($calibtabs as $key => $element)
489 if (!$key==0)
490 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);
491 printf("</td></tr>");
492 printf(" <tr><td>signal: ");
493 foreach($signaltabs as $key => $element)
494 if (!$key==0)
495 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);
496 printf("</td></tr>");
497 printf(" <tr><td>star: ");
498 foreach($startabs as $key => $element)
499 if (!$key==0)
500 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);
501 printf("</td></tr>");
502
503 printf(" </tr>");
504 printf(" </table>");
505
506 printf(" <table BORDER=\"1\">");
507 printf(" <tr BGCOLOR='#C0C0C0'>");
508 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);
509 printf(" <td>runs</td>\n");
510 printf(" <td>calscript</td>\n");
511 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
512 printf(" <td>dataruns</td>\n");
513 QueryRuns("Data", $firstrun, $db_id, $db);
514 printf(" </tr><tr BGCOLOR='#E0E0E0' ALIGN='center'>");
515 printf(" <td>pedruns</td>\n");
516 QueryRuns("Pedestal", $firstrun, $db_id, $db);
517 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
518 printf(" <td>calruns</td>\n");
519 QueryRuns("Calibration", $firstrun, $db_id, $db);
520 printf(" </tr>");
521 printf(" </table>");
522
523 if (is_null($filesavail))
524 {
525 printf(" <table BORDER=\"1\">");
526 printf(" <tr BGCOLOR='#C0C0C0'>");
527 printf(" <th>missing files</th>");
528 printf(" <td>run# of missing files</td>\n");
529 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
530 printf(" <td>rawfiles</td>\n");
531 QueryMissingFiles("fRawFileAvail", $firstrun, $db_id, $db);
532 printf(" </tr><tr BGCOLOR='#E0E0E0' ALIGN='center'>");
533 printf(" <td>ccfiles</td>\n");
534 QueryMissingFiles("fCCFileAvail", $firstrun, $db_id, $db);
535 printf(" </tr><tr BGCOLOR='#D0D0D0' ALIGN='center'>");
536 printf(" <td>cacofiles</td>\n");
537 QueryMissingFiles("fCaCoFileAvail", $firstrun, $db_id, $db);
538 printf(" </tr>");
539 printf(" </table>");
540 }
541
542
543 }
544 printf(" </table>");
545 printf("</td></tr><tr><td><br></td></tr>");
546
547 }
548 printf("</table>\n");
549
550 printf("</center>\n");
551 printf("</tr><tr class='Block'><td>\n");
552 }
553
554 function PrintPage($html, $host, $user, $pw, $db, $calibtabs, $signaltabs, $startabs)
555 {
556 $db_id = mysql_connect($host, $user, $pw);
557 if ($db_id==FALSE)
558 {
559 printf("mysql_connect returned the following error: %s\n", mysql_error());
560 die("");
561 }
562 mysql_select_db($db);
563
564 $query0 = CreateQuery($_GET);
565
566 $result0 = mysql_query($query0, $db_id);
567
568 if ($result0)
569 {
570 if ($html=="1" || $html=="2")
571 PrintSequenceInfo($result0, $db_id, $db, $calibtabs, $signaltabs, $startabs);
572 else
573 PrintText($result0);
574
575 mysql_free_result($result0);
576 }
577 mysql_close($db_id);
578
579 if ($html=="1")
580 printf("<U><B>submitted query:</B></U><BR>%s<BR>", htmlspecialchars($query0));
581 }
582
583 include ("include.php");
584 include ("db.php");
585 include ("tabs.php");
586
587 ini_set("display_errors", "On");
588 ini_set("mysql.trace_mode", "On");
589
590 if (!empty($_GET["fSendTxt"]))
591 {
592 header("Content-type: application/octet");
593 header("Content-Disposition: attachment; filename=query-result.txt");
594
595 PrintPage("0", $host, $user, $pw, $db, $calibtabs, $signaltabs, $startabs);
596 }
597 else
598 {
599 echo (file_get_contents("index-header.html"));
600
601 $environment = sizeof($_GET);
602
603 InitGet($_GET);
604 if (empty($_GET["fPrintTable"]))
605 PrintForm($_GET, $host, $user, $pw, $db);
606
607 if ($environment==0)
608 printf("No query submitted yet.<BR>");
609 else
610 {
611 if (empty($_GET["fPrintTable"]))
612 PrintPage("1", $host, $user, $pw, $db, $calibtabs, $signaltabs, $startabs);
613 else
614 PrintPage("2", $host, $user, $pw, $db, $calibtabs, $signaltabs, $startabs);
615 }
616
617 echo (file_get_contents("index-footer.html"));
618 }
619
620 ini_set("display_errors", "Off");
621 ini_set("mysql.trace_mode", "Off");
622}
623?>
Note: See TracBrowser for help on using the repository browser.