cal-log') as 'CalLink', ";//53 $query0 .= " CONCAT('star-log') as 'StarLink', ";//54 $query0 .= " CONCAT('', 'sequ-file') as 'SequLink' ";//55 $query0 .= " FROM Sequences "; $query0 .= " LEFT JOIN Source ON Sequences.fSourceKEY=Source.fSourceKEY "; $query0 .= " LEFT JOIN Project ON Sequences.fProjectKEY=Project.fProjectKEY "; $query0 .= " LEFT JOIN HvSettings ON Sequences.fHvSettingsKEY=HvSettings.fHvSettingsKEY "; $query0 .= " LEFT JOIN DiscriminatorThresholdTable ON Sequences.fDiscriminatorThresholdTableKEY=DiscriminatorThresholdTable.fDiscriminatorThresholdTableKEY "; $query0 .= " LEFT JOIN L1TriggerTable ON Sequences.fL1TriggerTableKEY=L1TriggerTable.fL1TriggerTableKEY "; $query0 .= " LEFT JOIN L2TriggerTable ON Sequences.fL2TriggerTableKEY=L2TriggerTable.fL2TriggerTableKEY "; $query0 .= " LEFT JOIN TriggerDelayTable ON Sequences.fTriggerDelayTableKEY=TriggerDelayTable.fTriggerDelayTableKEY "; $query0 .= " LEFT JOIN TestFlag ON Sequences.fTestFlagKEY=TestFlag.fTestFlagKEY "; $query0 .= " LEFT JOIN LightConditions ON Sequences.fLightConditionsKEY=LightConditions.fLightConditionsKEY "; $query0 .= " LEFT JOIN ManuallyChanged ON Sequences.fManuallyChangedKEY=ManuallyChanged.fManuallyChangedKEY "; $query0 .= " LEFT JOIN SequenceProcessStatus ON Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst "; $query0 .= " LEFT JOIN Calibration ON Sequences.fSequenceFirst=Calibration.fSequenceFirst "; $query0 .= " LEFT JOIN Star ON Sequences.fSequenceFirst=Star.fSequenceFirst "; if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"])) $query0 .= " WHERE Sequences.fSequenceFirst between " . $_GET["fRunMin"] . " and " . $_GET["fRunMax"] ; if (!empty($_GET["fSequenceNo"])) { if (strpos($query0, " WHERE ")==FALSE) $query0 .= " WHERE "; else $query0 .= " AND "; $query0 .= " Sequences.fSequenceFirst='" . $_GET["fSequenceNo"] . "'"; } if (!empty($_GET["fSourceN"])) { if (strpos($query0, " WHERE ")==FALSE) $query0 .= " WHERE "; else $query0 .= " AND "; $query0 .= " fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" "; } $query0 .= " ORDER BY Sequences.fSequenceFirst "; return $query0; } function InitGet($_GET) { // Find out whether it is the first call to the php script $first = empty($_GET["fRunMin"]) && empty($_GET["fRunMax"]); if (empty($_GET["fNumResults"])) $_GET["fNumResults"]="20"; if (empty($_GET["fAll"])) $_GET["fAll"]=$first?"On":""; } function PrintForm($_GET, $host, $user, $pw, $db) { printf("
\n"); printf("
\n"); printf("Sequ#    \n"); // printf("Sequence    \n"); if (empty($_GET["fRunMin"])) $min = GetMin("fSequenceFirst", "Sequences", $host, $user, $pw, $db); else $min = $_GET["fRunMin"]; if (empty($_GET["fRunMax"])) $max = GetMax("fSequenceFirst", "Sequences", $host, $user, $pw, $db); else $max = $_GET["fRunMax"]; printf("Sequences from \n", $min); printf("to    \n", $max); if ($_GET["fAll"]=="On") $checked = "checked"; else $checked = ""; printf("all information\n", $checked); printf("

\n"); printf("Source (regexp   \n"); ini_set("mysql.trace_mode", "Off"); ini_set("display_errors", "Off"); printf("   \n"); printf("   \n"); // if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE) // printf("   \n", $_SERVER["REQUEST_URI"]); if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE) printf("   \n", $_SERVER["REQUEST_URI"]); printf("

\n"); printf("
\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); } function GetStatus($step) { if (is_null($step)) return "not done"; else { if (strpos($step, "1970-01-01 00:00:00")==FALSE) return "done"; else return "not to be done"; } return "there is an error -> tell Dani"; } function GetCulm($azmin, $azmax) { $cul1=0; $cul2=180; if (($azmin < $cul1 && $azmax > $cul1) || ($azmin < $cul2 && $azmax > $cul2)) return "yes"; else return "no"; } function QueryRuns($type, $sequ, $db_id, $db) { $query1 = "SELECT fRunNumber, fCalibrationScriptName FROM RunData "; $query1 .= " LEFT JOIN RunType ON RunData.fRunTypeKEY=RunType.fRunTypeKEY "; $query1 .= " LEFT JOIN CalibrationScript ON RunData.fCalibrationScriptKEY=CalibrationScript.fCalibrationScriptKEY "; $query1 .= " WHERE fSequenceFirst=" . $sequ . " AND fRunTypeName='" . $type . "'"; mysql_select_db($db); $runs = mysql_query($query1, $db_id); $numruns = mysql_num_rows($runs); $calscript=mysql_result($runs, 0, 1); printf(" "); for ($i=0 ; $i<$numruns ; $i++) { $run=mysql_result($runs, $i, 0); if ($i!=0) printf(", "); printf(" %s ", $run); } printf(" \n"); printf(" %s ", $calscript); printf(" \n"); } function QueryMissingFiles($column, $sequ, $db_id, $db) { $query2 = "SELECT RunData.fRunNumber FROM RunData "; $query2 .= " LEFT JOIN RunProcessStatus ON RunData.fRunNumber=RunProcessStatus.fRunNumber "; $query2 .= " WHERE fSequenceFirst=" . $sequ . " AND IsNull(" . $column . ")"; mysql_select_db($db); $files = mysql_query($query2, $db_id); $numfiles = mysql_num_rows($files); printf(" "); for ($i=0 ; $i<$numfiles ; $i++) { $file=mysql_result($files, $i, 0); if ($i!=0) printf(", "); printf(" %s ", $file); } printf(" \n"); } function PrintSequenceInfo($result0, $db_id, $db, $calibtabs, $signaltabs, $startabs) { $numres = mysql_num_rows($result0); printf("
"); printf("\n"); printf(""); for ($i=0 ; $i<$numres ; $i++) { $firstrun=mysql_result($result0, $i, 0); $num=sprintf("%08d",$firstrun); $num2=substr($num,0,4); $lastrun=mysql_result($result0, $i, 1); $source=mysql_result($result0, $i, 2); $project=mysql_result($result0, $i, 3); $starttime=mysql_result($result0, $i, 4); $duration=mysql_result($result0, $i, 5); $numevents=mysql_result($result0, $i, 6); $zdmin=mysql_result($result0, $i, 7); $zdmax=mysql_result($result0, $i, 8); $azmin=mysql_result($result0, $i, 9); $azmax=mysql_result($result0, $i, 10); $hv=mysql_result($result0, $i, 11); $dt=mysql_result($result0, $i, 12); $l1tt=mysql_result($result0, $i, 13); $l2tt=mysql_result($result0, $i, 14); $td=mysql_result($result0, $i, 15); $testflag=mysql_result($result0, $i, 16); $lightcond=mysql_result($result0, $i, 17); $manuallychanged=mysql_result($result0, $i, 18); $sequfile=mysql_result($result0, $i, 19); $filesavail=mysql_result($result0, $i, 20); $callisto=mysql_result($result0, $i, 21); $star=mysql_result($result0, $i, 22); $fillcallisto=mysql_result($result0, $i, 23); $fillstar=mysql_result($result0, $i, 24); $unsi=mysql_result($result0, $i, 25); $unso=mysql_result($result0, $i, 26); $unri=mysql_result($result0, $i, 27); $unro=mysql_result($result0, $i, 28); $isoi=mysql_result($result0, $i, 29); $isoo=mysql_result($result0, $i, 30); $imc=mysql_result($result0, $i, 31); $arrtimei=mysql_result($result0, $i, 32); $arrtimeo=mysql_result($result0, $i, 33); $arrtimermsi=mysql_result($result0, $i, 34); $arrtimermso=mysql_result($result0, $i, 35); $convi=mysql_result($result0, $i, 36); $convo=mysql_result($result0, $i, 37); $meanpedrmsi=mysql_result($result0, $i, 38); $meanpedrmso=mysql_result($result0, $i, 39); $meansignali=mysql_result($result0, $i, 40); $meansignalo=mysql_result($result0, $i, 41); $pulsposmean=mysql_result($result0, $i, 42); $psf=mysql_result($result0, $i, 43); $ratio=mysql_result($result0, $i, 44); $muonrate=mysql_result($result0, $i, 45); $muonnum=mysql_result($result0, $i, 46); $effontime=mysql_result($result0, $i, 47); $datarate=mysql_result($result0, $i, 48); $maxhum=mysql_result($result0, $i, 49); $meannumislands=mysql_result($result0, $i, 50); $inhom=mysql_result($result0, $i, 51); $relontime=mysql_result($result0, $i, 52); $callink=mysql_result($result0, $i, 53); $starlink=mysql_result($result0, $i, 54); $sequlink=mysql_result($result0, $i, 55); printf(""); } printf("
"); printf("# of Sequences: %d ", $numres); printf("
"); printf(" "); printf(" \n"); printf(" ", $num2, $num, $firstrun); printf(" \n"); printf(" \n"); printf("
Sequence#: %s
%s, %s, zd: %s°-%s°, %.2fmin ", $source, $starttime, $zdmin, $zdmax, $duration/60); if (!is_null($star)) printf(", image files available "); printf(" \n"); printf("
\n"); printf("
\n"); printf(" "); printf(" \n"); printf(" "); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" "); if (!is_null($fillstar)) { printf(" \n"); printf(" \n"); printf(" \n"); } printf(" "); printf(" \n", $lightcond); printf(" \n", $maxhum); printf(" \n", $zdmin, $zdmax); printf(" \n", GetCulm($azmin, $azmax)); if (!is_null($fillstar)) { printf(" \n", $muonrate); printf(" \n", $ratio); printf(" \n", $psf); } printf("
conditionsmuon parameter
lightmax humzdculminationmuon rateratiopsf
%s%s %%%s°-%s°%s %sHz %s %smm
"); if ($_GET["fAll"]=="On") { printf("
\n"); printf("
\n"); printf(" "); printf(" \n"); printf(" "); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" "); printf(" "); printf(" \n", $source); printf(" \n", $numevents); printf(" \n", $project); printf(" \n", $lightcond); printf(" \n", $manuallychanged); printf(" \n", $testflag); printf("
general information
source name# eventsproject namelight conditionsmanually changedtest flag
%s %s %s %s %s %s
"); printf("
\n"); printf(" "); printf(" \n"); printf(" "); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" "); printf(" "); printf(" \n", $l1tt); printf(" \n", $l2tt); printf(" \n", $td); printf(" \n", $hv); printf(" \n", $dt); printf("
trigger & camera
l1 triggerl2 triggertrigger delayHvSettingsDT
%s %s %s %s %s
"); printf("
\n"); printf(" "); printf(" \n"); printf(" "); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" "); printf(" "); printf(" "); printf(" \n", GetStatus($sequfile)); printf(" \n", GetStatus($filesavail)); printf(" \n", GetStatus($callisto)); printf(" \n", GetStatus($fillcallisto)); printf(" \n", GetStatus($star)); printf(" \n", GetStatus($fillstar)); printf(" \n"); printf(" \n"); printf(" \n", $sequlink); printf(" \n"); printf(" \n", $callink); printf(" \n"); printf(" ", $starlink); printf(" "); printf("
steps
sequencefilefiles availcallistofillcalstarfillstar
%s %s %s %s %s %s
%s
%s
%s
"); printf("
\n"); if (!is_null($fillcallisto)) { printf(" "); printf(" "); printf(" \n"); printf(" \n"); printf(" "); printf(" "); printf(" \n"); printf(" \n", $unsi); printf(" \n", $unso); printf(" "); printf(" \n"); printf(" \n", $unri); printf(" \n", $unro); printf(" "); printf(" \n"); printf(" \n", $isoi); printf(" \n", $isoo); printf(" "); printf(" \n"); printf(" \n", $imc); printf(" "); printf(" \n"); printf(" \n", $arrtimei, $arrtimermsi); printf(" \n", $arrtimeo, $arrtimermso); printf(" "); printf(" \n"); printf(" \n", $convi); printf(" \n", $convo); printf(" "); printf(" \n"); printf(" \n", $meanpedrmsi); printf(" \n", $meanpedrmso); printf(" "); printf(" \n"); printf(" \n", $meansignali); printf(" \n", $meansignalo); printf(" "); printf(" \n"); printf(" \n", $pulsposmean); printf(" "); printf("
calibration (ref)innerouter
unsuitable pixel %s %s
unreliable pixel %s %s
isolated pixel %s %s
isolated max cluster %s
arrival time %s ± %s %s ± %s
conversion factor %s %s
mean ped rms %s %s
mean signal %s %s
mean pulse pos %s
"); printf("
\n"); } if (!is_null($fillstar)) { printf(" "); printf(" "); printf(" \n"); printf(" "); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" \n"); printf(" "); printf(" \n", $meannumislands); printf(" \n", $muonnum); printf(" \n", $effontime); printf(" \n", $datarate); printf(" \n", $muonrate); printf(" \n", $ratio); printf(" \n", $psf); printf(" \n", $inhom); printf(" \n", $relontime); printf(" "); printf("
star
# islands# muonseffontimedataratemuon rateratiopsfinhomrel. ontime
%s %s %ss %sHz %sHz %s %smm %s %s
"); printf("
"); } printf(" "); printf(" "); printf(" \n"); printf(" "); printf(" "); printf(" "); printf(" "); printf("
plots
calib: "); foreach($calibtabs as $key => $element) if (!$key==0) printf("%s ", $num2, $num, $num, $key, $element); printf("
signal: "); foreach($signaltabs as $key => $element) if (!$key==0) printf("%s ", $num2, $num, $num, $key, $element); printf("
star: "); foreach($startabs as $key => $element) if (!$key==0) printf("%s ", $num2, $num, $num, $key, $element); printf("
"); printf(" "); printf(" "); printf(" ", $firstrun, $lastrun); printf(" \n"); printf(" \n"); printf(" "); printf(" \n"); QueryRuns("Data", $firstrun, $db_id, $db); printf(" "); printf(" \n"); QueryRuns("Pedestal", $firstrun, $db_id, $db); printf(" "); printf(" \n"); QueryRuns("Calibration", $firstrun, $db_id, $db); printf(" "); printf("
runsrunscalscript
dataruns
pedruns
calruns
"); if (is_null($filesavail)) { printf(" "); printf(" "); printf(" "); printf(" \n"); printf(" "); printf(" \n"); QueryMissingFiles("fRawFileAvail", $firstrun, $db_id, $db); printf(" "); printf(" \n"); QueryMissingFiles("fCCFileAvail", $firstrun, $db_id, $db); printf(" "); printf(" \n"); QueryMissingFiles("fCaCoFileAvail", $firstrun, $db_id, $db); printf(" "); printf("
missing filesrun# of missing files
rawfiles
ccfiles
cacofiles
"); } } printf("
"); printf("

\n"); printf("
\n"); printf("\n"); } function PrintPage($html, $host, $user, $pw, $db, $calibtabs, $signaltabs, $startabs) { $db_id = mysql_connect($host, $user, $pw); if ($db_id==FALSE) { printf("mysql_connect returned the following error: %s\n", mysql_error()); die(""); } mysql_select_db($db); $query0 = CreateQuery($_GET); $result0 = mysql_query($query0, $db_id); if ($result0) { if ($html=="1" || $html=="2") PrintSequenceInfo($result0, $db_id, $db, $calibtabs, $signaltabs, $startabs); else PrintText($result0); mysql_free_result($result0); } mysql_close($db_id); PrintSubmittedQuery($query0, $html, $db, "old"); } include ("include.php"); include ("db.php"); include ("tabs.php"); ini_set("display_errors", "On"); ini_set("mysql.trace_mode", "On"); if (!empty($_GET["fSendTxt"])) { header("Content-type: application/octet"); header("Content-Disposition: attachment; filename=query-result.txt"); PrintPage("0", $host, $user, $pw, $db, $calibtabs, $signaltabs, $startabs); } else { echo (file_get_contents("index-header.html")); $environment = sizeof($_GET); InitGet($_GET); if (empty($_GET["fPrintTable"])) PrintForm($_GET, $host, $user, $pw, $db); if ($environment==0) printf("No query submitted yet.
"); else { if (empty($_GET["fPrintTable"])) PrintPage("1", $host, $user, $pw, $db, $calibtabs, $signaltabs, $startabs); else PrintPage("2", $host, $user, $pw, $db, $calibtabs, $signaltabs, $startabs); } echo (file_get_contents("index-footer.html")); } ini_set("display_errors", "Off"); ini_set("mysql.trace_mode", "Off"); } ?>