'; print 'Individual results: enter ROC type, ROC number, and test type.
'; print 'Example: "L1C1", "25", "gas leak rate" displays gas leak rate test results for chamber L1C1#025.'; $types = array("L0C0","L0C1","L1C0","L1C1","L2C0","L2C1", "L3C0","L3C1","L4C0","L4C1","L5C0","L5C1"); $NumTypes = sizeof($types); $tests = array(); $names = array(); $tests[0] = "gas leak rate"; $names[0] = "leak"; $tests[1] = "conditioning"; $names[1] = "cond"; $tests[2] = "gain uniformity"; $names[2] = "guni"; $tests[3] = "absolute gain"; $names[3] = "gabs"; $tests[4] = "spectral"; $names[4] = "spec"; $tests[5] = "stability"; $names[5] = "stab"; $tests[6] = "upload conductance"; $names[6] = "ucon"; $NumTests = sizeof($tests); print '
   '; print '   '; print '   '; print '   '; print '
'; print "Note: use the ''Upload'' link on the top of the page for instructions on how to upload your chamber test files. Choose ''upload conductance'' option to be directed to an upload page that allows you to set the leak conductance for that ROC."; print "
Summary results: enter ROC type and test type.
"; print 'Example: "L1C1", "gas leak rate" displays a summary of the gas leak test for all L1C1 chambers.
'; print '
   '; print '   '; print '   '; print '
'; print "
List of chambers currently in gateDB (incomplete data if underlined). Click to see the numbers by test type."; foreach($types as $roctype){ print "
$roctype:"; $command = 'ls ../../../trd-db-files/'.$roctype.'/*.gif'; $line = exec($command, $output, $retval); // the whole trickery that follows is because we don't wanna run ls on the system too many times... $currnum = -1; $oldidx = -1; $nfiles = 0; $counter = array(); for($i=0; $i<=sizeof($output); $i++){ $idx = substr($output[$i],28,2); $num = (int)$idx; if($num != $currnum){ $currnum = $num; if($oldidx>0) $counter[$oldidx] = $nfiles; $nfiles = 1; } else { $nfiles++; $oldidx = $idx; } } foreach($counter as $key => $nfiles){ $roc = (int)$key; if($nfiles>15) print " $roc"; if($nfiles>0 && $nfiles<16) print " $roc"; } unset($output); unset($counter); } print '

'; } ?> Upload the conductance of ROC '.$type.'#'.$num.' into gateDB:'; print '
'; print '[l/h]   '; print ''; print ''; print '
'; exit; } function PostPlot($type,$idx,$what){ $file1 = "../trd-db-files/".$type."/".$idx."-".$what.".gif"; $file2 = "/alice1/www/html/trd-db-files/".$type."/".$idx."-".$what.".gif"; $line = exec("ls $file2", $output, $retval); if(sizeof($output)>0){ print ''; print ''; print ' '; } } function PrintMssg($roctype,$rocnum,$what){ $lnk = 'text data'; switch($what){ case "leak": print '
Gas leak plots ('.$lnk.'): (1) Oxygen Concentration [ppm] vs. Time [s] (logarithmic scale on Y-axis); (2) last 24 data points (when available).
'; break; case "cond": print '
Conditioning plots ('.$lnk.'): (1) Anode Voltage [V] vs. Time [s]; (2) Anode Dark Current [nA] vs. Anode Voltage [V].
'; break; case "guni": print '
Gain uniformity plots ('.$lnk.'): (1) Anode Current [nA] vs. Z [cm]; (2) Anode Current [nA] vs. Z[cm] x Phi[deg].
'; break; case "gabs": print '
Absolute gain plots ('.$lnk.'): (1) Gas Gain vs. Anode Voltage [V] (logarithmic scale on Y-axis); (2) Gas Gain vs. Anode Current [nA].
'; break; case "spec": print '
Spectral plot ('.$lnk.'): Entries per Channel.
'; break; case "stab": print '
Stability plots ('.$lnk.'): Time dependence of (1) Peak Position, (2) Standard Deviation, (3) Chi2/NDF, (4) Anode Current [nA], (5) Oxygen Concentration [ppm], (6) Pressure [mbar], and (7) Temperature [C].
'; break; default: break; } } function PrintPars($roctype,$rocnum,$what){ $table = "roc_test_head_".$what; $SQL = "SELECT * FROM ".$table." WHERE roc_type='".$roctype."' AND roc_serial='".$rocnum."'"; $res = pg_query($SQL) or print "ERROR - Couldn't execute header query: $SQL
"; $num = pg_num_rows($res); if($num == 0){ print "Query of $what header table produced empty result!
"; } else { $row = pg_fetch_array($res); extract($row); switch($what){ case "leak": print "Selected test parameters: flow rate=".$flow_rate." l/h, O2 end conc=".$end_oxy." ppm, leakrate high flow=".$high_leak." mbar*l/h, leak conductance=".$conductance." l/h
"; break; case "cond": print "Selected test parameters: drift voltage=".$drift_volt." V, number of trips=".$trip_num."
"; break; case "guni": print "Selected test parameters: source=".$source.", dark current start/end=".$start_curr."/".$end_curr." nA, mean current(2D)=".$mean_curr." nA, current standard/maximum deviation(2D)=".$sigma_curr."/".$max_dev_curr." %
"; break; case "gabs": print "Selected test parameters: source=".$source.", source count rate=".$count_rate." kHz
"; break; case "spec": print "Selected test parameters: O2 end conc=".$end_oxy." ppm, peak position=".$peak_pos.", width=".$sigma."
"; break; case "stab": break; default: break; } } } $idx = $num; if($num<10){$idx="00".$num;} if($num>9&&$num<100){$idx="0".$num;} print "Notes: Click on 'text data' link to access data in text format, including full test header - only some selected header parameters are printed below. If a plot is not displayed, it means its data is not available."; if($test=="ALL") { PrintMssg($type,$num,"leak"); PrintPars($type,$num,"leak"); PostPlot($type,$idx,"leak1"); PostPlot($type,$idx,"leak2"); PrintMssg($type,$num,"cond"); PrintPars($type,$num,"cond"); PostPlot($type,$idx,"cond1"); PostPlot($type,$idx,"cond2"); PrintMssg($type,$num,"guni"); PrintPars($type,$num,"guni"); PostPlot($type,$idx,"guni_1d"); PostPlot($type,$idx,"guni_2d"); PrintMssg($type,$num,"gabs"); PrintPars($type,$num,"gabs"); PostPlot($type,$idx,"gabs1"); PostPlot($type,$idx,"gabs2"); PrintMssg($type,$num,"spec"); PrintPars($type,$num,"spec"); PostPlot($type,$idx,"spec"); PrintMssg($type,$num,"stab"); PrintPars($type,$num,"stab"); PostPlot($type,$idx,"stab1"); PostPlot($type,$idx,"stab2"); PostPlot($type,$idx,"stab3"); PostPlot($type,$idx,"stab4"); PostPlot($type,$idx,"stab5"); PostPlot($type,$idx,"stab6"); PostPlot($type,$idx,"stab7"); } elseif($test=="leak"){ PrintMssg($type,$num,"leak"); PrintPars($type,$num,"leak"); PostPlot($type,$idx,"leak1"); PostPlot($type,$idx,"leak2"); } elseif($test=="cond"){ PrintMssg($type,$num,"cond"); PrintPars($type,$num,"cond"); PostPlot($type,$idx,"cond1"); PostPlot($type,$idx,"cond2"); } elseif($test=="guni"){ PrintMssg($type,$num,"guni"); PrintPars($type,$num,"guni"); PostPlot($type,$idx,"guni_1d"); PostPlot($type,$idx,"guni_2d"); } elseif($test=="gabs"){ PrintMssg($type,$num,"gabs"); PrintPars($type,$num,"gabs"); PostPlot($type,$idx,"gabs1"); PostPlot($type,$idx,"gabs2"); } elseif($test=="spec"){ PrintMssg($type,$num,"spec"); PrintPars($type,$num,"spec"); PostPlot($type,$idx,"spec"); } elseif($test=="stab"){ PrintMssg($type,$num,"stab"); PrintPars($type,$num,"stab"); PostPlot($type,$idx,"stab1"); PostPlot($type,$idx,"stab2"); PostPlot($type,$idx,"stab3"); PostPlot($type,$idx,"stab4"); PostPlot($type,$idx,"stab5"); PostPlot($type,$idx,"stab6"); PostPlot($type,$idx,"stab7"); } } // END OF INDIVIDUAL PLOTS SECTION // SUMMARY PLOTS: if($_POST['stype'] && $_POST['stest']){ $stype = $_POST['stype']; $stest = $_POST['stest']; $InDir = "../trd-db-files/summaries/h"; function DrawHist($file){ print ''; print ''; print ' '; } print "Notes: Click on plots to open a larger view in a new window. All histograms have log Y axes. The statistical box shows the number of chambers used and the mean and RMS values."; if($stest=="ALL") { print "
".$stype." Gas Leak: leak rate high flow [mbar*l/h] and leak conductance [l/h].
"; DrawHist($InDir."LeakRate-".$stype.".gif"); DrawHist($InDir."Conduct-".$stype.".gif"); print "
".$stype." Conditioning: last measurement time [s] and the anode dark current [nA] at that time. Some ROCs have a current of -1nA at last time, hence the difference in the number of ROCs.
"; DrawHist($InDir."MaxTime-".$stype.".gif"); DrawHist($InDir."AnodeCur-".$stype.".gif"); print "
".$stype." Gain Uniformity: 2D current mean [nA], standard deviation [%] and maximum deviation [%].
"; DrawHist($InDir."CurrMean-".$stype.".gif"); DrawHist($InDir."CurrSig-".$stype.".gif"); DrawHist($InDir."CurrMaxDev-".$stype.".gif"); print "
".$stype." Absolute Gain: the gas gain measured at 1450V, 1500V, 1550V, and 1600V.
"; DrawHist($InDir."Gain-".$stype.".gif"); print "
".$stype." Spectral: the peak energy resolution [%]
"; DrawHist($InDir."EnRes-".$stype.".gif"); } elseif($stest=="leak"){ print "
".$stype." Gas Leak: leak rate high flow [mbar*l/h] and leak conductance [l/h].
"; DrawHist($InDir."LeakRate-".$stype.".gif"); DrawHist($InDir."Conduct-".$stype.".gif"); } elseif($stest=="cond"){ print "
".$stype." Conditioning: last measurement time [s] and the anode dark current [nA] at that time. Some ROCs have a current of -1nA at last time, hence the difference in the number of ROCs.
"; DrawHist($InDir."MaxTime-".$stype.".gif"); DrawHist($InDir."AnodeCur-".$stype.".gif"); } elseif($stest=="guni"){ print "
".$stype." Gain Uniformity: 2D current mean [nA], standard deviation [%] and maximum deviation [%].
"; DrawHist($InDir."CurrMean-".$stype.".gif"); DrawHist($InDir."CurrSig-".$stype.".gif"); DrawHist($InDir."CurrMaxDev-".$stype.".gif"); } elseif($stest=="gabs"){ print "
".$stype." Absolute Gain: the gas gain measured at 1450V, 1500V, 1550V, and 1600V.
"; DrawHist($InDir."Gain-".$stype.".gif"); } elseif($stest=="spec"){ print "
".$stype." Spectral: the peak energy resolution [%]
"; DrawHist($InDir."EnRes-".$stype.".gif"); } } // END OF SUMMARY PLOTS SECTION ?>