Author: [log in to unmask]
Date: Wed Apr 1 13:40:58 2015
New Revision: 2650
Log:
Updates to example plots.
Modified:
java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/example/ExamplePlotDriver.java
Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/example/ExamplePlotDriver.java
=============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/example/ExamplePlotDriver.java (original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/example/ExamplePlotDriver.java Wed Apr 1 13:40:58 2015
@@ -53,7 +53,7 @@
[X] Histogram2D overlay
-[ ] Cloud2D as scatter plot
+[X] Cloud2D as scatter plot
[ ] Cloud2D scatter plot overlay
@@ -72,6 +72,18 @@
https://docs.google.com/spreadsheets/d/1bqKvriNOEaeTrpTrk38kBGXM8oC_F5QIZeLcSSa3JsQ/
*/
+
+/*
+FADCGenericHits - class org.hps.recon.ecal.FADCGenericHit
+TriggerConfig - class org.hps.recon.ecal.daqconfig.EvioDAQParser
+EcalReadoutHits - class org.lcsim.event.base.BaseRawCalorimeterHit
+EpicsScalarData - interface org.lcsim.event.GenericObject
+EcalCalHits - interface org.lcsim.event.CalorimeterHit
+ScalarData - interface org.lcsim.event.GenericObject
+TriggerBank - class org.hps.recon.ecal.triggerbank.AbstractIntData
+EcalClusters - interface org.lcsim.event.Cluster
+*/
+
public class ExamplePlotDriver extends Driver {
AIDA aida = AIDA.defaultInstance();
@@ -81,7 +93,7 @@
IFitFactory fitFactory;
IHistogram1D calRawHitH1D, calClusterH1D, calHitH1D, calClusterEnergyH1D;
- IHistogram2D calHitMapH2D, calRawHitMapH2D;
+ IHistogram2D calHitMapH2D, calRawHitMapH2D, clusterHitMapH2D;
ICloud1D calRawHitsC1D, calClustersC1D;
ICloud2D calHitsVsEnergyC2D;
IFunction fittedFunction;
@@ -115,79 +127,102 @@
IPlotterStyle style = null;
// Define all of the AIDA objects to be used for example plotting.
- calClusterEnergyH1D = aida.histogram1D("Cal Cluster Energy", 100, 0., 10.);
- calRawHitH1D = aida.histogram1D("CalRawHit Count H1D", 20, 0., 20.);
- calHitH1D = aida.histogram1D("CalHit Count H1D", 20, 0., 20.);
- calClusterH1D = aida.histogram1D("CalCluster Count H1D", 20, 0., 20.);
- calHitMapH2D = aida.histogram2D("CalHit Map H2D", 47, -23.5, 23.5, 11, -5.5, 5.5);
- calRawHitMapH2D = aida.histogram2D("CalRawHit Map H2D", 47, -23.5, 23.5, 11, -5.5, 5.5);
- calRawHitsC1D = aida.cloud1D("CalRawHit Count C1D", 500);
- calClustersC1D = aida.cloud1D("CalCluster Count C1D", 500);
- calHitsVsEnergyC2D = aida.cloud2D("CalHits vs Energy C2D", 1000000);
+ calClusterEnergyH1D = aida.histogram1D("Clus Energy", 100, 0., 10.);
+ calRawHitH1D = aida.histogram1D("Raw Hit Count", 20, 0., 20.);
+ calHitH1D = aida.histogram1D("Calo Hit Count", 20, 0., 20.);
+ calClusterH1D = aida.histogram1D("Cluster Count", 20, 0., 20.);
+ calHitMapH2D = aida.histogram2D("Calo Hit Map", 47, -23.5, 23.5, 11, -5.5, 5.5);
+ clusterHitMapH2D = aida.histogram2D("Clus Hit Map", 47, -23.5, 23.5, 11, -5.5, 5.5);
+ calRawHitMapH2D = aida.histogram2D("Raw Hit Map", 47, -23.5, 23.5, 11, -5.5, 5.5);
+ calRawHitsC1D = aida.cloud1D("Raw Hit Count - Cloud", 500);
+ calClustersC1D = aida.cloud1D("Clus Count - Cloud", 500);
+ calHitsVsEnergyC2D = aida.cloud2D("Cal Hits vs Energy", 1000000);
fittedFunction = functionFactory.createFunctionByName("Gaussian", "G");
fittedFunction.setTitle("Example Fit");
/*
- * Histogram1D
+ * 1D Histogram
*/
- plotter = plotterFactory.create("IHistogram1D");
- plotter.createRegion();
+
+ plotter = plotterFactory.create("Histogram1D");
+ plotter.createRegions(2);
+
style = createDefaultPlotterStyle();
style.dataStyle().fillStyle().setColor("blue");
- plotter.region(0).setTitle("IHistogram1D");
+ plotter.region(0).setTitle("1D Histogram");
plotter.region(0).plot(calClusterEnergyH1D, style);
plotter.show();
- /*
- * Fit of Histogram1D
+ style = createDefaultPlotterStyle();
+ style.dataStyle().fillStyle().setColor("blue");
+ style.titleStyle().setVisible(false);
+ plotter.region(1).setTitle("IHistogram1D - No Title"); /* This shouldn't show! */
+ plotter.region(1).plot(calClusterEnergyH1D, style);
+
+ plotter.show();
+
+ /*
+ * Example Function Fit
*/
- plotter = plotterFactory.create("IHistogram1D Fit");
- plotter.createRegion();
+ plotter = plotterFactory.create("Example Function Fit");
+ plotter.createRegion();
+
style = createDefaultPlotterStyle();
style.dataStyle().fillStyle().setColor("blue");
- plotter.region(0).setTitle("IHistogram1D");
- plotter.region(0).plot(calHitH1D, style);
+ plotter.region(0).setTitle("1D Histogram");
+ plotter.region(0).plot(calHitH1D, style);
+
IPlotterStyle functionStyle = plotterFactory.createPlotterStyle();
+ functionStyle.dataStyle().lineStyle().setVisible(true);
functionStyle.dataStyle().lineStyle().setColor("red");
- functionStyle.dataStyle().markerStyle().setVisible(true);
- functionStyle.dataStyle().markerStyle().setColor("black");
- functionStyle.dataStyle().markerStyle().setShape("dot");
- functionStyle.dataStyle().markerStyle().setSize(2);
plotter.region(0).plot(fittedFunction, functionStyle);
plotter.show();
/*
- * Histogram1D overlay
+ * 1D Histogram overlay
*/
- plotter = plotterFactory.create("Overlayed IHistogram1D");
- plotter.createRegion();
- plotter.region(0).setTitle("Overlayed IHistogram1D");
+ plotter = plotterFactory.create("1D Histogram Overlay");
+ plotter.createRegion();
+ plotter.region(0).setTitle("1D Histogram Overlay");
+
style = createDefaultPlotterStyle();
style.dataStyle().fillStyle().setVisible(false);
style.dataStyle().errorBarStyle().setVisible(false);
style.dataStyle().lineStyle().setColor("blue");
plotter.region(0).plot(calRawHitH1D, style);
+
style = createDefaultPlotterStyle();
style.dataStyle().fillStyle().setVisible(false);
style.dataStyle().errorBarStyle().setVisible(false);
style.dataStyle().lineStyle().setColor("red");
plotter.region(0).plot(calHitH1D, style);
+
style = createDefaultPlotterStyle();
style.dataStyle().fillStyle().setVisible(false);
style.dataStyle().errorBarStyle().setVisible(false);
style.dataStyle().lineStyle().setColor("green");
plotter.region(0).plot(calClusterH1D, style);
- plotter.show();
-
- /*
- * Histogram2D as color map.
+ plotter.show();
+
+ /*
+ * Histogram2D as color map, with and without legend showing.
*/
plotter = plotterFactory.create("Histogram2D Color Map");
+ plotter.createRegions(2);
+
+ // Color map with legend.
style = createDefaultPlotterStyle();
style.setParameter("hist2DStyle", "colorMap");
- plotter.createRegion();
- plotter.region(0).setTitle("Histogram2D Color Map");
+ plotter.region(0).setTitle("Color Map");
plotter.region(0).plot(calHitMapH2D, style);
+
+ // Same color map with no legend.
+ style = createDefaultPlotterStyle();
+ style.setParameter("hist2DStyle", "colorMap");
+ style.legendBoxStyle().setVisible(false);
+ plotter.region(1).setTitle("Color Map - No Legend");
+ plotter.region(1).plot(calHitMapH2D, style);
+
plotter.show();
/*
@@ -203,20 +238,28 @@
plotter.show();
/*
- * Histogram2D overlay box plots
+ * Histogram2D box plot overlay.
*/
- plotter = plotterFactory.create("Overlaid IHistogram2D Box Plots");
- plotter.createRegion();
- plotter.region(0).setTitle("Overlaid Histogram2D Box Plots");
+ plotter = plotterFactory.create("Histogram2D Box Plot Overlay");
+
+ plotter.createRegion();
+ plotter.region(0).setTitle("Box Plot Overlay");
+
style = createDefaultPlotterStyle();
style.setParameter("hist2DStyle", "box");
+ style.dataStyle().lineStyle().setVisible(true);
style.dataStyle().lineStyle().setColor("green");
+ style.dataStyle().fillStyle().setVisible(false);
plotter.region(0).plot(calRawHitMapH2D, style);
+
style = createDefaultPlotterStyle();
style.setParameter("hist2DStyle", "box");
+ style.dataStyle().lineStyle().setVisible(true);
style.dataStyle().lineStyle().setColor("red");
- plotter.region(0).plot(calHitMapH2D, style);
- plotter.show();
+ style.dataStyle().fillStyle().setVisible(false);
+ plotter.region(0).plot(clusterHitMapH2D, style);
+
+ plotter.show();
/*
* Cloud1D which will convert to a histogram on the fly
@@ -231,14 +274,16 @@
/*
* Cloud1D overlay
*/
- plotter = plotterFactory.create("Overlayed Cloud1D");
- plotter.createRegion();
- plotter.region(0).setTitle("Overlayed Cloud1D");
+ plotter = plotterFactory.create("1D Cloud Overlay");
+ plotter.createRegion();
+ plotter.region(0).setTitle("1D Cloud Overlay");
+
style = createDefaultPlotterStyle();
style.dataStyle().lineStyle().setVisible(true);
style.dataStyle().lineStyle().setColor("green");
style.dataStyle().fillStyle().setVisible(false);
plotter.region(0).plot(calRawHitsC1D, style);
+
style = createDefaultPlotterStyle();
style.dataStyle().lineStyle().setVisible(true);
style.dataStyle().lineStyle().setColor("red");
@@ -249,9 +294,9 @@
/*
* Cloud2D as scatter plot.
*/
- plotter = plotterFactory.create("Cloud2D Scatter Plot");
- plotter.createRegion();
- plotter.region(0).setTitle("Cloud2D Scatter Plot");
+ plotter = plotterFactory.create("2D Cloud Scatter Plot");
+ plotter.createRegion();
+ plotter.region(0).setTitle("2D Cloud Scatter Plot");
style = createDefaultPlotterStyle();
style.dataStyle().markerStyle().setVisible(true); /* FIXME: This is false by default! */
style.dataStyle().markerStyle().setColor("purple");
@@ -262,8 +307,7 @@
}
public void process(EventHeader event) {
- //printCollectionSummary(event);
-
+
if (event.hasCollection(RawCalorimeterHit.class, ECAL_READOUT_HITS)) {
List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, ECAL_READOUT_HITS);
int nHits = hits.size();
@@ -296,7 +340,10 @@
calClustersC1D.fill(clusters.size());
for (Cluster cluster : clusters) {
calClusterEnergyH1D.fill(cluster.getEnergy());
- }
+
+ CalorimeterHit seedHit = cluster.getCalorimeterHits().get(0);
+ clusterHitMapH2D.fill(seedHit.getIdentifierFieldValue("ix"), seedHit.getIdentifierFieldValue("iy"));
+ }
}
// Fit an H1D.
|