Print

Print


Commit in java/trunk/monitoring-drivers on MAIN
pom.xml+1-1368 -> 369
src/main/java/org/hps/monitoring/drivers/ecal/BasicMonitoringPlotsDriver.java+105added 369
                                             /ECalCellIDPrintDriver.java+81added 369
                                             /EcalClusterPlots.java+200added 369
                                             /EcalDaqPlots.java+129added 369
                                             /EcalEventMonitor.java+127added 369
                                             /EcalEvsX.java+186added 369
                                             /EcalHitPlots.java+268added 369
                                             /EcalMonitoringPlots.java+135added 369
                                             /EcalPedestalPlots.java+308added 369
                                             /EcalWindowEventPlots.java+148added 369
                                             /EcalWindowPlots.java+187added 369
                                             /EcalWindowPlotsXY.java+175added 369
                                             /TriggerPlots.java+577added 369
src/main/java/org/hps/monitoring/drivers/svt/PedestalPlots.java+159added 369
                                            /SVTCellIDPrintDriver.java+68added 369
                                            /SVTEventDisplay.java+168added 369
                                            /SVTEventInfo.java+189added 369
                                            /SVTHitPulsePlots.java+200added 369
                                            /SVTHitRecoCorrelations.java+561added 369
                                            /SVTHitReconstructionPlots.java+306added 369
                                            /SVTMonitoringPlots.java+167added 369
                                            /SVTPulseFitPlots.java+189added 369
                                            /SVTSimpleEventDisplay.java+329added 369
                                            /SensorOccupancyPlotsDriver.java+190added 369
                                            /TrackTimePlots.java+314added 369
                                            /TrackingReconstructionPlots.java+1108added 369
src/main/java/org/hps/monitoring/ecal/lcsim/LCIOBridgeDriver.java+4-13368 -> 369
src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.java+3-3368 -> 369
                                           /EcalDaqPlots.java+4-9368 -> 369
                                           /EcalEventDisplay.java+9-22368 -> 369
                                           /EcalHitPlots.java+5-15368 -> 369
                                           /EcalMonitoringPlots.java+5-7368 -> 369
                                           /EcalWindowPlots.java+2-2368 -> 369
                                           /EcalWindowPlotsXY.java+1-1368 -> 369
+6608-73
26 added + 9 modified, total 35 files
Fix up this module's build with some new class locations.  Add back monitoring drivers which had wrong package.

java/trunk/monitoring-drivers
pom.xml 368 -> 369
--- java/trunk/monitoring-drivers/pom.xml	2014-03-26 03:45:57 UTC (rev 368)
+++ java/trunk/monitoring-drivers/pom.xml	2014-03-26 03:52:24 UTC (rev 369)
@@ -21,7 +21,7 @@
     <dependencies>
         <dependency>
             <groupId>org.hps</groupId>
-            <artifactId>hps-java</artifactId>
+            <artifactId>hps-recon</artifactId>
         </dependency>
     </dependencies>
     

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
BasicMonitoringPlotsDriver.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/BasicMonitoringPlotsDriver.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/BasicMonitoringPlotsDriver.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,105 @@
+package org.hps.monitoring.drivers.ecal;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.IHistogramFactory;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterFactory;
+
+import java.util.List;
+
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawCalorimeterHit;
+import org.lcsim.util.Driver;
+
+/**
+ * Basic ECal monitoring plots that work on Test Run data.
+ * @author jeremym
+ */
+public class BasicMonitoringPlotsDriver extends Driver {
+	
+	private String calHitsCollectionName = "EcalCalHits"; 
+	private String rawHitsCollectionName = "EcalReadoutHits";
+	private String clustersCollectionName = "EcalClusters";
+	
+	private IHistogram1D calHitEnergyH1D;
+	private IHistogram1D clusterEnergyH1D;
+	private IHistogram1D rawHitAmplitudeH1D;
+	private IHistogram2D calHitEnergyMapH2D;
+	
+	public BasicMonitoringPlotsDriver() {		
+	}
+	
+	public void startOfData() {		
+		
+		IAnalysisFactory.create().createHistogramFactory(null);
+		IPlotterFactory plotFactory = IAnalysisFactory.create().createPlotterFactory("ECAL Monitoring");
+		IHistogramFactory histogramFactory = IAnalysisFactory.create().createHistogramFactory(null);
+		
+		calHitEnergyH1D = histogramFactory.createHistogram1D(calHitsCollectionName + ": Energy", calHitsCollectionName + ": Energy", 200, 0.0, 2.0);
+		calHitEnergyH1D.annotation().addItem("xAxisLabel", "GeV");
+		calHitEnergyH1D.annotation().addItem("yAxisLabel", "Count");
+		IPlotter plotter = plotFactory.create("CalorimeterHits");
+		plotter.createRegion();
+		plotter.style().gridStyle().setVisible(false);
+		plotter.style().dataStyle().errorBarStyle().setVisible(false);
+		plotter.region(0).plot(calHitEnergyH1D);
+		plotter.show();
+		
+		rawHitAmplitudeH1D = histogramFactory.createHistogram1D(rawHitsCollectionName + ": Amplitude", rawHitsCollectionName + ": Amplitude", 150, 0.0, 15000.0);
+		rawHitAmplitudeH1D.annotation().addItem("xAxisLabel", "ADC Value");
+		rawHitAmplitudeH1D.annotation().addItem("yAxisLabel", "Count");
+		plotter = plotFactory.create("RawCalorimeterHits");
+		plotter.createRegion();
+		plotter.style().gridStyle().setVisible(false);
+		plotter.style().dataStyle().errorBarStyle().setVisible(false);
+		plotter.region(0).plot(rawHitAmplitudeH1D);
+		plotter.show();
+		
+		clusterEnergyH1D = histogramFactory.createHistogram1D(clustersCollectionName + ": Energy", clustersCollectionName + ": Energy", 100, 0.0, 3.0);
+		clusterEnergyH1D.annotation().addItem("xAxisLabel", "GeV");
+		clusterEnergyH1D.annotation().addItem("yAxisLabel", "Count");
+		plotter = plotFactory.create("Clusters");
+		plotter.createRegion();
+		plotter.style().gridStyle().setVisible(false);
+		plotter.style().dataStyle().errorBarStyle().setVisible(false);
+		plotter.region(0).plot(clusterEnergyH1D);
+		plotter.show();
+		
+		calHitEnergyMapH2D = histogramFactory.createHistogram2D(calHitsCollectionName + ": Energy Map", calHitsCollectionName + ": Energy Map", 47, -23.5, 23.5, 11, -5.5, 5.5);
+		plotter = plotFactory.create("CalorimeterHit Energy Map");
+		plotter.createRegion();
+		plotter.style().setParameter("hist2DStyle", "colorMap");
+		plotter.style().gridStyle().setVisible(false);
+		plotter.region(0).plot(calHitEnergyMapH2D);
+		plotter.show();
+	}
+	
+	public void process(EventHeader event) {
+		
+		List<CalorimeterHit> calHits = event.get(CalorimeterHit.class, calHitsCollectionName);
+		for (CalorimeterHit hit : calHits) {
+			calHitEnergyH1D.fill(hit.getCorrectedEnergy());
+			calHitEnergyMapH2D.fill(
+					hit.getIdentifierFieldValue("ix"), 
+					hit.getIdentifierFieldValue("iy"), 
+					hit.getCorrectedEnergy());
+		}
+		
+		List<Cluster> clusters = event.get(Cluster.class, clustersCollectionName);
+		for (Cluster cluster : clusters) {
+			clusterEnergyH1D.fill(cluster.getEnergy());
+		}
+		
+		List<RawCalorimeterHit> rawHits = null; 
+		if (event.hasCollection(RawCalorimeterHit.class, rawHitsCollectionName)) {
+			rawHits = event.get(RawCalorimeterHit.class, rawHitsCollectionName); 
+			for (RawCalorimeterHit hit : rawHits) {
+				rawHitAmplitudeH1D.fill(hit.getAmplitude());
+			}
+		}
+	}
+}
\ No newline at end of file

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
ECalCellIDPrintDriver.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/ECalCellIDPrintDriver.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/ECalCellIDPrintDriver.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,81 @@
+package org.hps.monitoring.drivers.ecal;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawCalorimeterHit;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.geometry.Subdetector;
+import org.lcsim.util.Driver;
+
+/**
+ *
+ * @author Sho Uemura <[log in to unmask]>
+ * @version $Id: ECalCellIDPrintDriver.java,v 1.1 2012/05/01 15:06:38 meeg Exp $
+ */
+public class ECalCellIDPrintDriver extends Driver {
+
+	Subdetector ecal;
+	IDDecoder dec;
+	String ecalName = "Ecal";
+	String ecalCollectionName = "EcalReadoutHits";
+	String outputFileName;
+	PrintWriter outputStream = null;
+
+	public ECalCellIDPrintDriver() {
+	}
+
+	public void setEcalCollectionName(String ecalCollectionName) {
+		this.ecalCollectionName = ecalCollectionName;
+	}
+
+	public void setEcalName(String ecalName) {
+		this.ecalName = ecalName;
+	}
+
+	public void setOutputFileName(String outputFileName) {
+		this.outputFileName = outputFileName;
+	}
+
+	public void startOfData() {
+		if (outputFileName != null) {
+			try {
+				outputStream = new PrintWriter(outputFileName);
+			} catch (IOException ex) {
+				throw new RuntimeException("Invalid outputFilePath!");
+			}
+		} else {
+			outputStream = new PrintWriter(System.out, true);
+		}
+	}
+
+	public void detectorChanged(Detector detector) {
+		// Get the Subdetector.
+		ecal = (Subdetector) detector.getSubdetector(ecalName);
+		dec = ecal.getIDDecoder();
+	}
+
+	public void process(EventHeader event) {
+		// Get the list of ECal hits.
+		if (event.hasCollection(RawCalorimeterHit.class, ecalCollectionName)) {
+			List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, ecalCollectionName);
+			//outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
+			for (RawCalorimeterHit hit : hits) {
+				dec.setID(hit.getCellID());
+				outputStream.printf("x=%d\ty=%d\n", dec.getValue("ix"), dec.getValue("iy"));
+			}
+		}
+		if (event.hasCollection(RawTrackerHit.class, ecalCollectionName)) {
+			List<RawTrackerHit> hits = event.get(RawTrackerHit.class, ecalCollectionName);
+			//outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
+			for (RawTrackerHit hit : hits) {
+				dec.setID(hit.getCellID());
+				outputStream.printf("x=%d\ty=%d\n", dec.getValue("ix"), dec.getValue("iy"));
+			}
+		}
+	}
+}
\ No newline at end of file

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
EcalClusterPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalClusterPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalClusterPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,200 @@
+package org.hps.monitoring.drivers.ecal;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+
+import java.util.List;
+
+import org.apache.commons.math.stat.StatUtils;
+import org.hps.recon.ecal.ECalUtils;
+import org.hps.recon.ecal.TriggerData;
+import org.hps.util.Resettable;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class EcalClusterPlots extends Driver implements Resettable {
+
+	//AIDAFrame plotterFrame;
+    String inputCollection = "EcalClusters";
+    AIDA aida = AIDA.defaultInstance();
+    IPlotter plotter, plotter2, plotter3, plotter4;
+    IHistogram1D clusterCountPlot;
+    IHistogram1D clusterSizePlot;
+    IHistogram1D clusterEnergyPlot;
+    IHistogram1D clusterMaxEnergyPlot;
+    IHistogram1D clusterTimes;
+    IHistogram1D clusterTimeSigma;
+    IHistogram2D edgePlot;
+    int eventn = 0;
+    double maxE = 5000 * ECalUtils.MeV;
+    boolean logScale = false;
+
+    public void setInputCollection(String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+
+    public void setMaxE(double maxE) {
+        this.maxE = maxE;
+    }
+
+    public void setLogScale(boolean logScale) {
+        this.logScale = logScale;
+    }
+
+    @Override
+    protected void detectorChanged(Detector detector) {
+
+    	//plotterFrame = new AIDAFrame();
+        //plotterFrame.setTitle("HPS ECal Cluster Plots");
+
+        // Setup the plotter.
+        plotter = aida.analysisFactory().createPlotterFactory().create("Cluster Counts");
+        plotter.setTitle("Cluster Counts");
+        //plotterFrame.addPlotter(plotter);
+        plotter.style().dataStyle().errorBarStyle().setVisible(false);
+
+        // Setup plots.
+        aida.tree().cd("/");
+        clusterCountPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Count per Event", 10, -0.5, 9.5);
+        clusterSizePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Size", 10, -0.5, 9.5);
+
+        // Create the plotter regions.
+        plotter.createRegions(1, 2);
+        plotter.region(0).plot(clusterCountPlot);
+        plotter.region(1).plot(clusterSizePlot);
+
+
+        // Setup the plotter.
+        plotter2 = aida.analysisFactory().createPlotterFactory().create("Cluster Energies");
+        plotter2.setTitle("Cluster Energies");
+        //plotterFrame.addPlotter(plotter2);
+        plotter2.style().dataStyle().errorBarStyle().setVisible(false);
+
+        if (logScale) {
+            plotter2.style().yAxisStyle().setParameter("scale", "log");
+        }
+
+        clusterEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Energy", 1000, -0.1, maxE);
+        clusterMaxEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Maximum Cluster Energy In Event", 1000, -0.1, maxE);
+
+
+        // Create the plotter regions.
+        plotter2.createRegions(1, 2);
+        plotter2.region(0).plot(clusterEnergyPlot);
+        plotter2.region(1).plot(clusterMaxEnergyPlot);
+
+        plotter3 = aida.analysisFactory().createPlotterFactory().create("Cluster Times");
+        plotter3.setTitle("Cluster Times");
+        //plotterFrame.addPlotter(plotter3);
+        plotter3.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter3.createRegions(1, 2);
+        plotter3.style().yAxisStyle().setParameter("scale", "log");
+
+        clusterTimes = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Times", 100, 0, 4.0 * 100);
+        clusterTimeSigma = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Time Sigma", 100, 0, 50);
+        plotter3.region(0).plot(clusterTimes);
+        plotter3.region(1).plot(clusterTimeSigma);
+
+        plotter4 = aida.analysisFactory().createPlotterFactory().create("Edges");
+        plotter4.setTitle("Edges");
+        //plotterFrame.addPlotter(plotter4);
+        plotter4.style().setParameter("hist2DStyle", "colorMap");
+        plotter4.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter4.style().zAxisStyle().setParameter("scale", "log");
+        plotter4.createRegion();
+
+        edgePlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Pairs Across Crystal Edges", 93, -23.25, 23.25, 21, -5.25, 5.25);
+        plotter4.region(0).plot(edgePlot);
+
+        //plotterFrame.setVisible(true);
+        //plotterFrame.pack();
+    }
+
+    @Override
+    public void process(EventHeader event) {
+        int orTrig = 0;
+        int topTrig = 0;
+        int botTrig = 0;
+        if (event.hasCollection(TriggerData.class, "TriggerBank")) {
+            List<TriggerData> triggerList = event.get(TriggerData.class, "TriggerBank");
+            if (!triggerList.isEmpty()) {
+                TriggerData triggerData = triggerList.get(0);
+
+                orTrig = triggerData.getOrTrig();
+                topTrig = triggerData.getTopTrig();
+                botTrig = triggerData.getBotTrig();
+            }
+        }
+        if (event.hasCollection(Cluster.class, inputCollection)) {
+            List<Cluster> clusters = event.get(Cluster.class, inputCollection);
+            clusterCountPlot.fill(clusters.size());
+            double maxEnergy = 0;
+            for (Cluster cluster : clusters) {
+//                if ((botTrig == 0 && cluster.getEnergy() > 130 && cluster.getPosition()[1] < 0) || (topTrig == 0 && cluster.getEnergy() > 130 && cluster.getPosition()[1] > 0)) {
+//                if ((botTrig == 0 && cluster.getPosition()[1] < 0) || (topTrig == 0 && cluster.getPosition()[1] > 0)) {
+                    clusterEnergyPlot.fill(cluster.getEnergy());
+                if (cluster.getEnergy() > maxEnergy) {
+                    maxEnergy = cluster.getEnergy();
+                }
+                int size = 0;
+                double[] times = new double[cluster.getCalorimeterHits().size()];
+//                    System.out.format("cluster:\n");
+                for (CalorimeterHit hit : cluster.getCalorimeterHits()) {
+                    if (hit.getRawEnergy() != 0) {
+                        times[size] = hit.getTime();
+                        clusterTimes.fill(hit.getTime());
+                        size++;
+//                            System.out.format("x=%d, y=%d, time=%f, energy=%f\n", hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"), hit.getTime(), hit.getRawEnergy());
+                    }
+                }
+                clusterSizePlot.fill(size);
+                clusterTimeSigma.fill(Math.sqrt(StatUtils.variance(times, 0, size)));
+
+                List<CalorimeterHit> hits = cluster.getCalorimeterHits();
+                for (int i = 0; i < hits.size(); i++) {
+                    CalorimeterHit hit1 = hits.get(i);
+                    if (hit1.getRawEnergy() == 0) {
+                        continue;
+                    }
+                    int x1 = hit1.getIdentifierFieldValue("ix");
+                    int y1 = hit1.getIdentifierFieldValue("iy");
+                    for (int j = i + 1; j < hits.size(); j++) {
+                        CalorimeterHit hit2 = hits.get(j);
+                        if (hit2.getRawEnergy() == 0) {
+                            continue;
+                        }
+                        int x2 = hit2.getIdentifierFieldValue("ix");
+                        int y2 = hit2.getIdentifierFieldValue("iy");
+                        if ((Math.abs(x1 - x2) <= 1 || x1 * x2 == -1) && (Math.abs(y1 - y2) <= 1)) {
+                            if (x1 != x2 || y1 != y2) {
+                                edgePlot.fill((x1 + x2) / 2.0, (y1 + y2) / 2.0);
+                            }
+                        }
+                    }
+                }
+//                }
+            }
+            clusterMaxEnergyPlot.fill(maxEnergy);
+        } else {
+            clusterCountPlot.fill(0);
+        }
+    }
+
+    @Override
+    public void reset() {
+        clusterCountPlot.reset();
+        clusterSizePlot.reset();
+        clusterEnergyPlot.reset();
+        clusterMaxEnergyPlot.reset();
+    }
+
+    @Override
+    public void endOfData() {
+    	//plotterFrame.dispose();
+    }
+}
\ No newline at end of file

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
EcalDaqPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalDaqPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalDaqPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,129 @@
+package org.hps.monitoring.drivers.ecal;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+import hep.aida.ref.plotter.PlotterRegion;
+import jas.hist.JASHist;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hps.conditions.deprecated.EcalConditions;
+import org.hps.util.Resettable;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawCalorimeterHit;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.compact.Subdetector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class EcalDaqPlots extends Driver implements Resettable {
+
+	private String subdetectorName = "Ecal";
+	private String inputCollection = "EcalReadoutHits";
+	private IPlotter plotter;
+	private AIDA aida;
+	private Detector detector;
+	private List<IHistogram1D> plots;
+        private static final short[] slots = {10, 13, 9, 14, 8, 15, 7, 16, 6, 17, 5, 18, 4, 19};
+
+	public EcalDaqPlots() {
+	}
+
+	public void setSubdetectorName(String subdetectorName) {
+		this.subdetectorName = subdetectorName;
+	}
+
+	public void setInputCollection(String inputCollection) {
+		this.inputCollection = inputCollection;
+	}
+
+	public void detectorChanged(Detector detector) {
+
+		this.detector = detector;
+
+		if (subdetectorName == null) {
+			throw new RuntimeException("The subdetectorName parameter was not set.");
+		}
+
+		if (inputCollection == null) {
+			throw new RuntimeException("The inputCollection parameter was not set.");
+		}
+
+		Subdetector subdetector = detector.getSubdetector(subdetectorName);
+
+		setupPlots();
+	}
+
+	private void setupPlots() {
+		plots = new ArrayList<IHistogram1D>();
+		aida = AIDA.defaultInstance();
+		aida.tree().cd("/");
+		plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECAL DAQ Plots");
+		IPlotterStyle pstyle = plotter.style();
+		pstyle.dataStyle().fillStyle().setColor("orange");
+		pstyle.dataStyle().markerStyle().setColor("orange");
+		pstyle.dataStyle().errorBarStyle().setVisible(false);
+		plotter.createRegions(7, 4);
+		int region = 0;
+		for (int i = 0; i < 14; i++) { // slot
+			for (int j = 1; j < 3; j++) { // crate                
+				//System.out.println("creating plot: " + "ECAL: Crate " + j + "; Slot " + i + " in region " + region);
+				IHistogram1D hist = aida.histogram1D("ECAL: Crate " + j + "; Slot " + slots[i], 16, 0, 16);
+				plots.add(hist);
+				plotter.region(region).plot(hist);
+				JASHist jhist = ((PlotterRegion) plotter.region(region)).getPlot();
+				jhist.setAllowUserInteraction(false);
+				jhist.setAllowPopupMenus(false);
+				region++;
+			}
+		}
+		plotter.show();
+	}
+
+//	public void endOfData() {
+//		if (plotter != null) {
+//			plotter.hide();
+//		}
+//	}
+
+	public void reset() {
+		if (plotter != null) {
+			plotter.hide();
+			plotter.destroyRegions();
+			for (IHistogram1D plot : plots) {
+				plot.reset();
+			}
+			detectorChanged(detector);
+		}
+	}
+
+	public void process(EventHeader event) {
+		if (event.hasCollection(RawCalorimeterHit.class, inputCollection)) {
+			List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, inputCollection);
+			for (RawCalorimeterHit hit : hits) {
+				Long daqId = EcalConditions.physicalToDaqID(hit.getCellID());
+				int crate = EcalConditions.getCrate(daqId);
+				int slot = EcalConditions.getSlot(daqId);
+				int channel = EcalConditions.getChannel(daqId);
+				//System.out.println("crate="+crate+"; slot="+slot+"; channel="+channel);
+				//System.out.println("filling plot: " + "ECAL: Crate " + crate + "; Slot " + slot);
+				aida.histogram1D("ECAL: Crate " + crate + "; Slot " + slot).fill(channel);
+			}
+		}
+		if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
+			List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
+			for (RawTrackerHit hit : hits) {
+				Long daqId = EcalConditions.physicalToDaqID(hit.getCellID());
+				int crate = EcalConditions.getCrate(daqId);
+				int slot = EcalConditions.getSlot(daqId);
+				int channel = EcalConditions.getChannel(daqId);
+				//System.out.println("crate="+crate+"; slot="+slot+"; channel="+channel);
+				//System.out.println("filling plot: " + "ECAL: Crate " + crate + "; Slot " + slot);
+				aida.histogram1D("ECAL: Crate " + crate + "; Slot " + slot).fill(channel);
+			}
+		}
+	}
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
EcalEventMonitor.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalEventMonitor.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalEventMonitor.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,127 @@
+package org.hps.monitoring.drivers.ecal;
+
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+import hep.aida.ref.plotter.PlotterRegion;
+
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.List;
+
+import javax.swing.JCheckBox;
+
+import org.hps.recon.ecal.HPSEcalCluster;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class EcalEventMonitor extends Driver implements ItemListener {
+
+    String inputCollectionName = "EcalCalHits";
+    String clusterCollectionName = "EcalClusters";
+    AIDA aida = AIDA.defaultInstance();
+    IPlotter plotter;
+    IHistogram2D hitPlot;
+    IHistogram2D clusterPlot;
+    int eventRefreshRate = 1;
+    int eventn = 0;
+    //private AIDAFrame plotterFrame;
+    private JCheckBox logScaleBox;
+
+    public EcalEventMonitor() {
+    }
+
+    public void setEventRefreshRate(int eventRefreshRate) {
+        this.eventRefreshRate = eventRefreshRate;
+    }
+
+    public void setInputCollectionName(String inputCollectionName) {
+        this.inputCollectionName = inputCollectionName;
+    }
+
+    protected void detectorChanged(Detector detector) {
+        // Setup plots.
+        aida.tree().cd("/");
+        hitPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollectionName + " : Pedestal-Subtracted ADC Value", 47, -23.5, 23.5, 11, -5.5, 5.5);
+
+        clusterPlot = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollectionName + " : Energy", 47, -23.5, 23.5, 11, -5.5, 5.5);
+
+        String title = "HPS ECal Event Monitor";
+        // Setup the plotter.
+        plotter = aida.analysisFactory().createPlotterFactory().create();
+        plotter.setTitle(title);
+        //plotterFrame = new AIDAFrame();
+        //plotterFrame.addPlotter(plotter);
+        //plotterFrame.setVisible(true);
+        //plotterFrame.setTitle(title);
+
+        // Create the plotter regions.
+        plotter.createRegions(1, 2);
+        plotter.style().statisticsBoxStyle().setVisible(false);
+
+        for (int i = 0; i < plotter.numberOfRegions(); i++) {
+            IPlotterStyle style = plotter.region(i).style();
+            style.setParameter("hist2DStyle", "colorMap");
+            style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+            style.zAxisStyle().setParameter("scale", "lin");
+        }
+
+        plotter.region(0).plot(hitPlot);
+        ((PlotterRegion) plotter.region(0)).getPlot().setAllowUserInteraction(false);
+        ((PlotterRegion) plotter.region(0)).getPlot().setAllowPopupMenus(false);
+
+        plotter.region(1).plot(clusterPlot);
+        ((PlotterRegion) plotter.region(1)).getPlot().setAllowUserInteraction(false);
+        ((PlotterRegion) plotter.region(1)).getPlot().setAllowPopupMenus(false);
+
+        logScaleBox = new JCheckBox("log scale");
+        logScaleBox.addItemListener(this);
+        //plotterFrame.getControlsPanel().add(logScaleBox);
+
+        //plotterFrame.pack();
+    }
+
+    public void process(EventHeader event) {
+        if (++eventn % eventRefreshRate != 0) {
+            return;
+        }
+        hitPlot.reset();
+        clusterPlot.reset();
+        if (event.hasCollection(CalorimeterHit.class, inputCollectionName)) {
+            List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollectionName);
+            for (CalorimeterHit hit : hits) {
+                hitPlot.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"), hit.getRawEnergy());
+            }
+        }
+        if (event.hasCollection(HPSEcalCluster.class, clusterCollectionName)) {
+            List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, clusterCollectionName);
+            for (HPSEcalCluster cluster : clusters) {
+                CalorimeterHit seedHit = cluster.getSeedHit();
+                clusterPlot.fill(seedHit.getIdentifierFieldValue("ix"), seedHit.getIdentifierFieldValue("iy"), cluster.getEnergy());
+            }
+        }
+    }
+
+    public void endOfData() {
+    	//if (plotterFrame != null) {
+        //    plotterFrame.dispose();
+        //}
+    }
+
+    @Override
+    public void itemStateChanged(ItemEvent ie) {
+        if (ie.getSource() == logScaleBox) {
+            for (int i = 0; i < plotter.numberOfRegions(); i++) {
+                IPlotterStyle style = plotter.region(i).style();
+                if (ie.getStateChange() == ItemEvent.DESELECTED) {
+                    style.zAxisStyle().setParameter("scale", "lin");
+                } else {
+                    style.zAxisStyle().setParameter("scale", "log");
+                }
+            }
+        }
+    }
+}
\ No newline at end of file

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
EcalEvsX.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalEvsX.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalEvsX.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,186 @@
+package org.hps.monitoring.drivers.ecal;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.BasicHepLorentzVector;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.HepLorentzVector;
+import hep.physics.vec.VecOp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hps.conditions.deprecated.EcalConditions;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.subdetector.HPSEcal3;
+import org.lcsim.geometry.subdetector.HPSEcal3.NeighborMap;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class EcalEvsX extends Driver {
+
+    String inputCollection = "EcalClusters";
+    AIDA aida = AIDA.defaultInstance();
+    IPlotter plotter;
+    IHistogram2D EvsXPlot;
+    IHistogram1D invMassPlot;
+    IHistogram2D clusterPairEnergyPlot;
+    IHistogram2D clusterPairPositionPlot;
+    Detector detector;
+    int eventn = 0;
+    double targetZ = 0;
+
+    public void setInputCollection(String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+
+    public void setTargetZ(double targetZ) {
+        this.targetZ = targetZ;
+    }
+
+    @Override
+    protected void detectorChanged(Detector detector) {
+
+        this.detector = detector;
+
+        // Setup the plotter.
+        plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal E vs X Plot");
+        plotter.style().dataStyle().errorBarStyle().setVisible(false);
+
+        // Setup plots.
+        aida.tree().cd("/");
+//        EvsXPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : E vs X", 50, -350.0, 400.0, 100, -2000, 2000);
+        EvsXPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : E vs X", 50, -350.0, 400.0, 100, 0, 2.0);
+        invMassPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Photon Pair Mass", 100, 0.0, 0.250);
+        clusterPairEnergyPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Pair Energies", 1000, -0.1, 2.0, 1000, -0.1, 2.0);
+        clusterPairPositionPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Pair Positions", 50, -350, 350, 50, -350, 350);
+
+        // Create the plotter regions.
+        plotter.createRegions(2, 2);
+//        plotter.style().statisticsBoxStyle().setVisible(false);
+        IPlotterStyle style = plotter.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.statisticsBoxStyle().setVisible(false);
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter.region(1).style().yAxisStyle().setParameter("scale", "log");
+        plotter.region(0).plot(EvsXPlot);
+        plotter.region(1).plot(invMassPlot);
+        plotter.region(2).plot(clusterPairEnergyPlot);
+        style = plotter.region(2).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.statisticsBoxStyle().setVisible(false);
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style.zAxisStyle().setParameter("scale", "log");
+        plotter.region(3).plot(clusterPairPositionPlot);
+        style = plotter.region(3).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.statisticsBoxStyle().setVisible(false);
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style.zAxisStyle().setParameter("scale", "log");
+        plotter.show();
+    }
+
+    @Override
+    public void process(EventHeader event) {
+//        int orTrig = 0;
+//        int topTrig = 0;
+//        int botTrig = 0;
+//        if (event.hasCollection(TriggerData.class, "TriggerBank")) {
+//            List<TriggerData> triggerList = event.get(TriggerData.class, "TriggerBank");
+//            if (!triggerList.isEmpty()) {
+//                TriggerData triggerData = triggerList.get(0);
+//
+//                orTrig = triggerData.getOrTrig();
+//                topTrig = triggerData.getTopTrig();
+//                botTrig = triggerData.getBotTrig();
+//            }
+//        }
+
+        if (event.hasCollection(Cluster.class, inputCollection)) {
+            List<Cluster> clusters = event.get(Cluster.class, inputCollection);
+            List<Cluster> goodClusters = new ArrayList<Cluster>();
+            for (Cluster cluster : clusters) {
+                if (true || isGoodCluster(cluster)) {
+                    goodClusters.add(cluster);
+                }
+            }
+//            boolean left = false;
+//            boolean right = false;
+//            for (Cluster cluster : goodClusters) {
+//                if (cluster.getPosition()[0] > 0) {
+//                    right = true;
+//                }
+//                if (cluster.getPosition()[0] < 0) {
+//                    left = true;
+//                }
+//            }
+//            if (left && right) {
+//            if (goodClusters.size()>1) {
+//                for (Cluster cluster : goodClusters) {
+            for (Cluster cluster : goodClusters) {
+//                EvsXPlot.fill(cluster.getPosition()[0], Math.signum(cluster.getPosition()[1])*cluster.getEnergy());
+                EvsXPlot.fill(cluster.getPosition()[0], cluster.getEnergy());
+            }
+//            }
+//            if (!event.hasCollection(TrackerHit.class, "HelicalTrackHits") || event.get(TrackerHit.class, "HelicalTrackHits").isEmpty()) {
+                for (int i = 0; i < goodClusters.size() - 1; i++) {
+                    Cluster clus1 = goodClusters.get(i);
+                    double e1 = clus1.getEnergy();
+                    double x1 = clus1.getPosition()[0];
+                    if (clus1.getPosition()[1] > 0 && x1 > 0) {
+                        x1 = 350 - x1;
+                    }
+                    for (int j = i + 1; j < goodClusters.size(); j++) {
+                        Cluster clus2 = goodClusters.get(j);
+                        double e2 = clus2.getEnergy();
+                        double x2 = clus2.getPosition()[0];
+                        if (clus2.getPosition()[1] > 0 && x2 > 0) {
+                            x2 = 350 - x2;
+                        }
+//                    if (clusters.get(i).getPosition()[1] * clusters.get(j).getPosition()[1] > 0) {
+//                        continue;
+//                    }
+                        clusterPairEnergyPlot.fill(Math.max(e1, e2), Math.min(e1, e2));
+                        clusterPairPositionPlot.fill(Math.max(x1, x2), Math.min(x1, x2));
+//                    double e1e2 = clusters.get(i).getEnergy() * clusters.get(j).getEnergy();
+//                    double dx2 = Math.pow(clusters.get(i).getPosition()[0] - clusters.get(j).getPosition()[0], 2) + Math.pow(clusters.get(i).getPosition()[1] - clusters.get(j).getPosition()[1], 2);
+//                    invMassPlot.fill(Math.sqrt(e1e2 * dx2 / (135 * 135)));
+                        invMassPlot.fill(VecOp.add(clusterAsPhoton(clus1), clusterAsPhoton(clus2)).magnitude());
+                    }
+                }
+//            }
+
+            ++eventn;
+        }
+    }
+
+    public HepLorentzVector clusterAsPhoton(Cluster cluster) {
+        Hep3Vector position = new BasicHep3Vector(cluster.getPosition());
+        Hep3Vector direction = VecOp.unit(VecOp.add(position, new BasicHep3Vector(41.27, 0, targetZ)));
+        return new BasicHepLorentzVector(cluster.getEnergy(), VecOp.mult(cluster.getEnergy(), direction));
+    }
+
+    public boolean isGoodCluster(Cluster cluster) {
+        NeighborMap map = ((HPSEcal3) EcalConditions.getSubdetector()).getNeighborMap();
+        for (CalorimeterHit hit : cluster.getCalorimeterHits()) {
+            if (map.get(hit.getCellID()).size() > 6) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public void endOfData() {
+        if (plotter != null) {
+            plotter.hide();
+            plotter.destroyRegions();
+        }
+    }
+}
\ No newline at end of file

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
EcalHitPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalHitPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalHitPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,268 @@
+package org.hps.monitoring.drivers.ecal;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterFactory;
+
+import java.util.List;
+
+import org.hps.recon.ecal.ECalUtils;
+import org.hps.recon.ecal.TriggerData;
+import org.hps.util.Resettable;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.GenericObject;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class EcalHitPlots extends Driver implements Resettable {
+
+    //AIDAFrame plotterFrame;
+    String inputCollection = "EcalCalHits";
+    AIDA aida = AIDA.defaultInstance();
+    IPlotter plotter, plotter2, plotter3, plotter4;
+    IHistogram1D hitCountPlot;
+    IHistogram1D hitTimePlot;
+    IHistogram1D hitEnergyPlot;
+    IHistogram1D hitMaxEnergyPlot;
+    IHistogram1D topTimePlot, botTimePlot, orTimePlot;
+    IHistogram1D topTrigTimePlot, botTrigTimePlot, orTrigTimePlot;
+    IHistogram2D topTimePlot2D, botTimePlot2D, orTimePlot2D;
+//    IHistogram2D topX, botX, topY, botY;
+    IHistogram2D edgePlot;
+    int eventn = 0;
+    double maxE = 5000 * ECalUtils.MeV;
+    boolean logScale = false;
+
+    public void setInputCollection(String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+
+    public void setMaxE(double maxE) {
+        this.maxE = maxE;
+    }
+
+    public void setLogScale(boolean logScale) {
+        this.logScale = logScale;
+    }
+
+    @Override
+    protected void detectorChanged(Detector detector) {
+
+        //plotterFrame = new AIDAFrame();
+        //plotterFrame.setTitle("HPS ECal Hit Plots");
+
+        aida.tree().cd("/");
+        IPlotterFactory plotterFactory = aida.analysisFactory().createPlotterFactory("Ecal Hit Plots");
+
+        // Setup the plotter.
+        plotter = plotterFactory.create("Hit Counts");
+        plotter.setTitle("Hit Counts");
+        //plotterFrame.addPlotter(plotter);
+        plotter.style().dataStyle().errorBarStyle().setVisible(false);
+
+        // Setup plots.
+        hitCountPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Count In Event", 10, -0.5, 9.5);
+        hitTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time", 100, 0 * 4.0, 100 * 4.0);
+
+        // Create the plotter regions.
+        plotter.createRegions(1, 2);
+        plotter.region(0).plot(hitCountPlot);
+        plotter.region(1).plot(hitTimePlot);
+
+
+        // Setup the plotter.
+        plotter2 = plotterFactory.create("Hit Energies");
+        plotter2.setTitle("Hit Energies");
+        //plotterFrame.addPlotter(plotter2);
+        plotter2.style().dataStyle().errorBarStyle().setVisible(false);
+
+        hitEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Energy", 1000, -0.1, maxE);
+        hitMaxEnergyPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Maximum Hit Energy In Event", 1000, -0.1, maxE);
+
+        if (logScale) {
+            plotter2.style().yAxisStyle().setParameter("scale", "log");
+        }
+
+        // Create the plotter regions.
+        plotter2.createRegions(1, 2);
+        plotter2.region(0).plot(hitEnergyPlot);
+        plotter2.region(1).plot(hitMaxEnergyPlot);
+
+        plotter3 = plotterFactory.create("Hit Times");
+        plotter3.setTitle("Hit Times");
+        //plotterFrame.addPlotter(plotter3);
+        plotter3.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter3.createRegions(3, 3);
+
+        topTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Top", 100, 0, 100 * 4.0);
+        botTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Bottom", 100, 0, 100 * 4.0);
+        orTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Or", 100, 0, 100 * 4.0);
+
+        topTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Top", 32, 0, 32);
+        botTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Bottom", 32, 0, 32);
+        orTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Or", 32, 0, 32);
+
+        topTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Top", 100, 0, 100 * 4.0, 32, 0, 32);
+        botTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Bottom", 100, 0, 100 * 4.0, 32, 0, 32);
+        orTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Or", 100, 0, 100 * 4.0, 32, 0, 32);
+
+        // Create the plotter regions.
+        plotter3.region(0).plot(topTimePlot);
+        plotter3.region(1).plot(botTimePlot);
+        plotter3.region(2).plot(orTimePlot);
+        plotter3.region(3).plot(topTrigTimePlot);
+        plotter3.region(4).plot(botTrigTimePlot);
+        plotter3.region(5).plot(orTrigTimePlot);
+        for (int i = 0; i < 6; i++) {
+            if (plotter3.region(i).style() != null) {
+                plotter3.region(i).style().yAxisStyle().setParameter("scale", "log");
+            }
+        }
+        plotter3.region(6).plot(topTimePlot2D);
+        plotter3.region(7).plot(botTimePlot2D);
+        plotter3.region(8).plot(orTimePlot2D);
+        for (int i = 6; i < 9; i++) {
+            if (plotter3.region(i).style() != null) {
+                plotter3.region(i).style().setParameter("hist2DStyle", "colorMap");
+                plotter3.region(i).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+                plotter3.region(i).style().zAxisStyle().setParameter("scale", "log");
+            }
+        }
+
+        plotter4 = plotterFactory.create("Edges");
+        plotter4.setTitle("Edges");
+        //plotterFrame.addPlotter(plotter4);
+        plotter4.style().setParameter("hist2DStyle", "colorMap");
+        plotter4.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter4.style().zAxisStyle().setParameter("scale", "log");
+        plotter4.createRegion();
+
+        edgePlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Pairs Across Crystal Edges", 93, -23.25, 23.25, 21, -5.25, 5.25);
+        plotter4.region(0).plot(edgePlot);
+
+        //plotterFrame.setVisible(true);
+        //plotterFrame.pack();
+    }
+
+    @Override
+    public void process(EventHeader event) {
+        int orTrigTime = -1;
+        int topTrigTime = -1;
+        int botTrigTime = -1;
+        if (event.hasCollection(GenericObject.class, "TriggerBank")) {
+            List<GenericObject> triggerList = event.get(GenericObject.class, "TriggerBank");
+            if (!triggerList.isEmpty()) {
+                GenericObject triggerData = triggerList.get(0);
+
+                int orTrig = TriggerData.getOrTrig(triggerData);
+                if (orTrig != 0) {
+                    for (int i = 0; i < 32; i++) {
+                        if ((1 << (31 - i) & orTrig) != 0) {
+                            orTrigTime = i;
+                            orTrigTimePlot.fill(i);
+                            break;
+                        }
+                    }
+                }
+                int topTrig = TriggerData.getTopTrig(triggerData);
+                if (topTrig != 0) {
+                    for (int i = 0; i < 32; i++) {
+                        if ((1 << (31 - i) & topTrig) != 0) {
+                            topTrigTime = i;
+                            topTrigTimePlot.fill(i);
+                            break;
+                        }
+                    }
+                }
+                int botTrig = TriggerData.getBotTrig(triggerData);
+                if (botTrig != 0) {
+                    for (int i = 0; i < 32; i++) {
+                        if ((1 << (31 - i) & botTrig) != 0) {
+                            botTrigTime = i;
+                            botTrigTimePlot.fill(i);
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+
+        if (event.hasCollection(CalorimeterHit.class, inputCollection)) {
+            List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection);
+            hitCountPlot.fill(hits.size());
+            double maxEnergy = 0;
+            double topTime = Double.POSITIVE_INFINITY;
+            double botTime = Double.POSITIVE_INFINITY;
+            double orTime = Double.POSITIVE_INFINITY;
+            for (CalorimeterHit hit : hits) {
+//                if (hit.getIdentifierFieldValue("iy") > 0) {
+//                    topX.fill(hit.getIdentifierFieldValue("ix"),hit.getPosition()[0]);
+//                    topY.fill(hit.getIdentifierFieldValue("iy"),hit.getPosition()[1]);
+//                } else {
+//                    botX.fill(hit.getIdentifierFieldValue("ix"),hit.getPosition()[0]);
+//                    botY.fill(hit.getIdentifierFieldValue("iy"),hit.getPosition()[1]);                    
+//                }
+                hitEnergyPlot.fill(hit.getRawEnergy());
+                hitTimePlot.fill(hit.getTime());
+                if (hit.getTime() < orTime) {
+                    orTime = hit.getTime();
+                }
+                if (hit.getIdentifierFieldValue("iy") > 0 && hit.getTime() < topTime) {
+                    topTime = hit.getTime();
+                }
+                if (hit.getIdentifierFieldValue("iy") < 0 && hit.getTime() < botTime) {
+                    botTime = hit.getTime();
+                }
+                if (hit.getRawEnergy() > maxEnergy) {
+                    maxEnergy = hit.getRawEnergy();
+                }
+            }
+            if (orTime != Double.POSITIVE_INFINITY) {
+                orTimePlot.fill(orTime);
+                orTimePlot2D.fill(orTime, orTrigTime);
+            }
+            if (topTime != Double.POSITIVE_INFINITY) {
+                topTimePlot.fill(topTime);
+                topTimePlot2D.fill(topTime, topTrigTime);
+            }
+            if (botTime != Double.POSITIVE_INFINITY) {
+                botTimePlot.fill(botTime);
+                botTimePlot2D.fill(botTime, botTrigTime);
+            }
+            hitMaxEnergyPlot.fill(maxEnergy);
+            for (int i = 0; i < hits.size(); i++) {
+                CalorimeterHit hit1 = hits.get(i);
+                int x1 = hit1.getIdentifierFieldValue("ix");
+                int y1 = hit1.getIdentifierFieldValue("iy");
+                for (int j = i + 1; j < hits.size(); j++) {
+                    CalorimeterHit hit2 = hits.get(j);
+                    int x2 = hit2.getIdentifierFieldValue("ix");
+                    int y2 = hit2.getIdentifierFieldValue("iy");
+                    if ((Math.abs(x1 - x2) <= 1 || x1 * x2 == -1) && (Math.abs(y1 - y2) <= 1)) {
+                        if (x1 != x2 || y1 != y2) {
+                            edgePlot.fill((x1 + x2) / 2.0, (y1 + y2) / 2.0);
+                        }
+                    }
+                }
+            }
+        } else {
+            hitCountPlot.fill(0);
+        }
+    }
+
+    @Override
+    public void reset() {
+        hitCountPlot.reset();
+        hitTimePlot.reset();
+        hitEnergyPlot.reset();
+        hitMaxEnergyPlot.reset();
+    }
+
+    @Override
+    public void endOfData() {
+        //plotterFrame.dispose();
+    }
+}
\ No newline at end of file

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
EcalMonitoringPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalMonitoringPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalMonitoringPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,135 @@
+package org.hps.monitoring.drivers.ecal;
+
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+
+import java.util.List;
+
+import org.hps.recon.ecal.HPSEcalCluster;
+import org.hps.util.Redrawable;
+import org.hps.util.Resettable;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.event.base.BaseRawCalorimeterHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class EcalMonitoringPlots extends Driver implements Resettable, Redrawable {
+
+    String inputCollection = "EcalReadoutHits";
+    String clusterCollection = "EcalClusters";
+    AIDA aida = AIDA.defaultInstance();
+    IPlotter plotter;
+    IHistogram2D hitCountFillPlot;
+    IHistogram2D hitCountDrawPlot;
+    IHistogram2D clusterCountFillPlot;
+    IHistogram2D clusterCountDrawPlot;
+    int eventRefreshRate = 1;
+    int eventn = 0;
+    boolean hide = false;
+
+    public EcalMonitoringPlots() {
+    }
+
+    public void setInputCollection(String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+
+    public void setClusterCollection(String clusterCollection) {
+        this.clusterCollection = clusterCollection;
+    }
+
+    public void setHide(boolean hide) {
+        this.hide = hide;
+    }
+
+    protected void detectorChanged(Detector detector) {
+        // Setup the plotter.
+        plotter = aida.analysisFactory().createPlotterFactory("Ecal Monitoring Plots").create("HPS ECal Monitoring Plots");
+        // Setup plots.
+        aida.tree().cd("/");
+        hitCountDrawPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Count", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        hitCountFillPlot = makeCopy(hitCountDrawPlot);
+        clusterCountDrawPlot = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Center Count", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        clusterCountFillPlot = makeCopy(clusterCountDrawPlot);
+
+        // Create the plotter regions.
+        plotter.createRegions(1, 2);
+        plotter.style().statisticsBoxStyle().setVisible(false);
+        IPlotterStyle style = plotter.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter.region(0).plot(hitCountDrawPlot);
+        style = plotter.region(1).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter.region(1).plot(clusterCountDrawPlot);
+        //if (!hide) {
+        //    plotter.show();
+        //}
+    }
+
+    public void process(EventHeader event) {
+        if (event.hasCollection(BaseRawCalorimeterHit.class, inputCollection)) {
+            List<BaseRawCalorimeterHit> hits = event.get(BaseRawCalorimeterHit.class, inputCollection);
+            for (BaseRawCalorimeterHit hit : hits) {
+                hitCountFillPlot.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+            }
+        }
+        if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
+            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
+            for (RawTrackerHit hit : hits) {
+                hitCountFillPlot.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+            }
+        }
+        if (event.hasCollection(CalorimeterHit.class, inputCollection)) {
+            List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection);
+            for (CalorimeterHit hit : hits) {
+                hitCountFillPlot.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+            }
+        }
+        if (event.hasCollection(HPSEcalCluster.class, clusterCollection)) {
+            List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, clusterCollection);
+//if (clusters.size()>1)            
+            for (HPSEcalCluster cluster : clusters) {
+                clusterCountFillPlot.fill(cluster.getSeedHit().getIdentifierFieldValue("ix"), cluster.getSeedHit().getIdentifierFieldValue("iy"));
+            }
+        }
+        if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
+            redraw();
+        }
+    }
+
+    public void endOfData() {
+        plotter.hide();
+        plotter.destroyRegions();
+    }
+
+    @Override
+    public void reset() {
+        hitCountFillPlot.reset();
+        hitCountDrawPlot.reset();
+        clusterCountFillPlot.reset();
+        clusterCountDrawPlot.reset();
+    }
+
+    @Override
+    public void redraw() {
+        hitCountDrawPlot.reset();
+        hitCountDrawPlot.add(hitCountFillPlot);
+        clusterCountDrawPlot.reset();
+        clusterCountDrawPlot.add(clusterCountFillPlot);
+    }
+
+    @Override
+    public void setEventRefreshRate(int eventRefreshRate) {
+        this.eventRefreshRate = eventRefreshRate;
+    }
+
+    private IHistogram2D makeCopy(IHistogram2D hist) {
+        return aida.histogram2D(hist.title() + "_copy", hist.xAxis().bins(), hist.xAxis().lowerEdge(), hist.xAxis().upperEdge(), hist.yAxis().bins(), hist.yAxis().lowerEdge(), hist.yAxis().upperEdge());
+    }
+}
\ No newline at end of file

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
EcalPedestalPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalPedestalPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalPedestalPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,308 @@
+package org.hps.monitoring.drivers.ecal;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+
+import org.hps.conditions.deprecated.EcalConditions;
+import org.hps.recon.ecal.ECalUtils;
+import org.hps.util.Redrawable;
+import org.hps.util.Resettable;
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierHelper;
+import org.lcsim.detector.identifier.Identifier;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.event.base.BaseRawCalorimeterHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class EcalPedestalPlots extends Driver implements Resettable, ActionListener, Redrawable {
+
+    private String inputCollection = "EcalReadoutHits";
+    private IPlotter plotter;
+    private IPlotter plotter2;
+    private AIDA aida = AIDA.defaultInstance();
+    //private AIDAFrame plotterFrame;
+    private IHistogram2D aMeanPlot;
+    private IHistogram2D aSigmaPlot;
+    private IHistogram2D tMeanPlot;
+    private IHistogram2D tSigmaPlot;
+    private IHistogram1D[][] aPlots = new IHistogram1D[47][11];
+    private IHistogram1D[][] tPlots = new IHistogram1D[47][11];
+    private JLabel xLabel, yLabel;
+    private JComboBox xCombo;
+    private JComboBox yCombo;
+    private JButton blankButton;
+    private static final Integer[] xList = new Integer[46];
+    private static final Integer[] yList = new Integer[10];
+    int eventRefreshRate = 1;
+    int eventn = 0;
+    boolean hide = false;
+    int calWindow = 0;
+    double maxE = 1000 * ECalUtils.MeV;
+
+    public EcalPedestalPlots() {
+        int count = 0;
+        for (int i = -23; i <= 23; i++) {
+            if (i != 0) {
+                xList[count] = i;
+                count++;
+            }
+        }
+        count = 0;
+        for (int i = -5; i <= 5; i++) {
+            if (i != 0) {
+                yList[count] = i;
+                count++;
+            }
+        }
+    }
+
+    public void setMaxE(double maxE) {
+        this.maxE = maxE;
+    }
+
+    public void setCalWindow(int calWindow) {
+        this.calWindow = calWindow;
+    }
+
+    public void setHide(boolean hide) {
+        this.hide = hide;
+    }
+
+    public void setInputCollection(String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+
+    @Override
+    public void detectorChanged(Detector detector) {
+        if (inputCollection == null) {
+            throw new RuntimeException("The inputCollection parameter was not set.");
+        }
+
+        aida = AIDA.defaultInstance();
+        aida.tree().cd("/");
+        aSigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma (Amplitude)", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        aMeanPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Mean (Amplitude)", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        tSigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma (Time)", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        tMeanPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Mean (Time)", 47, -23.5, 23.5, 11, -5.5, 5.5);
+
+        for (int x = -23; x <= 23; x++) { // slot
+            for (int y = -5; y <= 5; y++) { // crate                
+                //System.out.println("creating plot: " + "ECAL: Crate " + j + "; Slot " + i + " in region " + region);
+//                IHistogram1D hist = aida.histogram1D("ECAL: x=" + i + "; y=" + j, 1000, 0, 16);
+//                plots[x + 23][y + 5] = aida.cloud1D("ECAL: x=" + x + "; y=" + y);
+                if (calWindow == 0) {
+                    aPlots[x + 23][y + 5] = aida.histogram1D("ECAL Amplitudes: x=" + x + "; y=" + y, 500, -0.1, maxE);
+                } else {
+                    aPlots[x + 23][y + 5] = aida.histogram1D("ECAL Amplitudes: x=" + x + "; y=" + y, 1024, -0.5, 1023.5);
+                }
+                tPlots[x + 23][y + 5] = aida.histogram1D("ECAL Times: x=" + x + "; y=" + y, 100, 0, 100);
+            }
+        }
+
+        //plotterFrame = new AIDAFrame();
+        //plotterFrame.setTitle("HPS ECal Crystal Plots");
+
+        xCombo = new JComboBox(xList);
+        xCombo.addActionListener(this);
+        xLabel = new JLabel("x");
+        xLabel.setLabelFor(xCombo);
+        //plotterFrame.getControlsPanel().add(xLabel);
+        //plotterFrame.getControlsPanel().add(xCombo);
+        yCombo = new JComboBox(yList);
+        yCombo.addActionListener(this);
+        yLabel = new JLabel("y");
+        yLabel.setLabelFor(yCombo);
+        //plotterFrame.getControlsPanel().add(yLabel);
+        //plotterFrame.getControlsPanel().add(yCombo);
+        blankButton = new JButton("Hide histogram");
+        //plotterFrame.getControlsPanel().add(blankButton);
+        blankButton.addActionListener(this);
+
+        // Setup the plotter.
+        plotter = aida.analysisFactory().createPlotterFactory().create();
+        plotter.setTitle("HPS ECal Hit Amplitude Plots");
+        //plotterFrame.addPlotter(plotter);
+        plotter.createRegions(1, 3);
+
+        plotter.style().statisticsBoxStyle().setVisible(false);
+        plotter.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter.style().zAxisStyle().setParameter("allowZeroSuppression", "true");
+        IPlotterStyle style = plotter.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style = plotter.region(1).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter.region(0).plot(aSigmaPlot);
+        plotter.region(1).plot(aMeanPlot);
+
+        // Setup the plotter.
+        plotter2 = aida.analysisFactory().createPlotterFactory().create();
+        plotter2.setTitle("HPS ECal Hit Time Plots");
+        //plotterFrame.addPlotter(plotter2);
+        plotter2.createRegions(1, 3);
+
+        plotter2.style().statisticsBoxStyle().setVisible(false);
+        plotter2.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter2.style().zAxisStyle().setParameter("allowZeroSuppression", "true");
+        style = plotter2.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style = plotter2.region(1).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter2.region(0).plot(tSigmaPlot);
+        plotter2.region(1).plot(tMeanPlot);
+
+        plotter.region(2).plot(aPlots[-5 + 23][2 + 5 - 1]);
+        plotter2.region(2).plot(tPlots[-5 + 23][2 + 5 - 1]);
+        xCombo.setSelectedIndex(-5 + 23);
+        yCombo.setSelectedIndex(2 + 5 - 1);
+
+        //plotterFrame.pack();
+        //if (!hide) {
+        //    plotterFrame.setVisible(true);
+        //}
+    }
+
+    @Override
+    public void endOfData() {
+    	//plotterFrame.dispose();
+        if (calWindow > 0) {
+            for (int crate = 1; crate < 3; crate++) {
+                for (short slot = 0; slot < 20; slot++) {
+                    for (short ch = 0; ch < 16; ch++) {
+                        Long id = EcalConditions.daqToPhysicalID(crate, slot, ch);
+                        IIdentifierHelper helper = EcalConditions.getHelper();
+                        if (id == null) {
+                            continue;
+                        }
+                        IIdentifier compactId = new Identifier(id);
+                        int x = helper.getValue(compactId, "ix");
+                        int y = helper.getValue(compactId, "iy");
+                        System.out.printf("%d\t%d\t%d\t%f\t%f\n", crate, slot, ch, aPlots[x + 23][y + 5].mean(), aPlots[x + 23][y + 5].rms());
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public void reset() {
+        if (plotter != null) {
+            plotter.hide();
+            plotter.destroyRegions();
+            for (int x = -23; x <= 23; x++) { // slot
+                for (int y = -5; y <= 5; y++) { // crate                
+                    aPlots[x + 23][y + 5].reset();
+                }
+            }
+        }
+    }
+
+    @Override
+    public void process(EventHeader event) {
+        if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
+            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
+            for (RawTrackerHit hit : hits) {
+                int x = hit.getIdentifierFieldValue("ix");
+                int y = hit.getIdentifierFieldValue("iy");
+                if (calWindow > 0) {
+                    for (int i = 0; i < calWindow; i++) {
+                        aPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+                    }
+                } else {
+                    for (int i = 0; i < hit.getADCValues().length; i++) {
+                        aPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+                    }
+                }
+            }
+            if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
+                redraw();
+            }
+        }
+
+        if (event.hasCollection(BaseRawCalorimeterHit.class, inputCollection)) {
+            List<BaseRawCalorimeterHit> hits = event.get(BaseRawCalorimeterHit.class, inputCollection);
+            for (BaseRawCalorimeterHit hit : hits) {
+                int x = hit.getIdentifierFieldValue("ix");
+                int y = hit.getIdentifierFieldValue("iy");
+                aPlots[x + 23][y + 5].fill(hit.getAmplitude());
+                tPlots[x + 23][y + 5].fill(hit.getTimeStamp() / 64);
+            }
+            if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
+                redraw();
+            }
+        }
+
+        if (event.hasCollection(CalorimeterHit.class, inputCollection)) {
+            List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection);
+            for (CalorimeterHit hit : hits) {
+                int x = hit.getIdentifierFieldValue("ix");
+                int y = hit.getIdentifierFieldValue("iy");
+                aPlots[x + 23][y + 5].fill(hit.getRawEnergy());
+                tPlots[x + 23][y + 5].fill(hit.getTime() / 4.0);
+            }
+            if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
+                redraw();
+            }
+        }
+    }
+
+    @Override
+    public void actionPerformed(ActionEvent ae) {
+        if (ae.getSource() == blankButton) {
+            plotter.region(2).clear();
+            plotter2.region(2).clear();
+        } else {
+            Integer x, y;
+            x = (Integer) xCombo.getSelectedItem();
+            y = (Integer) yCombo.getSelectedItem();
+            plotter.region(2).clear();
+            plotter.region(2).plot(aPlots[x + 23][y + 5]);
+            plotter2.region(2).clear();
+            plotter2.region(2).plot(tPlots[x + 23][y + 5]);
+//            ((PlotterRegion) plotter.region(2)).getPlot().setAllowUserInteraction(false);
+//            ((PlotterRegion) plotter.region(2)).getPlot().setAllowPopupMenus(false);
+        }
+    }
+
+    @Override
+    public void redraw() {
+        aSigmaPlot.reset();
+        aMeanPlot.reset();
+        tSigmaPlot.reset();
+        tMeanPlot.reset();
+        for (int x = -23; x <= 23; x++) { // slot
+            for (int y = -5; y <= 5; y++) { // crate   
+                if (aPlots[x + 23][y + 5].entries() > 10) {
+                    aSigmaPlot.fill(x, y, aPlots[x + 23][y + 5].rms());
+                    aMeanPlot.fill(x, y, aPlots[x + 23][y + 5].mean());
+                }
+                if (tPlots[x + 23][y + 5].entries() > 10) {
+                    tSigmaPlot.fill(x, y, tPlots[x + 23][y + 5].rms());
+                    tMeanPlot.fill(x, y, tPlots[x + 23][y + 5].mean());
+                }
+            }
+        }
+    }
+
+    @Override
+    public void setEventRefreshRate(int eventRefreshRate) {
+        this.eventRefreshRate = eventRefreshRate;
+    }
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
EcalWindowEventPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalWindowEventPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalWindowEventPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,148 @@
+package org.hps.monitoring.drivers.ecal;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class EcalWindowEventPlots extends Driver implements ActionListener {
+
+    private String inputCollection;
+    private IPlotter plotter;
+    private AIDA aida = AIDA.defaultInstance();
+    //private AIDAFrame plotterFrame;
+    private IHistogram1D[][] plots = new IHistogram1D[47][11];
+    private JLabel xLabel, yLabel;
+    private JComboBox xCombo;
+    private JComboBox yCombo;
+    private JButton blankButton;
+    private static final Integer[] xList = new Integer[46];
+    private static final Integer[] yList = new Integer[10];
+    boolean hide = false;
+    int window = 100;
+
+    public void setWindow(int window) {
+        this.window = window;
+    }
+
+    public EcalWindowEventPlots() {
+        int count = 0;
+        for (int i = -23; i <= 23; i++) {
+            if (i != 0) {
+                xList[count] = i;
+                count++;
+            }
+        }
+        count = 0;
+        for (int i = -5; i <= 5; i++) {
+            if (i != 0) {
+                yList[count] = i;
+                count++;
+            }
+        }
+    }
+
+    public void setHide(boolean hide) {
+        this.hide = hide;
+    }
+
+    public void setInputCollection(String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+
+    @Override
+    public void detectorChanged(Detector detector) {
+        if (inputCollection == null) {
+            throw new RuntimeException("The inputCollection parameter was not set.");
+        }
+
+        // Setup the plotter.
+        plotter = aida.analysisFactory().createPlotterFactory().create();
+        plotter.setTitle("HPS ECal Window Event Plots");
+        //plotterFrame = new AIDAFrame();
+        //plotterFrame.addPlotter(plotter);
+
+        aida = AIDA.defaultInstance();
+        aida.tree().cd("/");
+
+        for (int x = -23; x <= 23; x++) { // slot
+            for (int y = -5; y <= 5; y++) { // crate                
+                plots[x + 23][y + 5] = aida.histogram1D("ECAL window: x=" + x + "; y=" + y, window, -0.5, window - 0.5);
+            }
+        }
+
+        // Create the plotter regions.
+        plotter.createRegion();
+
+        xCombo = new JComboBox(xList);
+        xCombo.addActionListener(this);
+        xLabel = new JLabel("x");
+        xLabel.setLabelFor(xCombo);
+        //plotterFrame.getControlsPanel().add(xLabel);
+        //plotterFrame.getControlsPanel().add(xCombo);
+        yCombo = new JComboBox(yList);
+        yCombo.addActionListener(this);
+        yLabel = new JLabel("y");
+        yLabel.setLabelFor(yCombo);
+        //plotterFrame.getControlsPanel().add(yLabel);
+        //plotterFrame.getControlsPanel().add(yCombo);
+        blankButton = new JButton("Hide histogram");
+        //plotterFrame.getControlsPanel().add(blankButton);
+        blankButton.addActionListener(this);
+
+        //plotterFrame.pack();
+
+        plotter.style().statisticsBoxStyle().setVisible(false);
+        plotter.style().zAxisStyle().setParameter("allowZeroSuppression", "true");
+        plotter.style().dataStyle().errorBarStyle().setVisible(false);
+
+        plotter.region(0).plot(plots[-5 + 23][2 + 5]);
+        xCombo.setSelectedIndex((-5 + 23));
+        yCombo.setSelectedIndex((2 + 5 - 1));
+
+        //if (!hide) {
+        //    plotterFrame.setVisible(true);
+        //}
+    }
+
+    @Override
+    public void process(EventHeader event) {
+        for (int x = -23; x <= 23; x++) { // slot
+            for (int y = -5; y <= 5; y++) { // crate                
+                plots[x + 23][y + 5].reset();
+            }
+        }
+
+        if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
+            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
+            for (RawTrackerHit hit : hits) {
+                int x = hit.getIdentifierFieldValue("ix");
+                int y = hit.getIdentifierFieldValue("iy");
+                for (int i = 0; i < window; i++) {
+                    plots[x + 23][y + 5].fill(i, hit.getADCValues()[i]);
+                }
+            }
+        }
+    }
+
+    @Override
+    public void actionPerformed(ActionEvent ae) {
+        Integer x, y;
+        x = (Integer) xCombo.getSelectedItem();
+        y = (Integer) yCombo.getSelectedItem();
+        plotter.region(0).clear();
+        plotter.region(0).plot(plots[x + 23][y + 5]);
+    }
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
EcalWindowPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalWindowPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalWindowPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,187 @@
+package org.hps.monitoring.drivers.ecal;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+
+import org.hps.conditions.deprecated.EcalConditions;
+import org.hps.util.AIDAFrame;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class EcalWindowPlots extends Driver implements ActionListener {
+
+    private String inputCollection = "EcalReadoutHits";
+    private IPlotter plotter;
+    private AIDAFrame plotterFrame;
+    private AIDA aida;
+    private Detector detector;
+    private IHistogram1D windowPlot;
+    private int window = 100;
+    private JLabel crateLabel, slotLabel, channelLabel;
+    private JComboBox crateCombo;
+    private JComboBox slotCombo;
+    private JComboBox channelCombo;
+    private static final String[] crateList = new String[3];
+    private static final String[] slotList = new String[17];
+    private static final String[] channelList = new String[17];
+    private boolean testCrate = false;
+    private boolean testSlot = false;
+    private boolean testChannel = false;
+    private int plotCrate, plotSlot, plotChannel;
+
+    public EcalWindowPlots() {
+        int count = 0;
+        crateList[0] = "all";
+        for (int i = 1; i <= 2; i++) {
+            count++;
+            crateList[count] = Integer.toString(i);
+        }
+        count = 0;
+        slotList[0] = "all";
+        for (int i = 0; i <= 15; i++) {
+            count++;
+            slotList[count] = Integer.toString(i);
+        }
+        count = 0;
+        channelList[0] = "all";
+        for (int i = 0; i <= 15; i++) {
+            count++;
+            channelList[count] = Integer.toString(i);
+        }
+    }
+
+    public void setInputCollection(String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+
+    public void setWindow(int window) {
+        this.window = window;
+    }
+
+    @Override
+    public void detectorChanged(Detector detector) {
+
+        this.detector = detector;
+
+        if (inputCollection == null) {
+            throw new RuntimeException("The inputCollection parameter was not set.");
+        }
+
+        setupPlots();
+    }
+
+    private void setupPlots() {
+        if (plotterFrame != null) {
+            plotterFrame.dispose();
+        }
+
+        aida = AIDA.defaultInstance();
+        aida.tree().cd("/");
+        plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECAL Window Plots");
+
+        plotterFrame = new AIDAFrame();
+        plotterFrame.addPlotter(plotter);
+        plotterFrame.setVisible(true);
+        IPlotterStyle pstyle = plotter.style();
+        pstyle.dataStyle().errorBarStyle().setVisible(false);
+        windowPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Window Mode Data", window, -0.5, window - 0.5);
+        plotter.region(0).plot(windowPlot);
+
+        crateCombo = new JComboBox(crateList);
+        crateCombo.addActionListener(this);
+        crateLabel = new JLabel("crate");
+        crateLabel.setLabelFor(crateCombo);
+        plotterFrame.getControlsPanel().add(crateLabel);
+        plotterFrame.getControlsPanel().add(crateCombo);
+        slotCombo = new JComboBox(slotList);
+        slotCombo.addActionListener(this);
+        slotLabel = new JLabel("slot");
+        slotLabel.setLabelFor(slotCombo);
+        plotterFrame.getControlsPanel().add(slotLabel);
+        plotterFrame.getControlsPanel().add(slotCombo);
+        channelCombo = new JComboBox(channelList);
+        channelCombo.addActionListener(this);
+        channelLabel = new JLabel("channel");
+        channelLabel.setLabelFor(channelCombo);
+        plotterFrame.getControlsPanel().add(channelLabel);
+        plotterFrame.getControlsPanel().add(channelCombo);
+        plotterFrame.pack();
+    }
+
+    @Override
+    public void endOfData() {
+        if (plotterFrame != null) {
+            plotterFrame.dispose();
+        }
+    }
+
+    @Override
+    public void process(EventHeader event) {
+        if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
+            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
+            for (RawTrackerHit hit : hits) {
+                Long daqId = EcalConditions.physicalToDaqID(hit.getCellID());
+                int crate = EcalConditions.getCrate(daqId);
+                int slot = EcalConditions.getSlot(daqId);
+                int channel = EcalConditions.getChannel(daqId);
+//				System.out.println("got hit: crate " + crate + ", slot " + slot + ", channel " + channel);
+                if (hit.getADCValues().length != window) {
+                    throw new RuntimeException("Hit has unexpected window length " + hit.getADCValues().length + ", not " + window);
+                }
+                if (testCrate && crate != plotCrate) {
+                    continue;
+                }
+                if (testSlot && slot != plotSlot) {
+                    continue;
+                }
+                if (testChannel && channel != plotChannel) {
+                    continue;
+                }
+                windowPlot.reset();
+                for (int i = 0; i < window; i++) {
+                    windowPlot.fill(i, hit.getADCValues()[i]);
+
+                }
+            }
+        }
+    }
+
+    @Override
+    public void actionPerformed(ActionEvent ae) {
+        String selItem;
+        selItem = (String) crateCombo.getSelectedItem();
+        if (selItem.equals("all")) {
+            testCrate = false;
+        } else {
+            testCrate = true;
+            plotCrate = Integer.decode(selItem);
+        }
+
+        selItem = (String) slotCombo.getSelectedItem();
+        if (selItem.equals("all")) {
+            testSlot = false;
+        } else {
+            testSlot = true;
+            plotSlot = Integer.decode(selItem);
+        }
+
+        selItem = (String) channelCombo.getSelectedItem();
+        if (selItem.equals("all")) {
+            testChannel = false;
+        } else {
+            testChannel = true;
+            plotChannel = Integer.decode(selItem);
+        }
+    }
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
EcalWindowPlotsXY.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalWindowPlotsXY.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/EcalWindowPlotsXY.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,175 @@
+package org.hps.monitoring.drivers.ecal;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+
+import org.hps.util.AIDAFrame;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.geometry.compact.Subdetector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class EcalWindowPlotsXY extends Driver implements ActionListener {
+
+    private String subdetectorName;
+    private String inputCollection;
+    private IPlotter plotter;
+    private AIDAFrame plotterFrame;
+    private AIDA aida;
+    private Detector detector;
+    private IDDecoder dec;
+    private IHistogram1D windowPlot;
+    private int window = 10;
+    private JLabel xLabel, yLabel;
+    private JComboBox xCombo;
+    private JComboBox yCombo;
+    private static final String[] xList = new String[47];
+    private static final String[] yList = new String[11];
+    private boolean testX = false;
+    private boolean testY = false;
+    private int plotX, plotY;
+
+    public EcalWindowPlotsXY() {
+        int count = 0;
+        xList[0] = "all";
+        for (int i = -23; i <= 23; i++) {
+            if (i != 0) {
+                count++;
+                xList[count] = Integer.toString(i);
+            }
+        }
+        count = 0;
+        yList[0] = "all";
+        for (int i = -5; i <= 5; i++) {
+            if (i != 0) {
+                count++;
+                yList[count] = Integer.toString(i);
+            }
+        }
+    }
+
+    public void setSubdetectorName(String subdetectorName) {
+        this.subdetectorName = subdetectorName;
+    }
+
+    public void setInputCollection(String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+
+    public void setWindow(int window) {
+        this.window = window;
+    }
+
+    public void detectorChanged(Detector detector) {
+
+        this.detector = detector;
+
+        if (subdetectorName == null) {
+            throw new RuntimeException("The subdetectorName parameter was not set.");
+        }
+
+        if (inputCollection == null) {
+            throw new RuntimeException("The inputCollection parameter was not set.");
+        }
+
+        Subdetector subdetector = detector.getSubdetector(subdetectorName);
+        dec = subdetector.getReadout().getIDDecoder();
+
+        setupPlots();
+    }
+
+    private void setupPlots() {
+        if (plotterFrame != null) {
+            plotterFrame.dispose();
+        }
+
+        aida = AIDA.defaultInstance();
+        aida.tree().cd("/");
+        plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECAL Window Plots");
+
+        plotterFrame = new AIDAFrame();
+        plotterFrame.addPlotter(plotter);
+        plotterFrame.setVisible(true);
+        IPlotterStyle pstyle = plotter.style();
+        pstyle.dataStyle().errorBarStyle().setVisible(false);
+        windowPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Window Mode Data", window, -0.5, window - 0.5);
+        plotter.region(0).plot(windowPlot);
+
+        xCombo = new JComboBox(xList);
+        xCombo.addActionListener(this);
+        xLabel = new JLabel("x");
+        xLabel.setLabelFor(xCombo);
+        plotterFrame.getControlsPanel().add(xLabel);
+        plotterFrame.getControlsPanel().add(xCombo);
+        yCombo = new JComboBox(yList);
+        yCombo.addActionListener(this);
+        yLabel = new JLabel("y");
+        yLabel.setLabelFor(yCombo);
+        plotterFrame.getControlsPanel().add(yLabel);
+        plotterFrame.getControlsPanel().add(yCombo);
+        plotterFrame.pack();
+    }
+
+    public void endOfData() {
+        if (plotterFrame != null) {
+            plotterFrame.dispose();
+        }
+    }
+
+    public void process(EventHeader event) {
+        if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
+            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
+            for (RawTrackerHit hit : hits) {
+                dec.setID(hit.getCellID());
+                int x = dec.getValue("ix");
+                int y = dec.getValue("iy");
+//				System.out.println("got hit: x= " + x + ", y= " + y);
+                if (hit.getADCValues().length != window) {
+                    throw new RuntimeException("Hit has unexpected window length " + hit.getADCValues().length + ", not " + window);
+                }
+                if (testX && x != plotX) {
+                    continue;
+                }
+                if (testY && y != plotY) {
+                    continue;
+                }
+                windowPlot.reset();
+                for (int i = 0; i < window; i++) {
+                    windowPlot.fill(i, hit.getADCValues()[i]);
+
+                }
+            }
+        }
+    }
+
+    @Override
+    public void actionPerformed(ActionEvent ae) {
+        String selItem;
+        selItem = (String) xCombo.getSelectedItem();
+        if (selItem.equals("all")) {
+            testX = false;
+        } else {
+            testX = true;
+            plotX = Integer.decode(selItem);
+        }
+
+        selItem = (String) yCombo.getSelectedItem();
+        if (selItem.equals("all")) {
+            testY = false;
+        } else {
+            testY = true;
+            plotY = Integer.decode(selItem);
+        }
+    }
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal
TriggerPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/TriggerPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/ecal/TriggerPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,577 @@
+package org.hps.monitoring.drivers.ecal;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+
+import java.util.List;
+
+import org.hps.recon.ecal.HPSEcalCluster;
+import org.hps.recon.ecal.TriggerData;
+import org.hps.util.Redrawable;
+import org.hps.util.Resettable;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.GenericObject;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class TriggerPlots extends Driver implements Resettable, Redrawable {
+
+    int eventRefreshRate = 10000;
+    int eventn = 0;
+    //AIDAFrame plotterFrame;
+    String inputCollection = "EcalCalHits";
+    String clusterCollection = "EcalClusters";
+    double clusterEnergyCut = 1280.0;
+    AIDA aida = AIDA.defaultInstance();
+    IPlotter plotter, plotter2, plotter3, plotter4, plotter5, plotter6;
+    IHistogram1D topHitTimePlot, botHitTimePlot, orHitTimePlot;
+    IHistogram1D topTrigTimePlot, botTrigTimePlot, orTrigTimePlot;
+    IHistogram2D topTimePlot2D, botTimePlot2D, orTimePlot2D;
+    IHistogram2D topClusters, botClusters, pairClusters;
+    IHistogram2D noTopClusters, noBotClusters;
+    IHistogram1D topClusTimePlot, botClusTimePlot, orClusTimePlot;
+    IHistogram2D topClusTime2D, botClusTime2D, orClusTime2D;
+    IHistogram1D topClusTimeDiff, botClusTimeDiff, orClusTimeDiff;
+    IHistogram2D trigType;
+    IHistogram1D simTrigTop, simTrigBot, simTrigAnd;
+    IHistogram1D toptrig_cl_ecal_e_tag, toptrig_cl_ecal_emax_tag, toptrig_cl_ecal_n_tag, toptrig_cl_ecal_e_probe, toptrig_cl_ecal_e_probe_trig, toptrigtag_cl_ecal_e_probe, toptrigtag_cl_ecal_e_probe_trig;
+    IHistogram1D bottrig_cl_ecal_e_tag, bottrig_cl_ecal_emax_tag, bottrig_cl_ecal_n_tag, bottrig_cl_ecal_e_probe, bottrig_cl_ecal_e_probe_trig, bottrigtag_cl_ecal_e_probe, bottrigtag_cl_ecal_e_probe_trig;
+
+    public void setInputCollection(String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+
+    public void setClusterCollection(String clusterCollection) {
+        this.clusterCollection = clusterCollection;
+    }
+
+    public void setClusterEnergyCut(double clusterEnergyCut) {
+        this.clusterEnergyCut = clusterEnergyCut;
+    }
+
+    @Override
+    protected void detectorChanged(Detector detector) {
+
+    	//plotterFrame = new AIDAFrame();
+        //plotterFrame.setTitle("HPS Trigger Plots");
+        aida.tree().cd("/");
+
+
+        plotter = aida.analysisFactory().createPlotterFactory().create("Hit Times");
+        plotter.setTitle("Hit Times");
+        //plotterFrame.addPlotter(plotter);
+        plotter.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter.createRegions(3, 3);
+
+        topHitTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Top", 100, 0, 100 * 4.0);
+        botHitTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Bottom", 100, 0, 100 * 4.0);
+        orHitTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Or", 100, 0, 100 * 4.0);
+
+        topTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Top", 32, 0, 32);
+        botTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Bottom", 32, 0, 32);
+        orTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Or", 32, 0, 32);
+
+        topTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Top", 101, -4.0, 100 * 4.0, 33, -1 * 4.0, 32 * 4.0);
+        botTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Bottom", 101, -4.0, 100 * 4.0, 33, -1 * 4.0, 32 * 4.0);
+        orTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Or", 101, -4.0, 100 * 4.0, 33, -1 * 4.0, 32 * 4.0);
+
+        // Create the plotter regions.
+        plotter.region(0).plot(topHitTimePlot);
+        plotter.region(1).plot(botHitTimePlot);
+        plotter.region(2).plot(orHitTimePlot);
+        plotter.region(3).plot(topTrigTimePlot);
+        plotter.region(4).plot(botTrigTimePlot);
+        plotter.region(5).plot(orTrigTimePlot);
+        for (int i = 0; i < 6; i++) {
+            plotter.region(i).style().yAxisStyle().setParameter("scale", "log");
+        }
+        plotter.region(6).plot(topTimePlot2D);
+        plotter.region(7).plot(botTimePlot2D);
+        plotter.region(8).plot(orTimePlot2D);
+        for (int i = 6; i < 9; i++) {
+            plotter.region(i).style().setParameter("hist2DStyle", "colorMap");
+            plotter.region(i).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+            plotter.region(i).style().zAxisStyle().setParameter("scale", "log");
+        }
+
+        plotter2 = aida.analysisFactory().createPlotterFactory().create("Clusters");
+        plotter2.setTitle("Clusters");
+        //plotterFrame.addPlotter(plotter2);
+        plotter2.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter2.style().setParameter("hist2DStyle", "colorMap");
+        plotter2.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter2.style().zAxisStyle().setParameter("scale", "log");
+        plotter2.createRegions(2, 3);
+
+        topClusters = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Clusters, Top Trigger", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        plotter2.region(0).plot(topClusters);
+        botClusters = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Clusters, Bot Trigger", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        plotter2.region(1).plot(botClusters);
+        pairClusters = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Clusters, Pair Trigger", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        plotter2.region(2).plot(pairClusters);
+        noTopClusters = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Clusters, No Top Trigger", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        plotter2.region(3).plot(noTopClusters);
+        noBotClusters = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Clusters, No Bot Trigger", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        plotter2.region(4).plot(noBotClusters);
+
+        topClusTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : First Cluster Time, Top", 100, 0, 100 * 4.0);
+        botClusTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : First Cluster Time, Bottom", 100, 0, 100 * 4.0);
+        orClusTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : First Cluster Time, Or", 100, 0, 100 * 4.0);
+
+        topClusTime2D = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time vs. Trig Time, Top", 101, -4.0, 100 * 4.0, 33, -1 * 4.0, 32 * 4.0);
+        botClusTime2D = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time vs. Trig Time, Bottom", 101, -4.0, 100 * 4.0, 33, -1 * 4.0, 32 * 4.0);
+        orClusTime2D = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time vs. Trig Time, Or", 101, -4.0, 100 * 4.0, 33, -1 * 4.0, 32 * 4.0);
+
+        topClusTimeDiff = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time - Trig Time, Top", 200, -100 * 4.0, 100 * 4.0);
+        botClusTimeDiff = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time - Trig Time, Bottom", 200, -100 * 4.0, 100 * 4.0);
+        orClusTimeDiff = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Time - Trig Time, Or", 200, -100 * 4.0, 100 * 4.0);
+
+        plotter3 = aida.analysisFactory().createPlotterFactory().create("Cluster Times");
+        plotter3.setTitle("Cluster Times");
+        //plotterFrame.addPlotter(plotter3);
+        plotter3.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter3.createRegions(3, 3);
+
+        plotter3.region(0).plot(topClusTimePlot);
+        plotter3.region(1).plot(botClusTimePlot);
+        plotter3.region(2).plot(orClusTimePlot);
+        for (int i = 0; i < 3; i++) {
+            plotter3.region(i).style().yAxisStyle().setParameter("scale", "log");
+        }
+        plotter3.region(3).plot(topClusTime2D);
+        plotter3.region(4).plot(botClusTime2D);
+        plotter3.region(5).plot(orClusTime2D);
+        for (int i = 3; i < 6; i++) {
+            plotter3.region(i).style().setParameter("hist2DStyle", "colorMap");
+            plotter3.region(i).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+            plotter3.region(i).style().zAxisStyle().setParameter("scale", "log");
+        }
+        plotter3.region(6).plot(topClusTimeDiff);
+        plotter3.region(7).plot(botClusTimeDiff);
+        plotter3.region(8).plot(orClusTimeDiff);
+//        for (int i = 6; i < 9; i++) {
+//            plotter3.region(i).style().yAxisStyle().setParameter("scale", "log");
+//        }
+
+        trigType = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Actual Trigger vs. Simulated Trigger", 4, 0, 4, 4, 0, 4);
+        simTrigTop = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : Simulated Trigger - Top-Trigger Events", 4, 0, 4);
+        simTrigBot = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : Simulated Trigger - Bottom-Trigger Events", 4, 0, 4);
+        simTrigAnd = aida.histogram1D(detector.getDetectorName() + " : " + clusterCollection + " : Simulated Trigger - And-Trigger Events", 4, 0, 4);
+
+        plotter4 = aida.analysisFactory().createPlotterFactory().create("Trigger Types");
+        plotter4.setTitle("Trigger Types");
+        //plotterFrame.addPlotter(plotter4);
+        plotter4.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter4.style().yAxisStyle().setParameter("scale", "log");
+//        plotter4.style().setParameter("hist2DStyle", "colorMap");
+//        plotter4.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+//        plotter4.style().zAxisStyle().setParameter("scale", "log");
+//        plotter4.createRegion();
+//        plotter4.region(0).plot(trigType);
+        plotter4.createRegions(1, 3);
+
+        plotter4.region(0).plot(simTrigTop);
+        plotter4.region(1).plot(simTrigBot);
+        plotter4.region(2).plot(simTrigAnd);
+
+        plotter5 = aida.analysisFactory().createPlotterFactory().create("Bottom turn-on");
+        plotter5.setTitle("Bottom turn-on");
+        //plotterFrame.addPlotter(plotter5);
+        plotter5.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter5.createRegions(3, 3);
+
+        double plotEnergyRange = 5 * clusterEnergyCut;
+
+        toptrig_cl_ecal_n_tag = aida.histogram1D("toptrig_cl_ecal_n_tag", 7, 0, 7);
+        toptrig_cl_ecal_e_probe = aida.histogram1D("toptrig_cl_ecal_e_probe", 200, 0, plotEnergyRange);
+        toptrigtag_cl_ecal_e_probe = aida.histogram1D("toptrigtag_cl_ecal_e_probe", 200, 0, plotEnergyRange);
+        toptrig_cl_ecal_e_tag = aida.histogram1D("toptrig_cl_ecal_e_tag", 200, 0, plotEnergyRange);
+        toptrig_cl_ecal_e_probe_trig = aida.histogram1D("toptrig_cl_ecal_e_probe_trig", 200, 0, plotEnergyRange);
+        toptrigtag_cl_ecal_e_probe_trig = aida.histogram1D("toptrigtag_cl_ecal_e_probe_trig", 200, 0, plotEnergyRange);
+        toptrig_cl_ecal_emax_tag = aida.histogram1D("toptrig_cl_ecal_emax_tag", 200, 0, plotEnergyRange);
+        plotter5.region(0).plot(toptrig_cl_ecal_n_tag);
+        plotter5.region(1).plot(toptrig_cl_ecal_e_probe);
+        plotter5.region(2).plot(toptrigtag_cl_ecal_e_probe);
+        plotter5.region(3).plot(toptrig_cl_ecal_e_tag);
+        plotter5.region(4).plot(toptrig_cl_ecal_e_probe_trig);
+        plotter5.region(5).plot(toptrigtag_cl_ecal_e_probe_trig);
+        plotter5.region(6).plot(toptrig_cl_ecal_emax_tag);
+
+        plotter6 = aida.analysisFactory().createPlotterFactory().create("Top turn-on");
+        plotter6.setTitle("Top turn-on");
+        //plotterFrame.addPlotter(plotter6);
+        plotter6.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter6.createRegions(3, 3);
+
+        bottrig_cl_ecal_n_tag = aida.histogram1D("bottrig_cl_ecal_n_tag", 7, 0, 7);
+        bottrig_cl_ecal_e_probe = aida.histogram1D("bottrig_cl_ecal_e_probe", 200, 0, plotEnergyRange);
+        bottrigtag_cl_ecal_e_probe = aida.histogram1D("bottrigtag_cl_ecal_e_probe", 200, 0, plotEnergyRange);
+        bottrig_cl_ecal_e_tag = aida.histogram1D("bottrig_cl_ecal_e_tag", 200, 0, plotEnergyRange);
+        bottrig_cl_ecal_e_probe_trig = aida.histogram1D("bottrig_cl_ecal_e_probe_trig", 200, 0, plotEnergyRange);
+        bottrigtag_cl_ecal_e_probe_trig = aida.histogram1D("bottrigtag_cl_ecal_e_probe_trig", 200, 0, plotEnergyRange);
+        bottrig_cl_ecal_emax_tag = aida.histogram1D("bottrig_cl_ecal_emax_tag", 200, 0, plotEnergyRange);
+        plotter6.region(0).plot(bottrig_cl_ecal_n_tag);
+        plotter6.region(1).plot(bottrig_cl_ecal_e_probe);
+        plotter6.region(2).plot(bottrigtag_cl_ecal_e_probe);
+        plotter6.region(3).plot(bottrig_cl_ecal_e_tag);
+        plotter6.region(4).plot(bottrig_cl_ecal_e_probe_trig);
+        plotter6.region(5).plot(bottrigtag_cl_ecal_e_probe_trig);
+        plotter6.region(6).plot(bottrig_cl_ecal_emax_tag);
+
+        //plotterFrame.setVisible(true);
+        //plotterFrame.pack();
+    }
+
+    @Override
+    public void process(EventHeader event) {
+        int orTrig = 0;
+        int topTrig = 0;
+        int botTrig = 0;
+        int pairTrig = 0;
+        int orTrigTime = -1;
+        int topTrigTime = -1;
+        int botTrigTime = -1;
+        if (event.hasCollection(GenericObject.class, "TriggerBank")) {
+            List<GenericObject> triggerList = event.get(GenericObject.class, "TriggerBank");
+            if (!triggerList.isEmpty()) {
+                GenericObject triggerData = triggerList.get(0);
+
+                pairTrig = TriggerData.getAndTrig(triggerData);
+                orTrig = TriggerData.getOrTrig(triggerData);
+                if (orTrig != 0) {
+                    for (int i = 0; i < 32; i++) {
+                        if ((1 << (31 - i) & orTrig) != 0) {
+                            orTrigTime = i;
+                            orTrigTimePlot.fill(i);
+                            break;
+                        }
+                    }
+                }
+                topTrig = TriggerData.getTopTrig(triggerData);
+                if (topTrig != 0) {
+                    for (int i = 0; i < 32; i++) {
+                        if ((1 << (31 - i) & topTrig) != 0) {
+                            topTrigTime = i;
+                            topTrigTimePlot.fill(i);
+                            break;
+                        }
+                    }
+                }
+                botTrig = TriggerData.getBotTrig(triggerData);
+                if (botTrig != 0) {
+                    for (int i = 0; i < 32; i++) {
+                        if ((1 << (31 - i) & botTrig) != 0) {
+                            botTrigTime = i;
+                            botTrigTimePlot.fill(i);
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+
+        if (event.hasCollection(CalorimeterHit.class, inputCollection)) {
+            List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection);
+//            double maxEnergy = 0;
+            double topTime = Double.POSITIVE_INFINITY;
+            double botTime = Double.POSITIVE_INFINITY;
+            double orTime = Double.POSITIVE_INFINITY;
+            for (CalorimeterHit hit : hits) {
+                if (hit.getTime() < orTime) {
+                    orTime = hit.getTime();
+                }
+                if (hit.getIdentifierFieldValue("iy") > 0 && hit.getTime() < topTime) {
+                    topTime = hit.getTime();
+                }
+                if (hit.getIdentifierFieldValue("iy") < 0 && hit.getTime() < botTime) {
+                    botTime = hit.getTime();
+                }
+//                if (hit.getRawEnergy() > maxEnergy) {
+//                    maxEnergy = hit.getRawEnergy();
+//                }
+            }
+            if (orTime != Double.POSITIVE_INFINITY) {
+                orHitTimePlot.fill(orTime);
+                orTimePlot2D.fill(orTime, 4.0 * orTrigTime);
+            }
+            if (topTime != Double.POSITIVE_INFINITY) {
+                topHitTimePlot.fill(topTime);
+                topTimePlot2D.fill(topTime, 4.0 * topTrigTime);
+            }
+            if (botTime != Double.POSITIVE_INFINITY) {
+                botHitTimePlot.fill(botTime);
+                botTimePlot2D.fill(botTime, 4.0 * botTrigTime);
+            }
+        }
+
+//        if (event.hasCollection(CalorimeterHit.class, inputCollection)) {
+//            List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection);
+        if (event.hasCollection(HPSEcalCluster.class, clusterCollection)) {
+            List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, clusterCollection);
+//if (clusters.size()>1)            
+            double topTime = -4.0;
+            double botTime = -4.0;
+            double orTime = -4.0;
+            clusterloop:
+            for (HPSEcalCluster cluster : clusters) {
+//            for (CalorimeterHit hit : hits) {
+                if (cluster.getEnergy() < clusterEnergyCut) {
+//                if (hit.getRawEnergy() < clusterEnergyCut) {
+                    continue;
+                }
+                CalorimeterHit hit = cluster.getSeedHit();
+
+                if (orTime < 0 || hit.getTime() < orTime) {
+                    orTime = hit.getTime();
+                }
+                if (hit.getIdentifierFieldValue("iy") > 0 && (topTime < 0 || hit.getTime() < topTime)) {
+                    topTime = hit.getTime();
+                }
+                if (hit.getIdentifierFieldValue("iy") < 0 && (botTime < 0 || hit.getTime() < botTime)) {
+                    botTime = hit.getTime();
+                }
+
+                if (topTrig != 0) {
+                    topClusters.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+                } else {
+                    noTopClusters.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+                }
+                if (botTrig != 0) {
+                    botClusters.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+                } else {
+                    noBotClusters.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+                }
+                if (pairTrig != 0) {
+                    pairClusters.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+                }
+
+//                if ((botTrig == 0 && cluster.getEnergy() > 130 && cluster.getPosition()[1] < 0) || (topTrig == 0 && cluster.getEnergy() > 130 && cluster.getPosition()[1] > 0)) {
+//                if (botTrig != 0 && topTrig != 0 && cluster.getEnergy() > 130 && cluster.getCalorimeterHits().size() > 1) {
+//                    for (CalorimeterHit hit : cluster.getCalorimeterHits()) {
+//                        if (hit.getRawEnergy() > 130) {
+//                            continue clusterloop;
+//                        }
+//                    }
+//                    botClusters.fill(cluster.getSeedHit().getIdentifierFieldValue("ix"), cluster.getSeedHit().getIdentifierFieldValue("iy"));
+//                }
+            }
+            if (orTime >= 0 || orTrigTime >= 0) {
+                orClusTimePlot.fill(orTime);
+                orClusTime2D.fill(orTime, 4.0 * orTrigTime);
+                if (orTime >= 0 || orTrigTime >= 0) {
+                    orClusTimeDiff.fill(orTime - orTrigTime * 4.0);
+                }
+            }
+            if (topTime >= 0 || topTrigTime >= 0) {
+                topClusTimePlot.fill(topTime);
+                topClusTime2D.fill(topTime, 4.0 * topTrigTime);
+                if (topTime >= 0 || topTrigTime >= 0) {
+                    topClusTimeDiff.fill(topTime - topTrigTime * 4.0);
+                }
+            }
+            if (botTime >= 0 || botTrigTime >= 0) {
+                botClusTimePlot.fill(botTime);
+                botClusTime2D.fill(botTime, 4.0 * botTrigTime);
+                if (botTime >= 0 || botTrigTime >= 0) {
+                    botClusTimeDiff.fill(botTime - botTrigTime * 4.0);
+                }
+            }
+
+            int trigTypeActual, trigTypeSim;
+
+            if (topTime < 0 && botTime < 0) {
+                trigTypeSim = 0;
+            } else if (topTime >= 0 && botTime < 0) {
+                trigTypeSim = 1;
+            } else if (topTime < 0 && botTime >= 0) {
+                trigTypeSim = 2;
+            } else {
+                trigTypeSim = 3;
+            }
+
+            if (topTrig == 0 && botTrig == 0) {
+                trigTypeActual = 0;
+            } else if (topTrig != 0 && botTrig == 0) {
+                trigTypeActual = 1;
+                simTrigTop.fill(trigTypeSim);
+            } else if (topTrig == 0 && botTrig != 0) {
+                trigTypeActual = 2;
+                simTrigBot.fill(trigTypeSim);
+            } else {
+                trigTypeActual = 3;
+                simTrigAnd.fill(trigTypeSim);
+            }
+
+            trigType.fill(trigTypeSim, trigTypeActual);
+
+
+
+
+            if (topTrig != 0) {
+
+                //Find the tag
+                double Etag = -999999.9;
+                HPSEcalCluster cl_tag = null; //highest-E cluster in top half
+                int nTag = 0; //num. clusters in top half
+
+                //Find a probe
+                double Eprobe = -999999.9;
+                HPSEcalCluster cl_probe = null; //highest-E cluster in bottom half
+                int nProbe = 0; //num. clusters in bottom half
+
+                for (HPSEcalCluster cl : clusters) {
+                    if (cl.getPosition()[1] > 0) { //top half
+                        ++nTag;
+                        toptrig_cl_ecal_e_tag.fill(cl.getEnergy());
+                        if (cl.getEnergy() > Etag) {
+                            Etag = cl.getEnergy();
+                            cl_tag = cl;
+                        }
+                    }
+                    if (cl.getPosition()[1] <= 0) { //bottom half
+                        ++nProbe;
+                        if (cl.getEnergy() > Eprobe) {
+                            Eprobe = cl.getEnergy();
+                            cl_probe = cl;
+                        }
+                    }
+                }
+
+                toptrig_cl_ecal_n_tag.fill(nTag);
+
+                if (cl_tag != null) {
+                    toptrig_cl_ecal_emax_tag.fill(cl_tag.getEnergy());
+                    //use only cases where the is a single probe candidate
+                    if (nProbe == 1) {
+                        toptrig_cl_ecal_e_probe.fill(cl_probe.getEnergy());
+                        if (botTrig != 0) {
+                            toptrig_cl_ecal_e_probe_trig.fill(cl_probe.getEnergy());
+                        }
+                        if (cl_tag.getEnergy() > 2.0 * clusterEnergyCut) {
+                            toptrigtag_cl_ecal_e_probe.fill(cl_probe.getEnergy());
+                            if (botTrig != 0) {
+                                toptrigtag_cl_ecal_e_probe_trig.fill(cl_probe.getEnergy());
+                            }
+                        }
+                    }
+                } //tag found
+            }//topTrigger
+
+            if (botTrig != 0) {
+
+                //Find the tag
+                double Etag = -999999.9;
+                HPSEcalCluster cl_tag = null; //highest-E cluster in bottom half
+                int nTag = 0; //num. clusters in top half
+
+                //Find a probe
+                double Eprobe = -999999.9;
+                HPSEcalCluster cl_probe = null; //highest-E cluster in top half
+                int nProbe = 0; //num. clusters in bottom half
+
+                for (HPSEcalCluster cl : clusters) {
+                    if (cl.getPosition()[1] < 0) { //bottom half
+                        ++nTag;
+                        bottrig_cl_ecal_e_tag.fill(cl.getEnergy());
+                        if (cl.getEnergy() > Etag) {
+                            Etag = cl.getEnergy();
+                            cl_tag = cl;
+                        }
+                    }
+                    if (cl.getPosition()[1] > 0) { //top half
+                        ++nProbe;
+                        if (cl.getEnergy() > Eprobe) {
+                            Eprobe = cl.getEnergy();
+                            cl_probe = cl;
+                        }
+                    }
+                }
+
+                bottrig_cl_ecal_n_tag.fill(nTag);
+
+                if (cl_tag != null) {
+                    bottrig_cl_ecal_emax_tag.fill(cl_tag.getEnergy());
+                    //use only cases where the is a single probe candidate
+                    if (nProbe == 1) {
+                        bottrig_cl_ecal_e_probe.fill(cl_probe.getEnergy());
+                        if (topTrig != 0) {
+                            bottrig_cl_ecal_e_probe_trig.fill(cl_probe.getEnergy());
+                        }
+                        if (cl_tag.getEnergy() > 2.0 * clusterEnergyCut) {
+                            bottrigtag_cl_ecal_e_probe.fill(cl_probe.getEnergy());
+                            if (topTrig != 0) {
+                                bottrigtag_cl_ecal_e_probe_trig.fill(cl_probe.getEnergy());
+                            }
+                        }
+                    }
+                } //tag found
+            }//botTrigger
+
+        }
+
+        if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
+            redraw();
+        }
+    }
+
+    @Override
+    public void reset() {
+    }
+
+    @Override
+    public void endOfData() {
+        redraw();
+        System.out.format("Top trigger bit: \t");
+        for (int i = 0; i < 4; i++) {
+            System.out.format("%d\t", simTrigTop.binEntries(i));
+        }
+        System.out.println();
+        System.out.format("Bottom trigger bit: \t");
+        for (int i = 0; i < 4; i++) {
+            System.out.format("%d\t", simTrigBot.binEntries(i));
+        }
+        System.out.println();
+        System.out.format("Both trigger bits: \t");
+        for (int i = 0; i < 4; i++) {
+            System.out.format("%d\t", simTrigAnd.binEntries(i));
+        }
+        System.out.println();
+
+        System.out.println("Events where top fired:");
+        System.out.format("Bottom fired:\t\t%d\t%d\n", simTrigAnd.binEntries(2) + simTrigAnd.binEntries(3), simTrigAnd.binEntries(0) + simTrigAnd.binEntries(1));
+        System.out.format("Bottom didn't fire:\t%d\t%d\n", simTrigTop.binEntries(2) + simTrigTop.binEntries(3), simTrigTop.binEntries(0) + simTrigTop.binEntries(1));
+        System.out.println("Events where bottom fired:");
+        System.out.format("Top fired:\t\t%d\t%d\n", simTrigAnd.binEntries(1) + simTrigAnd.binEntries(3), simTrigAnd.binEntries(0) + simTrigAnd.binEntries(2));
+        System.out.format("Top didn't fire:\t%d\t%d\n", simTrigBot.binEntries(1) + simTrigBot.binEntries(3), simTrigBot.binEntries(0) + simTrigBot.binEntries(2));
+        //plotterFrame.dispose();
+    }
+
+    @Override
+    public void redraw() {
+        IHistogram1D heffTop = aida.histogramFactory().divide("bottom turn-on: top tag", toptrig_cl_ecal_e_probe_trig, toptrig_cl_ecal_e_probe);
+        plotter5.region(7).clear();
+        plotter5.region(7).style().statisticsBoxStyle().setVisible(false);
+        plotter5.region(7).plot(heffTop);
+        IHistogram1D heffTop2 = aida.histogramFactory().divide("bottom turn-on: top tag > " + 2.0 * clusterEnergyCut, toptrigtag_cl_ecal_e_probe_trig, toptrigtag_cl_ecal_e_probe);
+        plotter5.region(8).clear();
+        plotter5.region(8).style().statisticsBoxStyle().setVisible(false);
+        plotter5.region(8).plot(heffTop2);
+
+        IHistogram1D heffBot = aida.histogramFactory().divide("top turn-on: bottom tag", bottrig_cl_ecal_e_probe_trig, bottrig_cl_ecal_e_probe);
+        plotter6.region(7).clear();
+        plotter6.region(7).style().statisticsBoxStyle().setVisible(false);
+        plotter6.region(7).plot(heffBot);
+        IHistogram1D heffBot2 = aida.histogramFactory().divide("top turn-on: bottom tag > " + 2.0 * clusterEnergyCut, bottrigtag_cl_ecal_e_probe_trig, bottrigtag_cl_ecal_e_probe);
+        plotter6.region(8).clear();
+        plotter6.region(8).style().statisticsBoxStyle().setVisible(false);
+        plotter6.region(8).plot(heffBot2);
+    }
+
+    @Override
+    public void setEventRefreshRate(int eventRefreshRate) {
+        this.eventRefreshRate = eventRefreshRate;
+    }
+}
\ No newline at end of file

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
PedestalPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/PedestalPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/PedestalPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,159 @@
+package org.hps.monitoring.drivers.svt;
+
+import hep.aida.IDataPoint;
+import hep.aida.IDataPointSet;
+import hep.aida.IFitResult;
+import hep.aida.IFitter;
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.ref.histogram.DataPoint;
+
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
+import org.hps.conditions.deprecated.SvtUtils;
+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.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author Sho Uemura <[log in to unmask]>
+ * @version $Id: $
+ */
+public class PedestalPlots extends Driver {
+
+    private AIDA aida = AIDA.defaultInstance();
+    private Map<SiSensor, IHistogram2D> hists;
+    private Map<SiSensor, int[]> counts;
+    private Map<SiSensor, double[]> means;
+    private Map<SiSensor, double[]> sumsqs;
+    private Map<SiSensor, IDataPointSet[]> plots;
+    private String rawTrackerHitCollectionName = "SVTRawTrackerHits";
+    private String fitFile = null;
+    private boolean plotTimeSeries = false;
+
+    public void setFitFile(String fitFile) {
+        this.fitFile = fitFile;
+    }
+
+    public void setPlotTimeSeries(boolean plotTimeSeries) {
+        this.plotTimeSeries = plotTimeSeries;
+    }
+
+    @Override
+    protected void detectorChanged(Detector detector) {
+
+        aida.tree().cd("/");
+
+        hists = new HashMap<SiSensor, IHistogram2D>();
+        counts = new HashMap<SiSensor, int[]>();
+        means = new HashMap<SiSensor, double[]>();
+        sumsqs = new HashMap<SiSensor, double[]>();
+        plots = new HashMap<SiSensor, IDataPointSet[]>();
+
+        for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
+            hists.put(sensor, aida.histogram2D(sensor.getName() + " sample 1 vs. ch", 640, -0.5, 639.5, 500, -500.0, 3000.0));
+            if (plotTimeSeries) {
+                counts.put(sensor, new int[640]);
+                means.put(sensor, new double[640]);
+                sumsqs.put(sensor, new double[640]);
+                IDataPointSet[] plotArray = new IDataPointSet[640];
+                plots.put(sensor, plotArray);
+                for (int i = 0; i < 640; i++) {
+                    plotArray[i] = aida.analysisFactory().createDataPointSetFactory(aida.tree()).create(sensor.getName() + ", channel " + i + " pedestal vs. event", 2);
+                }
+            }
+        }
+
+
+
+    }
+
+    @Override
+    public void process(EventHeader event) {
+        if (event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) {
+            // Get RawTrackerHit collection from event.
+            List<RawTrackerHit> rawTrackerHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
+
+            for (RawTrackerHit hit : rawTrackerHits) {
+                SiSensor sensor = (SiSensor) hit.getDetectorElement();
+                int strip = hit.getIdentifierFieldValue("strip");
+                double pedestal = HPSSVTCalibrationConstants.getPedestal(sensor, strip);
+                hists.get(sensor).fill(strip, hit.getADCValues()[0] - pedestal);
+
+                if (plotTimeSeries) {
+
+                    counts.get(sensor)[strip]++;
+                    double delta = hit.getADCValues()[0] - pedestal - means.get(sensor)[strip];
+                    means.get(sensor)[strip] += delta / counts.get(sensor)[strip];
+                    sumsqs.get(sensor)[strip] += delta * (hit.getADCValues()[0] - pedestal - means.get(sensor)[strip]);
+
+                    if (counts.get(sensor)[strip] >= 100) {
+                        double[] data = {event.getEventNumber(), means.get(sensor)[strip]};
+                        double[] errs = {0.0, Math.sqrt(sumsqs.get(sensor)[strip] / counts.get(sensor)[strip])};
+                        IDataPoint point = new DataPoint(data, errs);
+                        plots.get(sensor)[strip].addPoint(point);
+                        counts.get(sensor)[strip] = 0;
+                        means.get(sensor)[strip] = 0;
+                        sumsqs.get(sensor)[strip] = 0;
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public void endOfData() {
+        if (fitFile == null) {
+            return;
+        }
+
+        IFitter fitter = aida.analysisFactory().createFitFactory().createFitter("chi2");
+//        fitter.setFitMethod("CleverChiSquared");
+//        fitter.setFitMethod("binnedMaximumLikelihood");
+
+        PrintWriter fitWriter = null;
+        try {
+            fitWriter = new PrintWriter(fitFile);
+        } catch (FileNotFoundException ex) {
+            Logger.getLogger(PedestalPlots.class.getName()).log(Level.SEVERE, null, ex);
+        }
+
+        for (SiSensor sensor : hists.keySet()) {
+            fitWriter.println(sensor.getName());
+            IHistogram2D hist = hists.get(sensor);
+            IHistogram1D fit = aida.histogram1D("1D fit", hist.yAxis().bins(), hist.yAxis().lowerEdge(), hist.yAxis().upperEdge());
+            for (int i = 0; i < 640; i++) {
+                fitWriter.format("%d\t", i);
+                for (int y = 0; y < hist.yAxis().bins(); y++) {
+                    for (int j = 0; j < hist.binHeight(i, y); j++) {
+                        fit.fill(hist.binMeanY(i, y));
+                    }
+                }
+                fitWriter.format("%f\t%f\t%f\t", fit.sumBinHeights(), fit.mean(), fit.rms());
+                if (fit.sumBinHeights() > 100) {
+                    IFitResult result = fitter.fit(fit, "g");
+
+                    if (result.isValid()) {
+                        fitWriter.format("%f\t%f\t", result.fittedParameter("mean"), result.fittedParameter("sigma"));
+                    }
+                }
+                fitWriter.println();
+                fit.reset();
+            }
+            fitWriter.flush();
+        }
+        fitWriter.close();
+        aida.tree().rm("1D fit");
+    }
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTCellIDPrintDriver.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTCellIDPrintDriver.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTCellIDPrintDriver.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,68 @@
+package org.hps.monitoring.drivers.svt;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+
+import org.hps.recon.tracking.HPSSVTData;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.util.Driver;
+
+/**
+ *
+ * @author Sho Uemura <[log in to unmask]>
+ * @version $Id: HPSEcalDigitalPrintDriver.java,v 1.5 2012/04/27 22:13:52 meeg
+ * Exp $
+ */
+public class SVTCellIDPrintDriver extends Driver {
+
+	String rawTrackerHitCollectionName = "SVTData";
+	String outputFileName;
+	PrintWriter outputStream = null;
+
+	public SVTCellIDPrintDriver() {
+	}
+
+	public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) {
+		this.rawTrackerHitCollectionName = rawTrackerHitCollectionName;
+	}
+
+	public void setOutputFileName(String outputFileName) {
+		this.outputFileName = outputFileName;
+	}
+
+	public void startOfData() {
+		if (rawTrackerHitCollectionName == null) {
+			throw new RuntimeException("The parameter ecalCollectionName was not set!");
+		}
+
+		if (outputFileName != null) {
+			try {
+				outputStream = new PrintWriter(outputFileName);
+			} catch (IOException ex) {
+				throw new RuntimeException("Invalid outputFilePath!");
+			}
+		} else {
+			outputStream = new PrintWriter(System.out, true);
+		}
+	}
+
+	public void process(EventHeader event) {
+		// Get the list of ECal hits.
+		if (event.hasCollection(HPSSVTData.class, rawTrackerHitCollectionName)) {
+			List<HPSSVTData> hits = event.get(HPSSVTData.class, rawTrackerHitCollectionName);
+			//outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
+			for (HPSSVTData hit : hits) {
+				outputStream.printf("FPGA=%d\thybrid=%d\tchannel=%d\n", hit.getFPGAAddress(), hit.getHybridNumber(), hit.getChannelNumber());
+			}
+		}
+		if (event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) {
+			List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
+			//outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
+			for (RawTrackerHit hit : hits) {
+				outputStream.printf("name=%s\tside=%d\tstrip=%d\n", hit.getDetectorElement().getName(), hit.getIdentifierFieldValue("side"), hit.getIdentifierFieldValue("strip"));
+			}
+		}
+	}
+}
\ No newline at end of file

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTEventDisplay.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTEventDisplay.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTEventDisplay.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,168 @@
+package org.hps.monitoring.drivers.svt;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+import hep.physics.vec.Hep3Vector;
+
+import java.util.List;
+
+import org.hps.recon.ecal.HPSEcalCluster;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
+import org.lcsim.detector.tracker.silicon.SiStrips;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author mgraham
+ */
+public class SVTEventDisplay extends Driver {
+
+    private AIDA aida = AIDA.defaultInstance();
+    private String helicalTrackHitCollectionName = "HelicalTrackHits";
+    //    String eCalClusterCollectionName = "EcalClusters";
+    private int eventCount;
+    private IPlotter plotter;
+//    private ICloud2D cl2D;
+    private IHistogram2D svtDispZX;
+    private IHistogram2D svtDispZY;
+    String ecalSubdetectorName = "Ecal";
+    String ecalCollectionName = "EcalClusters";
+    double zEcal = 130;
+
+    protected void detectorChanged(Detector detector) {
+        aida.tree().cd("/");
+
+        if (detector.getSubdetector(ecalSubdetectorName) == null) {
+            throw new RuntimeException("There is no subdetector called " + ecalSubdetectorName + " in this detector");
+        }
+
+        IAnalysisFactory fac = aida.analysisFactory();
+
+        plotter = fac.createPlotterFactory().create("HPS SVT Event Display");
+        IPlotterStyle style = plotter.style();
+        style.statisticsBoxStyle().setVisible(false);
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+//        style.zAxisStyle().setParameter("scale", "log");
+
+        plotter.createRegions(1, 2);
+        svtDispZY = aida.histogram2D("SVT Raw Hits:  z vs y", 50, 0, 140, 50, -10, 10);
+        svtDispZX = aida.histogram2D("SVT Raw Hits:  z vs x", 50, 0, 140, 100, -35, 35);
+//        cl2D = aida.cloud2D("SVT Raw Hits:  z vs y");
+
+        plotter.region(0).plot(svtDispZY);
+        plotter.region(1).plot(svtDispZX);
+        plotter.show();
+
+    }
+
+//    public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) {
+//        this.rawTrackerHitCollectionName = rawTrackerHitCollectionName;
+//    }
+    public void setHelicalTrackHitCollectionName(String helicalTrackHitCollectionName) {
+        this.helicalTrackHitCollectionName = helicalTrackHitCollectionName;
+    }
+
+    public void process(EventHeader event) {
+//        if (event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) {
+        if (event.hasCollection(HelicalTrackHit.class, helicalTrackHitCollectionName)) {
+            ++eventCount;
+
+//            aida.histogram2D("SVT Raw Hits:  z vs y").reset();
+
+            svtDispZX.reset();
+            svtDispZY.reset();
+            List<HelicalTrackHit> rawHits = event.get(HelicalTrackHit.class, helicalTrackHitCollectionName);
+            for (HelicalTrackHit hrth : rawHits) {
+                fillPlots(hrth);
+            }
+
+            List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, ecalCollectionName);
+            //             System.out.println("Number of ECAL clusters="+clusters.size());
+            for (HPSEcalCluster cluster : clusters) {
+//                dec.setID(cluster.getSeedHit().getCellID());
+//                CalorimeterHit seedHit = cluster.getSeedHit();
+//                    System.out.println("z = "+seedHit.getPosition()[2]+" y = "+seedHit.getPosition()[1]);
+                if (cluster.getEnergy() > 0) {
+                    svtDispZY.fill(zEcal, cluster.getPosition()[1] / 10, cluster.getEnergy());
+                    svtDispZX.fill(zEcal, cluster.getPosition()[0] / 10, cluster.getEnergy());
+                }
+            }
+        } else {
+            System.out.println("SVTEventDisplay:  Event has no HelicalTrackHits");
+        }
+    }
+
+    @Override
+    public void endOfData() {
+        plotter.hide();
+    }
+
+    private void fillPlots(HelicalTrackHit hit) {
+
+//        SiSensor sensor = (SiSensor) hit.getDetectorElement();
+//        SiTrackerIdentifierHelper _sid_helper = (SiTrackerIdentifierHelper) (sensor.getIdentifierHelper());
+//        int strip = hit.getIdentifierFieldValue("strip");
+//        ChargeCarrier carrier = ChargeCarrier.getCarrier(_sid_helper.getSideValue(hit.getIdentifier()));
+//        SiSensorElectrodes electrodes = ((SiSensor) hit.getDetectorElement()).getReadoutElectrodes(carrier);
+//        Hep3Vector position = getGlobalHitPosition(hit, electrodes);
+
+//        short[] adcVal = hit.getADCValues();
+//        double ped = HPSSVTCalibrationConstants.getPedestal(sensor, strip);
+//        double noise = HPSSVTCalibrationConstants.getNoise(sensor, strip);
+
+
+//        aida.cloud2D("SVT Raw Hits:  z vs y").fill(position.z() / 10.0, position.y() / 10.0);
+//        aida.histogram2D("SVT Raw Hits:  z vs y").fill(position.z()/10.0,position.y()/10.0);
+//        aida.histogram2D("SVT Raw Hits:  z vs y").fill(position.z()/10.0,position.y()/10.0);
+//        double maxAdc = -9999;
+//        for (int i = 0; i < 6; i++) {
+//            if (adcVal[i] - ped > maxAdc)
+//                maxAdc = adcVal[i] - ped;
+//        }
+//        if(noise<70){
+        //       if (noise < 70 && !mask(position)) {
+//                  System.out.println(sensor.getName()+" strip # "+strip+"   "+position.z()+"   " + position.y());
+//            svtDisp.fill(position.z()/10.0,position.y()/10.0);
+//            svtDispZY.fill(position.z() / 10.0, position.y() / 10.0, maxAdc);
+//            svtDispZX.fill(position.z() / 10.0, position.x() / 10.0, maxAdc);
+
+        //           svtDispZY.fill(position.z() / 10.0, position.y() / 10.0, 1000.0);
+        //           svtDispZX.fill(position.z() / 10.0, position.x() / 10.0, 1000.0);
+        //       }
+        svtDispZY.fill(hit.z() / 10.0, hit.y() / 10.0, 1000.0);
+        svtDispZX.fill(hit.z() / 10.0, hit.x() / 10.0, 1000.0);
+
+    }
+
+    private Hep3Vector getGlobalHitPosition(RawTrackerHit hit, SiSensorElectrodes electrodes) {
+        Hep3Vector position = (((SiStrips) electrodes).getStripCenter(hit.getIdentifierFieldValue("strip")));
+        return ((SiSensor) electrodes.getDetectorElement()).getGeometry().getLocalToGlobal().transformed(position);
+    }
+
+    private boolean mask(Hep3Vector pos) {
+        double x = pos.x();
+        double y = pos.y();
+        double z = pos.z();
+
+        if (z > 300 && z < 320) {
+            if (y > -50 && y < -20) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public void setEcalCollectionName(String ecalCollectionName) {
+        this.ecalCollectionName = ecalCollectionName;
+    }
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTEventInfo.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTEventInfo.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTEventInfo.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,189 @@
+package org.hps.monitoring.drivers.svt;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+import hep.aida.IProfile;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.hps.conditions.deprecated.SvtUtils;
+import org.hps.util.Resettable;
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.tracker.silicon.ChargeCarrier;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
+import org.lcsim.detector.tracker.silicon.SiTrackerIdentifierHelper;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author mgraham
+ */
+public class SVTEventInfo extends Driver implements Resettable {
+
+    private List<IPlotter> plotters = new ArrayList<IPlotter>();
+    private AIDA aida = AIDA.defaultInstance();
+    private String rawTrackerHitCollectionName = "SVTRawTrackerHits";
+    IPlotter plotter;
+    IPlotter plotter2;
+    private String outputPlots = null;
+
+    public SVTEventInfo() {
+    }
+
+    
+    
+    public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) {
+        this.rawTrackerHitCollectionName = rawTrackerHitCollectionName;
+    }
+
+    protected void detectorChanged(Detector detector) {
+        aida.tree().cd("/");
+
+
+
+        IAnalysisFactory fac = aida.analysisFactory();
+        plotter = fac.createPlotterFactory().create("HPS SVT Events Plots");
+        plotters.add(plotter);
+        IPlotterStyle style = plotter.style();
+        style.dataStyle().fillStyle().setColor("yellow");
+        style.dataStyle().errorBarStyle().setVisible(false);
+        plotter.createRegions(2, 2);
+
+
+
+        plotter2 = fac.createPlotterFactory().create("HPS SVT Events Plots");
+        plotters.add(plotter2);
+        IPlotterStyle style2 = plotter2.style();
+        style2.dataStyle().fillStyle().setColor("green");
+        style2.dataStyle().errorBarStyle().setVisible(false);
+        plotter2.createRegions(1, 2);
+        style2.dataStyle().markerStyle().setSize(20);
+        IHistogram1D nrawTopPlot = aida.histogram1D("Total Number of Raw Hits in Top Half", 20, 0, 19.0);
+        IHistogram1D nrawBottomPlot = aida.histogram1D("Total Number of Raw Hits in Bottom Half", 20, 0, 19.0);
+        IHistogram1D nlayersTopPlot = aida.histogram1D("Number of Layers Hit in Top Half", 11, 0, 10.0);
+        IHistogram1D nlayersBottomPlot = aida.histogram1D("Number of Layers Hit in Bottom Half", 11, 0, 10.0);
+
+        IProfile avgLayersTopPlot = aida.profile1D("Number of Hits per layer in Top Half", 10, 1, 11);
+        IProfile avgLayersBottomPlot = aida.profile1D("Number of Hits per layer in Bottom Half", 10, 1, 11);
+
+        plotter.region(0).plot(nrawTopPlot);
+        plotter.region(1).plot(nrawBottomPlot);
+        plotter.region(2).plot(nlayersTopPlot);
+        plotter.region(3).plot(nlayersBottomPlot);
+
+        plotter2.region(0).plot(avgLayersTopPlot);
+        plotter2.region(1).plot(avgLayersBottomPlot);
+
+        plotter.show();
+        plotter2.show();
+    }
+
+    
+    public void setOutputPlots(String output) {
+        this.outputPlots = output;
+    }
+    
+    public void process(EventHeader event) {
+        if (event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) {
+            List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
+            int totalTopHit = 0;
+            int totalBotHit = 0;
+
+            int nlayersTopHit = 0;
+            int nlayersBotHit = 0;
+            int[] layersTop = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+            int[] layersBot = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+            for (RawTrackerHit hit : rawHits) {
+                int layerNumber = hit.getLayerNumber();
+                boolean isTop = isHitOnTop(hit);
+                if (isTop) {
+                    totalTopHit++;
+                    layersTop[layerNumber - 1]++;
+                } else {
+                    totalBotHit++;
+                    layersBot[layerNumber - 1]++;
+                }
+
+            }
+
+            System.out.println(totalTopHit);
+            aida.histogram1D("Total Number of Raw Hits in Top Half").fill(totalTopHit);
+            aida.histogram1D("Total Number of Raw Hits in Bottom Half").fill(totalBotHit);
+
+            for (int i = 0; i < 10; i++) {
+                if (layersTop[i] > 0)
+                    nlayersTopHit++;
+                if (layersBot[i] > 0)
+                    nlayersBotHit++;
+                aida.profile1D("Number of Hits per layer in Top Half").fill(i + 1, layersTop[i]);
+                aida.profile1D("Number of Hits per layer in Bottom Half").fill(i + 1, layersBot[i]);
+            }
+
+            aida.histogram1D("Number of Layers Hit in Top Half").fill(nlayersTopHit);
+            aida.histogram1D("Number of Layers Hit in Bottom Half").fill(nlayersBotHit);
+        } else {
+            aida.histogram1D("Total Number of Raw Hits in Top Half").fill(0);
+            aida.histogram1D("Total Number of Raw Hits in Bottom Half").fill(0);
+            for (int i = 0; i < 10; i++) {
+
+                aida.profile1D("Number of Hits per layer in Top Half").fill(i + 1, 0);
+                aida.profile1D("Number of Hits per layer in Bottom Half").fill(i + 1, 0);
+            }
+            aida.histogram1D("Number of Layers Hit in Top Half").fill(0);
+            aida.histogram1D("Number of Layers Hit in Bottom Half").fill(0);
+        }
+
+
+    }
+
+    public void endOfData() {
+        if (plotter != null) {
+            plotter.hide();
+        }
+        if (plotter2 != null) {
+            plotter2.hide();
+        }
+
+     if (outputPlots != null)
+            try {
+                aida.saveAs(outputPlots);
+            } catch (IOException ex) {
+                Logger.getLogger(TrackingReconstructionPlots.class.getName()).log(Level.SEVERE, null, ex);
+            }
+    }
+
+    private boolean isHitOnTop(RawTrackerHit hit) {
+        SiSensor sensor = (SiSensor) hit.getDetectorElement();
+        IIdentifier id = hit.getIdentifier();
+        SiTrackerIdentifierHelper _sid_helper = (SiTrackerIdentifierHelper) sensor.getIdentifierHelper();
+
+        ChargeCarrier carrier = ChargeCarrier.getCarrier(_sid_helper.getSideValue(id));
+        SiSensorElectrodes electrodes = ((SiSensor) hit.getDetectorElement()).getReadoutElectrodes(carrier);
+        if(!SvtUtils.getInstance().isTopLayer(sensor))
+            return false;
+        return true;
+    }
+
+    @Override
+    public void reset() {
+        aida.histogram1D("Total Number of Raw Hits in Top Half").reset();
+        aida.histogram1D("Total Number of Raw Hits in Bottom Half").reset();
+        aida.histogram1D("Number of Layers Hit in Top Half").reset();
+        aida.profile1D("Number of Hits per layer in Top Half").reset();
+        aida.histogram1D("Number of Layers Hit in Bottom Half").reset();
+        aida.profile1D("Number of Hits per layer in Top Half").reset();
+        aida.profile1D("Number of Hits per layer in Bottom Half").reset();
+    }
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTHitPulsePlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitPulsePlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitPulsePlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,200 @@
+package org.hps.monitoring.drivers.svt;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+import hep.aida.IProfile;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
+import org.hps.util.Resettable;
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierHelper;
+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.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author mgraham
+ */
+public class SVTHitPulsePlots extends Driver implements Resettable {
+
+	//private AIDAFrame plotterFrame;
+    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 IPlotter plotter3;
+    private IPlotter plotter2;
+    private List<SiSensor> sensors;
+    private Map<String, Integer> sensorRegionMap;
+    private String outputPlots = null;
+
+    protected void detectorChanged(Detector detector) {
+    	//plotterFrame = new AIDAFrame();
+        //plotterFrame.setTitle("HPS SVT Pulse Plots");
+
+        aida.tree().cd("/");
+
+
+        sensors = detector.getSubdetector(trackerName).getDetectorElement().findDescendants(SiSensor.class);
+
+
+        // Map a map of sensors to their region numbers in the plotter.
+        sensorRegionMap = new HashMap<String, Integer>();
+        for (SiSensor sensor : sensors) {
+            int region = computePlotterRegion(sensor);
+            sensorRegionMap.put(sensor.getName(), region);
+        }
+
+        IAnalysisFactory fac = aida.analysisFactory();
+
+
+        plotter3 = fac.createPlotterFactory("SVT Pulse Plots").create("HPS SVT Pulse Plots:  Raw Hits");
+        plotter3.setTitle("HPS SVT Pulse Plots:  Raw Hits");
+        //plotterFrame.addPlotter(plotter3);
+        plotters.add(plotter3);
+        IPlotterStyle style3 = plotter3.style();
+        style3.statisticsBoxStyle().setVisible(false);
+//        style3.statisticsBoxStyle().setVisibileStatistics(trackerName);
+        style3.dataStyle().fillStyle().setColor("black");
+        style3.dataStyle().errorBarStyle().setVisible(true);
+        plotter3.createRegions(5, 4);
+
+        plotter2 = fac.createPlotterFactory("SVT Pulse Plots").create("HPS SVT Hit vs Channel");
+        plotter2.setTitle("HPS SVT Hit vs Channel");
+        plotter2.style().setParameter("hist2DStyle", "colorMap");
+        plotter2.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter2.style().zAxisStyle().setParameter("scale", "log");
+        //plotterFrame.addPlotter(plotter2);
+        plotters.add(plotter2);
+        IPlotterStyle style2 = plotter2.style();
+        style2.statisticsBoxStyle().setVisible(false);
+        style3.statisticsBoxStyle().setVisibileStatistics("Entries");
+        style2.dataStyle().fillStyle().setColor("black");
+        style2.dataStyle().errorBarStyle().setVisible(false);
+        style3.dataStyle().errorBarStyle().setVisible(false);
+        style2.dataStyle().markerStyle().setColor("blue");
+        plotter2.createRegions(5, 4);
+        for (SiSensor sensor : sensors) {
+            IHistogram2D adcVsChanPlot = aida.histogram2D(sensor.getName() + "_AdcVsChan", 100, -100, 2000, 640, 0, 639);
+            IProfile pulsePlot = aida.profile1D(sensor.getName() + "_pulse", 6, 0, 24 * 6.0);
+            int region = sensorRegionMap.get(sensor.getName());
+
+            plotter3.region(region).plot(pulsePlot);
+            plotter2.region(region).plot(adcVsChanPlot);
+        }
+        //plotterFrame.pack();
+        //plotterFrame.setVisible(true);
+    }
+
+    public SVTHitPulsePlots() {
+    }
+
+    public void setOutputPlots(String output) {
+        this.outputPlots = output;
+    }
+
+    public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) {
+        this.rawTrackerHitCollectionName = rawTrackerHitCollectionName;
+    }
+
+    public void process(EventHeader event) {
+        if (event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) {
+            ++eventCount;
+            List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
+            for (RawTrackerHit hrth : rawHits) {
+                fillPlots(hrth);
+            }
+        }
+    }
+
+    private void fillPlots(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);
+        double noise = HPSSVTCalibrationConstants.getNoise(sensor, strip);
+        for (int i = 0; i < 6; i++) {
+            double pedSub = (adcVal[i] - ped);
+            aida.histogram2D(sensorName + "_AdcVsChan").fill(pedSub, strip);
+            //only plot hits above threshold...
+//            if (pedSub / noise > 3 && hasAdjacentHit(hit) && noise < 70)
+            if (hasAdjacentHit(hit) && noise < 100) {
+                aida.profile1D(sensorName + "_pulse").fill(24.0 * i, pedSub);
+            }
+        }
+    }
+
+    public void endOfData() {
+        if (outputPlots != null) {
+            try {
+                aida.saveAs(outputPlots);
+            } catch (IOException ex) {
+                Logger.getLogger(TrackingReconstructionPlots.class.getName()).log(Level.SEVERE, null, ex);
+            }
+        }
+        //plotterFrame.dispose();
+    }
+
+    private boolean hasAdjacentHit(RawTrackerHit hit) {
+
+        List<RawTrackerHit> hitsOnSensor = ((SiSensor) hit.getDetectorElement()).getReadout().getHits(RawTrackerHit.class);
+        int strip = hit.getIdentifierFieldValue("strip");
+
+        for (RawTrackerHit sensorHit : hitsOnSensor) {
+            int thisStrip = sensorHit.getIdentifierFieldValue("strip");
+//            System.out.println("hit strip = "+strip+"; other strips = "+thisStrip);
+            if (Math.abs(thisStrip - strip) == 1) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    @Override
+    public void reset() {
+        int ns = sensors.size();
+        for (int i = 0; i < ns; i++) {
+            aida.histogram2D(sensors.get(i).getName() + "_AdcVsChan").reset();
+            aida.profile1D(sensors.get(i).getName() + "_pulse").reset();
+        }
+    }
+    
+    private int computePlotterRegion(SiSensor sensor) {
+
+        IIdentifierHelper helper = sensor.getIdentifierHelper();
+        IIdentifier id = sensor.getIdentifier();
+
+        int layer = helper.getValue(id, "layer"); // 1-10; axial layers are odd layers; stereo layers are even
+        int module = helper.getValue(id, "module"); // 0-1; module number is top or bottom
+
+        // Compute the sensor's x and y grid coordinates and then translate to region number.
+        int ix = (layer - 1) / 2;
+        int iy = 0;
+        if (module > 0) {
+            iy += 2;
+        }
+        if (layer % 2 == 0) {
+            iy += 1;
+        }
+        int region = ix * 4 + iy;
+        //System.out.println(sensor.getName() + "; lyr=" + layer + "; mod=" + module + " -> xy[" + ix + "][" + iy + "] -> reg="+region);
+        return region;
+    }
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTHitRecoCorrelations.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitRecoCorrelations.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitRecoCorrelations.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,561 @@
+package org.hps.monitoring.drivers.svt;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+import hep.aida.ref.plotter.PlotterRegion;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.hps.util.Resettable;
+import org.lcsim.detector.identifier.IExpandedIdentifier;
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierDictionary;
+import org.lcsim.detector.identifier.IIdentifierHelper;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.detector.tracker.silicon.SiTrackerIdentifierHelper;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author mgraham
+ */
+public class SVTHitRecoCorrelations extends Driver implements Resettable {
+
+	//private List<AIDAFrame> plotterFrame = new ArrayList<AIDAFrame>();
+    private List<IPlotter> plotters = new ArrayList<IPlotter>();
+    private AIDA aida = AIDA.defaultInstance();                  
+    private String rawTrackerHitCollectionName = "SVTRawTrackerHits";
+    private String fittedTrackerHitCollectionName = "SVTFittedRawTrackerHits";
+    private String trackerHitCollectionName = "StripClusterer_SiTrackerHitStrip1D";
+    private String hthOutputCollectionName = "HelicalTrackHits";
+    private String trackerName = "Tracker";
+    private int eventCount;
+    private List<SiSensor> sensors;
+    ArrayList< ArrayList<IPlotter> > plotter = new ArrayList< ArrayList<IPlotter> >();
+    private Map<String, Integer> sensorRegionMap;
+    private String outputPlots = null;
+    String types[] = {"RawStrips","ClusterY","ClusterX"};
+    String side[] = {"top","bottom"};
+    
+    boolean doStrips = true;
+    
+    
+    protected void detectorChanged(Detector detector) {
+        //plotterFrame.add(new AIDAFrame());
+        //plotterFrame.get(0).setTitle("HPS Top SVT Hit Reconstruction Correlation Plots");
+        //plotterFrame.add(new AIDAFrame());
+        //plotterFrame.get(1).setTitle("HPS Bottom SVT Hit Reconstruction Correlation Plots");
+        
+        aida.tree().cd("/");
+
+
+        sensors = detector.getSubdetector(trackerName).getDetectorElement().findDescendants(SiSensor.class);
+
+        // Map a map of sensors to their region numbers in the plotter.
+//        sensorRegionMap = new HashMap<String, Integer>();
+//        for (SiSensor sensor : sensors) {
+//            int region = computePlotterRegion(sensor);
+//            sensorRegionMap.put(sensor.getName(), region);
+//        }
+        IAnalysisFactory fac = aida.analysisFactory();
+        
+        for(int i=0;i<2;++i) {
+            plotter.add(new ArrayList<IPlotter>());
+            for(int t=0;t<3;++t) {
+                IPlotter bcorr = fac.createPlotterFactory().create("compact_" + types[t] + " " + side[i] + " hits");
+                bcorr.setTitle("Cmpt "+ side[i] + " hits " + types[t]);
+                bcorr.createRegion();
+                plotter.get(i).add(bcorr);
+                //plotterFrame.get(i).addPlotter(bcorr);
+                plotters.add(bcorr);
+
+
+                IPlotterStyle style = bcorr.style();
+                style.setParameter("hist2DStyle", "colorMap");
+                style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+                style.statisticsBoxStyle().setVisible(false);
+                //style.dataStyle().fillStyle().setColor("yellow");
+                //style.dataStyle().errorBarStyle().setVisible(false);
+                IHistogram2D corPlot;
+                //if(t==t) {
+                        corPlot = aida.histogram2D("Cmpt_" + side[i] + "_" + types[t], 50*10, 0,10, 50*10, 0,10);
+                //}
+                
+                
+                plotter.get(i).get(t).region(0).plot(corPlot);
+                
+                
+                
+                ((PlotterRegion) plotter.get(i).get(t).region(0)).getPlot().setAllowUserInteraction(true);
+                ((PlotterRegion) plotter.get(i).get(t).region(0)).getPlot().setAllowPopupMenus(true);
+                
+            }
+        }
+
+        /*
+        for (int i=0;i<2;++i) {
+            plotter.add(new ArrayList<IPlotter>());
+            
+            for (int t=0;t<8;++t) {
+                IPlotter tmp = fac.createPlotterFactory().create(types[t] + " " + side[i] + " hits");
+                tmp.setTitle(side[i] + " hits " + types[t]);
+                if(i==2) tmp.createRegion();
+                else tmp.createRegions(5, 5);
+                plotter.get(i).add(tmp);
+                plotterFrame.get(i).addPlotter(tmp);
+                plotters.add(tmp);
+                
+                
+                IPlotterStyle style = tmp.style();
+                style.setParameter("hist2DStyle", "colorMap");
+                style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+                style.statisticsBoxStyle().setVisible(false);
+                //style.dataStyle().fillStyle().setColor("yellow");
+                //style.dataStyle().errorBarStyle().setVisible(false);
+                
+                IHistogram2D corPlot = aida.histogram2D("Cmpt_" + side[i] + "_" + types[t], 100*10, 0,10, 100*10, 0,10);
+                plotter.get(i).get(t).region(0).plot(corPlot);
+                
+            }
+        }
+        
+        
+     
+        
+        for (SiSensor ref_sensor : sensors) {
+            int ref_l = getLayer(ref_sensor);
+            int ref_s = getSide(ref_sensor);
+            boolean ref_a = isAxial(ref_sensor);
+            //ref_l = getPhysLayer(ref_l,ref_s,ref_a);
+            
+            System.out.println("Sensor " + ref_sensor.getName() + " -> ref_s " + ref_s + " layer " + getLayer(ref_sensor) + " phys layer " + ref_l + " axial " + ref_a);
+            //if (!ref_a) continue;
+            //if (ref_s == 1 ) continue; //only top for now
+
+            if(ref_l>3) continue;
+            
+            for (SiSensor sensor : sensors) {
+                int l = getLayer(sensor);
+                int s = getSide(sensor);
+                boolean a = isAxial(sensor);
+                
+                //l = getPhysLayer(l,s,a);
+
+                if(l>3) continue;
+                
+                
+                //correlation with same side and axial/stereo
+                
+                //if ( ref_a == a && ref_s == s ) {
+                if ( ref_s == s ) {
+                    int region = (ref_l-1) + (l-1)*5;
+                    //int region = (ref_l-1) + (l-1)*5;
+                    System.out.println("region " + region);
+                    double ymin,ymax;
+                    if(s==0) {
+                        ymin=0;
+                        ymax=60;
+                    }else {
+                        ymin=-60;
+                        ymax=0;
+                    }
+                    if( a ) {
+                        if(1==1) { 
+                            IHistogram2D corPlot = aida.histogram2D(side[s] + "_" + types[0] + "_layer" + ref_l + "_layer" + l, 50, ymin,ymax, 50, ymin,ymax);
+                            plotter.get(s).get(0).region(region).plot(corPlot);
+                        }
+                        if(doStrips) {
+                            //IHistogram2D corPlot1 = aida.histogram2D(side[s] + "_" + types[4] + "_layer" + ref_l + "_layer" + l, 642, 0,641, 642, 0,641);
+                            IHistogram2D corPlot1 = aida.histogram2D(side[s] + "_" + types[4] + "_layer" + ref_l + "_layer" + l, 100, 0,641, 100, 0,641);
+                            plotter.get(s).get(4).region(region).plot(corPlot1);
+                            IHistogram2D corPlot2 = aida.histogram2D(side[s] + "_" + types[6] + "_layer" + ref_l + "_layer" + l, 100, 0,641, 100, 0,641);
+                            plotter.get(s).get(6).region(region).plot(corPlot2);
+                        }
+                    } else {
+                        if(1==1) {
+                            IHistogram2D corPlot = aida.histogram2D(side[s] + "_" + types[1] + "_layer" + ref_l + "_layer" + l, 50, ymin, ymax, 50, ymin, ymax);
+                            plotter.get(s).get(1).region(region).plot(corPlot);
+                        }
+                        if(doStrips) {
+                            //IHistogram2D corPlot1 = aida.histogram2D(side[s] + "_" + types[5] + "_layer" + ref_l + "_layer" + l, 642, 0,641, 642, 0,641);
+                            IHistogram2D corPlot1 = aida.histogram2D(side[s] + "_" + types[5] + "_layer" + ref_l + "_layer" + l, 100, 0,641, 100, 0,641);
+                            plotter.get(s).get(5).region(region).plot(corPlot1);
+                            IHistogram2D corPlot2 = aida.histogram2D(side[s] + "_" + types[7] + "_layer" + ref_l + "_layer" + l, 100, 0,641, 100, 0,641);
+                            plotter.get(s).get(7).region(region).plot(corPlot2);
+                        
+                        }
+                    }
+
+                }
+               
+            }
+        }
+        
+        for (int i=1;i<6;++i) {
+            for (int ii=1;ii<6;++ii) {
+                for (int s=0;s<2;++s) {
+                    System.out.println(" i " + i + " ii " + ii + " s " + side[s]);
+                    double ymin,ymax;
+                    if(s==0) {
+                        ymin=0;
+                        ymax=60;
+                    }else {
+                        ymin=-60;
+                        ymax=0;
+                    }
+                    IHistogram2D corPlot = aida.histogram2D(side[s] + "_Y_HTH_layer" + i + "_layer" + ii, 50,ymin, ymax, 50, ymin, ymax);
+                    IHistogram2D corPlot1 = aida.histogram2D(side[s] + "_X_HTH_layer" + i + "_layer" + ii, 60, ymin, ymax, 60, ymin,ymax);
+                    int region = (i-1) + (ii-1)*5;
+                    plotter.get(s).get(2).region(region).plot(corPlot);
+                    plotter.get(s).get(3).region(region).plot(corPlot1);
+                }
+            }
+        }
+        */
+        
+        //for(int i=0;i<2;++i) {
+       	//plotterFrame.get(i).pack();
+        //    plotterFrame.get(i).setVisible(true);
+        //}
+    }
+
+    public SVTHitRecoCorrelations() {
+    }
+
+    public void setOutputPlots(String output) {
+        this.outputPlots = output;
+    }
+
+    public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) {
+        this.rawTrackerHitCollectionName = rawTrackerHitCollectionName;
+    }
+
+    public void setFittedTrackerHitCollectionName(String fittedTrackerHitCollectionName) {
+        this.fittedTrackerHitCollectionName = fittedTrackerHitCollectionName;
+    }
+
+    public void setTrackerHitCollectionName(String trackerHitCollectionName) {
+        this.trackerHitCollectionName = trackerHitCollectionName;
+    }
+
+    public void process(EventHeader event) {
+        
+    
+        ++eventCount;
+
+        if (event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) {
+            List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
+        
+            System.out.println("The RawTrackerHit collection " + rawTrackerHitCollectionName + " has " + rawHits.size() + " hits.");
+        
+            for (RawTrackerHit ref_hit : rawHits) {
+                
+                IIdentifierHelper ref_helper = ref_hit.getDetectorIdentifierHelper();
+                IIdentifier ref_id = ref_hit.getIdentifier();
+                int ref_l = ref_helper.getValue(ref_id, "layer"); // 1-10; axial layers are odd layers; stereo layers are even
+                int ref_s = ref_helper.getValue(ref_id, "module"); // 0-1; module number is top or bottom
+                boolean ref_a = isAxial(ref_s,ref_l);
+                //ref_l = getPhysLayer(ref_l,ref_s,ref_a);
+
+                ///if(ref_l>3) continue;
+        
+                for (RawTrackerHit hit : rawHits) {
+                       
+                    IIdentifierHelper helper = hit.getDetectorIdentifierHelper();
+                
+                    IIdentifier id = hit.getIdentifier();
+                    int l = helper.getValue(id, "layer"); // 1-10; axial layers are odd layers; stereo layers are even
+                    int s = helper.getValue(id, "module"); // 0-1; module number is top or bottom
+                    boolean a = isAxial(s,l);
+                    //l = getPhysLayer(l,s,a);
+
+                    //if(l>3) continue;
+
+                    //if (ref_a==a && ref_s==s) {
+                    if (ref_s==s) {
+                        IExpandedIdentifier ref_eid = ref_helper.unpack(ref_id);
+                        IIdentifierDictionary ref_dict = ref_helper.getIdentifierDictionary();
+                        int ref_strip = ref_eid.getValue(ref_dict.getFieldIndex("strip"));
+                        IExpandedIdentifier eid = helper.unpack(id);
+                        IIdentifierDictionary dict = helper.getIdentifierDictionary();
+                        int strip = eid.getValue(dict.getFieldIndex("strip"));
+                        
+                        
+                        double c_strip = ((double)strip)/640.0 + (l-1);
+                        double c_ref_strip = ((double)ref_strip)/640.0 + (ref_l-1);
+                        
+                        aida.histogram2D("Cmpt_" + side[s] + "_" + types[0]).fill(c_ref_strip,c_strip);
+                        
+            
+
+                        
+                        
+                        
+                        
+                        
+                        // Fill in the side and strip numbers.
+                        //ref_eid.setValue(dict.getFieldIndex("side"), sideNumber);
+                        //ref_eid.setValue(dict.getFieldIndex("strip"), stripNumber);
+
+                        //int clusterSize = cluster.getRawHits().size();
+                        //Move this to strip nr?
+                        //System.out.println("side " + side[s]);
+//                        if( a) {
+//                            if(doStrips) aida.histogram2D(side[s] + "_" + types[6] + "_layer" + ref_l + "_layer" + l).fill(ref_strip,strip);
+//                        } else {
+//                            if(doStrips) aida.histogram2D(side[s] + "_" + types[7] + "_layer" + ref_l + "_layer" + l).fill(ref_strip,strip);
+//
+//                        }
+                    }
+                }
+            }
+        }
+        else {
+        
+            System.out.println("No " + rawTrackerHitCollectionName + " was found in this event.");
+        }
+        
+        
+        
+        
+        
+        
+        
+        if (event.hasCollection(SiTrackerHitStrip1D.class, trackerHitCollectionName)) {
+            List<SiTrackerHitStrip1D> stripHits = event.get(SiTrackerHitStrip1D.class, trackerHitCollectionName);
+        
+            System.out.println("The SiTrackerHitStrip1D collection " + trackerHitCollectionName + " has " + stripHits.size() + " hits.");
+        
+            for (SiTrackerHitStrip1D ref_cluster : stripHits) {
+                SiSensor ref_sensor = ref_cluster.getSensor();
+                
+                boolean ref_a = isAxial(ref_sensor);
+                int ref_s = getSide(ref_sensor);
+                int ref_l = getLayer(ref_sensor);
+                //ref_l = getPhysLayer(ref_l,ref_s,ref_a);
+                
+                SiTrackerIdentifierHelper ref_helper = ref_cluster.getIdentifierHelper();
+                IIdentifier ref_id = ref_cluster.getRawHits().get(0).getIdentifier();                    
+                int ref_strip = ref_helper.getElectrodeValue(ref_id);
+
+                
+
+                for (SiTrackerHitStrip1D cluster : stripHits) {
+                    SiSensor sensor = cluster.getSensor();
+                    boolean a = isAxial(sensor);
+                    int s = getSide(sensor);
+
+                    if (ref_s==s) {
+                    //if (ref_a==a && ref_s==s) {
+
+                        int l = getLayer(sensor);
+                        //l = getPhysLayer(l,s,a);
+                        SiTrackerIdentifierHelper helper = cluster.getIdentifierHelper();
+                        IIdentifier id = cluster.getRawHits().get(0).getIdentifier();                    
+                        int strip = helper.getElectrodeValue(id);
+                                //.hps_hit.getRawTrackerHit().getIdentifier();
+
+                        //Remember measurement direction is tracking z
+                        double p  = cluster.getPosition()[0]/10.0 + (l-1);
+                        double ref_p  = ref_cluster.getPosition()[0]/10.0 + (ref_l-1);
+                        //System.out.println("Y " + cluster.getPosition()[0]);
+                        aida.histogram2D("Cmpt_" + side[s] + "_" + types[1]).fill(ref_p,p);
+
+                        //Remember non-measurement direction is tracking y
+                        p  = (cluster.getPosition()[1]+50.0)/100.0 + (l-1);
+                        ref_p  = (ref_cluster.getPosition()[1]+50.0)/100.0 + (ref_l-1);
+                        //System.out.println("X " + cluster.getPosition()[1]);
+                        aida.histogram2D("Cmpt_" + side[s] + "_" + types[2]).fill(ref_p,p);
+//                        
+//                        
+//                        
+//                        //int clusterSize = cluster.getRawHits().size();
+//                        //Move this to strip nr?
+//                        //System.out.println("side " + side[s]);
+//                        if( a) {
+//                            if(1==1) aida.histogram2D(side[s] + "_" + types[0] + "_layer" + ref_l + "_layer" + l).fill(ref_cluster.getPosition()[1],cluster.getPosition()[1]);
+//                            if(doStrips) aida.histogram2D(side[s] + "_" + types[4] + "_layer" + ref_l + "_layer" + l).fill(ref_strip,strip);
+//                        } else {
+//                            if(1==1) aida.histogram2D(side[s] + "_" + types[1] + "_layer" + ref_l + "_layer" + l).fill(ref_cluster.getPosition()[1],cluster.getPosition()[1]);
+//                            if(doStrips) aida.histogram2D(side[s] + "_" + types[5] + "_layer" + ref_l + "_layer" + l).fill(ref_strip,strip);
+//
+//                        }
+                    }
+                }
+            }
+        }
+        else {
+        
+            System.out.println("No " + trackerHitCollectionName + " was found in this event.");
+        }
+        
+        
+        
+        /*
+        if (event.hasCollection(TrackerHit.class, hthOutputCollectionName)) {
+        
+            List<TrackerHit> hth = event.get(TrackerHit.class, hthOutputCollectionName);
+            System.out.println("The HelicalTrackHit collection " + hthOutputCollectionName + " has " + hth.size() + " hits.");
+        
+            for (TrackerHit h_ref : hth) {
+                HelicalTrackHit hit_ref = (HelicalTrackHit)h_ref;
+                int layer_ref = hit_ref.Layer();
+                //HTH hits uses the axial layer nr i.e. odd numbers 1-10
+                layer_ref = (layer_ref+1)/2;
+                //How do I find the top or bottom side?
+                int ref_s = 0;
+                if (hit_ref.getPosition()[1] < 0 ) ref_s = 1;
+                
+                
+                
+                
+                //if (ref_s ==0) continue;
+
+                for (TrackerHit h : hth) {
+                    HelicalTrackHit hit = (HelicalTrackHit)h; 
+                    
+                    int layer = hit.Layer();
+                    layer = (layer+1)/2;
+                    String name = hit.Detector();
+                    int s = 0;
+                    if (hit.getPosition()[1] < 0 ) s = 1;
+                    //System.out.println("Hit name " + name + " layer " + layer + "  x,y , z" + hit.getPosition()[0] + "," + hit.getPosition()[1] + "," + hit.getPosition()[2] );
+                    //System.out.println("Hit name " + name + " layer " + layer_ref + "  x,y , z" + hit_ref.getPosition()[0] + "," + hit_ref.getPosition()[1] + "," + hit_ref.getPosition()[2] );
+                    
+                    if ( s == ref_s) {               
+                        aida.histogram2D(side[s] + "_Y_HTH_layer" + layer_ref + "_layer" + layer).fill(hit_ref.getPosition()[1],hit.getPosition()[1]);
+                        aida.histogram2D(side[s] + "_X_HTH_layer" + layer_ref + "_layer" + layer).fill(hit_ref.getPosition()[0],hit.getPosition()[0]);
+                    }
+                }
+                
+            }
+         
+        } else {
+        
+            System.out.println("No " + hthOutputCollectionName + " was found in this event.");
+        }
+        
+        */
+        
+        
+
+    }
+
+    public void endOfData() {
+        if (outputPlots != null)
+            try {
+                aida.saveAs(outputPlots);
+            } catch (IOException ex) {
+                Logger.getLogger(SVTHitRecoCorrelations.class.getName()).log(Level.SEVERE, null, ex);
+            }
+        //for(int i=0;i<2;++i) {
+        //    plotterFrame.get(i).dispose();
+        //}
+    }   
+
+    @Override
+    public void reset() {
+        int ns = sensors.size();
+        for (int i = 0; i < 5; i++) {
+            for (int ii = 0; ii < 5; ii++) {
+                aida.histogram2D("corr_TA_layer" + (i+1) + "_layer" + (ii+1)).reset();
+                aida.histogram2D("corr_TS_layer" + (i+1) + "_layer" + (ii+1)).reset();
+                aida.histogram2D("corrY_HTH_layer" + (i+1) + "_layer" + (ii+1)).reset();
+                aida.histogram2D("corrX_HTH_layer" + (i+1) + "_layer" + (ii+1)).reset();
+            }
+        }
+         
+    }
+
+    
+    private int getPhysLayer(int l,int side, boolean axial) {
+        if(side==0) {
+            //top: odd are axial        
+            if(axial) {
+                l = (l+1)/2;
+            } else {
+                l = l/2;
+            }
+        } else {
+            //bottom
+            if(axial) {
+                l = l/2;
+            } else {
+                l = (l+1)/2;
+            }
+        }
+        return l;
+    }
+
+    private int[] getSideAndLayer(SiSensor sensor) {
+        
+        IIdentifierHelper helper = sensor.getIdentifierHelper();
+        IIdentifier id = sensor.getIdentifier();
+        int layer = helper.getValue(id, "layer"); // 1-10; axial layers are odd layers; stereo layers are even
+        int module = helper.getValue(id, "module"); // 0-1; module number is top or bottom
+        int v[] = {module,layer};
+        return v;
+    
+
+    }
+
+     private int getSide(SiSensor sensor) {
+         int v[] = getSideAndLayer(sensor);
+         return v[0];
+         
+    }
+
+    private int getLayer(SiSensor sensor) {
+         int v[] = getSideAndLayer(sensor);
+         return v[1];
+         
+    }
+
+    private boolean isAxial(SiSensor sensor) {
+         int v[] = getSideAndLayer(sensor);
+         int layer = v[1];
+         if (v[0]==0) {
+             //top
+             if ( layer % 2 == 0 ) {
+                 return false;
+             }
+         } else {
+             //bottom
+             if ( layer % 2 != 0 ) {
+                 return false;
+             }
+         }
+         return true;
+    }
+    
+     private boolean isAxial(int ref_s,int ref_l) {
+        boolean ref_a=true;
+        if (ref_s==0) {
+             //top
+            if ( ref_l % 2 == 0 ) {
+                 ref_a = false;
+            }
+        } else {
+            //bottom
+            if ( ref_l % 2 != 0 ) {
+                ref_a = false;
+            }
+        }
+        return ref_a;
+            
+    
+     }
+    
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTHitReconstructionPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitReconstructionPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitReconstructionPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,306 @@
+package org.hps.monitoring.drivers.svt;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+import hep.aida.IProfile1D;
+import hep.aida.ref.plotter.PlotterRegion;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.hps.conditions.deprecated.SvtUtils;
+import org.hps.recon.tracking.HPSFittedRawTrackerHit;
+import org.hps.util.Resettable;
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierHelper;
+import org.lcsim.detector.tracker.silicon.DopedSilicon;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.detector.tracker.silicon.SiTrackerIdentifierHelper;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author mgraham
+ * @version $Id: SVTHitReconstructionPlots.java,v 1.14 2012/05/18 07:41:49 meeg
+ * Exp $
+ */
+public class SVTHitReconstructionPlots extends Driver implements Resettable {
+
+	//private AIDAFrame plotterFrame;
+    private AIDA aida = AIDA.defaultInstance();
+    private String fittedTrackerHitCollectionName = "SVTFittedRawTrackerHits";
+    private String trackerHitCollectionName = "StripClusterer_SiTrackerHitStrip1D";
+    private String trackerName = "Tracker";
+    private int eventCount;
+    private List<SiSensor> sensors;
+    IPlotter plotter1;
+    IPlotter plotter2;
+    IPlotter plotter3;
+    IPlotter plotter4;
+    IPlotter plotter5;
+    IPlotter plotter6;
+    IHistogram1D nrawPlot[][] = new IHistogram1D[2][10];
+    IHistogram1D nrecoPlot[][] = new IHistogram1D[2][10];
+    IHistogram1D nclustPlot[][] = new IHistogram1D[2][10];
+    IHistogram1D clusterSizePlot[][] = new IHistogram1D[2][10];
+    IHistogram1D clusterAmpPlot[][] = new IHistogram1D[2][10];
+    IHistogram2D clposVsStrip[][] = new IHistogram2D[2][10];
+    private Map<String, Integer> sensorRegionMap;
+    private String outputPlots = null;
+
+    protected void detectorChanged(Detector detector) {
+        //plotterFrame = new AIDAFrame();
+        //plotterFrame.setTitle("HPS SVT Hit Reconstruction Plots");
+
+        aida.tree().cd("/");
+
+
+        sensors = detector.getSubdetector(trackerName).getDetectorElement().findDescendants(SiSensor.class);
+
+        // Map a map of sensors to their region numbers in the plotter.
+        sensorRegionMap = new HashMap<String, Integer>();
+        for (SiSensor sensor : sensors) {
+            int region = computePlotterRegion(sensor);
+            sensorRegionMap.put(sensor.getName(), region);
+        }
+
+        IAnalysisFactory fac = aida.analysisFactory();
+
+        plotter1 = fac.createPlotterFactory().create("HPS SVT Raw Hit Plots");
+        plotter1.setTitle("Raw Hits");
+        //plotterFrame.addPlotter(plotter1);
+        IPlotterStyle style3 = plotter1.style();
+        style3.dataStyle().fillStyle().setColor("yellow");
+        style3.dataStyle().errorBarStyle().setVisible(false);
+        plotter1.createRegions(5, 4);
+
+        plotter3 = fac.createPlotterFactory().create("HPS SVT Reco Hit Plots");
+        plotter3.setTitle("Reco Hits");
+        //plotterFrame.addPlotter(plotter3);
+        IPlotterStyle style4 = plotter3.style();
+        style4.dataStyle().fillStyle().setColor("yellow");
+        style4.dataStyle().errorBarStyle().setVisible(false);
+        plotter3.createRegions(5, 4);
+
+
+        plotter2 = fac.createPlotterFactory().create("HPS SVT Cluster Hit Plots");
+        plotter2.setTitle("Clusters");
+        //plotterFrame.addPlotter(plotter2);
+        IPlotterStyle style44 = plotter2.style();
+        style44.dataStyle().fillStyle().setColor("yellow");
+        style44.dataStyle().errorBarStyle().setVisible(false);
+        plotter2.createRegions(5, 4);
+
+        plotter4 = fac.createPlotterFactory().create("HPS SVT Cluster Size Plots");
+        plotter4.setTitle("Cluster Size");
+        //plotterFrame.addPlotter(plotter4);
+        IPlotterStyle style6 = plotter4.style();
+        style6.dataStyle().fillStyle().setColor("green");
+        style6.dataStyle().errorBarStyle().setVisible(false);
+        plotter4.createRegions(5, 4);
+
+
+        plotter5 = fac.createPlotterFactory().create("HPS SVT Cluster Amp Plots");
+        plotter5.setTitle("Cluster Amplitude");
+        //plotterFrame.addPlotter(plotter5);
+        IPlotterStyle style7 = plotter5.style();
+        style7.dataStyle().fillStyle().setColor("green");
+        style7.dataStyle().errorBarStyle().setVisible(false);
+        plotter5.createRegions(5, 4);
+//        plotter5.createRegion();
+
+        plotter6 = fac.createPlotterFactory().create("HPS SVT Cluster Position Vs Channel");
+        plotter6.setTitle("Cluster Position (y)");
+        //plotterFrame.addPlotter(plotter6);
+        IPlotterStyle style8 = plotter6.style();
+        style8.dataStyle().fillStyle().setColor("green");
+        style8.dataStyle().errorBarStyle().setVisible(false);
+        style8.statisticsBoxStyle().setVisible(false);
+        plotter6.style().setParameter("hist2DStyle", "colorMap");
+        style8.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style8.zAxisStyle().setParameter("scale", "log");
+        plotter6.createRegions(5, 4);
+
+        for (int module = 0; module < 2; module++) {
+            for (int layer = 0; layer < 10; layer++) {
+                SiSensor sensor = SvtUtils.getInstance().getSensor(module, layer);
+                int region = computePlotterRegion(sensor);
+
+                nrawPlot[module][layer] = aida.histogram1D(sensor.getName() + "_raw_hits", 10, -0.5, 9.5);
+                nrecoPlot[module][layer] = aida.histogram1D(sensor.getName() + "_reco_hits", 10, -0.5, 9.5);
+                nclustPlot[module][layer] = aida.histogram1D(sensor.getName() + "_cluster_hits", 10, -0.5, 9.5);
+                clusterSizePlot[module][layer] = aida.histogram1D(sensor.getName() + "_cluster_size", 9, 0.5, 9.5);
+                clusterAmpPlot[module][layer] = aida.histogram1D(sensor.getName() + "_cluster_amp", 50, 0, 4000.0);
+                clposVsStrip[module][layer] = aida.histogram2D(sensor.getName() + "_cluster_vs_strip", 128, 0, 640, 100, -50, 50);
+                plotter1.region(region).plot(nrawPlot[module][layer]);
+                plotter3.region(region).plot(nrecoPlot[module][layer]);
+                plotter2.region(region).plot(nclustPlot[module][layer]);
+                plotter4.region(region).plot(clusterSizePlot[module][layer]);
+                plotter5.region(region).plot(clusterAmpPlot[module][layer]);
+                ((PlotterRegion) plotter5.region(region)).getPlot().getXAxis().setLabel("Cluster amplitude [ADC counts]");
+                plotter6.region(region).plot(clposVsStrip[module][layer]);
+            }
+        }
+
+//        plotter5.region(0).plot(aida.histogram1D("Tracker_TestRunModule_layer6_module0_sensor0" + "_cluster_amp"));
+//        ((PlotterRegion) plotter5.region(0)).getPlot().getXAxis().setLabel("Cluster amplitude [ADC counts]");
+
+        IProfile1D hitsPerLayerTop = aida.profile1D("Number of Fitted Hits per layer in Top Half", 10, 1, 11);
+        IProfile1D hitsPerLayerBot = aida.profile1D("Number of Fitted Hits per layer in Bottom Half", 10, 1, 11);
+        //plotterFrame.pack();
+        //plotterFrame.setVisible(true);
+    }
+
+    public SVTHitReconstructionPlots() {
+    }
+
+    public void setOutputPlots(String output) {
+        this.outputPlots = output;
+    }
+
+    public void setFittedTrackerHitCollectionName(String fittedTrackerHitCollectionName) {
+        this.fittedTrackerHitCollectionName = fittedTrackerHitCollectionName;
+    }
+
+    public void setTrackerHitCollectionName(String trackerHitCollectionName) {
+        this.trackerHitCollectionName = trackerHitCollectionName;
+    }
+
+    public void process(EventHeader event) {
+        if (!event.hasCollection(HPSFittedRawTrackerHit.class, fittedTrackerHitCollectionName)) {
+            System.out.println(fittedTrackerHitCollectionName + " does not exist; skipping event");
+            int ns = sensors.size();
+            for (int i = 0; i < ns; i++) {
+                int nraw = sensors.get(i).getReadout().getHits(RawTrackerHit.class).size();
+                aida.histogram1D(sensors.get(i).getName() + "_raw_hits").fill(nraw);
+                aida.histogram1D(sensors.get(i).getName() + "_reco_hits").fill(0);
+            }
+            return;
+        }
+
+        ++eventCount;
+        List<HPSFittedRawTrackerHit> fittedrawHits = event.get(HPSFittedRawTrackerHit.class, fittedTrackerHitCollectionName);
+        List<SiTrackerHitStrip1D> stripHits = event.get(SiTrackerHitStrip1D.class, trackerHitCollectionName);
+        int[] layersTop = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+        int[] layersBot = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+        for (HPSFittedRawTrackerHit hrth : fittedrawHits) {
+            SiSensor sensor = (SiSensor) hrth.getRawTrackerHit().getDetectorElement();
+            int layer = hrth.getRawTrackerHit().getLayerNumber();
+            if (!SvtUtils.getInstance().isTopLayer(sensor)) {
+                layersBot[layer - 1]++;
+            } else {
+                layersTop[layer - 1]++;
+            }
+        }
+
+        for (int i = 0; i < 10; i++) {
+            aida.profile1D("Number of Fitted Hits per layer in Top Half").fill(i + 1, layersTop[i]);
+            aida.profile1D("Number of Fitted Hits per layer in Bottom Half").fill(i + 1, layersBot[i]);
+        }
+        Map<SiSensor, Integer> clustMap = new HashMap<SiSensor, Integer>();
+        for (SiTrackerHitStrip1D cluster : stripHits) {
+            SiSensor sensor = cluster.getSensor();
+            if (clustMap.containsKey(sensor)) {
+                clustMap.put(sensor, clustMap.get(sensor) + 1);
+            } else {
+                clustMap.put(sensor, 1);
+            }
+            String sensorName = sensor.getName();
+            int clusterSize = cluster.getRawHits().size();
+            aida.histogram1D(sensorName + "_cluster_size").fill(clusterSize);
+            double cluAmp = cluster.getdEdx() / DopedSilicon.ENERGY_EHPAIR;
+            aida.histogram1D(sensorName + "_cluster_amp").fill(cluAmp);
+            double clpos = cluster.getPositionAsVector().y();
+            RawTrackerHit raw = (RawTrackerHit) cluster.getRawHits().get(0);
+            SiTrackerIdentifierHelper _sid_helper = (SiTrackerIdentifierHelper) raw.getDetectorElement().getIdentifierHelper();
+            IIdentifier id = raw.getIdentifier();
+            int stripNum = _sid_helper.getElectrodeValue(id);
+            aida.histogram2D(sensorName + "_cluster_vs_strip").fill(stripNum, clpos);
+        }
+
+
+        for (SiSensor sensor : sensors) {
+            String sensorName = sensor.getName();
+            int nraw = sensor.getReadout().getHits(RawTrackerHit.class).size();
+            int nreco = sensor.getReadout().getHits(HPSFittedRawTrackerHit.class).size();
+            aida.histogram1D(sensorName + "_raw_hits").fill(nraw);
+            aida.histogram1D(sensorName + "_reco_hits").fill(nreco);
+            if (clustMap.containsKey(sensor)) {
+                aida.histogram1D(sensorName + "_cluster_hits").fill(clustMap.get(sensor));
+            } else {
+                aida.histogram1D(sensorName + "_cluster_hits").fill(0);
+            }
+        }
+    }
+
+    public double getCluAmp(SiTrackerHitStrip1D stripHits, List<HPSFittedRawTrackerHit> hrths) {
+        stripHits.getdEdx();
+        List<RawTrackerHit> rawHits = stripHits.getRawHits();
+        double sum = 0.0;
+        for (RawTrackerHit hit : rawHits) {
+            //find the fitted hit amplitude
+            for (HPSFittedRawTrackerHit fittedHit : hrths) {
+                RawTrackerHit fh = fittedHit.getRawTrackerHit();
+                if (fh.equals(hit)) {
+                    sum += fittedHit.getAmp();
+                }
+            }
+        }
+        return sum;
+    }
+
+    public void endOfData() {
+        if (outputPlots != null) {
+            try {
+                aida.saveAs(outputPlots);
+            } catch (IOException ex) {
+                Logger.getLogger(TrackingReconstructionPlots.class.getName()).log(Level.SEVERE, null, ex);
+            }
+        }
+        //plotterFrame.dispose();
+    }
+
+    @Override
+    public void reset() {
+        for (SiSensor sensor : sensors) {
+            aida.histogram1D(sensor.getName() + "_raw_hits").reset();
+            aida.histogram1D(sensor.getName() + "_reco_hits").reset();
+            aida.histogram1D(sensor.getName() + "_cluster_size").reset();
+            aida.histogram1D(sensor.getName() + "_cluster_amp").reset();
+        }
+    }
+
+    private int computePlotterRegion(SiSensor sensor) {
+
+        IIdentifierHelper helper = sensor.getIdentifierHelper();
+        IIdentifier id = sensor.getIdentifier();
+
+        int layer = helper.getValue(id, "layer"); // 1-10; axial layers are odd layers; stereo layers are even
+        int module = helper.getValue(id, "module"); // 0-1; module number is top or bottom
+
+        // Compute the sensor's x and y grid coordinates and then translate to region number.
+        int ix = (layer - 1) / 2;
+        int iy = 0;
+        if (module > 0) {
+            iy += 2;
+        }
+        if (layer % 2 == 0) {
+            iy += 1;
+        }
+        int region = ix * 4 + iy;
+        //System.out.println(sensor.getName() + "; lyr=" + layer + "; mod=" + module + " -> xy[" + ix + "][" + iy + "] -> reg="+region);
+        return region;
+    }
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTMonitoringPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTMonitoringPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTMonitoringPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,167 @@
+package org.hps.monitoring.drivers.svt;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IProfile1D;
+
+import java.util.List;
+
+import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
+import org.hps.conditions.deprecated.SvtUtils;
+import org.hps.recon.tracking.HPSFittedRawTrackerHit;
+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.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ * This Driver makes plots of sensor occupancies across a run. It is intended to
+ * be used with the monitoring system. It will currently only run on a test run
+ * detector, as the number of sensors, and hence plotter regions, is hardcoded
+ * to 20.
+ *
+ * @author Jeremy McCormick <[log in to unmask]>
+ * @version $Id: SensorOccupancyPlotsDriver.java,v 1.12 2012/04/13 00:06:55
+ * jeremy Exp $
+ *
+ */
+public class SVTMonitoringPlots extends Driver {
+
+    private String inputCollection = "SVTRawTrackerHits";
+    private String fitCollection = "SVTFittedRawTrackerHits";
+    private AIDA aida = AIDA.defaultInstance();
+    //private AIDAFrame plotterFrame;
+    private IPlotter plotter, plotter2, plotter3;
+//    private IHistogram1D[][] plots = new IHistogram1D[2][10];
+    private IProfile1D[][] pedestalShifts = new IProfile1D[2][10];
+//    private IHistogram2D[][] pedestalShifts = new IHistogram2D[2][10];
+    private IHistogram2D[][] t0s = new IHistogram2D[2][10];
+    private IHistogram2D[][] amps = new IHistogram2D[2][10];
+
+    public SVTMonitoringPlots() {
+    }
+
+    public void setInputCollection(String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+
+    private int computePlotterRegion(int layer, int module) {
+        // Compute the sensor's x and y grid coordinates and then translate to region number.
+        int iy = (layer - 1) / 2;
+        int ix = 0;
+        if (module > 0) {
+            ix += 2;
+        }
+        if (layer % 2 == 0) {
+            ix += 1;
+        }
+        int region = ix * 5 + iy;
+        //System.out.println(sensor.getName() + "; lyr=" + layer + "; mod=" + module + " -> xy[" + ix + "][" + iy + "] -> reg="+region);
+        return region;
+    }
+
+    protected void detectorChanged(Detector detector) {
+        //plotterFrame = new AIDAFrame();
+        //plotterFrame.setTitle("HPS SVT Monitoring");
+
+        // Setup the plotter.
+        IAnalysisFactory fac = aida.analysisFactory();
+
+        plotter = fac.createPlotterFactory().create("Pedestal Shifts");
+        plotter.setTitle("Pedestal Shifts");
+        //plotterFrame.addPlotter(plotter);
+        plotter.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter.style().statisticsBoxStyle().setVisible(false);
+        plotter.style().dataStyle().fillStyle().setColor("red");
+        plotter.style().dataStyle().markerStyle().setShape("dot");
+        plotter.style().dataStyle().markerStyle().setSize(1);
+        plotter.createRegions(4, 5);
+
+        plotter2 = fac.createPlotterFactory().create("Fitted T0");
+        plotter2.setTitle("Fitted T0");
+        //plotterFrame.addPlotter(plotter2);
+        plotter2.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter2.style().statisticsBoxStyle().setVisible(false);
+        plotter2.style().setParameter("hist2DStyle", "colorMap");
+        plotter2.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter2.style().zAxisStyle().setParameter("scale", "log");
+        plotter2.style().zAxisStyle().setVisible(false);
+        plotter2.createRegions(4, 5);
+
+        plotter3 = fac.createPlotterFactory().create("Fitted Amplitude");
+        plotter3.setTitle("Fitted Amplitude");
+        //plotterFrame.addPlotter(plotter3);
+        plotter3.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter3.style().statisticsBoxStyle().setVisible(false);
+        plotter3.style().setParameter("hist2DStyle", "colorMap");
+        plotter3.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter3.style().zAxisStyle().setParameter("scale", "log");
+        plotter3.style().zAxisStyle().setVisible(false);
+        plotter3.createRegions(4, 5);
+
+        // Setup the occupancy plots.
+        aida.tree().cd("/");
+        for (int module = 0; module < 2; module++) {
+            for (int layer = 0; layer < 10; layer++) {
+                int region = computePlotterRegion(layer + 1, module);
+                SiSensor sensor = SvtUtils.getInstance().getSensor(module, layer);
+                pedestalShifts[module][layer] = aida.profile1D(sensor.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(sensor.getName() + " Fitted T0", 640, -0.5, 639.5, 100, -24, 72);
+                plotter2.region(region).plot(t0s[module][layer]);
+                amps[module][layer] = aida.histogram2D(sensor.getName() + " Fitted Amplitude", 640, -0.5, 639.5, 100, 0, 2000);
+                plotter3.region(region).plot(amps[module][layer]);
+            }
+        }
+        //plotterFrame.pack();
+        //plotterFrame.setVisible(true);
+    }
+
+    public void process(EventHeader event) {
+        if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
+
+            // Get RawTrackerHit collection from event.
+            List<RawTrackerHit> rawTrackerHits = event.get(RawTrackerHit.class, inputCollection);
+
+            // Clear histograms.
+            for (int module = 0; module < 2; module++) {
+                for (int layer = 1; layer < 11; layer++) {
+//                    plotter.region(computePlotterRegion(layer, module)).setYLimits(pedestalShifts[module][layer - 1].minBinHeight()-100, pedestalShifts[module][layer - 1].maxBinHeight()+100);
+//                    pedestalShifts[module][layer - 1].reset();
+                }
+            }
+
+            // Increment strip hit count.
+            for (RawTrackerHit hit : rawTrackerHits) {
+                int layer = hit.getIdentifierFieldValue("layer"); // 1-10; axial layers are odd layers; stereo layers are even
+                int module = hit.getIdentifierFieldValue("module"); // 0-1; module number is top or bottom
+                double pedestal = HPSSVTCalibrationConstants.getPedestal((SiSensor) hit.getDetectorElement(), hit.getIdentifierFieldValue("strip"));
+                pedestalShifts[module][layer - 1].fill(hit.getIdentifierFieldValue("strip"), hit.getADCValues()[0] - pedestal);
+            }
+        }
+
+        if (event.hasCollection(HPSFittedRawTrackerHit.class, fitCollection)) {
+            List<HPSFittedRawTrackerHit> fits = event.get(HPSFittedRawTrackerHit.class, fitCollection);
+            for (HPSFittedRawTrackerHit fit : fits) {
+                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");
+                if (fit.getShapeFitParameters().getChiSq() < 5) {
+                    double noise = HPSSVTCalibrationConstants.getNoise((SiSensor) fit.getRawTrackerHit().getDetectorElement(), strip);
+                    if (fit.getAmp() > 4 * noise) {
+                        t0s[module][layer - 1].fill(strip, fit.getT0());
+                    }
+                    amps[module][layer - 1].fill(strip, fit.getAmp());
+                }
+            }
+        }
+    }
+
+    public void endOfData() {
+    	//plotterFrame.dispose();
+    }
+}
\ No newline at end of file

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTPulseFitPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTPulseFitPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTPulseFitPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,189 @@
+package org.hps.monitoring.drivers.svt;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
+import org.hps.conditions.deprecated.HPSSVTConstants;
+import org.hps.conditions.deprecated.SvtUtils;
+import org.hps.recon.tracking.HPSFittedRawTrackerHit;
+import org.hps.util.Resettable;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author mgraham
+ * @version $Id: SVTHitReconstructionPlots.java,v 1.14 2012/05/18 07:41:49 meeg
+ * Exp $
+ */
+public class SVTPulseFitPlots extends Driver implements Resettable {
+
+    private AIDA aida = AIDA.defaultInstance();
+    private String fittedTrackerHitCollectionName = "SVTFittedRawTrackerHits";
+//    private String trackerName = "Tracker";
+    private int eventCount;
+    IPlotter plotter;
+    IPlotter plotter2;
+    IPlotter plotter3;
+    IPlotter plotter4;
+    IPlotter plotter5;
+    private String outputPlots = null;
+    private IHistogram1D[][] t0 = new IHistogram1D[2][10];
+    private IHistogram1D[][] amp = new IHistogram1D[2][10];
+    private IHistogram1D[][] chisq = new IHistogram1D[2][10];
+    private IHistogram2D[][] t0a = new IHistogram2D[2][10];
+    private IHistogram2D[][] shape = new IHistogram2D[2][10];
+//    private IHistogram2D shape;
+
+    protected void detectorChanged(Detector detector) {
+
+        aida.tree().cd("/");
+
+        IAnalysisFactory fac = aida.analysisFactory();
+        plotter = fac.createPlotterFactory("SVT Pulse Fit").create("HPS SVT Timing Plots");
+        plotter.setTitle("Timing");
+        IPlotterStyle style = plotter.style();
+        style.dataStyle().fillStyle().setColor("yellow");
+        style.dataStyle().errorBarStyle().setVisible(false);
+        plotter.createRegions(4, 5);
+
+        plotter2 = fac.createPlotterFactory("SVT Pulse Fit").create("HPS SVT Amplitude Plots");
+        plotter2.setTitle("Amplitude");
+        IPlotterStyle style2 = plotter2.style();
+        style2.dataStyle().fillStyle().setColor("yellow");
+        style2.dataStyle().errorBarStyle().setVisible(false);
+        plotter2.createRegions(4, 5);
+
+        plotter3 = fac.createPlotterFactory("SVT Pulse Fit").create("HPS SVT Chisq Plots");
+        plotter3.setTitle("Chisq");
+        plotter3.style().dataStyle().fillStyle().setColor("yellow");
+        plotter3.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter3.createRegions(4, 5);
+
+        plotter4 = fac.createPlotterFactory("SVT Pulse Fit").create("A vs. T0");
+        plotter4.setTitle("A vs. T0");
+        plotter4.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter4.style().statisticsBoxStyle().setVisible(false);
+        plotter4.style().setParameter("hist2DStyle", "colorMap");
+        plotter4.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter4.style().zAxisStyle().setParameter("scale", "log");
+        plotter4.style().zAxisStyle().setVisible(false);
+        plotter4.createRegions(4, 5);
+
+        plotter5 = fac.createPlotterFactory("SVT Pulse Fit").create("Pulse Shape");
+        plotter5.setTitle("Pulse shape");
+        plotter5.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter5.style().statisticsBoxStyle().setVisible(false);
+        plotter5.style().setParameter("hist2DStyle", "colorMap");
+        plotter5.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotter5.style().zAxisStyle().setParameter("scale", "log");
+        plotter5.style().zAxisStyle().setVisible(false);
+        plotter5.createRegions(4, 5);
+
+        for (int module = 0; module < 2; module++) {
+            for (int layer = 0; layer < 10; layer++) {
+                SiSensor sensor = SvtUtils.getInstance().getSensor(module, layer);
+                int region = computePlotterRegion(layer + 1, module);
+                t0[module][layer] = aida.histogram1D(sensor.getName() + "_timing", 50, -100, 100.0);
+                plotter.region(region).plot(t0[module][layer]);
+                amp[module][layer] = aida.histogram1D(sensor.getName() + "_amplitude", 50, 0, 2000.0);
+                plotter2.region(region).plot(amp[module][layer]);
+                chisq[module][layer] = aida.histogram1D(sensor.getName() + "_chisq", 100, 0, 10.0);
+                plotter3.region(region).plot(chisq[module][layer]);
+                t0a[module][layer] = aida.histogram2D(sensor.getName() + " A vs. T0", 100, -100, 100, 100, 0, 2000);
+                plotter4.region(region).plot(t0a[module][layer]);
+                shape[module][layer] = aida.histogram2D(sensor.getName() + " Shape", 200, -1, 3, 200, -0.5, 2);
+                plotter5.region(region).plot(shape[module][layer]);
+
+            }
+        }
+    }
+
+    public SVTPulseFitPlots() {
+    }
+
+    public void setOutputPlots(String output) {
+        this.outputPlots = output;
+    }
+
+    public void setFittedTrackerHitCollectionName(String fittedTrackerHitCollectionName) {
+        this.fittedTrackerHitCollectionName = fittedTrackerHitCollectionName;
+    }
+
+    public void process(EventHeader event) {
+        ++eventCount;
+        List<HPSFittedRawTrackerHit> fittedrawHits = event.get(HPSFittedRawTrackerHit.class, fittedTrackerHitCollectionName);
+        for (HPSFittedRawTrackerHit fit : fittedrawHits) {
+            SiSensor sensor = (SiSensor) fit.getRawTrackerHit().getDetectorElement();
+            int strip = fit.getRawTrackerHit().getIdentifierFieldValue("strip");
+            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 layer = hrth.getRawTrackerHit().getLayerNumber();
+            double fittedAmp = fit.getAmp();
+            double fittedT0 = fit.getT0();
+            String sensorName = sensor.getName();
+            aida.histogram1D(sensorName + "_timing").fill(fittedT0);
+            aida.histogram1D(sensorName + "_amplitude").fill(fittedAmp);
+            aida.histogram1D(sensorName + "_chisq").fill(fit.getShapeFitParameters().getChiSq());
+
+            double noise = HPSSVTCalibrationConstants.getNoise(sensor, strip);
+            double pedestal = HPSSVTCalibrationConstants.getPedestal(sensor, strip);
+            double tp = HPSSVTCalibrationConstants.getTShaping(sensor, strip);
+
+            t0a[module][layer - 1].fill(fit.getT0(), fit.getAmp());
+            if (fit.getAmp() > 4 * noise) {
+                for (int i = 0; i < fit.getRawTrackerHit().getADCValues().length; i++) {
+                    shape[module][layer - 1].fill((i * HPSSVTConstants.SAMPLING_INTERVAL - fit.getT0()) / tp, (fit.getRawTrackerHit().getADCValues()[i] - pedestal) / fit.getAmp());
+//                    shape.fill((i * HPSSVTConstants.SAMPLE_INTERVAL - hrth.getT0()) / tp, (hrth.getRawTrackerHit().getADCValues()[i] - pedestal) / hrth.getAmp());
+                }
+            }
+        }
+    }
+
+    public void endOfData() {
+        if (outputPlots != null) {
+            try {
+                aida.saveAs(outputPlots);
+            } catch (IOException ex) {
+                Logger.getLogger(TrackingReconstructionPlots.class.getName()).log(Level.SEVERE, null, ex);
+            }
+        }
+    }
+
+    public void reset() {
+        for (int module = 0; module < 2; module++) {
+            for (int layer = 0; layer < 10; layer++) {
+                t0[module][layer].reset();
+                amp[module][layer].reset();
+                chisq[module][layer].reset();
+                t0a[module][layer].reset();
+                shape[module][layer].reset();
+            }
+        }
+    }
+
+    private int computePlotterRegion(int layer, int module) {
+        int iy = (layer - 1) / 2;
+        int ix = 0;
+        if (module > 0) {
+            ix += 2;
+        }
+        if (layer % 2 == 0) {
+            ix += 1;
+        }
+        int region = ix * 5 + iy;
+        return region;
+    }
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTSimpleEventDisplay.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTSimpleEventDisplay.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTSimpleEventDisplay.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,329 @@
+package org.hps.monitoring.drivers.svt;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterFactory;
+//import hep.aida.jfree.plot.style.DefaultHistogram1DStyle;
+
+import java.util.List;
+
+import org.hps.conditions.deprecated.SvtUtils;
+import org.hps.util.Resettable;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHit;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ * Plots hit counts for all SVT channels at each stage of reconstruction.
+ * This class can be configured to reset after each event for use as an
+ * event display by calling {@link #setSingleEvent(boolean)}.
+ * 
+ * @version $Id: SVTSimpleEventDisplay.java,v 1.13 2013/11/06 19:19:55 jeremy Exp $
+ */
+public class SVTSimpleEventDisplay extends Driver implements Resettable {
+
+    /*
+     * Names of collections.
+     */
+    private String inputCollection = "SVTRawTrackerHits";
+    private String trackerHitCollection = "StripClusterer_SiTrackerHitStrip1D";
+    private String helicalHitCollection = "HelicalTrackHits";
+    
+    /* 
+     * Reference to AIDA utility.
+     */
+    private AIDA aida = AIDA.defaultInstance();
+    
+    /*
+     * AIDA objects that will be setup during initialization.
+     */
+    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 IPlotterFactory factory;
+    
+    /*
+     * Single event mode setting.
+     */
+    private boolean singleEvent = true;
+
+    /**
+     * Class constructor.
+     */
+    public SVTSimpleEventDisplay() {
+    }
+
+    /**
+     * Set the name of the HelicalTrackHit collection.
+     * @param helicalHitCollection The name of the HelicalTrackHit collection.
+     */
+    public void setHelicalHitCollection(String helicalHitCollection) {
+        this.helicalHitCollection = helicalHitCollection;
+    }
+
+    /**
+     * Set this Driver to reset after each event.
+     * @param singleEvent Set to true if Driver should reset after each event.
+     */
+    public void setSingleEvent(boolean singleEvent) {
+        this.singleEvent = singleEvent;
+    }
+
+    /**
+     * Set the RawTrackerHit collection name.
+     * @param inputCollection The name of the RawTrackerHit collection.
+     * FIXME: This method should really be called setRawTrackerHitCollection instead.
+     */
+    public void setInputCollection(String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+
+    /**
+     * Set the name of the TrackerHit collection.
+     * @param trackerHitCollection The name of the TrackerHit collection.
+     */
+    public void setTrackerHitCollection(String trackerHitCollection) {
+        this.trackerHitCollection = trackerHitCollection;
+    }
+
+    /**
+     * Get the plotter region index from a layer and module number of a sensor.
+     * @param layer The sensor's layer number.
+     * @param module The sensor's module number.
+     * @return The index of the plotter region for the layer and module.
+     */
+    private int computePlotterRegion(int layer, int module) {
+        // Compute the sensor's x and y grid coordinates and then translate to region number.
+        int iy = (layer - 1) / 2;
+        int ix = 0;
+        if (module > 0) {
+            ix += 2;
+        }
+        if (layer % 2 == 0) {
+            ix += 1;
+        }
+        int region = ix * 5 + iy;
+        //System.out.println(sensor.getName() + "; lyr=" + layer + "; mod=" + module + " -> xy[" + ix + "][" + iy + "] -> reg="+region);
+        return region;
+    }
+
+    /**
+     * Configure this Driver for a new Detector, e.g. setup the plots and show them.
+     */
+    protected void detectorChanged(Detector detector) {
+        createPlotterFactory();
+        setupRawTrackerHitPlots();
+        setupTrackerHitPlots();
+        setupHelicalTrackHitPlots();
+        setupHitCountPlots();
+        setupOccupancyPlots();
+        showPlots();
+    }
+
+    /**
+     * Create the PlotterFactory.
+     */
+    private void createPlotterFactory() {
+        factory = aida.analysisFactory().createPlotterFactory("SVT Event Display");
+    }
+
+    private void setupHitCountPlots() {
+        plotter4 = factory.create("Hit Counts");
+        plotter4.setTitle("Hit Counts");
+        //plotter4.setStyle(new DefaultHistogram1DStyle());
+        plotter4.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter4.createRegions(1, 2);
+        
+        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]);
+    }
+
+    private void setupHelicalTrackHitPlots() {
+        plotter3 = factory.create("HelicalTrackHits");
+        plotter3.setTitle("HelicalTrackHits");
+        //plotter3.setStyle(new DefaultHistogram1DStyle());
+        plotter3.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter3.style().statisticsBoxStyle().setVisible(false);
+        plotter3.createRegions(4, 5);
+    }
+
+    private void setupTrackerHitPlots() {
+        plotter2 = factory.create("TrackerHits");
+        plotter2.setTitle("TrackerHits");
+        //plotter2.setStyle(new DefaultHistogram1DStyle());
+        plotter2.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter2.style().statisticsBoxStyle().setVisible(false);
+        plotter2.createRegions(4, 5);
+    }
+
+    private void setupRawTrackerHitPlots() {
+        plotter = factory.create("RawTrackerHits");
+        plotter.setTitle("RawTrackerHits");
+        //plotter.setStyle(new DefaultHistogram1DStyle());
+        plotter.style().dataStyle().errorBarStyle().setVisible(false);
+        plotter.style().statisticsBoxStyle().setVisible(false);
+        plotter.createRegions(4, 5);
+    }
+
+    private void showPlots() {
+        plotter.show();
+        plotter2.show();
+        plotter3.show();
+        plotter4.show();
+    }
+
+    private void setupOccupancyPlots() {
+        aida.tree().cd("/");
+        for (int module = 0; module < 2; module++) {
+            for (int layer = 0; layer < 10; layer++) {
+                int region = computePlotterRegion(layer + 1, module);
+                rth[module][layer] = aida.histogram1D(SvtUtils.getInstance().getSensor(module, layer).getName() + " RawTrackerHits", 640, -0.5, 639.5);
+                plotter.region(region).plot(rth[module][layer]);
+                th[module][layer] = aida.histogram1D(SvtUtils.getInstance().getSensor(module, layer).getName() + " TrackerHits", 640, -0.5, 639.5);
+                plotter2.region(region).plot(th[module][layer]);
+                hth[module][layer] = aida.histogram1D(SvtUtils.getInstance().getSensor(module, layer).getName() + " HelicalTrackHits", 640, -0.5, 639.5);
+                plotter3.region(region).plot(hth[module][layer]);
+            }
+        }
+    }
+
+    /**
+     * Process a single event by filling histograms with event data.
+     * @param event The current event.
+     */
+    public void process(EventHeader event) {
+
+        // Clear histograms if in single event mode.
+        if (singleEvent) {
+            resetPlots();
+        }
+
+        plotRawTrackerHits(event);
+
+        plotTrackerHits(event);
+
+        plotHelicalTrackHits(event);
+    }
+
+    /**
+     * Fill HelicalTrackHit plots for one event.
+     * @param event The event.
+     */
+    private void plotHelicalTrackHits(EventHeader event) {
+        if (event.hasCollection(HelicalTrackHit.class, helicalHitCollection)) {
+            
+            List<HelicalTrackHit> helicalTrackerHits = event.get(HelicalTrackHit.class, helicalHitCollection);
+
+            System.out.println(helicalHitCollection + " has " + helicalTrackerHits.size() + " hits");
+            
+            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);
+            }
+        } else {
+            throw new RuntimeException("Collection " + helicalHitCollection + " was not found.");
+        }
+    }
+
+    /**
+     * Fill TrackerHit plots for one event.
+     * @param event The event.
+     */
+    private void plotTrackerHits(EventHeader event) {
+        if (event.hasCollection(SiTrackerHit.class, trackerHitCollection)) {
+            
+            List<SiTrackerHit> trackerHits = event.get(SiTrackerHit.class, trackerHitCollection);
+
+            System.out.println(trackerHitCollection + " has " + trackerHits.size() + " hits");
+            
+            // Increment strip hit count.
+            for (SiTrackerHit hit : trackerHits) {
+                for (RawTrackerHit rawHit : hit.getRawHits()) {
+                    int layer = rawHit.getIdentifierFieldValue("layer"); // 1-10; axial layers are odd layers; stereo layers are even
+                    int module = rawHit.getIdentifierFieldValue("module"); // 0-1; module number is top or bottom
+
+                    th[module][layer - 1].fill(rawHit.getIdentifierFieldValue("strip"));
+                }
+            }
+        } else {
+            throw new RuntimeException("Collection " + trackerHitCollection + " was not found.");
+        }
+    }
+
+    /**
+     * Fill RawTrackerHit plots for one event.
+     * @param event The event.
+     */
+    private void plotRawTrackerHits(EventHeader event) {
+        if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
+            List<RawTrackerHit> rawTrackerHits = event.get(RawTrackerHit.class, inputCollection);
+
+            System.out.println(inputCollection + " has " + rawTrackerHits.size() + " hits");
+            
+            // Increment strip hit count.
+            for (RawTrackerHit hit : rawTrackerHits) {
+                int layer = hit.getIdentifierFieldValue("layer"); // 1-10; axial layers are odd layers; stereo layers are even
+                int module = hit.getIdentifierFieldValue("module"); // 0-1; module number is top or bottom
+
+                rth[module][layer - 1].fill(hit.getIdentifierFieldValue("strip"));
+            }
+        } else {
+            throw new RuntimeException("Collection " + inputCollection + " was not found.");
+        }
+    }
+
+    /**
+     * Reset the plots for running in single event mode.
+     */
+    private void resetPlots() {
+        for (int module = 0; module < 2; module++) {
+            for (int layer = 1; layer < 11; layer++) {
+                rth[module][layer - 1].reset();
+                th[module][layer - 1].reset();
+                hth[module][layer - 1].reset();
+            }
+        }
+    }
+
+    /**
+     * Reset the hit count plot, which is not affected by single event setting. 
+     */
+    private void resetHitCountPlot() {
+        for (int module = 0; module < 2; module++) {
+            hitCount[module].reset();
+        }
+    }
+
+    /**
+     * Reset this Driver's plots.
+     */
+    public void reset() {
+        resetPlots();
+        resetHitCountPlot();
+    }
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SensorOccupancyPlotsDriver.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SensorOccupancyPlotsDriver.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SensorOccupancyPlotsDriver.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,190 @@
+package org.hps.monitoring.drivers.svt;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+import hep.aida.ref.plotter.PlotterRegion;
+import jas.hist.JASHist;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hps.util.Resettable;
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierHelper;
+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.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ * This Driver makes plots of sensor occupancies across a run. It is intended to
+ * be used with the monitoring system. It will currently only run on a test run
+ * detector, as the number of sensors, and hence plotter regions, is hardcoded
+ * to 20.
+ *
+ * @author Jeremy McCormick <[log in to unmask]>
+ * @version $Id: SensorOccupancyPlotsDriver.java,v 1.8 2013/11/06 19:19:55 jeremy Exp $
+ *
+ */
+public class SensorOccupancyPlotsDriver extends Driver implements Resettable {
+
+    private String rawTrackerHitCollectionName = "SVTRawTrackerHits";
+    private String trackerName = "Tracker";
+    private AIDA aida = AIDA.defaultInstance();
+    private IPlotter plotter;
+    private Detector detector;
+    private List<SiSensor> sensors;
+    private Map<String, int[]> occupancyMap;
+    private Map<String, Integer> sensorRegionMap;
+    private int eventCount = 0;
+    private int eventRefreshRate = 1000;
+    private static final String nameStrip = "Tracker_TestRunModule_";
+    private static final int maxChannels = 640;
+
+    public SensorOccupancyPlotsDriver() {
+    }
+
+    public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) {
+        this.rawTrackerHitCollectionName = rawTrackerHitCollectionName;
+    }
+
+    public void setEventRefreshRate(int eventRefreshRate) {
+        this.eventRefreshRate = eventRefreshRate;
+    }
+
+    private int computePlotterRegion(SiSensor sensor) {
+
+        IIdentifierHelper helper = sensor.getIdentifierHelper();
+        IIdentifier id = sensor.getIdentifier();
+
+        int layer = helper.getValue(id, "layer"); // 1-10; axial layers are odd layers; stereo layers are even
+        int module = helper.getValue(id, "module"); // 0-1; module number is top or bottom
+
+        // Compute the sensor's x and y grid coordinates and then translate to region number.
+        int ix = (layer - 1) / 2;
+        int iy = 0;
+        if (module > 0) {
+            iy += 2;
+        }
+        if (layer % 2 == 0) {
+            iy += 1;
+        }
+        int region = ix * 4 + iy;
+        //System.out.println(sensor.getName() + "; lyr=" + layer + "; mod=" + module + " -> xy[" + ix + "][" + iy + "] -> reg="+region);
+        return region;
+    }
+
+    protected void detectorChanged(Detector detector) {
+
+        // Setup the plotter.
+        IAnalysisFactory fac = aida.analysisFactory();
+        plotter = fac.createPlotterFactory("SVT").create("Sensor Occupancy Plots");
+        IPlotterStyle pstyle = plotter.style();
+        pstyle.dataStyle().fillStyle().setColor("green");
+        //pstyle.dataStyle().markerStyle().setColor("green");
+        pstyle.dataStyle().markerStyle().setVisible(false);
+        pstyle.dataStyle().outlineStyle().setVisible(false);
+        pstyle.dataStyle().errorBarStyle().setVisible(false);
+        pstyle.statisticsBoxStyle().setVisible(false);
+
+        // Create regions.
+        plotter.createRegions(5, 4);
+
+        // Cache Detector object.
+        this.detector = detector;
+
+        // Make a list of SiSensors in the SVT.
+        sensors = this.detector.getSubdetector(trackerName).getDetectorElement().findDescendants(SiSensor.class);
+
+        // Reset the data structure that keeps track of strip occupancies.
+        resetOccupancyMap();
+
+        // For now throw an error if there are "too many" sensors.
+        if (sensors.size() > 20) {
+            throw new RuntimeException("Can't handle > 20 sensors at a time.");
+        }
+
+        // Map a map of sensors to their region numbers in the plotter.
+        sensorRegionMap = new HashMap<String, Integer>();
+        for (SiSensor sensor : sensors) {
+            int region = computePlotterRegion(sensor);
+            sensorRegionMap.put(sensor.getName(), region);
+        }
+
+        // Setup the occupancy plots.
+        aida.tree().cd("/");
+        for (SiSensor sensor : sensors) {
+        	//IHistogram1D occupancyPlot = aida.histogram1D(sensor.getName().replaceAll("Tracker_TestRunModule_", ""), 640, 0, 639);
+            IHistogram1D occupancyPlot = createSensorPlot(sensor);
+            occupancyPlot.reset();
+            int region = sensorRegionMap.get(sensor.getName());
+            plotter.region(region).plot(occupancyPlot);
+            JASHist hist = ((PlotterRegion) plotter.region(region)).getPlot();
+            hist.setAllowUserInteraction(false);
+            hist.setAllowPopupMenus(false);
+        }
+    }
+
+    public void process(EventHeader event) {
+        if (event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) {
+
+            // Get RawTrackerHit collection from event.
+            List<RawTrackerHit> rawTrackerHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
+
+            // Increment strip hit count.
+            for (RawTrackerHit hit : rawTrackerHits) {
+                int[] strips = occupancyMap.get(hit.getDetectorElement().getName());
+                strips[hit.getIdentifierFieldValue("strip")] += 1;
+            }
+
+            // Plot strip occupancies.
+            if (eventCount % eventRefreshRate == 0) {
+                for (SiSensor sensor : sensors) {
+                	//IHistogram1D sensorHist = aida.histogram1D(sensor.getName());
+                    IHistogram1D sensorHist = getSensorPlot(sensor);
+                    sensorHist.reset();
+                    int[] strips = occupancyMap.get(sensor.getName());
+                    for (int i = 0; i < strips.length; i++) {
+                        double stripOccupancy = (double) strips[i] / (double) (eventCount);
+                        if (stripOccupancy != 0) {
+                            sensorHist.fill(i, stripOccupancy);
+                        }
+                    }
+                }
+            }
+
+            // Increment event counter.
+            ++eventCount;
+        }
+    }
+    
+    private IHistogram1D getSensorPlot(SiSensor sensor) {
+    	return aida.histogram1D(sensor.getName());
+    }
+    
+    private IHistogram1D createSensorPlot(SiSensor sensor) {
+    	IHistogram1D hist = aida.histogram1D(sensor.getName(), maxChannels, 0, maxChannels-1);
+    	hist.setTitle(sensor.getName().replaceAll(nameStrip, "")
+                .replace("module", "mod")
+                .replace("layer", "lyr")
+                .replace("sensor", "sens"));
+    	return hist;
+    }
+
+    private void resetOccupancyMap() {
+        occupancyMap = new HashMap<String, int[]>();
+        for (SiSensor sensor : sensors) {
+            occupancyMap.put(sensor.getName(), new int[640]);
+        }
+    }
+
+    public void reset() {
+        eventCount = 0;
+        resetOccupancyMap();
+    }
+}
\ No newline at end of file

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
TrackTimePlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/TrackTimePlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/TrackTimePlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,314 @@
+package org.lcsim.hps.monitoring.svt;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterFactory;
+import hep.aida.IPlotterStyle;
+import hep.aida.ref.plotter.PlotterRegion;
+
+import java.util.List;
+
+import org.hps.conditions.deprecated.SvtUtils;
+import org.hps.recon.ecal.TriggerData;
+import org.hps.util.Resettable;
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierHelper;
+import org.lcsim.detector.tracker.silicon.DopedSilicon;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.Track;
+import org.lcsim.event.TrackerHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackCross;
+import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
+import org.lcsim.geometry.Detector;
+import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author meeg
+ * @version $Id: SVTHitReconstructionPlots.java,v 1.14 2012/05/18 07:41:49 meeg
+ * Exp $
+ */
+public class TrackTimePlots extends Driver implements Resettable {
+
+	//private AIDAFrame plotterFrame;
+    private AIDA aida = AIDA.defaultInstance();
+    private String hitCollection = "StripClusterer_SiTrackerHitStrip1D";
+    private String trackCollection = "MatchedTracks";
+    IPlotter plotter, plotter2, plotter3, plotter4, plotter5, plotter6, plotter7;
+    private IHistogram1D[][] t0 = new IHistogram1D[2][10];
+    private IHistogram1D[][] trackHitT0 = new IHistogram1D[2][10];
+    private IHistogram1D[][] trackHitDt = new IHistogram1D[2][10];
+    private IHistogram2D[][] trackHit2D = new IHistogram2D[2][10];
+    private IHistogram1D[] trackT0 = new IHistogram1D[2];
+    private IHistogram2D[] trackTrigTime = new IHistogram2D[2];
+    private IHistogram2D[][] trackHitDtChan = new IHistogram2D[2][10];
+    private IHistogram1D[] trackTimeRange = new IHistogram1D[2];
+    private IHistogram2D[] trackTimeMinMax = new IHistogram2D[2];
+
+    @Override
+    protected void detectorChanged(Detector detector) {
+    	//plotterFrame = new AIDAFrame();
+        //plotterFrame.setTitle("HPS SVT Track Time Plots");
+
+        aida.tree().cd("/");
+
+        IPlotterFactory fac = aida.analysisFactory().createPlotterFactory();
+
+        IPlotterStyle style;
+
+        plotter = fac.create("HPS SVT Timing Plots");
+        plotter.setTitle("Hit Times");
+        //plotterFrame.addPlotter(plotter);
+        style = plotter.style();
+        style.dataStyle().fillStyle().setColor("yellow");
+        style.dataStyle().errorBarStyle().setVisible(false);
+        plotter.createRegions(4, 5);
+
+        plotter2 = fac.create("HPS SVT Track Time");
+        plotter2.setTitle("Track Time");
+        //plotterFrame.addPlotter(plotter2);
+        style = plotter2.style();
+        style.dataStyle().fillStyle().setColor("yellow");
+        style.dataStyle().errorBarStyle().setVisible(false);
+        plotter2.createRegions(2, 2);
+
+        plotter3 = fac.create("HPS SVT Timing Plots");
+        plotter3.setTitle("Track Hit Time");
+        //plotterFrame.addPlotter(plotter3);
+        style = plotter3.style();
+        style.dataStyle().fillStyle().setColor("yellow");
+        style.dataStyle().errorBarStyle().setVisible(false);
+        plotter3.createRegions(4, 5);
+
+        plotter4 = fac.create("HPS SVT Timing Plots");
+        plotter4.setTitle("Track Hit dt");
+        //plotterFrame.addPlotter(plotter4);
+        style = plotter4.style();
+        style.dataStyle().fillStyle().setColor("yellow");
+        style.dataStyle().errorBarStyle().setVisible(false);
+        plotter4.createRegions(4, 5);
+
+        plotter5 = fac.create("HPS SVT Timing Plots");
+        plotter5.setTitle("Track Time vs. dt");
+        //plotterFrame.addPlotter(plotter5);
+        style = plotter5.style();
+        style.statisticsBoxStyle().setVisible(false);
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style.zAxisStyle().setParameter("scale", "log");
+        plotter5.createRegions(4, 5);
+
+        plotter6 = fac.create("HPS SVT Timing Plots");
+        plotter6.setTitle("Track dt vs. Channel");
+        //plotterFrame.addPlotter(plotter6);
+        style = plotter6.style();
+        style.statisticsBoxStyle().setVisible(false);
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style.zAxisStyle().setParameter("scale", "log");
+        plotter6.createRegions(4, 5);
+
+        plotter7 = fac.create("HPS SVT Track Hit Time Range");
+        plotter7.setTitle("Track Hit Time Range");
+        //plotterFrame.addPlotter(plotter7);
+        style = plotter7.style();
+        style.dataStyle().fillStyle().setColor("yellow");
+        style.dataStyle().errorBarStyle().setVisible(false);
+        plotter7.createRegions(2, 2);
+
+        for (int module = 0; module < 2; module++) {
+            for (int layer = 0; layer < 10; layer++) {
+                SiSensor sensor = SvtUtils.getInstance().getSensor(module, layer);
+                int region = computePlotterRegion(layer + 1, module);
+                t0[module][layer] = aida.histogram1D(sensor.getName() + "_timing", 75, -50, 100.0);
+                plotter.region(region).plot(t0[module][layer]);
+                ((PlotterRegion) plotter.region(region)).getPlot().getXAxis().setLabel("Hit time [ns]");
+                trackHitT0[module][layer] = aida.histogram1D(sensor.getName() + "_trackHit_timing", 75, -50, 4000.0);
+                plotter3.region(region).plot(trackHitT0[module][layer]);
+                ((PlotterRegion) plotter3.region(region)).getPlot().getXAxis().setLabel("Hit time [ns]");
+                trackHitDt[module][layer] = aida.histogram1D(sensor.getName() + "_trackHit_dt", 50, -20, 20.0);
+                plotter4.region(region).plot(trackHitDt[module][layer]);
+                ((PlotterRegion) plotter4.region(region)).getPlot().getXAxis().setLabel("Hit time residual [ns]");
+                trackHit2D[module][layer] = aida.histogram2D(sensor.getName() + "_trackHit_dt_2D", 75, -50, 100.0, 50, -20, 20.0);
+                plotter5.region(region).plot(trackHit2D[module][layer]);
+                ((PlotterRegion) plotter5.region(region)).getPlot().getXAxis().setLabel("Track time [ns]");
+                ((PlotterRegion) plotter5.region(region)).getPlot().getYAxis().setLabel("Hit time [ns]");
+                trackHitDtChan[module][layer] = aida.histogram2D(sensor.getName() + "_trackHit_dt_chan", 200, -20, 20, 50, -20, 20.0);
+                plotter6.region(region).plot(trackHitDtChan[module][layer]);
+                ((PlotterRegion) plotter6.region(region)).getPlot().getXAxis().setLabel("Hit position [mm]");
+                ((PlotterRegion) plotter6.region(region)).getPlot().getYAxis().setLabel("Hit time residual [ns]");
+            }
+            trackT0[module] = aida.histogram1D((module == 0 ? "Top" : "Bottom") + " Track Time", 75, -50, 100.0);
+            plotter2.region(module).plot(trackT0[module]);
+            ((PlotterRegion) plotter2.region(module)).getPlot().getXAxis().setLabel("Track time [ns]");
+            trackTrigTime[module] = aida.histogram2D((module == 0 ? "Top" : "Bottom") + " Track Time vs. Trig Time", 75, -50, 100.0, 33, -1, 32);
+            plotter2.region(module + 2).plot(trackTrigTime[module]);
+            ((PlotterRegion) plotter2.region(module+2)).getPlot().getXAxis().setLabel("Track time [ns]");
+            ((PlotterRegion) plotter2.region(module+2)).getPlot().getYAxis().setLabel("Trigger time [clocks]");
+            style = plotter2.region(module + 2).style();
+            style.setParameter("hist2DStyle", "colorMap");
+            style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+            style.zAxisStyle().setParameter("scale", "log");
+
+            trackTimeRange[module] = aida.histogram1D((module == 0 ? "Top" : "Bottom") + " Track Hit Time Range", 75, 0, 30.0);
+            plotter7.region(module).plot(trackTimeRange[module]);
+            ((PlotterRegion) plotter7.region(module)).getPlot().getXAxis().setLabel("Track time range [ns]");
+            trackTimeMinMax[module] = aida.histogram2D((module == 0 ? "Top" : "Bottom") + " First and Last Track Hit Times", 75, -50, 100.0, 75, -50, 100.0);
+            plotter7.region(module + 2).plot(trackTimeMinMax[module]);
+            ((PlotterRegion) plotter7.region(module+2)).getPlot().getXAxis().setLabel("First track hit time [ns]");
+            ((PlotterRegion) plotter7.region(module+2)).getPlot().getYAxis().setLabel("Last track hit time [ns]");
+            style = plotter7.region(module + 2).style();
+            style.setParameter("hist2DStyle", "colorMap");
+            style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+            style.zAxisStyle().setParameter("scale", "log");
+        }
+//        shape = aida.histogram2D("Shape", 200, -1, 3, 200, -0.5, 2);
+//        plotter5.region(0).plot(shape);
+
+        //plotterFrame.pack();
+        //plotterFrame.setVisible(true);
+    }
+
+    public void setHitCollection(String hitCollection) {
+        this.hitCollection = hitCollection;
+    }
+
+    public void setTrackCollection(String trackCollection) {
+        this.trackCollection = trackCollection;
+    }
+
+    @Override
+    public void process(EventHeader event) {
+        int orTrig = 0;
+        int topTrig = 0;
+        int botTrig = 0;
+
+        int orTrigTime = -1;
+        int topTrigTime = -1;
+        int botTrigTime = -1;
+        if (event.hasCollection(TriggerData.class, "TriggerBank")) {
+            List<TriggerData> triggerList = event.get(TriggerData.class, "TriggerBank");
+            if (!triggerList.isEmpty()) {
+                TriggerData triggerData = triggerList.get(0);
+
+                orTrig = triggerData.getOrTrig();
+                if (orTrig != 0) {
+                    for (int i = 0; i < 32; i++) {
+                        if ((1 << (31 - i) & orTrig) != 0) {
+                            orTrigTime = i;
+                            break;
+                        }
+                    }
+                }
+                topTrig = triggerData.getTopTrig();
+                if (topTrig != 0) {
+                    for (int i = 0; i < 32; i++) {
+                        if ((1 << (31 - i) & topTrig) != 0) {
+                            topTrigTime = i;
+                            break;
+                        }
+                    }
+                }
+                botTrig = triggerData.getBotTrig();
+                if (botTrig != 0) {
+                    for (int i = 0; i < 32; i++) {
+                        if ((1 << (31 - i) & botTrig) != 0) {
+                            botTrigTime = i;
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+
+        IIdentifierHelper helper = SvtUtils.getInstance().getHelper();
+        List<SiTrackerHitStrip1D> hits = event.get(SiTrackerHitStrip1D.class, hitCollection);
+        for (SiTrackerHitStrip1D hit : hits) {
+            IIdentifier id = hit.getSensor().getIdentifier();
+            int layer = helper.getValue(id, "layer");
+            int module = helper.getValue(id, "module");
+//            System.out.format("%d, %d, %d\n",hit.getCellID(),layer,module);
+            t0[module][layer - 1].fill(hit.getTime());
+        }
+//
+
+        List<Track> tracks = event.get(Track.class, trackCollection);
+        for (Track track : tracks) {
+            int trackModule = -1;
+            if (track.getTrackerHits().get(0).getPosition()[2] > 0) {
+                trackModule = 0;
+            } else {
+                trackModule = 1;
+            }
+            double minTime = Double.POSITIVE_INFINITY;
+            double maxTime = Double.NEGATIVE_INFINITY;
+            int hitCount = 0;
+            double trackTime = 0;
+            for (TrackerHit hitCross : track.getTrackerHits()) {
+                for (HelicalTrackStrip hit : ((HelicalTrackCross) hitCross).getStrips()) {
+                    int layer = hit.layer();
+                    trackHitT0[trackModule][layer - 1].fill(hit.dEdx() / DopedSilicon.ENERGY_EHPAIR);
+                    trackTime += hit.time();
+                    hitCount++;
+                    if (hit.time() > maxTime) {
+                        maxTime = hit.time();
+                    }
+                    if (hit.time() < minTime) {
+                        minTime = hit.time();
+                    }
+                }
+            }
+            trackTimeMinMax[trackModule].fill(minTime, maxTime);
+            trackTimeRange[trackModule].fill(maxTime - minTime);
+            trackTime /= hitCount;
+            trackT0[trackModule].fill(trackTime);
+            if (trackModule == 0) {
+                trackTrigTime[trackModule].fill(trackTime, topTrigTime);
+            } else {
+                trackTrigTime[trackModule].fill(trackTime, botTrigTime);
+            }
+            for (TrackerHit hitCross : track.getTrackerHits()) {
+                for (HelicalTrackStrip hit : ((HelicalTrackCross) hitCross).getStrips()) {
+                    int layer = hit.layer();
+                    trackHitDt[trackModule][layer - 1].fill(hit.time() - trackTime);
+                    trackHit2D[trackModule][layer - 1].fill(trackTime, hit.time() - trackTime);
+                    trackHitDtChan[trackModule][layer - 1].fill(hit.umeas(), hit.time() - trackTime);
+                }
+            }
+        }
+    }
+
+    @Override
+    public void endOfData() {
+    	//plotterFrame.dispose();
+    }
+
+    @Override
+    public void reset() {
+        for (int module = 0; module < 2; module++) {
+            for (int layer = 0; layer < 10; layer++) {
+                trackHitT0[module][layer].reset();
+                trackHitDt[module][layer].reset();
+                t0[module][layer].reset();
+                trackT0[module].reset();
+            }
+        }
+    }
+
+    private int computePlotterRegion(int layer, int module) {
+        int iy = (layer - 1) / 2;
+        int ix = 0;
+        if (module > 0) {
+            ix += 2;
+        }
+        if (layer % 2 == 0) {
+            ix += 1;
+        }
+        int region = ix * 5 + iy;
+        return region;
+    }
+}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
TrackingReconstructionPlots.java added at 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/TrackingReconstructionPlots.java	                        (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/TrackingReconstructionPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -0,0 +1,1108 @@
+package org.hps.monitoring.drivers.svt;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+import hep.aida.IProfile;
+import hep.physics.matrix.SymmetricMatrix;
+import hep.physics.vec.Hep3Vector;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.hps.conditions.deprecated.BeamlineConstants;
+import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
+import org.hps.conditions.deprecated.HPSSVTCalibrationConstants.ChannelConstants;
+import org.hps.conditions.deprecated.SvtUtils;
+import org.hps.recon.ecal.HPSEcalCluster;
+import org.hps.recon.tracking.DumbShaperFit;
+import org.hps.recon.tracking.HPSShapeFitParameters;
+import org.hps.recon.tracking.HPSShaperFitAlgorithm;
+import org.hps.recon.tracking.HelixConverter;
+import org.hps.recon.tracking.StraightLineTrack;
+import org.hps.recon.tracking.TrackUtils;
+import org.hps.util.Resettable;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.LCIOParameters.ParameterName;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.event.Track;
+import org.lcsim.event.TrackerHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackCross;
+import org.lcsim.fit.helicaltrack.HelicalTrackFit;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
+import org.lcsim.fit.helicaltrack.HelixUtils;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
+import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
+import org.lcsim.recon.tracking.seedtracker.SeedTrack;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author mgraham
+ */
+public class TrackingReconstructionPlots extends Driver implements Resettable {
+
+    //private AIDAFrame plotterFrame;
+    //private AIDAFrame topFrame;
+    //private AIDAFrame bottomFrame;
+    private AIDA aida = AIDA.defaultInstance();
+    private String rawTrackerHitCollectionName = "SVTRawTrackerHits";
+    private String fittedTrackerHitCollectionName = "SVTFittedRawTrackerHits";
+    private String trackerHitCollectionName = "StripClusterer_SiTrackerHitStrip1D";
+    private String helicalTrackHitCollectionName = "HelicalTrackHits";
+    private String rotatedTrackHitCollectionName = "RotatedHelicalTrackHits";
+    private String helicalTrackHitRelationsCollectionName = "HelicalTrackHitRelations";
+    private String trackCollectionName = "MatchedTracks";
+    private String trackerName = "Tracker";
+    String ecalSubdetectorName = "Ecal";
+    String ecalCollectionName = "EcalClusters";
+    private Detector detector = null;
+    IDDecoder dec;
+    private int eventCount;
+    private List<SiSensor> sensors;
+    private String outputPlots = null;
+    IPlotter plotter;
+    IPlotter plotter2;
+    IPlotter plotter22;
+    IPlotter plotter222;
+    IPlotter plotter3;
+    IPlotter plotter3_1;
+    IPlotter plotter3_2;
+    IPlotter plotter4;
+    IPlotter plotter5;
+    IPlotter plotter5_1;
+    IPlotter plotter55;
+    IPlotter plotter6;
+    IPlotter plotter7;
+    IPlotter top1;
+    IPlotter top2;
+    IPlotter top3;
+    IPlotter top4;
+    IPlotter bot1;
+    IPlotter bot2;
+    IPlotter bot3;
+    IPlotter bot4;
+    double zEcal = 1500;
+    double zAtDownStrPairSpec = 914.0; //mm
+    double zAtColl = -1500;
+    IHistogram1D trkPx;
+    IHistogram1D nTracks;
+    HPSShaperFitAlgorithm _shaper = new DumbShaperFit();
+
+    @Override
+    protected void detectorChanged(Detector detector) {
+        this.detector = detector;
+        aida.tree().cd("/");
+        //plotterFrame = new AIDAFrame();
+        //plotterFrame.setTitle("HPS Tracking Plots");
+
+        //topFrame = new AIDAFrame();
+        //topFrame.setTitle("Top Tracking Plots");
+        //bottomFrame = new AIDAFrame();
+        //bottomFrame.setTitle("Bottom Tracking Plots");
+
+        sensors = detector.getSubdetector(trackerName).getDetectorElement().findDescendants(SiSensor.class);
+
+        IAnalysisFactory fac = aida.analysisFactory();
+        plotter = fac.createPlotterFactory().create("HPS Tracking Plots");
+        plotter.setTitle("Momentum");
+        IPlotterStyle style = plotter.style();
+        style.dataStyle().fillStyle().setColor("yellow");
+        style.dataStyle().errorBarStyle().setVisible(false);
+        plotter.createRegions(2, 2);
+        //plotterFrame.addPlotter(plotter);
+
+        trkPx = aida.histogram1D("Track Momentum (Px)", 25, -0.25, 0.25);
+        IHistogram1D trkPy = aida.histogram1D("Track Momentum (Py)", 25, -0.1, 0.1);
+        IHistogram1D trkPz = aida.histogram1D("Track Momentum (Pz)", 25, 0, 3.5);
+        IHistogram1D trkChi2 = aida.histogram1D("Track Chi2", 25, 0, 25.0);
+
+        plotter.region(0).plot(trkPx);
+        plotter.region(1).plot(trkPy);
+        plotter.region(2).plot(trkPz);
+        plotter.region(3).plot(trkChi2);
+        
+        plotter.show();
+
+//   ******************************************************************
+
+
+        top1 = fac.createPlotterFactory().create("Top Tracking Plots");
+        top1.setTitle("Top Momentum");
+        IPlotterStyle stop1 = top1.style();
+        stop1.dataStyle().fillStyle().setColor("green");
+        stop1.dataStyle().errorBarStyle().setVisible(false);
+        top1.createRegions(2, 2);
+        //topFrame.addPlotter(top1);
+
+        IHistogram1D toptrkPx = aida.histogram1D("Top Track Momentum (Px)", 25, -0.25, 0.25);
+        IHistogram1D toptrkPy = aida.histogram1D("Top Track Momentum (Py)", 25, -0.1, 0.1);
+        IHistogram1D toptrkPz = aida.histogram1D("Top Track Momentum (Pz)", 25, 0, 3.5);
+        IHistogram1D toptrkChi2 = aida.histogram1D("Top Track Chi2", 25, 0, 25.0);
+
+        top1.region(0).plot(toptrkPx);
+        top1.region(1).plot(toptrkPy);
+        top1.region(2).plot(toptrkPz);
+        top1.region(3).plot(toptrkChi2);
+        
+        top1.show();
+
+
+        bot1 = fac.createPlotterFactory().create("Bottom Tracking Plots");
+        bot1.setTitle("Bottom Momentum");
+        IPlotterStyle sbot1 = bot1.style();
+        sbot1.dataStyle().fillStyle().setColor("blue");
+        sbot1.dataStyle().errorBarStyle().setVisible(false);
+        bot1.createRegions(2, 2);
+        //bottomFrame.addPlotter(bot1);
+
+        IHistogram1D bottrkPx = aida.histogram1D("Bottom Track Momentum (Px)", 25, -0.25, 0.25);
+        IHistogram1D bottrkPy = aida.histogram1D("Bottom Track Momentum (Py)", 25, -0.1, 0.1);
+        IHistogram1D bottrkPz = aida.histogram1D("Bottom Track Momentum (Pz)", 25, 0, 3.5);
+        IHistogram1D bottrkChi2 = aida.histogram1D("Bottom Track Chi2", 25, 0, 25.0);
+
+        bot1.region(0).plot(bottrkPx);
+        bot1.region(1).plot(bottrkPy);
+        bot1.region(2).plot(bottrkPz);
+        bot1.region(3).plot(bottrkChi2);
+
+        bot1.show();
+        
+//   ******************************************************************
+
+        IHistogram1D trkd0 = aida.histogram1D("d0 ", 25, -100.0, 100.0);
+        IHistogram1D trkphi = aida.histogram1D("sinphi ", 25, -0.2, 0.2);
+        IHistogram1D trkomega = aida.histogram1D("omega ", 25, -0.0025, 0.0025);
+        IHistogram1D trklam = aida.histogram1D("tan(lambda) ", 25, -0.1, 0.1);
+        IHistogram1D trkz0 = aida.histogram1D("z0 ", 25, -100.0, 100.0);
+
+        plotter22 = fac.createPlotterFactory().create("HPS Track Params");
+        plotter22.setTitle("Track parameters");
+        //plotterFrame.addPlotter(plotter22);
+        IPlotterStyle style22 = plotter22.style();
+        style22.dataStyle().fillStyle().setColor("yellow");
+        style22.dataStyle().errorBarStyle().setVisible(false);
+        plotter22.createRegions(2, 3);
+        plotter22.region(0).plot(trkd0);
+        plotter22.region(1).plot(trkphi);
+        plotter22.region(2).plot(trkomega);
+        plotter22.region(3).plot(trklam);
+        plotter22.region(4).plot(trkz0);
+
+
+        plotter2 = fac.createPlotterFactory().create("HPS Tracking Plots");
+        plotter2.setTitle("Track extrapolation");
+        //plotterFrame.addPlotter(plotter2);
+        IPlotterStyle style2 = plotter2.style();
+        style2.dataStyle().fillStyle().setColor("yellow");
+        style2.dataStyle().errorBarStyle().setVisible(false);
+        plotter2.createRegions(2, 4);
+        IHistogram1D xAtConverter = aida.histogram1D("X (mm) @ Z=-60cm", 50, -50, 50);
+        IHistogram1D yAtConverter = aida.histogram1D("Y (mm) @ Z=-60cm", 50, -20, 20);
+        IHistogram1D xAtColl = aida.histogram1D("X (mm) @ Z=-150cm", 50, -200, 200);
+        IHistogram1D yAtColl = aida.histogram1D("Y (mm) @ Z=-150cm", 50, -200, 200);
+        IHistogram1D xAtEcal = aida.histogram1D("X (mm) @ ECAL", 50, -500, 500);
+        IHistogram1D yAtEcal = aida.histogram1D("Y (mm) @ ECAL", 50, -100, 100);
+        IHistogram1D xAtEcal2 = aida.histogram1D("X (mm) @ ECAL (Pz>1)", 50, -500, 500);
+        IHistogram1D yAtEcal2 = aida.histogram1D("Y (mm) @ ECAL (Pz>1)", 50, -100, 100);
+
+        plotter2.region(0).plot(xAtConverter);
+        plotter2.region(4).plot(yAtConverter);
+        plotter2.region(1).plot(xAtColl);
+        plotter2.region(5).plot(yAtColl);
+        plotter2.region(2).plot(xAtEcal);
+        plotter2.region(6).plot(yAtEcal);
+        plotter2.region(3).plot(xAtEcal2);
+        plotter2.region(7).plot(yAtEcal2);
+
+        plotter222 = fac.createPlotterFactory().create("HPS Tracking Plots");
+        plotter222.setTitle("Other");
+        //plotterFrame.addPlotter(plotter222);
+        IPlotterStyle style222 = plotter222.style();
+        style222.dataStyle().fillStyle().setColor("yellow");
+        style222.dataStyle().errorBarStyle().setVisible(false);
+        plotter222.createRegions(2, 3);
+
+        IHistogram1D nHits = aida.histogram1D("Hits per Track", 2, 4, 6);
+        IHistogram1D amp = aida.histogram1D("Amp (HitOnTrack)", 50, 0, 5000);
+        IHistogram1D ampcl = aida.histogram1D("Amp (CluOnTrack)", 50, 0, 5000);
+        IHistogram1D amp2 = aida.histogram1D("Amp Pz>1000 (HitOnTrack)", 50, 0, 5000);
+        IHistogram1D ampcl2 = aida.histogram1D("Amp Pz>1000 (CluOnTrack)", 50, 0, 5000);
+        nTracks = aida.histogram1D("Tracks per Event", 3, 0, 3);
+
+        plotter222.region(0).plot(nHits);
+        plotter222.region(3).plot(nTracks);
+        plotter222.region(1).plot(amp);
+        plotter222.region(4).plot(amp2);
+        plotter222.region(2).plot(ampcl);
+        plotter222.region(5).plot(ampcl2);
+
+
+        plotter3 = fac.createPlotterFactory().create("HPS Residual Plots");
+        plotter3.setTitle("Residuals");
+        //plotterFrame.addPlotter(plotter3);
+        IPlotterStyle style3 = plotter3.style();
+        style3.dataStyle().fillStyle().setColor("yellow");
+        style3.dataStyle().errorBarStyle().setVisible(false);
+        plotter3.createRegions(5, 2);
+
+        double minResidY = -1.5;
+        double maxResidY = 1.5;
+
+        double minResidX = -5;
+        double maxResidX = 5;
+
+        IHistogram1D mod1ResX = aida.histogram1D("Module 1 Residual X(mm)", 25, minResidX, maxResidX);
+        IHistogram1D mod1ResY = aida.histogram1D("Module 1 Residual Y(mm)", 25, minResidY, maxResidY);
+
+        IHistogram1D mod2ResX = aida.histogram1D("Module 2 Residual X(mm)", 25, minResidX, maxResidX);
+        IHistogram1D mod2ResY = aida.histogram1D("Module 2 Residual Y(mm)", 25, minResidY, maxResidY);
+
+        IHistogram1D mod3ResX = aida.histogram1D("Module 3 Residual X(mm)", 25, minResidX, maxResidX);
+        IHistogram1D mod3ResY = aida.histogram1D("Module 3 Residual Y(mm)", 25, minResidY, maxResidY);
+
+        IHistogram1D mod4ResX = aida.histogram1D("Module 4 Residual X(mm)", 25, minResidX, maxResidX);
+        IHistogram1D mod4ResY = aida.histogram1D("Module 4 Residual Y(mm)", 25, minResidY, maxResidY);
+
+        IHistogram1D mod5ResX = aida.histogram1D("Module 5 Residual X(mm)", 25, minResidX, maxResidX);
+        IHistogram1D mod5ResY = aida.histogram1D("Module 5 Residual Y(mm)", 25, minResidY, maxResidY);
+
+        plotter3.region(0).plot(mod1ResX);
+        plotter3.region(2).plot(mod2ResX);
+        plotter3.region(4).plot(mod3ResX);
+        plotter3.region(6).plot(mod4ResX);
+        plotter3.region(8).plot(mod5ResX);
+
+        plotter3.region(1).plot(mod1ResY);
+        plotter3.region(3).plot(mod2ResY);
+        plotter3.region(5).plot(mod3ResY);
+        plotter3.region(7).plot(mod4ResY);
+        plotter3.region(9).plot(mod5ResY);
+
+
+        plotter3_1 = fac.createPlotterFactory().create("HPS Residual Plots (Single hit per layer)");
+        plotter3_1.setTitle("Residuals (Top)");
+        //plotterFrame.addPlotter(plotter3_1);
+        IPlotterStyle style3_1 = plotter3_1.style();
+        style3_1.dataStyle().fillStyle().setColor("yellow");
+        style3_1.dataStyle().errorBarStyle().setVisible(false);
+        plotter3_1.createRegions(5, 2);
+
+        IHistogram1D mod1ResX_Top = aida.histogram1D("Module 1 Residual X(mm) Top", 25, minResidX, maxResidX);
+        IHistogram1D mod1ResY_Top = aida.histogram1D("Module 1 Residual Y(mm) Top", 25, minResidY, maxResidY);
+
+        IHistogram1D mod2ResX_Top = aida.histogram1D("Module 2 Residual X(mm) Top", 25, minResidX, maxResidX);
+        IHistogram1D mod2ResY_Top = aida.histogram1D("Module 2 Residual Y(mm) Top", 25, minResidY, maxResidY);
+
+        IHistogram1D mod3ResX_Top = aida.histogram1D("Module 3 Residual X(mm) Top", 25, minResidX, maxResidX);
+        IHistogram1D mod3ResY_Top = aida.histogram1D("Module 3 Residual Y(mm) Top", 25, minResidY, maxResidY);
+
+        IHistogram1D mod4ResX_Top = aida.histogram1D("Module 4 Residual X(mm) Top", 25, minResidX, maxResidX);
+        IHistogram1D mod4ResY_Top = aida.histogram1D("Module 4 Residual Y(mm) Top", 25, minResidY, maxResidY);
+
+        IHistogram1D mod5ResX_Top = aida.histogram1D("Module 5 Residual X(mm) Top", 25, minResidX, maxResidX);
+        IHistogram1D mod5ResY_Top = aida.histogram1D("Module 5 Residual Y(mm) Top", 25, minResidY, maxResidY);
+
+        plotter3_1.region(0).plot(mod1ResX_Top);
+        plotter3_1.region(2).plot(mod2ResX_Top);
+        plotter3_1.region(4).plot(mod3ResX_Top);
+        plotter3_1.region(6).plot(mod4ResX_Top);
+        plotter3_1.region(8).plot(mod5ResX_Top);
+
+        plotter3_1.region(1).plot(mod1ResY_Top);
+        plotter3_1.region(3).plot(mod2ResY_Top);
+        plotter3_1.region(5).plot(mod3ResY_Top);
+        plotter3_1.region(7).plot(mod4ResY_Top);
+        plotter3_1.region(9).plot(mod5ResY_Top);
+
+
+        plotter3_2 = fac.createPlotterFactory().create("HPS Residual Plots (Single strip cluster per layer)");
+        plotter3_2.setTitle("Residuals (Bottom)");
+        //plotterFrame.addPlotter(plotter3_2);
+        IPlotterStyle style3_2 = plotter3_2.style();
+        style3_2.dataStyle().fillStyle().setColor("yellow");
+        style3_2.dataStyle().errorBarStyle().setVisible(false);
+        plotter3_2.createRegions(5, 2);
+
+        IHistogram1D mod1ResX_Bottom = aida.histogram1D("Module 1 Residual X(mm) Bottom", 25, minResidX, maxResidX);
+        IHistogram1D mod1ResY_Bottom = aida.histogram1D("Module 1 Residual Y(mm) Bottom", 25, minResidY, maxResidY);
+
+        IHistogram1D mod2ResX_Bottom = aida.histogram1D("Module 2 Residual X(mm) Bottom", 25, minResidX, maxResidX);
+        IHistogram1D mod2ResY_Bottom = aida.histogram1D("Module 2 Residual Y(mm) Bottom", 25, minResidY, maxResidY);
+
+        IHistogram1D mod3ResX_Bottom = aida.histogram1D("Module 3 Residual X(mm) Bottom", 25, minResidX, maxResidX);
+        IHistogram1D mod3ResY_Bottom = aida.histogram1D("Module 3 Residual Y(mm) Bottom", 25, minResidY, maxResidY);
+
+        IHistogram1D mod4ResX_Bottom = aida.histogram1D("Module 4 Residual X(mm) Bottom", 25, minResidX, maxResidX);
+        IHistogram1D mod4ResY_Bottom = aida.histogram1D("Module 4 Residual Y(mm) Bottom", 25, minResidY, maxResidY);
+
+        IHistogram1D mod5ResX_Bottom = aida.histogram1D("Module 5 Residual X(mm) Bottom", 25, minResidX, maxResidX);
+        IHistogram1D mod5ResY_Bottom = aida.histogram1D("Module 5 Residual Y(mm) Bottom", 25, minResidY, maxResidY);
+
+        plotter3_2.region(0).plot(mod1ResX_Bottom);
+        plotter3_2.region(2).plot(mod2ResX_Bottom);
+        plotter3_2.region(4).plot(mod3ResX_Bottom);
+        plotter3_2.region(6).plot(mod4ResX_Bottom);
+        plotter3_2.region(8).plot(mod5ResX_Bottom);
+
+        plotter3_2.region(1).plot(mod1ResY_Bottom);
+        plotter3_2.region(3).plot(mod2ResY_Bottom);
+        plotter3_2.region(5).plot(mod3ResY_Bottom);
+        plotter3_2.region(7).plot(mod4ResY_Bottom);
+        plotter3_2.region(9).plot(mod5ResY_Bottom);
+
+
+
+
+        plotter4 = fac.createPlotterFactory().create("HPS Track and ECal Plots");
+        plotter4.setTitle("Track and ECal Correlations");
+        //plotterFrame.addPlotter(plotter4);
+        IPlotterStyle style4 = plotter4.style();
+        style4.setParameter("hist2DStyle", "colorMap");
+        style4.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style4.dataStyle().fillStyle().setColor("yellow");
+        style4.dataStyle().errorBarStyle().setVisible(false);
+        plotter4.createRegions(2, 3);
+
+        IHistogram2D eVsP = aida.histogram2D("Energy Vs Momentum", 50, 0, 500, 50, 0, 3000);
+        IHistogram1D eOverP = aida.histogram1D("Energy Over Momentum", 50, 0, 2);
+
+        IHistogram1D distX = aida.histogram1D("deltaX", 50, -400, 400);
+        IHistogram1D distY = aida.histogram1D("deltaY", 50, -40, 40);
+
+//        IHistogram1D distX2 = aida.histogram1D("deltaX (Pz>1)", 50, -400, 400);
+//        IHistogram1D distY2 = aida.histogram1D("deltaY (Pz>1)", 50, -40, 40);
+
+        IHistogram2D xEcalVsTrk = aida.histogram2D("X ECal Vs Track", 100, -400, 400, 100, -400, 400);
+        IHistogram2D yEcalVsTrk = aida.histogram2D("Y ECal Vs Track", 100, -100, 100, 100, -100, 100);
+
+        plotter4.region(0).plot(eVsP);
+        plotter4.region(3).plot(eOverP);
+        plotter4.region(1).plot(distX);
+        plotter4.region(4).plot(distY);
+        plotter4.region(2).plot(xEcalVsTrk);
+        plotter4.region(5).plot(yEcalVsTrk);
+
+
+        //   ******************************************************************
+
+
+        top2 = fac.createPlotterFactory().create("Top ECal Plots");
+        top2.setTitle("Top ECal Correlations");
+        IPlotterStyle stop2 = top2.style();
+        stop2.dataStyle().fillStyle().setColor("green");
+        stop2.dataStyle().errorBarStyle().setVisible(false);
+        stop2.setParameter("hist2DStyle", "colorMap");
+        stop2.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        top2.createRegions(2, 3);
+        //topFrame.addPlotter(top2);
+
+        IHistogram2D topeVsP = aida.histogram2D("Top Energy Vs Momentum", 50, 0, 500, 50, 0, 3000);
+        IHistogram1D topeOverP = aida.histogram1D("Top Energy Over Momentum", 50, 0, 2);
+
+        IHistogram1D topdistX = aida.histogram1D("Top deltaX", 50, -400, 400);
+        IHistogram1D topdistY = aida.histogram1D("Top deltaY", 50, -40, 40);
+        
+
+        IHistogram2D topxEcalVsTrk = aida.histogram2D("Top X ECal Vs Track", 100, -400, 400, 100, -400, 400);
+        IHistogram2D topyEcalVsTrk = aida.histogram2D("Top Y ECal Vs Track", 100, 0, 100, 100, 0, 100);
+
+
+        top2.region(0).plot(topeVsP);
+        top2.region(3).plot(topeOverP);
+        top2.region(1).plot(topdistX);
+        top2.region(4).plot(topdistY);
+        top2.region(2).plot(topxEcalVsTrk);
+        top2.region(5).plot(topyEcalVsTrk);
+
+
+        bot2 = fac.createPlotterFactory().create("Bottom ECal Plots");
+        bot2.setTitle("Bottom ECal Correlations");
+        IPlotterStyle sbot2 = bot2.style();
+        sbot2.dataStyle().fillStyle().setColor("green");
+        sbot2.dataStyle().errorBarStyle().setVisible(false);
+        sbot2.setParameter("hist2DStyle", "colorMap");
+        sbot2.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        bot2.createRegions(2, 3);
+        //bottomFrame.addPlotter(bot2);
+
+        IHistogram2D BottomeVsP = aida.histogram2D("Bottom Energy Vs Momentum", 50, 0, 500, 50, 0, 3000);
+        IHistogram1D BottomeOverP = aida.histogram1D("Bottom Energy Over Momentum", 50, 0, 2);
+
+        IHistogram1D BottomdistX = aida.histogram1D("Bottom deltaX", 50, -400, 400);
+        IHistogram1D BottomdistY = aida.histogram1D("Bottom deltaY", 50, -40, 40);
+        
+        
+        IHistogram2D BottomxEcalVsTrk = aida.histogram2D("Bottom X ECal Vs Track", 100, -400, 400, 100, -400, 400);
+        IHistogram2D BottomyEcalVsTrk = aida.histogram2D("Bottom Y ECal Vs Track", 100, -100, 0, 100, -100, 0);
+
+
+        bot2.region(0).plot(BottomeVsP);
+        bot2.region(3).plot(BottomeOverP);
+        bot2.region(1).plot(BottomdistX);
+        bot2.region(4).plot(BottomdistY);
+        bot2.region(2).plot(BottomxEcalVsTrk);
+        bot2.region(5).plot(BottomyEcalVsTrk);
+
+        
+//   ******************************************************************
+
+        top3 = fac.createPlotterFactory().create("Top ECal Plots");
+        top3.setTitle("Top ECal More Correlations");
+        IPlotterStyle stop3 = top3.style();
+        stop3.dataStyle().fillStyle().setColor("green");
+        stop3.dataStyle().errorBarStyle().setVisible(false);
+        stop3.setParameter("hist2DStyle", "colorMap");
+        stop3.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        top3.createRegions(1, 2);
+        //topFrame.addPlotter(top3);
+        
+        IHistogram2D topdistXvsX = aida.histogram2D("Top deltaX vs X", 51,-400,400, 25, -400, 400);
+        IHistogram2D topdistYvsY = aida.histogram2D("Top deltaY vs Y", 51,0,100, 25, -40, 40);
+        
+        top3.region(0).plot(topdistXvsX);
+        top3.region(1).plot(topdistYvsY);
+        
+        
+        bot3 = fac.createPlotterFactory().create("Bottom ECal Plots");
+        bot3.setTitle("Bottom ECal More Correlations");
+        IPlotterStyle sbot3 = bot3.style();
+        sbot3.dataStyle().fillStyle().setColor("green");
+        sbot3.dataStyle().errorBarStyle().setVisible(false);
+        sbot3.setParameter("hist2DStyle", "colorMap");
+        sbot3.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        bot3.createRegions(1, 2);
+        //bottomFrame.addPlotter(bot3);
+        
+        
+        IHistogram2D botdistXvsX = aida.histogram2D("Bottom deltaX vs X", 51,-400,400, 25, -400, 400);
+        IHistogram2D botdistYvsY = aida.histogram2D("Bottom deltaY vs Y", 51,-100,0, 25, -40, 40);
+        
+        
+        bot3.region(0).plot(botdistXvsX);
+        bot3.region(1).plot(botdistYvsY);
+        
+        
+//   ******************************************************************
+
+
+        plotter5 = fac.createPlotterFactory().create("HPS Hit Positions");
+        plotter5.setTitle("Hit Positions:  Top");
+        //plotterFrame.addPlotter(plotter5);
+        IPlotterStyle style5 = plotter5.style();
+        style5.setParameter("hist2DStyle", "colorMap");
+        style5.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style5.dataStyle().fillStyle().setColor("yellow");
+        style5.dataStyle().errorBarStyle().setVisible(false);
+        plotter5.createRegions(1, 2);
+
+        IHistogram1D charge = aida.histogram1D("Charge", 3, -1, 1);
+
+        IHistogram2D l1Pos = aida.histogram2D("Layer 1 HTH Position:  Top", 50, -55, 55, 55, -25, 25);
+        IHistogram2D l7Pos = aida.histogram2D("Layer 7 HTH Position:  Top", 50, -55, 55, 55, -25, 25);
+
+        plotter5.region(0).plot(l1Pos);
+        plotter5.region(1).plot(l7Pos);
+
+        plotter5_1 = fac.createPlotterFactory().create("HPS Hit Positions");
+        plotter5_1.setTitle("Hit Positions:  Bottom");
+        //plotterFrame.addPlotter(plotter5_1);
+        IPlotterStyle style5_1 = plotter5_1.style();
+        style5_1.setParameter("hist2DStyle", "colorMap");
+        style5_1.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style5_1.dataStyle().fillStyle().setColor("yellow");
+        style5_1.dataStyle().errorBarStyle().setVisible(false);
+        plotter5_1.createRegions(1, 2);
+
+        IHistogram2D l1PosBot = aida.histogram2D("Layer 1 HTH Position:  Bottom", 50, -55, 55, 55, -25, 25);
+        IHistogram2D l7PosBot = aida.histogram2D("Layer 7 HTH Position:  Bottom", 50, -55, 55, 55, -25, 25);
+        plotter5_1.region(0).plot(l1PosBot);
+        plotter5_1.region(1).plot(l7PosBot);
+
+        plotter55 = fac.createPlotterFactory().create("HPS Hit Positions");
+        plotter55.setTitle("Helical Track Hits");
+        //plotterFrame.addPlotter(plotter55);
+        IPlotterStyle style55 = plotter55.style();
+        style55.dataStyle().fillStyle().setColor("Green");
+        style55.dataStyle().errorBarStyle().setVisible(false);
+        style55.dataStyle().markerStyle().setSize(20);
+        plotter55.createRegions(1, 2);
+
+        IProfile avgLayersTopPlot = aida.profile1D("Number of Stereo Hits per layer in Top Half", 5, 1, 11);
+        IProfile avgLayersBottomPlot = aida.profile1D("Number of Stereo Hits per layer in Bottom Half", 5, 1, 11);
+
+
+        plotter55.region(0).plot(avgLayersTopPlot);
+        plotter55.region(1).plot(avgLayersBottomPlot);
+
+
+        plotter6 = fac.createPlotterFactory().create("HPS ECAL Hit Positions");
+        plotter6.setTitle("ECAL Positions");
+        //plotterFrame.addPlotter(plotter6);
+        IPlotterStyle style6 = plotter6.style();
+        style6.setParameter("hist2DStyle", "colorMap");
+        style6.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style6.dataStyle().fillStyle().setColor("yellow");
+        style6.dataStyle().errorBarStyle().setVisible(false);
+        plotter6.createRegions(4, 2);
+
+
+        IHistogram2D topECal = aida.histogram2D("Top ECal Cluster Position", 50, -400, 400, 10, 0, 100);
+        IHistogram2D botECal = aida.histogram2D("Bottom ECal Cluster Position", 50, -400, 400, 10, -100, 0);
+        IHistogram2D topECal1 = aida.histogram2D("Top ECal Cluster Position (>0 tracks)", 50, -400, 400, 10, 0, 100);
+        IHistogram2D botECal1 = aida.histogram2D("Bottom ECal Cluster Position (>0 tracks)", 50, -400, 400, 10, -100, 0);
+        IHistogram2D topECal2 = aida.histogram2D("Top ECal Cluster Position (E>100,>0 tracks)", 50, -400, 400, 10, 0, 100);
+        IHistogram2D botECal2 = aida.histogram2D("Bottom ECal Cluster Position (E>100,>0 tracks)", 50, -400, 400, 10, -100, 0);
+        IHistogram2D topECal3 = aida.histogram2D("Top ECal Cluster Position w_E (E>100,>0 tracks)", 50, -400, 400, 10, 0, 100);
+        IHistogram2D botECal3 = aida.histogram2D("Bottom ECal Cluster Position w_E (E>100,>0 tracks)", 50, -400, 400, 10, -100, 0);
+
+
+        plotter6.region(0).plot(topECal);
+        plotter6.region(1).plot(botECal);
+        plotter6.region(2).plot(topECal1);
+        plotter6.region(3).plot(botECal1);
+        plotter6.region(4).plot(topECal2);
+        plotter6.region(5).plot(botECal2);
+        plotter6.region(6).plot(topECal3);
+        plotter6.region(7).plot(botECal3);
+
+        //plotterFrame.pack();
+        //plotterFrame.setVisible(true);
+
+        //topFrame.pack();
+        //topFrame.setVisible(true);
+
+        //bottomFrame.pack();
+        //bottomFrame.setVisible(true);
+
+        plotter7 = fac.createPlotterFactory().create("HPS ECAL Hit Positions");
+        plotter7.setTitle("Basic Misc Stuff");
+        //plotterFrame.addPlotter(plotter7);
+        IPlotterStyle style7 = plotter7.style();
+        style7.setParameter("hist2DStyle", "colorMap");
+        style7.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style7.dataStyle().fillStyle().setColor("yellow");
+        style7.dataStyle().errorBarStyle().setVisible(false);
+        plotter7.createRegions(2, 2);
+
+        IHistogram2D quadrants = aida.histogram2D("Charge vs Slope", 2, -1, 1, 2, -1, 1);
+        plotter7.region(0).plot(quadrants);
+
+
+    }
+
+    public TrackingReconstructionPlots() {
+    }
+
+    public void setOutputPlots(String output) {
+        this.outputPlots = output;
+    }
+
+    public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) {
+        this.rawTrackerHitCollectionName = rawTrackerHitCollectionName;
+    }
+
+    public void setFittedTrackerHitCollectionName(String fittedTrackerHitCollectionName) {
+        this.fittedTrackerHitCollectionName = fittedTrackerHitCollectionName;
+    }
+
+    public void setTrackerHitCollectionName(String trackerHitCollectionName) {
+        this.trackerHitCollectionName = trackerHitCollectionName;
+    }
+
+    public void setHelicalTrackHitCollectionName(String helicalTrackHitCollectionName) {
+        this.helicalTrackHitCollectionName = helicalTrackHitCollectionName;
+    }
+
+    public void setTrackCollectionName(String trackCollectionName) {
+        this.trackCollectionName = trackCollectionName;
+    }
+
+    @Override
+    public void process(EventHeader event) {
+        aida.tree().cd("/");
+        if (!event.hasCollection(HelicalTrackHit.class, helicalTrackHitCollectionName)) {
+//            System.out.println(helicalTrackHitCollectionName + " does not exist; skipping event");
+            return;
+        }
+
+        List<HelicalTrackHit> rotList = event.get(HelicalTrackHit.class, rotatedTrackHitCollectionName);
+        for (HelicalTrackHit hth : rotList) {
+            HelicalTrackCross htc = (HelicalTrackCross) hth;
+//            System.out.println("TrackingReconstructionPlots::original helical track position = "+hth.getPosition()[0]+","+hth.getPosition()[1]+","+hth.getPosition()[2]);
+//            System.out.println("TrackingReconstructionPlots::corrected helical track position = "+htc.getCorrectedPosition().toString());
+        }
+        List<HelicalTrackHit> hthList = event.get(HelicalTrackHit.class, helicalTrackHitCollectionName);
+        int[] layersTop = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+        int[] layersBot = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+        for (HelicalTrackHit hth : hthList) {
+            HelicalTrackCross htc = (HelicalTrackCross) hth;
+//            System.out.println("TrackingReconstructionPlots::original helical track position = "+hth.getPosition()[0]+","+hth.getPosition()[1]+","+hth.getPosition()[2]);
+//            System.out.println("TrackingReconstructionPlots::corrected helical track position = "+htc.getCorrectedPosition().toString());
+            //These Helical Track Hits are in the JLAB frame
+//            htc.resetTrackDirection();
+            double x = htc.getPosition()[0];
+            double y = htc.getPosition()[1];
+            SiSensor sensor = ((SiSensor) ((RawTrackerHit) htc.getRawHits().get(0)).getDetectorElement());
+            if (SvtUtils.getInstance().isTopLayer(sensor)) {
+                layersTop[htc.Layer() - 1]++;
+                Hep3Vector sensorPos = ((SiSensor) ((RawTrackerHit) htc.getRawHits().get(0)).getDetectorElement()).getGeometry().getPosition();
+                if (htc.Layer() == 1) {
+//                    System.out.println(sensorPos.toString());
+//                    System.out.println("Hit X = " + x + "; Hit Y = " + y);
+//                    aida.histogram2D("Layer 1 HTH Position:  Top").fill(x - sensorPos.x(), y - sensorPos.y());
+                }
+//                if (htc.Layer() == 7)
+//                    aida.histogram2D("Layer 7 HTH Position:  Top").fill(x - sensorPos.x(), y - sensorPos.y());
+            } else {
+                layersBot[htc.Layer() - 1]++;
+                Hep3Vector sensorPos = ((SiSensor) ((RawTrackerHit) htc.getRawHits().get(0)).getDetectorElement()).getGeometry().getPosition();
+                if (htc.Layer() == 1) {
+//                    System.out.println(sensorPos.toString());
+//                    System.out.println("Hit X = " + x + "; Hit Y = " + y);
+//                    aida.histogram2D("Layer 1 HTH Position:  Bottom").fill(x - sensorPos.x(), y - sensorPos.y());
+                }
+//                if (htc.Layer() == 7)
+//                    aida.histogram2D("Layer 7 HTH Position:  Bottom").fill(x - sensorPos.x(), y - sensorPos.y());
+            }
+        }
+        for (int i = 0; i < 10; i++) {
+            aida.profile1D("Number of Stereo Hits per layer in Top Half").fill(i + 1, layersTop[i]);
+            aida.profile1D("Number of Stereo Hits per layer in Bottom Half").fill(i + 1, layersBot[i]);
+        }
+        if (!event.hasCollection(Track.class, trackCollectionName)) {
+//            System.out.println(trackCollectionName + " does not exist; skipping event");
+            aida.histogram1D("Number Tracks/Event").fill(0);
+            return;
+        }
+
+
+
+        List<Track> tracks = event.get(Track.class, trackCollectionName);
+        nTracks.fill(tracks.size());
+        if (event.hasCollection(HPSEcalCluster.class, ecalCollectionName)) {
+            List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, ecalCollectionName);
+            for (HPSEcalCluster cluster : clusters) {
+                //System.out.println("cluser position = ("+cluster.getPosition()[0]+","+cluster.getPosition()[1]+") with energy = "+cluster.getEnergy());
+                if (cluster.getPosition()[1] > 0)
+                    aida.histogram2D("Top ECal Cluster Position").fill(cluster.getPosition()[0], cluster.getPosition()[1]);
+                if (cluster.getPosition()[1] < 0)
+                    aida.histogram2D("Bottom ECal Cluster Position").fill(cluster.getPosition()[0], cluster.getPosition()[1]);
+
+                if (tracks.size() > 0) {
+                    if (cluster.getPosition()[1] > 0)
+                        aida.histogram2D("Top ECal Cluster Position (>0 tracks)").fill(cluster.getPosition()[0], cluster.getPosition()[1]);
+                    if (cluster.getPosition()[1] < 0)
+                        aida.histogram2D("Bottom ECal Cluster Position (>0 tracks)").fill(cluster.getPosition()[0], cluster.getPosition()[1]);
+
+                    if (cluster.getEnergy() > 100) {
+                        if (cluster.getPosition()[1] > 0) {
+                            aida.histogram2D("Top ECal Cluster Position (E>100,>0 tracks)").fill(cluster.getPosition()[0], cluster.getPosition()[1]);
+                            aida.histogram2D("Top ECal Cluster Position w_E (E>100,>0 tracks)").fill(cluster.getPosition()[0], cluster.getPosition()[1], cluster.getEnergy());
+                        }
+                        if (cluster.getPosition()[1] < 0) {
+                            aida.histogram2D("Bottom ECal Cluster Position (E>100,>0 tracks)").fill(cluster.getPosition()[0], cluster.getPosition()[1]);
+                            aida.histogram2D("Bottom ECal Cluster Position w_E (E>100,>0 tracks)").fill(cluster.getPosition()[0], cluster.getPosition()[1], cluster.getEnergy());
+                        }
+                    }
+                }
+
+
+
+            }
+        }
+
+
+        List<SiTrackerHitStrip1D> stripHits = event.get(SiTrackerHitStrip1D.class, "StripClusterer_SiTrackerHitStrip1D");
+        int stripClustersPerLayerTop[] = getStripClustersPerLayer(stripHits, "up");
+        //int stripClustersPerLayerBottom[] = getStripClustersPerLayer(stripHits,"down");
+
+        boolean hasSingleStripClusterPerLayer = singleStripClusterPerLayer(stripClustersPerLayerTop);
+
+        for (Track trk : tracks) {
+
+            boolean isSingleHitPerLayerTrack = singleTrackHitPerLayer(trk);
+
+            aida.histogram1D("Track Momentum (Px)").fill(trk.getPY());
+            aida.histogram1D("Track Momentum (Py)").fill(trk.getPZ());
+            aida.histogram1D("Track Momentum (Pz)").fill(trk.getPX());
+            aida.histogram1D("Track Chi2").fill(trk.getChi2());
+
+            aida.histogram1D("Hits per Track").fill(trk.getTrackerHits().size());
+            SeedTrack stEle = (SeedTrack) trk;
+            SeedCandidate seedEle = stEle.getSeedCandidate();
+            HelicalTrackFit ht = seedEle.getHelix();
+            HelixConverter converter = new HelixConverter(0);
+            StraightLineTrack slt = converter.Convert(ht);
+
+            Hep3Vector posAtEcal = TrackUtils.getTrackPositionAtEcal(trk);
+
+            aida.histogram1D("X (mm) @ Z=-60cm").fill(slt.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[0]);  //this is y in the tracker frame
+            aida.histogram1D("Y (mm) @ Z=-60cm").fill(slt.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN)[1]);  //this is z in the tracker frame
+            //double sECAL = HelixUtils.PathToXPlane(ht, zEcal, 3000, 1).get(0);
+            aida.histogram1D("X (mm) @ Z=-150cm").fill(slt.getYZAtX(zAtColl)[0]);
+            aida.histogram1D("Y (mm) @ Z=-150cm").fill(slt.getYZAtX(zAtColl)[1]);
+
+
+            //Straight line after field-region???
+            //HelixConverter converterEcal = new HelixConverter(zAtDownStrPairSpec);
+            //StraightLineTrack sltEcal = converterEcal.Convert(ht);
+//            double sECAL = HelixUtils.PathToXPlane(ht, zEcal, 3000, 1).get(0);
+//            Hep3Vector posonhelix = HelixUtils.PointOnHelix(ht, sECAL);//position in tracker coordinates!
+
+            aida.histogram1D("X (mm) @ ECAL").fill(posAtEcal.x());
+            aida.histogram1D("Y (mm) @ ECAL").fill(posAtEcal.y());
+            if (trk.getPX() > 1.0) {
+                aida.histogram1D("X (mm) @ ECAL (Pz>1)").fill(posAtEcal.x());
+                aida.histogram1D("Y (mm) @ ECAL (Pz>1)").fill(posAtEcal.y());
+            }
+            aida.histogram1D("d0 ").fill(trk.getTrackParameter(ParameterName.d0.ordinal()));
+            aida.histogram1D("sinphi ").fill(Math.sin(trk.getTrackParameter(ParameterName.phi0.ordinal())));
+            aida.histogram1D("omega ").fill(trk.getTrackParameter(ParameterName.omega.ordinal()));
+            aida.histogram1D("tan(lambda) ").fill(trk.getTrackParameter(ParameterName.tanLambda.ordinal()));
+            aida.histogram1D("z0 ").fill(trk.getTrackParameter(ParameterName.z0.ordinal()));
+
+            int isTop = -1;
+            if (trk.getTrackerHits().get(0).getPosition()[2] > 0)
+                isTop = 0;//make plot look pretty
+            int charge = trk.getCharge();
+            if (charge > 0)
+                charge = 0;//make plot look pretty
+//            System.out.println("Charge = " + charge + "; isTop = " + isTop);
+            aida.histogram2D("Charge vs Slope").fill(charge, isTop);
+            if (isTop == 0) {
+                aida.histogram1D("Top Track Momentum (Px)").fill(trk.getPY());
+                aida.histogram1D("Top Track Momentum (Py)").fill(trk.getPZ());
+                aida.histogram1D("Top Track Momentum (Pz)").fill(trk.getPX());
+                aida.histogram1D("Top Track Chi2").fill(trk.getChi2());
+            } else {
+                aida.histogram1D("Bottom Track Momentum (Px)").fill(trk.getPY());
+                aida.histogram1D("Bottom Track Momentum (Py)").fill(trk.getPZ());
+                aida.histogram1D("Bottom Track Momentum (Pz)").fill(trk.getPX());
+                aida.histogram1D("Bottom Track Chi2").fill(trk.getChi2());
+            }
+            List<TrackerHit> hitsOnTrack = trk.getTrackerHits();
+            for (TrackerHit hit : hitsOnTrack) {
+                HelicalTrackHit htc = (HelicalTrackHit) hit;
+                HelicalTrackCross htcross = (HelicalTrackCross) htc;
+                double sHit = ht.PathMap().get(htc);
+                Hep3Vector posonhelix = HelixUtils.PointOnHelix(ht, sHit);
+
+                double yTr = posonhelix.y();
+                double zTr = posonhelix.z();
+                int layer = htc.Layer();
+                String modNum = "Module X ";
+                if (layer == 1)
+                    modNum = "Module 1 ";
+                if (layer == 3)
+                    modNum = "Module 2 ";
+                if (layer == 5)
+                    modNum = "Module 3 ";
+                if (layer == 7)
+                    modNum = "Module 4 ";
+                if (layer == 9)
+                    modNum = "Module 5 ";
+                SymmetricMatrix cov = htc.getCorrectedCovMatrix();
+
+                aida.histogram1D(modNum + "Residual X(mm)").fill(htcross.getCorrectedPosition().y() - yTr);//these hits should be rotated track hits already
+                aida.histogram1D(modNum + "Residual Y(mm)").fill(htcross.getCorrectedPosition().z() - zTr);//these hits should be rotated track hits already
+                if (hit.getPosition()[2] > 0) {
+                    aida.histogram1D(modNum + "Residual X(mm) Top").fill(htcross.getCorrectedPosition().y() - yTr);//these hits should be rotated track hits already
+                    aida.histogram1D(modNum + "Residual Y(mm) Top").fill(htcross.getCorrectedPosition().z() - zTr);//these hits should be rotated track hits already
+
+                }
+                if (hit.getPosition()[2] < 0) {
+                    aida.histogram1D(modNum + "Residual X(mm) Bottom").fill(htcross.getCorrectedPosition().y() - yTr);//these hits should be rotated track hits already
+                    aida.histogram1D(modNum + "Residual Y(mm) Bottom").fill(htcross.getCorrectedPosition().z() - zTr);//these hits should be rotated track hits already
+
+                }
+                SiSensor sensor = ((SiSensor) ((RawTrackerHit) htc.getRawHits().get(0)).getDetectorElement());
+                double x = htcross.getCorrectedPosition().y();
+                double y = htcross.getCorrectedPosition().z();
+                if (SvtUtils.getInstance().isTopLayer(sensor)) {
+                    layersTop[htc.Layer() - 1]++;
+                    Hep3Vector sensorPos = ((SiSensor) ((RawTrackerHit) htc.getRawHits().get(0)).getDetectorElement()).getGeometry().getPosition();
+                    if (htc.Layer() == 1) {
+//                    System.out.println(sensorPos.toString());
+//                    System.out.println("Hit X = " + x + "; Hit Y = " + y);
+                        aida.histogram2D("Layer 1 HTH Position:  Top").fill(x - sensorPos.x(), y - sensorPos.y());
+                    }
+                    if (htc.Layer() == 7)
+                        aida.histogram2D("Layer 7 HTH Position:  Top").fill(x - sensorPos.x(), y - sensorPos.y());
+                } else {
+                    layersBot[htc.Layer() - 1]++;
+                    Hep3Vector sensorPos = ((SiSensor) ((RawTrackerHit) htc.getRawHits().get(0)).getDetectorElement()).getGeometry().getPosition();
+                    if (htc.Layer() == 1) {
+//                    System.out.println(sensorPos.toString());
+//                    System.out.println("Hit X = " + x + "; Hit Y = " + y);
+                        aida.histogram2D("Layer 1 HTH Position:  Bottom").fill(x - sensorPos.x(), y - sensorPos.y());
+                    }
+                    if (htc.Layer() == 7)
+                        aida.histogram2D("Layer 7 HTH Position:  Bottom").fill(x - sensorPos.x(), y - sensorPos.y());
+                }
+/*
+                List<RawTrackerHit> rawHits = hit.getRawHits();                
+                for (RawTrackerHit rawHit : rawHits) {
+                    ChannelConstants constants = HPSSVTCalibrationConstants.getChannelConstants((SiSensor) rawHit.getDetectorElement(), rawHit.getIdentifierFieldValue("strip"));
+                    HPSShapeFitParameters fit = _shaper.fitShape(rawHit, constants);
+                    double amp = fit.getAmp();
+                    
+                    aida.histogram1D("Amp (HitOnTrack)").fill(amp);
+                    if (trk.getPX() > 1)
+                        aida.histogram1D("Amp Pz>1000 (HitOnTrack)").fill(amp);
+                }                
+                */
+
+               for(HelicalTrackStrip hts:htcross.getStrips()){
+                   double clusterSum=0;                 
+                   for(RawTrackerHit rawHit: (List<RawTrackerHit>)hts.rawhits()){
+                       ChannelConstants constants = HPSSVTCalibrationConstants.getChannelConstants((SiSensor) rawHit.getDetectorElement(), rawHit.getIdentifierFieldValue("strip"));
+                        HPSShapeFitParameters fit = _shaper.fitShape(rawHit, constants);
+                        double amp = fit.getAmp();
+                        clusterSum+=amp;
+                         aida.histogram1D("Amp (HitOnTrack)").fill(amp);
+                    if (trk.getPX() > 1)
+                        aida.histogram1D("Amp Pz>1000 (HitOnTrack)").fill(amp);
+                   }
+                   aida.histogram1D("Amp (CluOnTrack)").fill(clusterSum);
+                      if (trk.getPX() > 1)
+                    aida.histogram1D("Amp Pz>1000 (CluOnTrack)").fill(clusterSum);
+                }
+            }
+            List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, ecalCollectionName);
+            HPSEcalCluster clust = findClosestCluster(posAtEcal, clusters);
+
+            //           if (clust != null) {
+            if (clust != null) {
+                
+                posAtEcal = TrackUtils.extrapolateTrack(trk,clust.getPosition()[2]);//.positionAtEcal();
+
+                aida.histogram2D("Energy Vs Momentum").fill(clust.getEnergy(), trk.getPX() * 1000.0);
+                aida.histogram1D("Energy Over Momentum").fill(clust.getEnergy() / (trk.getPX() * 1000.0));
+                aida.histogram1D("deltaX").fill(clust.getPosition()[0] - posAtEcal.x());
+                aida.histogram1D("deltaY").fill(clust.getPosition()[1] - posAtEcal.y());
+//                if (trk.getPX() > 1.0) {
+//                    aida.histogram1D("deltaX (Pz>1)").fill(clust.getPosition()[0] - posAtEcal.y());
+//                    aida.histogram1D("deltaY (Pz>1)").fill(clust.getPosition()[1] - posAtEcal.z());
+//                }
+                aida.histogram2D("X ECal Vs Track").fill(clust.getPosition()[0], posAtEcal.x());
+                aida.histogram2D("Y ECal Vs Track").fill(clust.getPosition()[1], posAtEcal.y());
+                if (isTop == 0) {
+                    aida.histogram2D("Top Energy Vs Momentum").fill(clust.getEnergy(), trk.getPX() * 1000.0);
+//                    aida.histogram2D("Top Energy Vs Momentum").fill(posAtEcal.y(), trk.getPX() * 1000.0);
+                    aida.histogram1D("Top Energy Over Momentum").fill(clust.getEnergy() / (trk.getPX() * 1000.0));
+                    aida.histogram1D("Top deltaX").fill(clust.getPosition()[0] - posAtEcal.x());
+                    aida.histogram1D("Top deltaY").fill(clust.getPosition()[1] - posAtEcal.y());
+                    aida.histogram2D("Top deltaX vs X").fill(clust.getPosition()[0],clust.getPosition()[0] - posAtEcal.x());
+                    aida.histogram2D("Top deltaY vs Y").fill(clust.getPosition()[1],clust.getPosition()[1] - posAtEcal.y());
+                    aida.histogram2D("Top X ECal Vs Track").fill(clust.getPosition()[0], posAtEcal.x());
+                    aida.histogram2D("Top Y ECal Vs Track").fill(clust.getPosition()[1], posAtEcal.y());
+                } else {
+                    aida.histogram2D("Bottom Energy Vs Momentum").fill(clust.getEnergy(), trk.getPX() * 1000.0);
+                    aida.histogram1D("Bottom Energy Over Momentum").fill(clust.getEnergy() / (trk.getPX() * 1000.0));
+                    aida.histogram1D("Bottom deltaX").fill(clust.getPosition()[0] - posAtEcal.x());
+                    aida.histogram1D("Bottom deltaY").fill(clust.getPosition()[1] - posAtEcal.y());
+                    aida.histogram2D("Bottom deltaX vs X").fill(clust.getPosition()[0],clust.getPosition()[0] - posAtEcal.x());
+                    aida.histogram2D("Bottom deltaY vs Y").fill(clust.getPosition()[1],clust.getPosition()[1] - posAtEcal.y());
+                    aida.histogram2D("Bottom X ECal Vs Track").fill(clust.getPosition()[0], posAtEcal.x());
+                    aida.histogram2D("Bottom Y ECal Vs Track").fill(clust.getPosition()[1], posAtEcal.y());
+                }
+
+            }
+
+        }
+    }
+
+    public int[] getTrackHitsPerLayer(Track trk) {
+        int n[] = {0, 0, 0, 0, 0};
+        List<TrackerHit> hitsOnTrack = trk.getTrackerHits();
+        int layer;
+        for (TrackerHit hit : hitsOnTrack) {
+            HelicalTrackHit htc = (HelicalTrackHit) hit;
+//            if (htc.getPosition()[2] < 0) {
+            layer = htc.Layer();
+            layer = (layer - 1) / 2;
+            n[layer] = n[layer] + 1;
+//            }
+        }
+
+        return n;
+    }
+
+    public boolean singleTrackHitPerLayer(Track track) {
+        int hitsPerLayer[] = getTrackHitsPerLayer(track);
+        for (int i = 0; i < 5; ++i) {
+            if (hitsPerLayer[i] != 1) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public boolean singleStripClusterPerLayer(int hitsPerLayer[]) {
+        //This includes both axial and stereo separately 
+        // so for a hit in each double layer we need 10 hits
+        for (int i = 0; i < 10; ++i) {
+            if (hitsPerLayer[i] != 1) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public int[] getStripClustersPerLayer(List<SiTrackerHitStrip1D> trackerHits, String side) {
+        String si_side;
+        String name;
+        int l;
+        int i;
+        int n[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+        boolean ddd = false;
+
+        if (ddd) {
+            System.out.println("Get # hits per layer on side \"" + side + "\"");
+        }
+
+        for (SiTrackerHitStrip1D stripCluster : trackerHits) {
+
+            if (ddd) {
+                System.out.println("Processing stripCluster " + stripCluster.toString());
+            }
+
+
+            if (!"".equals(side)) {
+                String s;
+                if (stripCluster.getPosition()[1] >= 0.0)
+                    s = "up";
+                else
+                    s = "down";
+                if (!s.equals(side))
+                    continue;
+            }
+
+            name = stripCluster.getSensor().getName();
+            if (name.length() < 14) {
+                System.err.println("This name is too short!!");
+                throw new RuntimeException("SiSensor name " + name + " is invalid?");
+            }
+
+            if (ddd) {
[truncated at 1000 lines; 111 more skipped]

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/lcsim
LCIOBridgeDriver.java 368 -> 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/lcsim/LCIOBridgeDriver.java	2014-03-26 03:45:57 UTC (rev 368)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/lcsim/LCIOBridgeDriver.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -1,24 +1,15 @@
 package org.hps.monitoring.ecal.lcsim;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
-import java.util.PriorityQueue;
-import java.util.Set;
 
+import org.hps.monitoring.ecal.event.Cluster;
+import org.hps.monitoring.ecal.event.EcalHit;
+import org.hps.monitoring.ecal.ui.PEventViewer;
+import org.hps.recon.ecal.HPSEcalCluster;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.EventHeader;
-import org.lcsim.hps.recon.ecal.HPSEcalCluster;
 import org.lcsim.util.Driver;
 
-import org.hps.monitoring.ecal.event.Cluster;
-import org.hps.monitoring.ecal.event.EcalHit;
-import org.hps.monitoring.ecal.ui.PEventViewer;
-
 /**
  * Class <code>LCIOBridgeDriver</code> displays LCIO events on the
  * event display.

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots
EcalClusterPlots.java 368 -> 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.java	2014-03-26 03:45:57 UTC (rev 368)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalClusterPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -10,13 +10,13 @@
 import java.util.List;
 
 import org.apache.commons.math.stat.StatUtils;
+import org.hps.recon.ecal.ECalUtils;
+import org.hps.recon.ecal.TriggerData;
+import org.hps.util.Resettable;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.Cluster;
 import org.lcsim.event.EventHeader;
 import org.lcsim.geometry.Detector;
-import org.lcsim.hps.evio.TriggerData;
-import org.lcsim.hps.monitoring.deprecated.Resettable;
-import org.lcsim.hps.recon.ecal.ECalUtils;
 import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
 

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots
EcalDaqPlots.java 368 -> 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalDaqPlots.java	2014-03-26 03:45:57 UTC (rev 368)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalDaqPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -4,24 +4,19 @@
 import hep.aida.IPlotter;
 import hep.aida.IPlotterFactory;
 import hep.aida.IPlotterStyle;
-import hep.aida.ref.plotter.PlotterRegion;
-import jas.hist.JASHist;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawCalorimeterHit;
+import org.hps.conditions.deprecated.EcalConditions;
+import org.hps.util.Resettable;
 import org.lcsim.event.CalorimeterHit;
-import org.lcsim.event.RawTrackerHit;
+import org.lcsim.event.EventHeader;
 import org.lcsim.geometry.Detector;
 import org.lcsim.geometry.compact.Subdetector;
-import org.lcsim.hps.monitoring.deprecated.Resettable;
-import org.lcsim.hps.recon.ecal.EcalConditions; //THIS IS THE OLD ONE
 import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
-
-import org.hps.conditions.ecal.*;  //This is the new condition system
+//THIS IS THE OLD ONE
 /**
  * The driver <code>EcalDaqPlots</code> implements the histogram shown to the user 
  * in the fourth tab of the Monitoring Application, when using the Ecal monitoring lcsim file.

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots
EcalEventDisplay.java 368 -> 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalEventDisplay.java	2014-03-26 03:45:57 UTC (rev 368)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalEventDisplay.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -3,38 +3,25 @@
 import hep.aida.IHistogram1D;
 import hep.aida.IHistogram2D;
 import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
 import hep.aida.IPlotterFactory;
-import hep.aida.ref.plotter.PlotterUtilities;
 
-
+import java.awt.Point;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.awt.Point;
 import java.util.List;
 
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-
-import org.lcsim.geometry.Detector;
-import org.hps.util.AIDAFrame;
-
-
-import org.lcsim.hps.recon.ecal.EcalConditions;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.CalorimeterHit;
-import org.lcsim.event.base.BaseRawCalorimeterHit;
-import org.lcsim.hps.recon.ecal.HPSEcalCluster;
-//import org.lcsim.hps.users.celentan.EcalEventDisplayListener;
-import org.hps.monitoring.ecal.ui.PEventViewer;
 import org.hps.monitoring.ecal.event.Cluster;
 import org.hps.monitoring.ecal.event.EcalHit;
+//import org.lcsim.hps.users.celentan.EcalEventDisplayListener;
+import org.hps.monitoring.ecal.ui.PEventViewer;
 import org.hps.monitoring.ecal.util.CrystalEvent;
 import org.hps.monitoring.ecal.util.CrystalListener;
-import org.hps.monitoring.ecal.plots.EcalMonitoringUtils;
+import org.hps.recon.ecal.HPSEcalCluster;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
 
 /**
  *  The driver <code>EcalEvendDisplay</code> implements the histogram shown to the user 

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots
EcalHitPlots.java 368 -> 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalHitPlots.java	2014-03-26 03:45:57 UTC (rev 368)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalHitPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -3,31 +3,21 @@
 import hep.aida.IHistogram1D;
 import hep.aida.IHistogram2D;
 import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
 import hep.aida.IPlotterFactory;
-import hep.aida.ref.plotter.PlotterUtilities;
+import hep.aida.IPlotterStyle;
 
-import java.util.List;
 import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.List;
 
+import org.hps.recon.ecal.ECalUtils;
+import org.hps.recon.ecal.TriggerData;
+import org.hps.util.Resettable;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.GenericObject;
 import org.lcsim.geometry.Detector;
-import org.lcsim.hps.evio.TriggerData;
-import org.lcsim.hps.monitoring.deprecated.Resettable;
-import org.lcsim.hps.monitoring.deprecated.Redrawable;
-
-import org.lcsim.hps.recon.ecal.ECalUtils;
 import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
-import org.freehep.swing.popup.GlobalMouseListener;
-import org.freehep.swing.popup.GlobalPopupListener;
-
-import org.hps.monitoring.ecal.plots.EcalMonitoringUtils;
-
-import javax.swing.JPanel;
 //import org.jfree.chart.ChartPanel;
 
 /**

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots
EcalMonitoringPlots.java 368 -> 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringPlots.java	2014-03-26 03:45:57 UTC (rev 368)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -1,26 +1,24 @@
 package org.hps.monitoring.ecal.plots;
 
-import hep.aida.IHistogram2D;
 import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
 import hep.aida.IPlotter;
 import hep.aida.IPlotterStyle;
 
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
+import org.hps.recon.ecal.HPSEcalCluster;
+import org.hps.util.Redrawable;
+import org.hps.util.Resettable;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.RawTrackerHit;
 import org.lcsim.event.base.BaseRawCalorimeterHit;
 import org.lcsim.geometry.Detector;
-import org.lcsim.hps.monitoring.deprecated.Redrawable;
-import org.lcsim.hps.monitoring.deprecated.Resettable;
-import org.lcsim.hps.recon.ecal.HPSEcalCluster;
 import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
 
-import org.hps.monitoring.ecal.plots.EcalMonitoringUtils;
-
 /**
  * The driver <code>EcalMonitoringPlots</code> implements the histogram shown to the user 
  * in the first tab of the Monitoring Application, when using the Ecal monitoring lcsim file.

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots
EcalWindowPlots.java 368 -> 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalWindowPlots.java	2014-03-26 03:45:57 UTC (rev 368)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalWindowPlots.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -11,11 +11,11 @@
 import javax.swing.JComboBox;
 import javax.swing.JLabel;
 
+import org.hps.conditions.deprecated.EcalConditions;
+import org.hps.util.AIDAFrame;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.RawTrackerHit;
 import org.lcsim.geometry.Detector;
-import org.lcsim.hps.monitoring.deprecated.AIDAFrame;
-import org.lcsim.hps.recon.ecal.EcalConditions;
 import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
 

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots
EcalWindowPlotsXY.java 368 -> 369
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalWindowPlotsXY.java	2014-03-26 03:45:57 UTC (rev 368)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalWindowPlotsXY.java	2014-03-26 03:52:24 UTC (rev 369)
@@ -11,12 +11,12 @@
 import javax.swing.JComboBox;
 import javax.swing.JLabel;
 
+import org.hps.util.AIDAFrame;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.RawTrackerHit;
 import org.lcsim.geometry.Detector;
 import org.lcsim.geometry.IDDecoder;
 import org.lcsim.geometry.compact.Subdetector;
-import org.lcsim.hps.monitoring.deprecated.AIDAFrame;
 import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
 
SVNspam 0.1