Commit in hps-java/src/main/java/org/lcsim/hps/monitoring on MAIN | |||
ecal/EcalPedestalPlots.java | +186 | -185 | 1.2 -> 1.3 |
/EcalEventMonitor.java | +4 | -2 | 1.4 -> 1.5 |
/EcalWindowPlotsXY.java | +150 | -153 | 1.2 -> 1.3 |
/EcalWindowPlots.java | +172 | -175 | 1.2 -> 1.3 |
AIDAFrame.java | +37 | -34 | 1.2 -> 1.3 |
+549 | -549 |
add tabs to AIDAFrame
diff -u -r1.2 -r1.3 --- EcalPedestalPlots.java 2 May 2012 00:39:40 -0000 1.2 +++ EcalPedestalPlots.java 4 May 2012 02:24:43 -0000 1.3 @@ -25,191 +25,192 @@
public class EcalPedestalPlots extends Driver implements Resettable, ActionListener {
- private String subdetectorName; - private Subdetector subdetector; - private String inputCollection; - private IPlotter plotter; - private AIDA aida = AIDA.defaultInstance(); - private AIDAFrame plotterFrame; - private Detector detector; - private IDDecoder dec; - private List<ICloud1D> plotsList; - private IHistogram2D meanPlot; - private IHistogram2D sigmaPlot; - private ICloud1D[][] plots = new ICloud1D[47][11]; - private JLabel xLabel, yLabel; - private JComboBox xCombo; - private JComboBox yCombo; - private static final Integer[] xList = new Integer[46]; - private static final Integer[] yList = new Integer[10]; - - 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 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 = detector.getSubdetector(subdetectorName); - dec = subdetector.getReadout().getIDDecoder(); - - setupPlots(); - } - - private void setupPlots() { - // Setup the plotter. - plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal Pedestal Plots"); - plotterFrame = new AIDAFrame(plotter); - plotterFrame.setVisible(true); - - plotsList = new ArrayList<ICloud1D>(); - aida = AIDA.defaultInstance(); - aida.tree().cd("/"); - sigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma", 47, -23.5, 23.5, 11, -5.5, 5.5); - meanPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Mean", 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);
+ private String subdetectorName; + private Subdetector subdetector; + private String inputCollection; + private IPlotter plotter; + private AIDA aida = AIDA.defaultInstance(); + private AIDAFrame plotterFrame; + private Detector detector; + private IDDecoder dec; + private List<ICloud1D> plotsList; + private IHistogram2D meanPlot; + private IHistogram2D sigmaPlot; + private ICloud1D[][] plots = new ICloud1D[47][11]; + private JLabel xLabel, yLabel; + private JComboBox xCombo; + private JComboBox yCombo; + private static final Integer[] xList = new Integer[46]; + private static final Integer[] yList = new Integer[10]; + + 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 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 = detector.getSubdetector(subdetectorName); + dec = subdetector.getReadout().getIDDecoder(); + + setupPlots(); + } + + private void setupPlots() { + // Setup the plotter. + plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal Pedestal Plots"); + plotterFrame = new AIDAFrame(); + plotterFrame.addPlotter(plotter); + plotterFrame.setVisible(true); + + plotsList = new ArrayList<ICloud1D>(); + aida = AIDA.defaultInstance(); + aida.tree().cd("/"); + sigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma", 47, -23.5, 23.5, 11, -5.5, 5.5); + meanPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Mean", 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); - plotsList.add(plots[x + 23][y + 5]); - } - } - - // Create the plotter regions. - plotter.createRegions(1, 3); - - 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); - - JMenuBar menuBar = plotterFrame.getMenubar(); - JMenu menu = new JMenu("File"); - JMenuItem item = new JMenuItem("meeg"); - menu.add(item); - menuBar.add(menu); - - - plotterFrame.pack(); - - plotter.style().statisticsBoxStyle().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(sigmaPlot); - plotter.region(1).plot(meanPlot); - plotter.region(2).plot(plots[17][0]); - ((PlotterRegion) plotter.region(0)).getPlot().setAllowUserInteraction(false); - ((PlotterRegion) plotter.region(0)).getPlot().setAllowPopupMenus(false); - - ((PlotterRegion) plotter.region(1)).getPlot().setAllowUserInteraction(false); - ((PlotterRegion) plotter.region(1)).getPlot().setAllowPopupMenus(false); - } - - public void endOfData() { - if (plotter != null) { - plotter.hide(); - } - } - - public void reset() { - if (plotter != null) { - plotter.hide(); - plotter.destroyRegions(); - for (ICloud1D plot : plotsList) { - plot.reset(); - } - detectorChanged(detector); - } - } - - 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"); - for (int i = 0; i < hit.getADCValues().length; i++) { - plots[x + 23][y + 5].fill(hit.getADCValues()[i]); - } - } - } - - if (event.hasCollection(RawCalorimeterHit.class, inputCollection)) { - List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, inputCollection); - for (RawCalorimeterHit hit : hits) { - dec.setID(hit.getCellID()); - int x = dec.getValue("ix"); - int y = dec.getValue("iy"); - plots[x + 23][y + 5].fill(hit.getAmplitude()); - } - } - - sigmaPlot.reset(); - meanPlot.reset(); - for (int x = -23; x <= 23; x++) { // slot - for (int y = -5; y <= 5; y++) { // crate - sigmaPlot.fill(x, y, plots[x + 23][y + 5].rms()); - meanPlot.fill(x, y, plots[x + 23][y + 5].mean()); - //System.out.println("creating plot: " + "ECAL: Crate " + j + "; Slot " + i + " in region " + region);
+ plots[x + 23][y + 5] = aida.cloud1D("ECAL: x=" + x + "; y=" + y); + plotsList.add(plots[x + 23][y + 5]); + } + } + + // Create the plotter regions. + plotter.createRegions(1, 3); + + 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); + + JMenuBar menuBar = plotterFrame.getMenubar(); + JMenu menu = new JMenu("File"); + JMenuItem item = new JMenuItem("meeg"); + menu.add(item); + menuBar.add(menu); + + + plotterFrame.pack(); + + plotter.style().statisticsBoxStyle().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(sigmaPlot); + plotter.region(1).plot(meanPlot); + plotter.region(2).plot(plots[17][0]); + ((PlotterRegion) plotter.region(0)).getPlot().setAllowUserInteraction(false); + ((PlotterRegion) plotter.region(0)).getPlot().setAllowPopupMenus(false); + + ((PlotterRegion) plotter.region(1)).getPlot().setAllowUserInteraction(false); + ((PlotterRegion) plotter.region(1)).getPlot().setAllowPopupMenus(false); + } + + public void endOfData() { + if (plotter != null) { + plotter.hide(); + } + } + + public void reset() { + if (plotter != null) { + plotter.hide(); + plotter.destroyRegions(); + for (ICloud1D plot : plotsList) { + plot.reset(); + } + detectorChanged(detector); + } + } + + 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"); + for (int i = 0; i < hit.getADCValues().length; i++) { + plots[x + 23][y + 5].fill(hit.getADCValues()[i]); + } + } + } + + if (event.hasCollection(RawCalorimeterHit.class, inputCollection)) { + List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, inputCollection); + for (RawCalorimeterHit hit : hits) { + dec.setID(hit.getCellID()); + int x = dec.getValue("ix"); + int y = dec.getValue("iy"); + plots[x + 23][y + 5].fill(hit.getAmplitude()); + } + } + + sigmaPlot.reset(); + meanPlot.reset(); + for (int x = -23; x <= 23; x++) { // slot + for (int y = -5; y <= 5; y++) { // crate + sigmaPlot.fill(x, y, plots[x + 23][y + 5].rms()); + meanPlot.fill(x, y, plots[x + 23][y + 5].mean()); + //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);
- } - } - } - - @Override - public void actionPerformed(ActionEvent ae) { - Integer x, y; - x = (Integer) xCombo.getSelectedItem(); - y = (Integer) yCombo.getSelectedItem(); - plotter.region(2).clear(); - plotter.region(2).plot(plots[x + 23][y + 5]); - ((PlotterRegion) plotter.region(2)).getPlot().setAllowUserInteraction(false); - ((PlotterRegion) plotter.region(2)).getPlot().setAllowPopupMenus(false); - }
+ } + } + } + + @Override + public void actionPerformed(ActionEvent ae) { + Integer x, y; + x = (Integer) xCombo.getSelectedItem(); + y = (Integer) yCombo.getSelectedItem(); + plotter.region(2).clear(); + plotter.region(2).plot(plots[x + 23][y + 5]); + ((PlotterRegion) plotter.region(2)).getPlot().setAllowUserInteraction(false); + ((PlotterRegion) plotter.region(2)).getPlot().setAllowPopupMenus(false); + }
}
diff -u -r1.4 -r1.5 --- EcalEventMonitor.java 3 May 2012 16:11:32 -0000 1.4 +++ EcalEventMonitor.java 4 May 2012 02:24:43 -0000 1.5 @@ -81,7 +81,8 @@
// Setup the plotter. plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal Event Monitor");
- plotterFrame = new AIDAFrame(plotter);
+ plotterFrame = new AIDAFrame(); + plotterFrame.addPlotter(plotter);
plotterFrame.setVisible(true); plotterFrame.setTitle("HPS ECal Event Monitor");
@@ -159,8 +160,9 @@
if (hitPlot != null) { hitPlot.reset(); }
- if (plotterFrame != null )
+ if (plotterFrame != null) {
plotterFrame.dispose();
+ }
} @Override
diff -u -r1.2 -r1.3 --- EcalWindowPlotsXY.java 2 May 2012 00:39:40 -0000 1.2 +++ EcalWindowPlotsXY.java 4 May 2012 02:24:43 -0000 1.3 @@ -16,162 +16,159 @@
import org.lcsim.geometry.IDDecoder; import org.lcsim.geometry.compact.Subdetector; import org.lcsim.hps.monitoring.AIDAFrame;
-import org.lcsim.hps.monitoring.Resettable;
import org.lcsim.util.Driver; import org.lcsim.util.aida.AIDA;
-public class EcalWindowPlotsXY extends Driver implements Resettable, ActionListener {
+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(plotter); - plotterFrame.setVisible(true); - IPlotterStyle pstyle = plotter.style(); - pstyle.dataStyle().errorBarStyle().setVisible(false); - windowPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Count", 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() { - } - - public void reset() { - 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");
+ 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 + " : Hit Count", 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); - } - }
+ 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); + } + }
}
diff -u -r1.2 -r1.3 --- EcalWindowPlots.java 2 May 2012 00:39:40 -0000 1.2 +++ EcalWindowPlots.java 4 May 2012 02:24:43 -0000 1.3 @@ -15,185 +15,182 @@
import org.lcsim.geometry.Detector; import org.lcsim.geometry.compact.Subdetector; import org.lcsim.hps.monitoring.AIDAFrame;
-import org.lcsim.hps.monitoring.Resettable;
import org.lcsim.hps.recon.ecal.HPSEcalConditions; import org.lcsim.util.Driver; import org.lcsim.util.aida.AIDA;
-public class EcalWindowPlots extends Driver implements Resettable, ActionListener {
+public class EcalWindowPlots extends Driver implements ActionListener {
- private String subdetectorName; - private String inputCollection; - private IPlotter plotter; - private AIDAFrame plotterFrame; - private AIDA aida; - private Detector detector; - private IHistogram1D windowPlot; - private int window = 10; - 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 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); - HPSEcalConditions.fillDaqCellMap(subdetector); - - 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(plotter); - plotterFrame.setVisible(true); - IPlotterStyle pstyle = plotter.style(); - pstyle.dataStyle().errorBarStyle().setVisible(false); - windowPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Count", 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(); - } - - public void endOfData() { - } - - public void reset() { - 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) { - Long daqId = HPSEcalConditions.physicalToDaqID(hit.getCellID()); - int crate = HPSEcalConditions.getCrate(daqId); - int slot = HPSEcalConditions.getSlot(daqId); - int channel = HPSEcalConditions.getChannel(daqId);
+ private String subdetectorName; + private String inputCollection; + private IPlotter plotter; + private AIDAFrame plotterFrame; + private AIDA aida; + private Detector detector; + private IHistogram1D windowPlot; + private int window = 10; + 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 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); + HPSEcalConditions.fillDaqCellMap(subdetector); + + 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 + " : Hit Count", 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(); + } + + 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) { + Long daqId = HPSEcalConditions.physicalToDaqID(hit.getCellID()); + int crate = HPSEcalConditions.getCrate(daqId); + int slot = HPSEcalConditions.getSlot(daqId); + int channel = HPSEcalConditions.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); - } - }
+ 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); + } + }
}
diff -u -r1.2 -r1.3 --- AIDAFrame.java 26 Apr 2012 18:15:26 -0000 1.2 +++ AIDAFrame.java 4 May 2012 02:24:43 -0000 1.3 @@ -8,48 +8,51 @@
/** * * @author Sho Uemura <[log in to unmask]>
- * @version $Id: AIDAFrame.java,v 1.2 2012/04/26 18:15:26 meeg Exp $
+ * @version $Id: AIDAFrame.java,v 1.3 2012/05/04 02:24:43 meeg Exp $
*/ public class AIDAFrame extends JFrame {
- IPlotter plotter; - JPanel plotterPanel; - JPanel controlsPanel; - JMenuBar menubar;
+ JPanel controlsPanel; + JMenuBar menubar; + JTabbedPane tabbedPane; + + public AIDAFrame() { + tabbedPane = new JTabbedPane(); +// this.setContentPane(tabbedFrame); + this.getContentPane().setLayout(new BorderLayout());
- public AIDAFrame(IPlotter plotter) { - this.getContentPane().setLayout(new BorderLayout()); - plotterPanel = new JPanel(new BorderLayout()); - - // Now embed the plotter - plotterPanel.add(PlotterUtilities.componentForPlotter(plotter), BorderLayout.CENTER); - - - menubar = new JMenuBar();
+ menubar = new JMenuBar();
// JMenu menu = new JMenu("File"); // JMenuItem item = new JMenuItem("meeg"); // menu.add(item); // menubar.add(menu);
- this.setJMenuBar(menubar); - - this.add(plotterPanel,BorderLayout.NORTH); - - controlsPanel = new JPanel(); - controlsPanel.setLayout(new BoxLayout(controlsPanel,BoxLayout.X_AXIS)); - this.add(controlsPanel,BorderLayout.SOUTH); - - this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - } - - public IPlotter getPlotter() { - return plotter; - }
+ this.setJMenuBar(menubar);
- public JPanel getControlsPanel() { - return controlsPanel; - }
+ this.add(tabbedPane, BorderLayout.NORTH);
- public JMenuBar getMenubar() { - return menubar; - }
+ controlsPanel = new JPanel(); + controlsPanel.setLayout(new BoxLayout(controlsPanel, BoxLayout.X_AXIS)); + this.add(controlsPanel, BorderLayout.SOUTH); + + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } + + public void addPlotter(IPlotter plotter) { + JPanel plotterPanel = new JPanel(new BorderLayout()); + // Now embed the plotter + plotterPanel.add(PlotterUtilities.componentForPlotter(plotter), BorderLayout.CENTER); + tabbedPane.add(plotter.title(), plotterPanel); + } + + public JTabbedPane getTabbedPane() { + return tabbedPane; + } + + public JPanel getControlsPanel() { + return controlsPanel; + } + + public JMenuBar getMenubar() { + return menubar; + }
}
\ No newline at end of file
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1