java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/example
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/example/DummyErrorDriver.java (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/example/DummyErrorDriver.java 2014-09-18 22:51:19 UTC (rev 1051)
@@ -0,0 +1,53 @@
+package org.hps.monitoring.drivers.example;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+
+/**
+ * Driver for testing the error handling in the monitoring app.
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class DummyErrorDriver extends Driver {
+
+ boolean throwProcess = true;
+ boolean throwEndOfData = false;
+ boolean throwStartOfData = false;
+ boolean throwDetectorChanged = false;
+
+ public void throwProcess(boolean throwProcess) {
+ this.throwProcess = throwProcess;
+ }
+
+ public void throwEndOfData(boolean throwEndOfData) {
+ this.throwEndOfData = throwEndOfData;
+ }
+
+ public void throwStartOfData(boolean throwStartOfData) {
+ this.throwStartOfData = throwStartOfData;
+ }
+
+ public void throwDetectorChanged(boolean throwDetectorChanged) {
+ this.throwDetectorChanged = throwDetectorChanged;
+ }
+
+ public void startOfData() {
+ if (throwStartOfData)
+ throw new RuntimeException("This is a dummy error from the startOfData method.");
+ }
+
+ public void endOfData() {
+ if (throwEndOfData)
+ throw new RuntimeException("This is a dummy error from the endOfData method.");
+ }
+
+ public void process(EventHeader event) {
+ if (throwProcess)
+ throw new RuntimeException("This is a dummy error from the process method.");
+ }
+
+ public void detectorChanged(Detector detector) {
+ if (throwDetectorChanged)
+ throw new RuntimeException("This is a dummy error from the detectorChanged method.");
+ }
+}
\ No newline at end of file
java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/example
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/example/SimplePlotDriver.java (rev 0)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/example/SimplePlotDriver.java 2014-09-18 22:51:19 UTC (rev 1051)
@@ -0,0 +1,46 @@
+package org.hps.monitoring.drivers.example;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterFactory;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawCalorimeterHit;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class SimplePlotDriver extends Driver {
+
+ static String ecalCollectionName = "EcalReadoutHits";
+ static String svtCollectionName = "SVTRawTrackerHits";
+
+ AIDA aida = AIDA.defaultInstance();
+ IHistogram1D svtHitsPlot;
+ IHistogram1D ecalHitsPlot;
+ IHistogram1D ecalEnergyPlot;
+
+ public void startOfData() {
+ ecalHitsPlot = aida.histogram1D("ECAL Hits per Event", 20, 0., 20.);
+ svtHitsPlot = aida.histogram1D("SVT Hits per Event", 200, 0., 200.);
+
+ IPlotterFactory plotterFactory = aida.analysisFactory().createPlotterFactory("Monitoring Test Plots");
+
+ IPlotter plotter = plotterFactory.create("ECAL");
+ plotter.createRegion();
+ plotter.region(0).plot(ecalHitsPlot);
+ plotter.show();
+
+ plotter = plotterFactory.create("SVT");
+ plotter.createRegion();
+ plotter.region(0).plot(svtHitsPlot);
+ plotter.show();
+ }
+
+ public void process(EventHeader event) {
+ if (event.hasCollection(RawTrackerHit.class, svtCollectionName))
+ svtHitsPlot.fill(event.get(RawTrackerHit.class, svtCollectionName).size());
+ if (event.hasCollection(RawCalorimeterHit.class, ecalCollectionName))
+ ecalHitsPlot.fill(event.get(RawCalorimeterHit.class, ecalCollectionName).size());
+ }
+}
\ No newline at end of file