2 added + 7 modified, total 9 files
hps-java/src/main/java/org/lcsim/hps/monitoring/svt
diff -u -r1.1 -r1.2
--- SVTMonitoringPlots.java 17 May 2012 18:24:10 -0000 1.1
+++ SVTMonitoringPlots.java 18 May 2012 03:48:45 -0000 1.2
@@ -117,7 +117,7 @@
pedestalShifts[module][layer] = aida.profile1D(HPSSVTDAQMaps.sensorArray[module][layer].getName() + " Pedestal Shifts", 640, -0.5, 639.5);
// pedestalShifts[module][layer] = aida.histogram2D(HPSSVTDAQMaps.sensorArray[module][layer].getName() + " Pedestal Shifts", 640, -0.5, 639.5, 100, -500, 500);
plotter.region(region).plot(pedestalShifts[module][layer]);
- t0s[module][layer] = aida.histogram2D(HPSSVTDAQMaps.sensorArray[module][layer].getName() + " Fitted T0", 640, -0.5, 639.5, 100, -24, 48);
+ t0s[module][layer] = aida.histogram2D(HPSSVTDAQMaps.sensorArray[module][layer].getName() + " Fitted T0", 640, -0.5, 639.5, 100, -24, 72);
plotter2.region(region).plot(t0s[module][layer]);
amps[module][layer] = aida.histogram2D(HPSSVTDAQMaps.sensorArray[module][layer].getName() + " Fitted Amplitude", 640, -0.5, 639.5, 100, 0, 2000);
plotter3.region(region).plot(amps[module][layer]);
@@ -160,8 +160,12 @@
int layer = fit.getRawTrackerHit().getIdentifierFieldValue("layer"); // 1-10; axial layers are odd layers; stereo layers are even
int module = fit.getRawTrackerHit().getIdentifierFieldValue("module"); // 0-1; module number is top or bottom
int strip = fit.getRawTrackerHit().getIdentifierFieldValue("strip");
- t0s[module][layer - 1].fill(strip,fit.getT0());
- amps[module][layer - 1].fill(strip,fit.getAmp());
+ if (fit.getShapeFitParameters().getChiSq() < 5) {
+// if (fit.getAmp() > 200) {
+ t0s[module][layer - 1].fill(strip, fit.getT0());
+// }
+ amps[module][layer - 1].fill(strip, fit.getAmp());
+ }
}
}
hps-java/src/main/java/org/lcsim/hps/monitoring/svt
diff -u -r1.12 -r1.13
--- SVTHitReconstructionPlots.java 17 May 2012 18:24:10 -0000 1.12
+++ SVTHitReconstructionPlots.java 18 May 2012 03:48:45 -0000 1.13
@@ -41,6 +41,7 @@
IPlotter plotter4;
IPlotter plotter5;
IPlotter plotter6;
+ IPlotter plotter7;
private Map<String, Integer> sensorRegionMap;
private String outputPlots = null;
@@ -77,43 +78,50 @@
style2.dataStyle().errorBarStyle().setVisible(false);
plotter2.createRegions(5, 4);
-
- plotter3 = fac.createPlotterFactory().create("HPS SVT Raw Hit Plots");
- plotter3.setTitle("Raw Hits");
+ plotter3 = fac.createPlotterFactory().create("HPS SVT Chisq Plots");
+ plotter3.setTitle("Chisq");
plotterFrame.addPlotter(plotter3);
- IPlotterStyle style3 = plotter3.style();
- style3.dataStyle().fillStyle().setColor("yellow");
- style3.dataStyle().errorBarStyle().setVisible(false);
+ plotter3.style().dataStyle().fillStyle().setColor("yellow");
+ plotter3.style().dataStyle().errorBarStyle().setVisible(false);
plotter3.createRegions(5, 4);
- plotter4 = fac.createPlotterFactory().create("HPS SVT Reco Hit Plots");
- plotter4.setTitle("Reco Hits");
+ plotter4 = fac.createPlotterFactory().create("HPS SVT Raw Hit Plots");
+ plotter4.setTitle("Raw Hits");
plotterFrame.addPlotter(plotter4);
- IPlotterStyle style4 = plotter4.style();
- style4.dataStyle().fillStyle().setColor("yellow");
- style4.dataStyle().errorBarStyle().setVisible(false);
+ IPlotterStyle style3 = plotter4.style();
+ style3.dataStyle().fillStyle().setColor("yellow");
+ style3.dataStyle().errorBarStyle().setVisible(false);
plotter4.createRegions(5, 4);
- plotter5 = fac.createPlotterFactory().create("HPS SVT Cluster Size Plots");
- plotter5.setTitle("Cluster Size");
+ plotter5 = fac.createPlotterFactory().create("HPS SVT Reco Hit Plots");
+ plotter5.setTitle("Reco Hits");
plotterFrame.addPlotter(plotter5);
- IPlotterStyle style5 = plotter5.style();
- style5.dataStyle().fillStyle().setColor("green");
- style5.dataStyle().errorBarStyle().setVisible(false);
+ IPlotterStyle style4 = plotter5.style();
+ style4.dataStyle().fillStyle().setColor("yellow");
+ style4.dataStyle().errorBarStyle().setVisible(false);
plotter5.createRegions(5, 4);
-
- plotter6 = fac.createPlotterFactory().create("HPS SVT Cluster Amp Plots");
- plotter6.setTitle("Cluster Amplitude");
+
+ plotter6 = fac.createPlotterFactory().create("HPS SVT Cluster Size Plots");
+ plotter6.setTitle("Cluster Size");
plotterFrame.addPlotter(plotter6);
- IPlotterStyle style6 = plotter6.style();
+ IPlotterStyle style5 = plotter6.style();
+ style5.dataStyle().fillStyle().setColor("green");
+ style5.dataStyle().errorBarStyle().setVisible(false);
+ plotter6.createRegions(5, 4);
+
+ plotter7 = fac.createPlotterFactory().create("HPS SVT Cluster Amp Plots");
+ plotter7.setTitle("Cluster Amp");
+ plotterFrame.addPlotter(plotter7);
+ IPlotterStyle style6 = plotter7.style();
style6.dataStyle().fillStyle().setColor("green");
style6.dataStyle().errorBarStyle().setVisible(false);
- plotter6.createRegions(5, 4);
+ plotter7.createRegions(5, 4);
for (SiSensor sensor : sensors) {
- IHistogram1D timingPlot = aida.histogram1D(sensor.getName() + "_timing", 50, -25, 25.0);
+ IHistogram1D timingPlot = aida.histogram1D(sensor.getName() + "_timing", 50, -100, 100.0);
IHistogram1D amplitudePlot = aida.histogram1D(sensor.getName() + "_amplitude", 50, 0, 2000.0);
+ IHistogram1D chisqPlot = aida.histogram1D(sensor.getName() + "_chisq", 100, 0, 10.0);
IHistogram1D nrawPlot = aida.histogram1D(sensor.getName() + "_raw_hits", 10, 0, 9.0);
IHistogram1D nrecoPlot = aida.histogram1D(sensor.getName() + "_reco_hits", 10, 0, 9.0);
IHistogram1D clusterSizePlot = aida.histogram1D(sensor.getName() + "_cluster_size", 9, 1, 9.0);
@@ -121,10 +129,11 @@
int region = sensorRegionMap.get(sensor.getName());
plotter.region(region).plot(timingPlot);
plotter2.region(region).plot(amplitudePlot);
- plotter3.region(region).plot(nrawPlot);
- plotter4.region(region).plot(nrecoPlot);
- plotter5.region(region).plot(clusterSizePlot);
- plotter6.region(region).plot(clusterAmpPlot);
+ plotter4.region(region).plot(nrawPlot);
+ plotter5.region(region).plot(nrecoPlot);
+ plotter6.region(region).plot(clusterSizePlot);
+ plotter7.region(region).plot(clusterAmpPlot);
+ plotter3.region(region).plot(chisqPlot);
}
plotterFrame.pack();
@@ -184,6 +193,7 @@
String sensorName = hrth.getRawTrackerHit().getDetectorElement().getName();
aida.histogram1D(sensorName + "_timing").fill(fittedT0);
aida.histogram1D(sensorName + "_amplitude").fill(fittedAmp);
+ aida.histogram1D(sensorName + "_chisq").fill(hrth.getShapeFitParameters().getChiSq());
}
for (SiSensor sensor : sensors) {
String sensorName = sensor.getName();
@@ -200,7 +210,7 @@
//double cluAmp = getCluAmp(cluster,fittedrawHits);
double cluAmp = cluster.getdEdx();
aida.histogram1D(sensorName + "_cluster_amp").fill(cluAmp);
-
+
}
}
@@ -209,27 +219,26 @@
stripHits.getdEdx();
List<RawTrackerHit> rawHits = stripHits.getRawHits();
double sum = 0.0;
- for (RawTrackerHit hit: rawHits) {
+ for (RawTrackerHit hit : rawHits) {
//find the fitted hit amplitude
- for (HPSFittedRawTrackerHit fittedHit: hrths) {
+ for (HPSFittedRawTrackerHit fittedHit : hrths) {
RawTrackerHit fh = fittedHit.getRawTrackerHit();
if (fh.equals(hit)) {
sum += fittedHit.getAmp();
- }
+ }
}
}
return sum;
}
-
-
-
+
public void endOfData() {
- if (outputPlots != null)
+ if (outputPlots != null) {
try {
aida.saveAs(outputPlots);
} catch (IOException ex) {
Logger.getLogger(TrackingReconstructionPlots.class.getName()).log(Level.SEVERE, null, ex);
}
+ }
plotterFrame.dispose();
}
hps-java/src/main/java/org/lcsim/hps/monitoring/svt
diff -u -r1.3 -r1.4
--- SVTSimpleEventDisplay.java 17 May 2012 18:24:10 -0000 1.3
+++ SVTSimpleEventDisplay.java 18 May 2012 03:48:45 -0000 1.4
@@ -34,10 +34,11 @@
private String trackerHitCollection = "StripClusterer_SiTrackerHitStrip1D";
private String helicalHitCollection = "HelicalTrackHits";
private AIDA aida = AIDA.defaultInstance();
- private IPlotter plotter, plotter2, plotter3;
+ private IPlotter plotter, plotter2, plotter3, plotter4;
private IHistogram1D[][] rth = new IHistogram1D[2][10];
private IHistogram1D[][] th = new IHistogram1D[2][10];
private IHistogram1D[][] hth = new IHistogram1D[2][10];
+ private IHistogram1D hitCount[] = new IHistogram1D[2];
private boolean singleEvent = true;
public SVTSimpleEventDisplay() {
@@ -102,6 +103,13 @@
plotter3.style().statisticsBoxStyle().setVisible(false);
plotter3.createRegions(4, 5);
+ plotter4 = fac.createPlotterFactory().create("Hit Counts");
+ plotter4.setTitle("Hit Counts");
+ plotterFrame.addPlotter(plotter4);
+ plotter4.style().dataStyle().errorBarStyle().setVisible(false);
+ plotter4.style().statisticsBoxStyle().setVisible(false);
+ plotter4.createRegions(1, 2);
+
// Setup the occupancy plots.
aida.tree().cd("/");
for (int module = 0; module < 2; module++) {
@@ -116,6 +124,11 @@
}
}
+ hitCount[0] = aida.histogram1D("Hit layers in top", 6, -0.5, 5.5);
+ plotter4.region(0).plot(hitCount[0]);
+ hitCount[1] = aida.histogram1D("Hit layers in bottom", 6, -0.5, 5.5);
+ plotter4.region(1).plot(hitCount[1]);
+
plotterFrame.pack();
plotterFrame.setVisible(true);
}
@@ -161,15 +174,27 @@
if (event.hasCollection(HelicalTrackHit.class, helicalHitCollection)) {
List<HelicalTrackHit> helicalTrackerHits = event.get(HelicalTrackHit.class, helicalHitCollection);
+ boolean[][] hasHit = new boolean[2][5];
+
// Increment strip hit count.
for (HelicalTrackHit hit : helicalTrackerHits) {
for (Object rawHit : hit.getRawHits()) {
int layer = ((RawTrackerHit) rawHit).getIdentifierFieldValue("layer"); // 1-10; axial layers are odd layers; stereo layers are even
int module = ((RawTrackerHit) rawHit).getIdentifierFieldValue("module"); // 0-1; module number is top or bottom
-
+ hasHit[module][(layer - 1) / 2] = true;
hth[module][layer - 1].fill(((RawTrackerHit) rawHit).getIdentifierFieldValue("strip"));
}
}
+
+ for (int module = 0; module < 2; module++) {
+ int count = 0;
+ for (int i = 0; i < 5; i++) {
+ if (hasHit[module][i]) {
+ count++;
+ }
+ }
+ hitCount[module].fill(count);
+ }
}
}
// public void endOfData() {
hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.8 -r1.9
--- HPSShaperAnalyticFitAlgorithm.java 17 May 2012 18:24:10 -0000 1.8
+++ HPSShaperAnalyticFitAlgorithm.java 18 May 2012 03:48:45 -0000 1.9
@@ -13,35 +13,36 @@
*/
public class HPSShaperAnalyticFitAlgorithm implements HPSShaperFitAlgorithm {
- public HPSShapeFitParameters fitShape(RawTrackerHit rth, ChannelConstants constants){
- short[] samples = rth.getADCValues();
- return this.fitShape(samples, constants);
+ public HPSShapeFitParameters fitShape(RawTrackerHit rth, ChannelConstants constants) {
+ short[] samples = rth.getADCValues();
+ return this.fitShape(samples, constants);
}
-
- public HPSShapeFitParameters fitShape(short[] samples, ChannelConstants constants){
- double minChisq = Double.POSITIVE_INFINITY;
+
+ public HPSShapeFitParameters fitShape(short[] samples, ChannelConstants constants) {
+ double minChisq = Double.POSITIVE_INFINITY;
int bestStart = 0;
HPSShapeFitParameters fit = new HPSShapeFitParameters();
- for(int i = 0; i < samples.length -2; i++){
+ for (int i = 0; i < samples.length - 2; i++) {
double chisq = fitSection(samples, constants, fit, i);
+// System.out.println("i = " + i + ", " + fit);
if (chisq < minChisq) {
minChisq = chisq;
bestStart = i;
}
}
fit.setChiSq(fitSection(samples, constants, fit, bestStart));
-// System.out.format("%f\t%f\t%f\t%f\t%f\t%f\n",samples[0]-constants.getPedestal(),samples[1]-constants.getPedestal(),samples[2]-constants.getPedestal(),samples[3]-constants.getPedestal(),samples[4]-constants.getPedestal(),samples[5]-constants.getPedestal());
-// System.out.println("start = "+bestStart+", "+fit);
+// System.out.format("%f\t%f\t%f\t%f\t%f\t%f\n", samples[0] - constants.getPedestal(), samples[1] - constants.getPedestal(), samples[2] - constants.getPedestal(), samples[3] - constants.getPedestal(), samples[4] - constants.getPedestal(), samples[5] - constants.getPedestal());
+// System.out.println("start = " + bestStart + ", " + fit);
return fit;
}
- private double fitSection(short[] samples, ChannelConstants constants, HPSShapeFitParameters fit, int start) {
+ private double fitSection(short[] samples, ChannelConstants constants, HPSShapeFitParameters fit, int start) {
int length = samples.length - start;
double[] y = new double[length];
double[] t = new double[length];
for (int i = 0; i < length; i++) {
- y[i] = samples[start + i] - constants.getPedestal();
+ y[i] = samples[start + i] - constants.getPedestal();
t[i] = HPSSVTConstants.SAMPLE_INTERVAL * i;
}
@@ -77,7 +78,7 @@
time_var += dt_dp * dt_dp;
height_var += dh_dp * dh_dp;
}
-
+ t0 += HPSSVTConstants.SAMPLE_INTERVAL * start;
fit.setAmp(A);
fit.setAmpErr(Math.sqrt(height_var));
fit.setT0(t0);
hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.9 -r1.10
--- HPSSVTDAQMaps.java 17 May 2012 18:24:10 -0000 1.9
+++ HPSSVTDAQMaps.java 18 May 2012 03:48:45 -0000 1.10
@@ -9,6 +9,7 @@
//--- org.lcsim ---//
import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.conditions.ConditionsManager.ConditionsNotFoundException;
import org.lcsim.conditions.ConditionsSet;
import org.lcsim.detector.IDetectorElement;
import org.lcsim.detector.identifier.IIdentifier;
@@ -25,7 +26,7 @@
* Creates maps between SVT sensors to FPGA and Hybrid pairs and vice versa
*
* @author Omar Moreno
- * @version $Id: HPSSVTDAQMaps.java,v 1.9 2012/05/17 18:24:10 meeg Exp $
+ * @version $Id: HPSSVTDAQMaps.java,v 1.10 2012/05/18 03:48:45 meeg Exp $
*/
public class HPSSVTDAQMaps extends Driver {
@@ -108,11 +109,11 @@
// Get the HPS detector conditions
// Removed this because it causes detector to be set twice when running jobs. --JM
- //try {
- // mgr.setDetector(detector.getDetectorName(), 0);
- //} catch (ConditionsNotFoundException e) {
- // System.out.println("The conditions for " + detector.getDetectorName() + " were not found!");
- //}
+ try {
+ mgr.setDetector(detector.getDetectorName(), 0);
+ } catch (ConditionsNotFoundException e) {
+ System.out.println("The conditions for " + detector.getDetectorName() + " were not found!");
+ }
// Get the top SVT DAQ Map
ConditionsSet svtDAQMap = mgr.getConditions("daqmap/SVTDAQMapTop");
hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.10 -r1.11
--- HPSSVTCalibrationConstants.java 17 May 2012 18:24:10 -0000 1.10
+++ HPSSVTCalibrationConstants.java 18 May 2012 03:48:45 -0000 1.11
@@ -41,7 +41,8 @@
*/>, double[] /*
* constants
*/> tpMap = new HashMap<Pair<Integer, Integer>, double[]>();
- private static boolean calibrationLoaded = false;
+ private static boolean pedestalLoaded = false;
+ private static boolean tpLoaded = false;
/**
* Default Constructor.
@@ -75,6 +76,23 @@
throw new RuntimeException("couldn't get baseline file", e);
}
+
+ if (date != null) {
+ ConditionsSet calibSet = conditions.getConditions("calibSVT/tp");
+ filePath = HPSCalibrationListener.getCalibForDate(calibSet, date);
+ }
+
+ if (filePath == null) {
+ filePath = "calibSVT/default.tp";
+ }
+
+ try {
+ Reader tpReader = conditions.getRawConditions(filePath).getReader();
+ loadTp(tpReader);
+ } catch (IOException e) {
+ throw new RuntimeException("couldn't get Tp file", e);
+ }
+
}
private static void loadBaseline(Reader baselineReader) {
@@ -124,11 +142,60 @@
}
}
}
- calibrationLoaded = true;
+ pedestalLoaded = true;
+ }
+
+ public static boolean pedestalLoaded() {
+ return pedestalLoaded;
+ }
+
+ private static void loadTp(Reader baselineReader) {
+ BufferedReader bufferedTp = new BufferedReader(baselineReader);
+ String line;
+ while (true) {
+ try {
+ line = bufferedTp.readLine();
+ } catch (IOException e) {
+ throw new RuntimeException("couldn't parse baseline file", e);
+ }
+ if (line == null) {
+ break;
+ }
+
+ if (line.indexOf("#") != -1) {
+ line = line.substring(0, line.indexOf("#"));
+ }
+
+ StringTokenizer lineTok = new StringTokenizer(line);
+
+ if (lineTok.countTokens() != 0) {
+ if (lineTok.countTokens() != 7) {
+ throw new RuntimeException("Invalid line in baseline file: " + line);
+ } else {
+ int fpga = Integer.valueOf(lineTok.nextToken());
+ int hybrid = Integer.valueOf(lineTok.nextToken());
+ int channel = Integer.valueOf(lineTok.nextToken());
+ double amplitude = Double.valueOf(lineTok.nextToken());
+ double t0 = Double.valueOf(lineTok.nextToken());
+ double tp = Double.valueOf(lineTok.nextToken());
+ double chisq = Double.valueOf(lineTok.nextToken());
+
+ Pair<Integer, Integer> daqPair = new Pair(hybrid, fpga);
+
+ double[] tps = tpMap.get(daqPair);
+ if (tps == null) {
+ tps = new double[HPSSVTConstants.TOTAL_APV25_CHANNELS * HPSSVTConstants.TOTAL_APV25_PER_HYBRID];
+ tpMap.put(daqPair, tps);
+ }
+ tps[channel] = tp;
+ }
+ }
+ }
+ tpLoaded = true;
}
- public static boolean calibrationLoaded() {
- return calibrationLoaded;
+ public static boolean tpLoaded() {
+ return tpLoaded;
}
public static Double getNoise(SiSensor sensor, int channel) {
@@ -183,8 +250,7 @@
if (value != null) {
constants.setTp(value);
} else {
-// System.out.println("Couldn't get Tp for sensor " + sensor.getName() + ", channel " + channel);
-// constants.setTp(35.0);
+ System.out.println("Couldn't get Tp for sensor " + sensor.getName() + ", channel " + channel);
constants.setTp(53.0);
}
hps-java/scripts
diff -N make_svt_tp.sh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ make_svt_tp.sh 18 May 2012 03:48:45 -0000 1.1
@@ -0,0 +1,11 @@
+#!/bin/bash
+for fpga in `seq 0 6`
+do
+ for hyb in `seq 0 2`
+ do
+ for chan in `seq 0 639`
+ do
+ echo "$fpga $hyb $chan 4913.0 17.0 35.0 289.0"
+ done
+ done
+done
hps-java/scripts
diff -N make_svt_base.sh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ make_svt_base.sh 18 May 2012 03:48:45 -0000 1.1
@@ -0,0 +1,11 @@
+#!/bin/bash
+for fpga in `seq 0 6`
+do
+ for hyb in `seq 0 2`
+ do
+ for chan in `seq 0 639`
+ do
+ echo "$fpga $hyb $chan 1638.0 18.0"
+ done
+ done
+done
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.11 -r1.12
--- TestRunEvioToLcio.java 17 May 2012 18:24:11 -0000 1.11
+++ TestRunEvioToLcio.java 18 May 2012 03:48:45 -0000 1.12
@@ -32,7 +32,7 @@
*/
public class TestRunEvioToLcio {
- private static final String defaultDetectorName = "HPS-Test-JLAB-v4pt0";
+ private static final String defaultDetectorName = "HPS-TestRun-v2";
private static final String defaultSteeringFile = "/org/lcsim/hps/steering/DummyMonitoring.lcsim";
/**
@@ -169,13 +169,6 @@
// write events to disk.
fileLoop:
while (maxEvents == 0 || nEvents < maxEvents) {
- if (sleepTime > 0) {
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
EvioEvent evioEvent = null;
try {
eventLoop:
@@ -215,6 +208,15 @@
// Catch all event processing errors and continue.
e.printStackTrace();
continue;
+ } finally {
+ if (sleepTime > 0) {
+ try {
+ Thread.sleep(sleepTime);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
}
nEvents++;
}
CVSspam 0.2.12