Commit in hps-java/src/main/java/org/lcsim/hps/monitoring/svt on MAIN | |||
SVTHitPulsePlots.java | +86 | added 1.1 |
Make SVT hit pulse plots
diff -N SVTHitPulsePlots.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ SVTHitPulsePlots.java 30 Apr 2012 23:16:41 -0000 1.1 @@ -0,0 +1,86 @@
+package org.lcsim.hps.monitoring.svt; + +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.HPSSVTCalibrationConstants; +import org.lcsim.util.Driver; +import org.lcsim.util.aida.AIDA; + +/** + * + * @author mgraham + */ +public class SVTHitPulsePlots extends Driver { + + private List<IPlotter> plotters = new ArrayList<IPlotter>(); + private AIDA aida = AIDA.defaultInstance(); + private String rawTrackerHitCollectionName = "RawTrackerHitMaker_RawTrackerHits"; + private String trackerName = "Tracker"; + private int eventCount; + private Detector detector = null; + + 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 plotter3 = fac.createPlotterFactory().create("HPS SVT Pulse Plots"); + plotters.add(plotter3); + IPlotterStyle style3 = plotter3.style(); + style3.statisticsBoxStyle().setVisible(false); + 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++) { + IHistogram2D pulsePlot = aida.histogram2D(sensors.get(i).getName() + "_pulse", 6, 0, 24 * 6.0, 50, 2500, 8000.0); + plotter3.region(i).plot(pulsePlot); + } + plotter3.show(); + } + + public SVTHitPulsePlots() { + } + + public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) { + this.rawTrackerHitCollectionName = rawTrackerHitCollectionName; + } + + + + public void process(EventHeader event) { + ++eventCount; + if (!HPSSVTCalibrationConstants.calibrationLoaded()) { + HPSSVTCalibrationConstants.loadCalibrationConstants(); + } + List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, "SVTRawTrackerHits"); + for (RawTrackerHit hrth : rawHits) { + fillPulsePlot(hrth); + } + + } + + 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]); + aida.histogram2D(sensorName+"_pulse").fill(24.0*i, pedSub); + } + } +}
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