3 added + 3 modified, total 6 files
hps-java/src/main/java/org/lcsim/hps/recon/ecal
diff -N HPSDummyTriggerDriver.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HPSDummyTriggerDriver.java 26 Apr 2012 18:15:26 -0000 1.1
@@ -0,0 +1,24 @@
+package org.lcsim.hps.recon.ecal;
+
+import java.util.List;
+import org.lcsim.hps.util.ClockSingleton;
+
+/**
+ * Free-running trigger - triggers on every Nth event
+ *
+ * @author Sho Uemura <[log in to unmask]>
+ * @version $Id: HPSDummyTriggerDriver.java,v 1.1 2012/04/26 18:15:26 meeg Exp $
+ */
+public class HPSDummyTriggerDriver extends HPSTriggerDriver {
+
+ int period = 100;
+
+ public void setPeriod(int period) {
+ this.period = period;
+ }
+
+ @Override
+ public boolean testTrigger(List<HPSEcalCluster> clusters) {
+ return (ClockSingleton.getClock() % period == 0);
+ }
+}
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -N EcalWindowPlotsXY.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ EcalWindowPlotsXY.java 26 Apr 2012 18:15:26 -0000 1.1
@@ -0,0 +1,181 @@
+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 DAQ 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) {
+ List<RawTrackerHit> rawTrackerHits = event.get(RawTrackerHit.class, inputCollection);
+ //FIXME: this check is necessary because hasCollection(type, name) doesn't seem to actually check type!
+ if (!rawTrackerHits.isEmpty() && RawTrackerHit.class.isInstance(rawTrackerHits.get(0))) {
+ 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 EcalPedestalPlots.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ EcalPedestalPlots.java 26 Apr 2012 18:15:26 -0000 1.1
@@ -0,0 +1,203 @@
+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.JComboBox;
+import javax.swing.JLabel;
+
+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 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 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);
+
+ 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, 2);
+
+ 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();
+
+ 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(sigmaPlot);
+// plotter.region(1).plot(plots[18][2]);
+ ((PlotterRegion) plotter.region(0)).getPlot().setAllowUserInteraction(false);
+ ((PlotterRegion) plotter.region(0)).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) {
+ List<RawTrackerHit> rawTrackerHits = event.get(RawTrackerHit.class, inputCollection);
+ //FIXME: this check is necessary because hasCollection(type, name) doesn't seem to actually check type!
+ if (!rawTrackerHits.isEmpty() && RawTrackerHit.class.isInstance(rawTrackerHits.get(0))) {
+ 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]);
+ }
+ }
+ }
+
+ List<RawCalorimeterHit> rawCalHits = event.get(RawCalorimeterHit.class, inputCollection);
+ //FIXME: this check is necessary because hasCollection(type, name) doesn't seem to actually check type!
+ if (!rawCalHits.isEmpty() && RawCalorimeterHit.class.isInstance(rawCalHits.get(0))) {
+ 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();
+ 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());
+ //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(1).clear();
+ plotter.region(1).plot(plots[x + 23][y + 5]);
+ ((PlotterRegion) plotter.region(1)).getPlot().setAllowUserInteraction(false);
+ ((PlotterRegion) plotter.region(1)).getPlot().setAllowPopupMenus(false);
+ }
+}
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -u -r1.1 -r1.2
--- EcalWindowPlots.java 25 Apr 2012 03:57:49 -0000 1.1
+++ EcalWindowPlots.java 26 Apr 2012 18:15:26 -0000 1.2
@@ -33,15 +33,33 @@
private JComboBox crateCombo;
private JComboBox slotCombo;
private JComboBox channelCombo;
- private static final String[] crateList = {"all", "1", "2"};
- private static final String[] slotList = {"all", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"};
- private static final String[] channelList = {"all", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"};
+ 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) {
@@ -122,29 +140,33 @@
}
public void process(EventHeader event) {
- 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]);
+ List<RawTrackerHit> rawTrackerHits = event.get(RawTrackerHit.class, inputCollection);
+ //FIXME: this check is necessary because hasCollection(type, name) doesn't seem to actually check type!
+ if (!rawTrackerHits.isEmpty() && RawTrackerHit.class.isInstance(rawTrackerHits.get(0))) {
+ 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]);
+ }
}
}
}
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -u -r1.1 -r1.2
--- AIDAFrame.java 25 Apr 2012 03:57:49 -0000 1.1
+++ AIDAFrame.java 26 Apr 2012 18:15:26 -0000 1.2
@@ -3,14 +3,12 @@
import hep.aida.*;
import hep.aida.ref.plotter.PlotterUtilities;
import java.awt.BorderLayout;
-import java.util.Random;
import javax.swing.*;
-import java.awt.event.ActionEvent;
/**
*
* @author Sho Uemura <[log in to unmask]>
- * @version $Id: AIDAFrame.java,v 1.1 2012/04/25 03:57:49 meeg Exp $
+ * @version $Id: AIDAFrame.java,v 1.2 2012/04/26 18:15:26 meeg Exp $
*/
public class AIDAFrame extends JFrame {
@@ -28,10 +26,10 @@
menubar = new JMenuBar();
- JMenu menu = new JMenu("File");
- JMenuItem item = new JMenuItem("meeg");
- menu.add(item);
- menubar.add(menu);
+// JMenu menu = new JMenu("File");
+// JMenuItem item = new JMenuItem("meeg");
+// menu.add(item);
+// menubar.add(menu);
this.setJMenuBar(menubar);
this.add(plotterPanel,BorderLayout.NORTH);
@@ -40,7 +38,7 @@
controlsPanel.setLayout(new BoxLayout(controlsPanel,BoxLayout.X_AXIS));
this.add(controlsPanel,BorderLayout.SOUTH);
- this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
+ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public IPlotter getPlotter() {
hps-java/src/main/resources/org/lcsim/hps/steering
diff -u -r1.1 -r1.2
--- ECalWindowMonitoring.lcsim 25 Apr 2012 03:57:49 -0000 1.1
+++ ECalWindowMonitoring.lcsim 26 Apr 2012 18:15:27 -0000 1.2
@@ -8,13 +8,18 @@
<execute>
<driver name="EventMarkerDriver"/>
<driver name="EcalWindowPlots"/>
+ <driver name="EcalPedestalPlots"/>
</execute>
<drivers>
- <driver name="EcalWindowPlots" type="org.lcsim.hps.monitoring.EcalWindowPlots">
+ <driver name="EcalWindowPlots" type="org.lcsim.hps.monitoring.EcalWindowPlotsXY">
<subdetectorName>Ecal</subdetectorName>
<inputCollection>EcalReadoutHits</inputCollection>
<window>100</window>
</driver>
+ <driver name="EcalPedestalPlots" type="org.lcsim.hps.monitoring.EcalPedestalPlots">
+ <subdetectorName>Ecal</subdetectorName>
+ <inputCollection>EcalReadoutHits</inputCollection>
+ </driver>
<driver name="EventMarkerDriver"
type="org.lcsim.job.EventMarkerDriver">
<eventInterval>1</eventInterval>
CVSspam 0.2.12