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

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