6 removed files
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -N EcalDaqPlots.java
--- EcalDaqPlots.java 27 Apr 2012 22:13:53 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,130 +0,0 @@
-package org.lcsim.hps.monitoring;
-
-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.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.hps.recon.ecal.HPSEcalDaqIDConverter;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EcalDaqPlots extends Driver implements Resettable {
-
- private String subdetectorName;
- private String inputCollection;
- private HPSEcalDaqIDConverter idMap;
- private IPlotter plotter;
- private AIDA aida;
- private Detector detector;
- private List<IHistogram1D> plots;
-
- 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);
- idMap = new HPSEcalDaqIDConverter();
- idMap.fillDaqCellMap(subdetector);
-
- 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 " + 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 = idMap.physicalToDaqID(hit.getCellID());
- int crate = HPSEcalDaqIDConverter.getCrate(daqId);
- int slot = HPSEcalDaqIDConverter.getSlot(daqId);
- int channel = HPSEcalDaqIDConverter.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 = idMap.physicalToDaqID(hit.getCellID());
- int crate = HPSEcalDaqIDConverter.getCrate(daqId);
- int slot = HPSEcalDaqIDConverter.getSlot(daqId);
- int channel = HPSEcalDaqIDConverter.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);
- }
- }
- }
-}
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -N EcalMonitoringPlots.java
--- EcalMonitoringPlots.java 27 Apr 2012 23:08:02 -0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,104 +0,0 @@
-package org.lcsim.hps.monitoring;
-
-import hep.aida.IHistogram2D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-import hep.aida.ref.plotter.PlotterRegion;
-
-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.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EcalMonitoringPlots extends Driver implements Resettable {
-
- String ecalName = "Ecal";
- String rawCalorimeterHitCollectionName = "EcalRawHits";
- AIDA aida = AIDA.defaultInstance();
- IPlotter plotter;
- IHistogram2D hitCountPlot;
- IDDecoder dec;
- Detector detector;
- int eventn = 0;
-
- public EcalMonitoringPlots() {
- }
-
- public void setRawCalorimeterHitCollectionName(String rawCalorimeterHitCollectionName) {
- this.rawCalorimeterHitCollectionName = rawCalorimeterHitCollectionName;
- }
-
- public void setEcalName(String ecalName) {
- this.ecalName = ecalName;
- }
-
- protected void detectorChanged(Detector detector) {
-
- this.detector = detector;
-
- if (detector.getSubdetector(ecalName) == null) {
- throw new RuntimeException("There is no subdetector called " + ecalName + " in this detector");
- }
-
- // Cache the IDDecoder for the ECal.
- dec = detector.getSubdetector(ecalName).getReadout().getIDDecoder();
-
- // Setup the plotter.
- plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal Monitoring Plots");
-
- // Setup plots.
- aida.tree().cd("/");
- hitCountPlot = aida.histogram2D(detector.getDetectorName() + " : " + rawCalorimeterHitCollectionName + " : Hit Count", 47, -23.5, 23.5, 11, -5.5, 5.5);
-
- // Create the plotter regions.
- plotter.createRegion();
- 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(hitCountPlot);
- ((PlotterRegion) plotter.region(0)).getPlot().setAllowUserInteraction(false);
- ((PlotterRegion) plotter.region(0)).getPlot().setAllowPopupMenus(false);
- plotter.show();
- }
-
- public void process(EventHeader event) {
- if (event.hasCollection(RawCalorimeterHit.class, rawCalorimeterHitCollectionName)) {
- List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, rawCalorimeterHitCollectionName);
- for (RawCalorimeterHit hit : hits) {
- dec.setID(hit.getCellID());
- hitCountPlot.fill(dec.getValue("ix"), dec.getValue("iy"));
- }
- ++eventn;
- }
- if (event.hasCollection(RawTrackerHit.class, rawCalorimeterHitCollectionName)) {
- List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawCalorimeterHitCollectionName);
- for (RawTrackerHit hit : hits) {
- dec.setID(hit.getCellID());
- hitCountPlot.fill(dec.getValue("ix"), dec.getValue("iy"));
- }
- ++eventn;
- }
- }
-
- public void endOfData() {
- if (plotter != null) {
- plotter.hide();
- plotter.destroyRegions();
- }
- if (hitCountPlot != null) {
- hitCountPlot.reset();
- }
- }
-
- public void reset() {
- plotter.hide();
- hitCountPlot.reset();
- detectorChanged(detector);
- }
-}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -N EcalPedestalPlots.java
--- EcalPedestalPlots.java 27 Apr 2012 23:08:02 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,217 +0,0 @@
-package org.lcsim.hps.monitoring;
-
-import hep.aida.ICloud1D;
-import hep.aida.IHistogram2D;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-import hep.aida.ref.plotter.PlotterRegion;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.swing.*;
-
-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.compact.Subdetector;
-import org.lcsim.hps.recon.ecal.HPSEcalDaqIDConverter;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EcalPedestalPlots extends Driver implements Resettable, ActionListener {
-
- private String subdetectorName;
- private Subdetector subdetector;
- private String inputCollection;
- private HPSEcalDaqIDConverter idMap;
- 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);
- idMap = new HPSEcalDaqIDConverter();
- idMap.fillDaqCellMap(subdetector);
- 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);
-// 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);
-// 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);
- }
-}
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -N EcalWindowPlots.java
--- EcalWindowPlots.java 27 Apr 2012 23:08:02 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,199 +0,0 @@
-package org.lcsim.hps.monitoring;
-
-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.lcsim.event.EventHeader;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.compact.Subdetector;
-import org.lcsim.hps.recon.ecal.HPSEcalDaqIDConverter;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EcalWindowPlots extends Driver implements Resettable, ActionListener {
-
- private String subdetectorName;
- private String inputCollection;
- private HPSEcalDaqIDConverter idMap;
- 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);
- idMap = new HPSEcalDaqIDConverter();
- idMap.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 = idMap.physicalToDaqID(hit.getCellID());
- int crate = HPSEcalDaqIDConverter.getCrate(daqId);
- int slot = HPSEcalDaqIDConverter.getSlot(daqId);
- int channel = HPSEcalDaqIDConverter.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);
- }
- }
-}
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -N EcalWindowPlotsXY.java
--- EcalWindowPlotsXY.java 27 Apr 2012 23:08:02 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,179 +0,0 @@
-package org.lcsim.hps.monitoring;
-
-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.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.recon.ecal.HPSEcalDaqIDConverter;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EcalWindowPlotsXY extends Driver implements Resettable, ActionListener {
-
- private String subdetectorName;
- private String inputCollection;
- private HPSEcalDaqIDConverter idMap;
- 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);
- idMap = new HPSEcalDaqIDConverter();
- idMap.fillDaqCellMap(subdetector);
- 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");
-// 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);
- }
- }
-}
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -N SensorOccupancyPlotsDriver.java
--- SensorOccupancyPlotsDriver.java 28 Apr 2012 22:03:39 -0000 1.14
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,178 +0,0 @@
-package org.lcsim.hps.monitoring;
-
-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.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.12 2012/04/13 00:06:55
- * jeremy Exp $
- *
- */
-public class SensorOccupancyPlotsDriver extends Driver implements Resettable {
-
- private String rawTrackerHitCollectionName = "RawTrackerHitMaker_RawTrackerHits";
- 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;
-
- 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().create(detector.getDetectorName() + " : HPS SVT Sensor Occupancy Plots");
- IPlotterStyle pstyle = plotter.style();
- pstyle.dataStyle().fillStyle().setColor("green");
- pstyle.dataStyle().markerStyle().setColor("green");
- 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(), 640, 0, 639);
- 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);
- }
- plotter.show();
- }
-
- 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());
- 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 void resetOccupancyMap() {
- occupancyMap = new HashMap<String, int[]>();
- for (SiSensor sensor : sensors) {
- occupancyMap.put(sensor.getName(), new int[640]);
- }
- }
-
- public void endOfData() {
- if (plotter != null) {
- plotter.hide();
- }
- }
-
- public void reset() {
- eventCount = 0;
- resetOccupancyMap();
- }
-}
\ No newline at end of file
CVSspam 0.2.12