Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/monitoring on MAIN
SVTHitReconstructionPlots.java+120added 1.1
Monitoring plots for reconstructed SVT hits...right now show t0/amplitude and pulse shape for hits on each sensor.

hps-java/src/main/java/org/lcsim/hps/monitoring
SVTHitReconstructionPlots.java added at 1.1
diff -N SVTHitReconstructionPlots.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SVTHitReconstructionPlots.java	30 Apr 2012 18:49:46 -0000	1.1
@@ -0,0 +1,120 @@
+package org.lcsim.hps.monitoring;
+
+import hep.aida.*;
+import java.util.ArrayList;
+import java.util.List;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.hps.recon.tracking.HPSFittedRawTrackerHit;
+import org.lcsim.hps.recon.tracking.HPSSVTCalibrationConstants;
+import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author mgraham
+ */
+public class SVTHitReconstructionPlots extends Driver {
+
+    private List<IPlotter> plotters = new ArrayList<IPlotter>();
+    private AIDA aida = AIDA.defaultInstance();
+    private String rawTrackerHitCollectionName = "RawTrackerHitMaker_RawTrackerHits";
+    private String rawCalorimeterHitCollectionName = "EcalRawHits";
+    private String trackerHitCollectionName = "StripClusterer_SiTrackerHitStrip1D";
+    private String trackerName = "Tracker";
+    private int eventCount;
+    private Detector detector = null;
+    private IHistogram2D adcValuePlot;
+
+    protected void detectorChanged(Detector detector) {
+        this.detector = detector;
+        aida.tree().cd("/");
+
+
+        List<SiSensor> sensors = detector.getSubdetector(trackerName).getDetectorElement().findDescendants(SiSensor.class);
+
+
+        IAnalysisFactory fac = aida.analysisFactory();
+        IPlotter plotter = fac.createPlotterFactory().create("HPS SVT Timing Plots");
+        plotters.add(plotter);
+        IPlotterStyle style = plotter.style();
+        style.dataStyle().fillStyle().setColor("yellow");
+        style.dataStyle().errorBarStyle().setVisible(false);
+        plotter.createRegions(5, 4);
+
+        IPlotter plotter2 = fac.createPlotterFactory().create("HPS SVT Amplitude Plots");
+        plotters.add(plotter2);
+        IPlotterStyle style2 = plotter2.style();
+        style2.dataStyle().fillStyle().setColor("yellow");
+        style2.dataStyle().errorBarStyle().setVisible(false);
+        plotter2.createRegions(5, 4);
+
+        IPlotter plotter3 = fac.createPlotterFactory().create("HPS SVT Pulse Plots");
+        plotters.add(plotter3);
+        IPlotterStyle style3 = plotter3.style();
+        
+        style3.dataStyle().fillStyle().setColor("yellow");
+        style3.dataStyle().errorBarStyle().setVisible(false);
+        plotter3.createRegions(5, 4);
+
+        int ns = sensors.size();
+        for (int i = 0; i < ns; i++) {
+            IHistogram1D timingPlot = aida.histogram1D(sensors.get(i).getName() + "_timing", 50, -10, 90);
+            IHistogram1D amplitudePlot = aida.histogram1D(sensors.get(i).getName() + "_amplitude", 50, 0, 3000.0);
+            IHistogram2D pulsePlot = aida.histogram2D(sensors.get(i).getName() + "_pulse", 6, 0, 24 * 6.0, 50, -100, 3000.0);
+            plotter.region(i).plot(timingPlot);
+            plotter2.region(i).plot(amplitudePlot);
+            plotter3.region(i).plot(pulsePlot);
+        }
+        plotter.show();
+        plotter2.show();
+        plotter3.show();
+    }
+
+    public SVTHitReconstructionPlots() {
+    }
+
+    public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) {
+        this.rawTrackerHitCollectionName = rawTrackerHitCollectionName;
+    }
+
+    public void setRawCalorimeterHitCollectionName(String rawCalorimeterHitCollectionName) {
+        this.rawCalorimeterHitCollectionName = rawCalorimeterHitCollectionName;
+    }
+
+    public void setTrackerHitCollectionName(String trackerHitCollectionName) {
+        this.trackerHitCollectionName = trackerHitCollectionName;
+    }
+
+    public void process(EventHeader event) {        
+        ++eventCount;
+        List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, "SVTRawTrackerHits");
+        List<HPSFittedRawTrackerHit> fittedrawHits = event.get(HPSFittedRawTrackerHit.class, "SVTFittedRawTrackerHits");
+        List<SiTrackerHitStrip1D> stripHits = event.get(SiTrackerHitStrip1D.class, "StripClusterer_SiTrackerHitStrip1D");
+        for (HPSFittedRawTrackerHit hrth : fittedrawHits) {
+            double fittedAmp = hrth.getAmp();
+            double fittedT0 = hrth.getT0();
+            String sensorName = hrth.getRawTrackerHit().getDetectorElement().getName();
+            aida.histogram1D(sensorName + "_timing").fill(fittedT0);
+            aida.histogram1D(sensorName + "_amplitude").fill(fittedAmp);
+            fillPulsePlot(hrth.getRawTrackerHit());
+
+        }
+
+    }
+
+    private void fillPulsePlot(RawTrackerHit hit) {
+        String sensorName = hit.getDetectorElement().getName();
+        SiSensor sensor = (SiSensor) hit.getDetectorElement();
+        int strip = hit.getIdentifierFieldValue("strip");
+        short[] adcVal = hit.getADCValues();
+        double ped = HPSSVTCalibrationConstants.getPedestal(sensor, strip);
+        for (int i = 0; i < 6; i++) {
+            double pedSub = (adcVal[i] - ped);
+            aida.histogram2D(sensorName+"_pulse").fill(24.0*i, pedSub);
+        }       
+    }
+}
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1