5 added + 2 removed + 6 modified, total 13 files
hps-java/scripts
diff -N et_monitoring_app.sh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ et_monitoring_app.sh 22 Mar 2012 22:03:35 -0000 1.1
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# This stuff only works on Linux due to dependency on a system-dependent JNI lib which doesn't seem to compile on OSX.
+if [ $(uname) == "Linux" ]
+then
+ echo "Running on a Linux system. OK."
+else
+ echo "Not running on a Linux system. Bailing!"
+ exit 1
+fi
+
+# Check for LD_LIBRARY_PATH which should point to hps-et-java lib dir.
+if [ -z "$LD_LIBRARY_PATH" ]; then
+ echo "No LD_LIBRARY_PATH is set in your environment. Set this to [--YOUR_PATH_TO--]/hps-et-java/lib/lib/Linux-x86_64/ and try again."
+ exit 1
+fi
+
+# Single argument is name of EVIO file.
+eviofile=$1
+
+# Classpath pointing to the hps-java jar.
+classpath=`pwd`/target/hps-java-1.1-SNAPSHOT-bin.jar
+
+# Run it.
+prod="java -classpath $classpath org.lcsim.hps.monitoring.MonitoringConsumer -f ETBuffer -host $(hostname) -s MY_STATION"
+echo $prod
+exec $prod
hps-java/scripts
diff -N et_evio_consumer_test.sh
--- et_evio_consumer_test.sh 16 Mar 2012 20:31:07 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-# This stuff only works on Linux due to dependency on a system-dependent JNI lib which doesn't seem to compile on OSX.
-if [ $(uname) == "Linux" ]
-then
- echo "Running on a Linux system. OK."
-else
- echo "Not running on a Linux system. Bailing!"
- exit 1
-fi
-
-# Check for LD_LIBRARY_PATH which should point to hps-et-java lib dir.
-if [ -z "$LD_LIBRARY_PATH" ]; then
- echo "No LD_LIBRARY_PATH is set in your environment. Set this to [--YOUR_PATH_TO--]/hps-et-java/lib/lib/Linux-x86_64/ and try again."
- exit 1
-fi
-
-# Single argument is name of EVIO file.
-eviofile=$1
-
-# Classpath pointing to the hps-java jar.
-classpath=`pwd`/target/hps-java-1.1-SNAPSHOT-bin.jar
-
-# Run it.
-prod="java -classpath $classpath org.lcsim.hps.evio.EvioConsumer -f ETBuffer -host $(hostname) -s MY_STATION"
-echo $prod
-exec $prod
hps-java/src/main/java/org/lcsim/hps/evio
diff -u -r1.2 -r1.3
--- MCRawDataToEvio4Converter.java 22 Mar 2012 02:21:16 -0000 1.2
+++ MCRawDataToEvio4Converter.java 22 Mar 2012 22:03:35 -0000 1.3
@@ -24,9 +24,11 @@
* The EVIO event structure is as follows, and subject to change.
*
* event
- * bank
+ * bank (ecal)
* composite data
- * bank
+ * bank (ecal)
+ * composite data
+ * bank (svt)
* composite data
*
* The tracker data bank has number = 1 and the ecal data bank has number = 2.
hps-java/src/main/java/org/lcsim/hps/evio
diff -N EvioConsumer.java
--- EvioConsumer.java 22 Mar 2012 03:54:53 -0000 1.12
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,691 +0,0 @@
-package org.lcsim.hps.evio;
-
-import hep.aida.IAnalysisFactory;
-import hep.aida.IBaseHistogram;
-import hep.aida.ICloud1D;
-import hep.aida.IHistogram1D;
-import hep.aida.IManagedObject;
-import hep.aida.IPlotter;
-import hep.aida.IPlotterStyle;
-import hep.aida.ITree;
-
-import java.awt.Color;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import org.freehep.record.loop.event.RecordSuppliedEvent;
-import org.jlab.coda.et.EtAttachment;
-import org.jlab.coda.et.EtConstants;
-import org.jlab.coda.et.EtEvent;
-import org.jlab.coda.et.EtStation;
-import org.jlab.coda.et.EtStationConfig;
-import org.jlab.coda.et.EtSystem;
-import org.jlab.coda.et.EtSystemOpenConfig;
-import org.jlab.coda.et.enums.Mode;
-import org.jlab.coda.et.enums.Modify;
-import org.jlab.coda.et.exception.EtTimeoutException;
-import org.jlab.coda.jevio.EvioEvent;
-import org.jlab.coda.jevio.EvioReader;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawCalorimeterHit;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackerHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.hps.monitoring.ConnectionPanel;
-import org.lcsim.hps.monitoring.ConnectionParameters;
-import org.lcsim.hps.monitoring.ConnectionParameters.ConnectionParametersException;
-import org.lcsim.job.JobControlManager;
-import org.lcsim.util.Driver;
-import org.lcsim.util.DriverAdapter;
-import org.lcsim.util.aida.AIDA;
-
-/**
- * This class is an example of an event consumer for an ET system.
- *
- * Based on Carl Timmer's apps.Consumer class from jevio 4.0 release.
- *
- * @author Jeremy McCormick
- */
-// TODO Move plots into separate Driver which can be called from the .lcsim file, in order to cleanup this class.
-// TODO Move the code that wraps Driver and event loop into the JobControlManager.
-// TODO The main class should be renamed to "TestRunMonitoringGui" or something similar.
-// TODO Integrate the ConnectionPanel so that it can be used for changing connection parameters.
-public class EvioConsumer {
-
- // TODO Next three should be settable as job options.
- private static final String detectorName = "HPS-Test-JLAB-v4pt0";
- private static final String trackerHitCollectionName = "StripClusterer_SiTrackerHitStrip1D";
- private static final String lcsimXml = "/org/lcsim/hps/steering/EtTest.lcsim";
-
- private static Detector detector;
- private static Map<SiSensor,int[]> occupancyMap;
- private static IPlotter occuPlot;
- private static EvioConsumerGui gui;
-
- private static long jobStartTime;
- private static int eventCount;
-
- private static List<IPlotter> plotters = new ArrayList<IPlotter>();
-
- private static final boolean debug = true;
-
- public EvioConsumer() {
- }
-
- static void clearAidaTree() {
- ITree tree = AIDA.defaultInstance().tree();
- String names[] = tree.listObjectNames("/", true);
- for (String name : names) {
- IManagedObject o = tree.find(name);
- if (o instanceof IBaseHistogram) {
- ((IBaseHistogram) o).reset();
- }
- }
- }
-
- static void setupPlots() {
-
- AIDA aida = AIDA.defaultInstance();
- aida.tree().cd("/");
- IHistogram1D adcValuePlot = aida.histogram1D("ADC Value", 500, 0, 500);
- ICloud1D eventRatePlot = aida.cloud1D("Event Rate [Hz]");
- IHistogram1D rawHitCountPlot = aida.histogram1D("Number of RawTrackerHits in Event", 100, 0, 100);
- IHistogram1D tkrHitCountPlot = aida.histogram1D("Number of TrackerHits in Event", 50, 0, 50);
- IHistogram1D tkrCountPlot = aida.histogram1D("Number of Tracks in Event", 20, 0, 20);
- ICloud1D hitsPerTrackPlot = aida.cloud1D("Number of Hits per Track");
- IHistogram1D tkrMomXPlot = aida.histogram1D("Track Px", 200, 0, 2.0);
- IHistogram1D tkrMomYPlot = aida.histogram1D("Track Py", 160, -0.2, 0.2);
- IHistogram1D tkrMomZPlot = aida.histogram1D("Track Pz", 160, -0.2, 0.2);
- IHistogram1D tkrMomPlot = aida.histogram1D("Track P", 200, 0, 4.0);
- ICloud1D timePlot = aida.cloud1D("Time [ns]");
- ICloud1D badEventPlot = aida.cloud1D("Bad Event Count");
-
- IAnalysisFactory fac = aida.analysisFactory();
- IPlotter plotter = fac.createPlotterFactory().create("HPS SVT Plots");
- plotters.add(plotter);
- plotter.style().dataStyle().errorBarStyle().setVisible(false);
- plotter.createRegions(4,4);
- plotter.region(0).plot(adcValuePlot);
- plotter.region(1).plot(eventRatePlot);
- plotter.region(2).plot(rawHitCountPlot);
- plotter.region(3).plot(tkrHitCountPlot);
- plotter.region(4).plot(tkrCountPlot);
- plotter.region(5).plot(hitsPerTrackPlot);
- plotter.region(6).plot(tkrMomXPlot);
- plotter.region(7).plot(tkrMomYPlot);
- plotter.region(8).plot(tkrMomZPlot);
- plotter.region(9).plot(tkrMomPlot);
- plotter.region(10).plot(timePlot);
- plotter.region(11).plot(badEventPlot);
- plotter.show();
-
- // Make a list of sensors in the SVT.
- // FIXME Hard-coded reference to subdetector name.
- List<SiSensor> sensors = detector.getSubdetector("Tracker").getDetectorElement().findDescendants(SiSensor.class);
-
- // Setup occupancy plots.
- IPlotter plotter2 = fac.createPlotterFactory().create("HPS SVT Sensor Occupancy Plots");
- plotters.add(plotter2);
- IPlotterStyle style = plotter2.style();
- style.dataStyle().fillStyle().setColor("yellow");
- style.dataStyle().errorBarStyle().setVisible(false);
- plotter2.createRegions(5, 4);
- int ns = sensors.size();
- for (int i=0; i<ns; i++) {
- IHistogram1D occupancyPlot = aida.histogram1D(sensors.get(i).getName(), 640, 0, 639);
- plotter2.region(i).plot(occupancyPlot);
- }
- plotter2.show();
-
- // Data structure for occupancy calculations by sensor.
- occupancyMap = new HashMap<SiSensor,int[]>();
- for (SiSensor sensor : sensors) {
- occupancyMap.put(sensor, new int[640]);
- }
-
- // Normalized occupancy plots are only setup the first time, not after a call to "reset" from the GUI.
- if (occuPlot == null) {
- IPlotter plotter3 = fac.createPlotterFactory().create("HPS SVT Normalized Sensor Occupancy Plots");
- occuPlot = plotter3;
- IPlotterStyle style3 = plotter3.style();
- style3.dataStyle().fillStyle().setColor("green");
- style3.dataStyle().markerStyle().setColor("green");
- style3.dataStyle().errorBarStyle().setVisible(false);
- style3.statisticsBoxStyle().setVisible(false);
- plotter3.createRegions(5, 4);
- for (int i=0; i<ns; i++) {
- IHistogram1D occupancyPlot = aida.histogram1D(sensors.get(i).getName() + " Normalized", 640, 0, 639);
- plotter3.region(i).plot(occupancyPlot);
- }
- plotter3.show();
- }
-
- // Ecal plots.
- IPlotter plotter4 = fac.createPlotterFactory().create("HPS ECAL Plots");
- plotters.add(plotter4);
- ICloud1D ecalTimePlot = aida.cloud1D("Timestamp");
- ICloud1D ecalAmplitudePlot = aida.cloud1D("Amplitude");
- ICloud1D ecalHitsPlot = aida.cloud1D("Number of Hits");
- plotter4.createRegions(2, 2);
- plotter4.region(0).plot(ecalTimePlot);
- plotter4.region(1).plot(ecalAmplitudePlot);
- plotter4.region(2).plot(ecalHitsPlot);
- plotter4.show();
- }
-
- public static void main(String[] args) {
-
- // Create ET system connection parameters.
- ConnectionParameters cn = new ConnectionParameters();
- try {
- cn.setup(args);
- } catch (ConnectionParametersException e) {
- e.printStackTrace();
- ConnectionParameters.usage();
- System.exit(1);
- }
-
- try {
- // make a direct connection to ET system's tcp server
- EtSystemOpenConfig config = new EtSystemOpenConfig(cn.etName, cn.host, cn.port);
-
- // create ET system object with verbose debugging output
- EtSystem sys = new EtSystem(config, EtConstants.debugInfo);
- sys.open();
-
- // configuration of a new station
- EtStationConfig statConfig = new EtStationConfig();
- statConfig.setFlowMode(cn.flowMode);
- if (!cn.blocking) {
- statConfig.setBlockMode(EtConstants.stationNonBlocking);
- if (cn.qSize > 0) {
- statConfig.setCue(cn.qSize);
- }
- }
-
- // create station
- EtStation stat = sys.createStation(statConfig, cn.statName, cn.position, cn.pposition);
-
- // attach to new station
- EtAttachment att = sys.attach(stat);
-
- // array of events
- EtEvent[] mevs = null;
-
- // Job manager to run LCSim.
- JobControlManager jobMgr = new JobControlManager();
- jobMgr.checkInputFiles(false);
- InputStream is = (new EvioConsumer()).getClass().getResourceAsStream(lcsimXml);
- jobMgr.setup(is);
-
- // Get list of Drivers.
- List<Driver> drivers = jobMgr.getDriverExecList();
-
- // Wrap Drivers with DriverAdapter.
- Driver topDriver = new Driver();
- for (Driver driver : drivers) {
- topDriver.add(driver);
- }
- DriverAdapter driverAdapter = new DriverAdapter(topDriver);
-
- // Call wrapper to startOfData() on DriverAdapter.
- driverAdapter.configure(null);
-
- // Make the builder for creating LCSim events from EVIO data.
- LCSimEventBuilder eventBuilder = new LCSimEventBuilder(detectorName);
- eventBuilder.setDebug(true);
-
- EvioConsumer.detector = eventBuilder.getDetector();
-
- // Get names of raw data collections.
- String rawTrackerHitCollectionName = eventBuilder.getRawTrackerHitCollectionName();
- String rawCalorimeterHitCollectionName = eventBuilder.getRawCalorimeterHitCollectionName();
-
- // Setup all the plots for the job.
- setupPlots();
-
- // The default AIDA instance.
- AIDA aida = AIDA.defaultInstance();
-
- //ConnectionPanel.main(new String[]{});
-
- // Show GUI.
- EvioConsumerGui.main(new String[]{});
- Thread.sleep(1000);
-
- ConnectionPanel.main(new String[]{});
-
- // Number of current event from 0.
- //int eventCount = 0;
- jobStartTime = System.currentTimeMillis();
- long eventRateStart = System.nanoTime();
- final int eventRateInterval = 50;
- while (true) {
-
- // Use this for unlimited wait time.
- //mevs = sys.getEvents(att, Mode.SLEEP, null, 0, chunk);
- boolean timedOut = false;
- try {
- mevs = sys.getEvents(att, Mode.TIMED, Modify.NOTHING, 5000000, cn.chunk);
- } catch (EtTimeoutException e) {
- timedOut = true;
- }
- // When timeout occurs, do cleanup and exit.
- if (timedOut) {
-
- long jobEndTime = System.currentTimeMillis();
- long jobTime = jobEndTime - jobStartTime;
- System.out.println("Job time: " + jobTime / 1000 + " seconds");
-
- // Call wrapper to endOfData() on DriverAdapter.
- driverAdapter.finish(null);
-
- // Exit after user presses enter.
- System.out.println("Press ENTER to exit ...");
- System.console().readLine();
- System.exit(0);
- }
-
- // Loop over retrieved EtEvents.
- for (EtEvent mev : mevs) {
-
- // Get EvioEvent and check for errors.
- ByteBuffer buf = mev.getDataBuffer();
- EvioReader reader = new EvioReader(buf);
- EvioEvent evioEvent = null;
- try {
- evioEvent = reader.parseNextEvent();
- } catch (java.nio.BufferUnderflowException e) {
- System.out.println("Caught underflow!");
- }
- // Something bad happened and event was not built. Just skip it.
- if (evioEvent == null) {
- System.out.println("Failed to build EVIO event <" + eventCount + ">. Skipping this EtEvent!");
- aida.cloud1D("Bad Event Count").fill(0);
- continue;
- }
-
- // Create LCSim event from EVIO data.
- EventHeader lcsimEvent = eventBuilder.makeLCSimEvent(evioEvent);
-
- // Get collections from event.
- List<RawTrackerHit> rawTrackerHits = lcsimEvent.get(RawTrackerHit.class, rawTrackerHitCollectionName);
- if (debug)
- System.out.println("rawTrackerHits.size = " + rawTrackerHits.size());
- List<RawCalorimeterHit> rawCalorimeterHits = lcsimEvent.get(RawCalorimeterHit.class, rawCalorimeterHitCollectionName);
- if (debug)
- System.out.println("rawCalHits.size = " + rawCalorimeterHits.size());
-
- // Make a new event for DriverAdapter.
- RecordSuppliedEvent loopEvent = new RecordSuppliedEvent(new Object(), lcsimEvent);
-
- // Call process methods via Driver Adapter.
- driverAdapter.recordSupplied(loopEvent);
-
- // Make ECal plots.
- makeEcalPlots(aida, rawCalorimeterHits);
-
- // Fill RawTrackerHit count.
- aida.histogram1D("Number of RawTrackerHits in Event").fill(rawTrackerHits.size());
-
- // Loop over RawTrackerHit collection.
- for (RawTrackerHit hit : rawTrackerHits) {
-
- // Fill ADC value plot.
- aida.histogram1D("ADC Value").fill(hit.getADCValues()[0]);
-
- // Fill time plot.
- aida.cloud1D("Time [ns]").fill(hit.getTime());
-
- // Fill basic (non-normalized) occupancy plot.
- aida.histogram1D(hit.getDetectorElement().getName()).fill(hit.getIdentifierFieldValue("strip"));
-
- // Increment hit counts for occupancy calculations.
- int[] strips = occupancyMap.get((SiSensor) hit.getDetectorElement());
- strips[hit.getIdentifierFieldValue("strip")] += 1;
- }
-
- // Normalized occupancy plots.
- occuPlot.clearRegions();
- int si = 0;
- for (SiSensor sensor : occupancyMap.keySet()) {
- int[] strips = occupancyMap.get(sensor);
- aida.histogram1D(sensor.getName() + " Normalized").reset();
- for (int i = 0; i < strips.length; i++) {
- double stripOccupancy = (double) strips[i] / (double) (eventCount + 1);
- if (stripOccupancy != 0) {
- aida.histogram1D(sensor.getName() + " Normalized").fill(i, stripOccupancy);
- }
- }
- occuPlot.region(si).plot(aida.histogram1D(sensor.getName() + " Normalized"));
- ++si;
- }
- occuPlot.show();
-
- // Get Track list from event.
- // This breaks if there is more than one Track collection generated by LCSim.
- List<Track> tracks = lcsimEvent.get(Track.class).get(0);
-
- // Plot number of Tracks.
- aida.histogram1D("Number of Tracks in Event").fill(tracks.size());
-
- // Track plots.
- for (Track track : tracks) {
- aida.cloud1D("Number of Hits per Track").fill(track.getTrackerHits().size());
- aida.histogram1D("Track Px").fill(track.getPX());
- aida.histogram1D("Track Py").fill(track.getPY());
- aida.histogram1D("Track Pz").fill(track.getPZ());
- double[] p = track.getMomentum();
- aida.histogram1D("Track P").fill(Math.sqrt(p[0] * p[0] + p[1] * p[1] + p[2] * p[2]));
- }
-
- // Number of TrackerHits.
- List<TrackerHit> trackerHits = lcsimEvent.get(TrackerHit.class, trackerHitCollectionName);
- aida.histogram1D("Number of TrackerHits in Event").fill(trackerHits.size());
-
- long currTime = System.currentTimeMillis() - jobStartTime;
- gui.setElapsedTime(currTime);
-
- // Increment event count.
- ++eventCount;
-
- // Periodically compute event rate.
- if (eventCount % eventRateInterval == 0) {
-
- long eventRateEnd = System.nanoTime();
- long eventElapsed = eventRateEnd - eventRateStart;
- long nsPerEvent = eventElapsed / eventRateInterval;
- double eventRate = 10e9 / nsPerEvent;
- gui.setEventRate(eventRate);
- eventRateStart = System.nanoTime();
-
- // Compute rolling average event processing time.
- double avgProcTime = (System.currentTimeMillis() - jobStartTime) / (double) eventCount;
- double avgEventRate = 1000 / avgProcTime;
- gui.setAverageEventRate(avgEventRate);
- }
-
- gui.incrEventCount();
-
- }
-
- // Put events back into ET system.
- // FIXME Is this necessary when running in read-only mode?
- sys.putEvents(att, mevs);
- }
- }
- catch (Exception ex) {
- System.out.println("Error using ET system as consumer.");
- ex.printStackTrace();
- }
- }
-
- private static void makeEcalPlots(AIDA aida, List<RawCalorimeterHit> hits) {
- aida.cloud1D("Number of Hits").fill(hits.size());
- for (RawCalorimeterHit hit : hits) {
- aida.cloud1D("Timestamp").fill(hit.getTimeStamp());
- aida.cloud1D("Amplitude").fill(hit.getAmplitude());
- }
- }
-
- static class EvioConsumerGui extends JPanel implements ActionListener {
-
- JButton resetButton;
- JButton saveButton;
- JButton quitButton;
- JTextField eventCounter;
- JTextField elapsedTime;
- JTextField eventRate;
- JTextField host;
- JTextField port;
- JTextField avgEventRate;
- DecimalFormat rateFormat = new DecimalFormat("#.##");
-
- EvioConsumerGui() {
-
- setLayout(new GridBagLayout());
-
- GridBagConstraints c = new GridBagConstraints();
-
- // Panel for labels and values.
- c.gridx = 0;
- c.gridy = 0;
- JPanel fieldsPanel = new JPanel();
- fieldsPanel.setLayout(new GridBagLayout());
- add(fieldsPanel, c);
-
- // Panel for control buttons.
- c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 1;
- JPanel buttonsPanel = new JPanel();
- buttonsPanel.setLayout(new GridBagLayout());
- add(buttonsPanel, c);
-
- c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 0;
- c.anchor = GridBagConstraints.WEST;
- JLabel eventLabel = new JLabel("Events Processed: ");
- eventLabel.setHorizontalAlignment(JLabel.LEFT);
- fieldsPanel.add(eventLabel, c);
-
- c = new GridBagConstraints();
- c.gridx = 1;
- c.gridy = 0;
- c.anchor = GridBagConstraints.EAST;
- eventCounter = new JTextField("0", 6);
- eventCounter.setHorizontalAlignment(JTextField.RIGHT);
- eventCounter.setEditable(false);
- eventCounter.setBackground(Color.WHITE);
- fieldsPanel.add(eventCounter, c);
-
- c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 1;
- c.anchor = GridBagConstraints.WEST;
- JLabel timeLabel = new JLabel("Elapsed Time [ms]:");
- timeLabel.setHorizontalAlignment(JLabel.LEFT);
- fieldsPanel.add(timeLabel, c);
-
- c = new GridBagConstraints();
- c.gridx = 1;
- c.gridy = 1;
- c.anchor = GridBagConstraints.EAST;
- elapsedTime = new JTextField("0", 10);
- elapsedTime.setHorizontalAlignment(JTextField.RIGHT);
- elapsedTime.setEditable(false);
- elapsedTime.setBackground(Color.WHITE);
- fieldsPanel.add(elapsedTime, c);
-
- c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 2;
- c.anchor = GridBagConstraints.WEST;
- JLabel rateLabel = new JLabel("Event Rate [Hz]:");
- rateLabel.setHorizontalAlignment(JLabel.LEFT);
- fieldsPanel.add(rateLabel, c);
-
- c = new GridBagConstraints();
- c.gridx = 1;
- c.gridy = 2;
- c.anchor = GridBagConstraints.EAST;
- eventRate = new JTextField("0", 4);
- eventRate.setHorizontalAlignment(JTextField.RIGHT);
- eventRate.setEditable(false);
- eventRate.setBackground(Color.WHITE);
- fieldsPanel.add(eventRate, c);
-
- c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 3;
- c.anchor = GridBagConstraints.WEST;
- JLabel avgRateLabel = new JLabel("Average Event Rate [Hz]:");
- avgRateLabel.setHorizontalAlignment(JLabel.LEFT);
- fieldsPanel.add(avgRateLabel, c);
-
- c = new GridBagConstraints();
- c.gridx = 1;
- c.gridy = 3;
- c.anchor = GridBagConstraints.EAST;
- avgEventRate = new JTextField("0", 6);
- avgEventRate.setHorizontalAlignment(JTextField.RIGHT);
- avgEventRate.setEditable(false);
- avgEventRate.setBackground(Color.WHITE);
- fieldsPanel.add(avgEventRate, c);
-
- // Button padding.
- Insets buttonInsets = new Insets(1, 1, 1, 1);
-
- c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 0;
- c.fill = GridBagConstraints.BOTH;
- c.insets = buttonInsets;
- resetButton = new JButton("Reset");
- resetButton.setActionCommand("reset");
- resetButton.addActionListener(this);
- resetButton.setToolTipText("Reset the plots.");
- buttonsPanel.add(resetButton, c);
-
- c = new GridBagConstraints();
- c.gridx = 1;
- c.gridy = 0;
- c.fill = GridBagConstraints.BOTH;
- c.insets = buttonInsets;
- saveButton = new JButton("Save Plots");
- saveButton.setActionCommand("save");
- saveButton.addActionListener(this);
- saveButton.setToolTipText("Save the plots to an AIDA file.");
- buttonsPanel.add(saveButton, c);
-
- c = new GridBagConstraints();
- c.gridx = 2;
- c.gridy = 0;
- c.fill = GridBagConstraints.BOTH;
- c.insets = buttonInsets;
- quitButton = new JButton("Quit");
- quitButton.setActionCommand("quit");
- quitButton.addActionListener(this);
- quitButton.setToolTipText("Quit the job.");
- buttonsPanel.add(quitButton, c);
- }
-
- public void incrEventCount() {
- int e = Integer.parseInt(eventCounter.getText());
- e += 1;
- eventCounter.setText(Integer.toString(e));
- }
-
- public void setElapsedTime(long time) {
- elapsedTime.setText(Long.toString(time));
- }
-
- public void setEventRate(double rate) {
- eventRate.setText(rateFormat.format(rate));
- }
-
- public void setAverageEventRate(double rate) {
- avgEventRate.setText(rateFormat.format(rate));
- }
-
- public void resetEventCount() {
- eventCounter.setText("0");
- }
-
- public void resetTimer() {
- jobStartTime = System.currentTimeMillis();
- }
-
- public static void createAndShow() {
- JFrame frame = new JFrame("EvioConsumer GUI");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- gui = new EvioConsumerGui();
- gui.setOpaque(true);
- frame.setContentPane(gui);
-
- frame.pack();
- frame.setVisible(true);
- }
-
- public void actionPerformed(ActionEvent e) {
- String cmd = e.getActionCommand();
- if ("reset".equals(cmd)) {
- reset();
- }
- else if ("save".equals(cmd)) {
- save();
- }
- else if ("quit".equals(cmd)) {
- quit();
- }
- }
-
- private void reset() {
-
- for (IPlotter plotter : plotters) {
- plotter.hide();
- plotter.clearRegions();
- }
- plotters.clear();
-
- clearAidaTree();
- setupPlots();
- resetEventCount();
- resetTimer();
-
- eventCount = 0;
- }
-
- private void save() {
- JFileChooser fc = new JFileChooser();
- int r = fc.showSaveDialog(EvioConsumerGui.this);
- if (r == JFileChooser.APPROVE_OPTION) {
- File fileName = fc.getSelectedFile();
- try {
- AIDA.defaultInstance().saveAs(fileName);
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- }
- else {
- System.out.println("Save operation was cancelled.");
- }
- }
-
- private void quit() {
- System.exit(0);
- }
-
- public static void main(String[] args) {
- javax.swing.SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- createAndShow();
- }
- });
- }
- }
-}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -N MonitoringConsumer.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MonitoringConsumer.java 22 Mar 2012 22:03:35 -0000 1.1
@@ -0,0 +1,196 @@
+package org.lcsim.hps.monitoring;
+
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+import org.freehep.record.loop.event.RecordSuppliedEvent;
+import org.jlab.coda.et.EtAttachment;
+import org.jlab.coda.et.EtConstants;
+import org.jlab.coda.et.EtEvent;
+import org.jlab.coda.et.EtStation;
+import org.jlab.coda.et.EtStationConfig;
+import org.jlab.coda.et.EtSystem;
+import org.jlab.coda.et.EtSystemOpenConfig;
+import org.jlab.coda.et.enums.Mode;
+import org.jlab.coda.et.enums.Modify;
+import org.jlab.coda.et.exception.EtTimeoutException;
+import org.jlab.coda.jevio.EvioEvent;
+import org.jlab.coda.jevio.EvioReader;
+import org.lcsim.event.EventHeader;
+import org.lcsim.hps.evio.LCSimEventBuilder;
+import org.lcsim.hps.monitoring.ConnectionParameters.ConnectionParametersException;
+import org.lcsim.job.JobControlManager;
+import org.lcsim.util.Driver;
+import org.lcsim.util.DriverAdapter;
+
+/**
+ * This class is an example of an event consumer for an ET system.
+ *
+ * Based on Carl Timmer's apps.Consumer class from jevio 4.0 release.
+ *
+ * @author Jeremy McCormick
+ */
+// TODO Move the code that wraps Driver and event loop into the JobControlManager.
+// TODO Integrate the ConnectionPanel so that it can be used for changing connection parameters.
+public class MonitoringConsumer {
+
+ // TODO Next two should be job options.
+ private static final String detectorName = "HPS-Test-JLAB-v4pt0";
+ private static final String lcsimXml = "/org/lcsim/hps/steering/EtTest.lcsim";
+
+ private MonitoringGui gui;
+ private int eventCount;
+
+ private JobControlManager jobMgr;
+
+ public MonitoringConsumer()
+ {}
+
+ public static void main(String [] args) {
+ MonitoringConsumer app = new MonitoringConsumer();
+ app.run(args);
+ }
+
+ public void run(String[] args) {
+
+ // Create ET system connection parameters.
+ ConnectionParameters cn = new ConnectionParameters();
+ try {
+ cn.setup(args);
+ } catch (ConnectionParametersException e) {
+ e.printStackTrace();
+ ConnectionParameters.usage();
+ System.exit(1);
+ }
+
+ try {
+ // make a direct connection to ET system's tcp server
+ EtSystemOpenConfig config = new EtSystemOpenConfig(cn.etName, cn.host, cn.port);
+
+ // create ET system object with verbose debugging output
+ EtSystem sys = new EtSystem(config, EtConstants.debugInfo);
+ sys.open();
+
+ // configuration of a new station
+ EtStationConfig statConfig = new EtStationConfig();
+ statConfig.setFlowMode(cn.flowMode);
+ if (!cn.blocking) {
+ statConfig.setBlockMode(EtConstants.stationNonBlocking);
+ if (cn.qSize > 0) {
+ statConfig.setCue(cn.qSize);
+ }
+ }
+
+ // create station
+ EtStation stat = sys.createStation(statConfig, cn.statName, cn.position, cn.pposition);
+
+ // attach to new station
+ EtAttachment att = sys.attach(stat);
+
+ // array of events
+ EtEvent[] mevs = null;
+
+ // Job manager to run LCSim.
+ jobMgr = new JobControlManager();
+ jobMgr.checkInputFiles(false);
+ InputStream is = (new MonitoringConsumer()).getClass().getResourceAsStream(lcsimXml);
+ jobMgr.setup(is);
+
+ // Get list of Drivers.
+ List<Driver> drivers = jobMgr.getDriverExecList();
+
+ // Wrap Drivers with DriverAdapter.
+ Driver topDriver = new Driver();
+ for (Driver driver : drivers) {
+ topDriver.add(driver);
+ }
+ DriverAdapter driverAdapter = new DriverAdapter(topDriver);
+
+ // Call wrapper to startOfData() on DriverAdapter.
+ driverAdapter.configure(null);
+
+ // Make the builder for creating LCSim events from EVIO data.
+ LCSimEventBuilder eventBuilder = new LCSimEventBuilder(detectorName);
+ eventBuilder.setDebug(true);
+
+ // Show GUI.
+ MonitoringGui.main(new String[]{});
+ Thread.sleep(2000);
+ gui = MonitoringGui.getMonitoringGui();
+ gui.setJobControlManager(jobMgr);
+
+ ConnectionPanel.main(new String[]{});
+
+ // Start job timer.
+ gui.updateJobStartTime();
+
+ // Event loop.
+ while (true) {
+
+ // Use these arguments for unlimited wait time.
+ //mevs = sys.getEvents(att, Mode.SLEEP, null, 0, chunk);
+ boolean timedOut = false;
+ try {
+ mevs = sys.getEvents(att, Mode.TIMED, Modify.NOTHING, 10000000, cn.chunk);
+ } catch (EtTimeoutException e) {
+ timedOut = true;
+ }
+ // When timeout occurs, do cleanup and exit.
+ if (timedOut) {
+
+ // Call wrapper to Driver.endOfData() on DriverAdapter.
+ driverAdapter.finish(null);
+
+ // Exit after user presses enter.
+ System.out.println("Press ENTER to exit ...");
+ System.console().readLine();
+ System.exit(0);
+ }
+
+ // Loop over retrieved EtEvents.
+ for (EtEvent mev : mevs) {
+
+ // Increment GUI event count.
+ gui.incrEventCount();
+
+ // Get EvioEvent and check for errors.
+ ByteBuffer buf = mev.getDataBuffer();
+ EvioReader reader = new EvioReader(buf);
+ EvioEvent evioEvent = null;
+ try {
+ evioEvent = reader.parseNextEvent();
+ } catch (java.nio.BufferUnderflowException e) {
+ System.out.println("Caught underflow!");
+ }
+ if (evioEvent == null) {
+ System.out.println("Failed to build EVIO event <" + eventCount + ">. Skipping this EtEvent!");
+ continue;
+ }
+
+ // Create LCSim event from EVIO data.
+ EventHeader lcsimEvent = eventBuilder.makeLCSimEvent(evioEvent);
+
+ // Make a new event for DriverAdapter.
+ RecordSuppliedEvent loopEvent = new RecordSuppliedEvent(new Object(), lcsimEvent);
+
+ // Call process methods via Driver Adapter.
+ driverAdapter.recordSupplied(loopEvent);
+
+ // Update elapsed time.
+ gui.updateElapsedTime();
+
+ // Update the average event rate in the GUI.
+ gui.updateAverageEventRate();
+ }
+
+ // Put events back into the ET system.
+ sys.putEvents(att, mevs);
+ }
+ }
+ catch (Exception ex) {
+ System.out.println("Error using ET system as consumer.");
+ ex.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -N MonitoringGui.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MonitoringGui.java 22 Mar 2012 22:03:35 -0000 1.1
@@ -0,0 +1,281 @@
+package org.lcsim.hps.monitoring;
+
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
+import java.text.DecimalFormat;
+
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import org.lcsim.job.JobControlManager;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class MonitoringGui extends JPanel implements ActionListener {
+
+ private JButton resetButton;
+ private JButton saveButton;
+ private JButton quitButton;
+ private JTextField eventCounterField;
+ private JTextField elapsedTimeField;
+ //private JTextField eventRateField;
+ private JTextField avgEventRateField;
+ private DecimalFormat rateFormat = new DecimalFormat("#.##");
+
+ private static JobControlManager jobMgr;
+ private static MonitoringGui monitoringGui;
+
+ private long jobStartTime;
+
+ MonitoringGui() {
+
+ setLayout(new GridBagLayout());
+
+ GridBagConstraints c = new GridBagConstraints();
+
+ // Panel for labels and values.
+ c.gridx = 0;
+ c.gridy = 0;
+ JPanel fieldsPanel = new JPanel();
+ fieldsPanel.setLayout(new GridBagLayout());
+ add(fieldsPanel, c);
+
+ // Panel for control buttons.
+ c = new GridBagConstraints();
+ c.gridx = 0;
+ c.gridy = 1;
+ JPanel buttonsPanel = new JPanel();
+ buttonsPanel.setLayout(new GridBagLayout());
+ add(buttonsPanel, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 0;
+ c.gridy = 0;
+ c.anchor = GridBagConstraints.WEST;
+ JLabel eventLabel = new JLabel("Events Processed: ");
+ eventLabel.setHorizontalAlignment(JLabel.LEFT);
+ fieldsPanel.add(eventLabel, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 1;
+ c.gridy = 0;
+ c.anchor = GridBagConstraints.EAST;
+ eventCounterField = new JTextField("0", 6);
+ eventCounterField.setHorizontalAlignment(JTextField.RIGHT);
+ eventCounterField.setEditable(false);
+ eventCounterField.setBackground(Color.WHITE);
+ fieldsPanel.add(eventCounterField, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 0;
+ c.gridy = 1;
+ c.anchor = GridBagConstraints.WEST;
+ JLabel timeLabel = new JLabel("Elapsed Time [ms]:");
+ timeLabel.setHorizontalAlignment(JLabel.LEFT);
+ fieldsPanel.add(timeLabel, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 1;
+ c.gridy = 1;
+ c.anchor = GridBagConstraints.EAST;
+ elapsedTimeField = new JTextField("0", 10);
+ elapsedTimeField.setHorizontalAlignment(JTextField.RIGHT);
+ elapsedTimeField.setEditable(false);
+ elapsedTimeField.setBackground(Color.WHITE);
+ fieldsPanel.add(elapsedTimeField, c);
+
+ /*
+ c = new GridBagConstraints();
+ c.gridx = 0;
+ c.gridy = 2;
+ c.anchor = GridBagConstraints.WEST;
+ JLabel rateLabel = new JLabel("Event Rate [Hz]:");
+ rateLabel.setHorizontalAlignment(JLabel.LEFT);
+ fieldsPanel.add(rateLabel, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 1;
+ c.gridy = 2;
+ c.anchor = GridBagConstraints.EAST;
+ eventRate = new JTextField("0", 4);
+ eventRate.setHorizontalAlignment(JTextField.RIGHT);
+ eventRate.setEditable(false);
+ eventRate.setBackground(Color.WHITE);
+ fieldsPanel.add(eventRate, c);
+ */
+
+ c = new GridBagConstraints();
+ c.gridx = 0;
+ c.gridy = 2;
+ c.anchor = GridBagConstraints.WEST;
+ JLabel avgRateLabel = new JLabel("Average Event Rate [Hz]:");
+ avgRateLabel.setHorizontalAlignment(JLabel.LEFT);
+ fieldsPanel.add(avgRateLabel, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 1;
+ c.gridy = 2;
+ c.anchor = GridBagConstraints.EAST;
+ avgEventRateField = new JTextField("0", 6);
+ avgEventRateField.setHorizontalAlignment(JTextField.RIGHT);
+ avgEventRateField.setEditable(false);
+ avgEventRateField.setBackground(Color.WHITE);
+ fieldsPanel.add(avgEventRateField, c);
+
+ // Button padding.
+ Insets buttonInsets = new Insets(1, 1, 1, 1);
+
+ c = new GridBagConstraints();
+ c.gridx = 0;
+ c.gridy = 0;
+ c.fill = GridBagConstraints.BOTH;
+ c.insets = buttonInsets;
+ resetButton = new JButton("Reset");
+ resetButton.setActionCommand("reset");
+ resetButton.addActionListener(this);
+ resetButton.setToolTipText("Reset the plots.");
+ buttonsPanel.add(resetButton, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 1;
+ c.gridy = 0;
+ c.fill = GridBagConstraints.BOTH;
+ c.insets = buttonInsets;
+ saveButton = new JButton("Save Plots");
+ saveButton.setActionCommand("save");
+ saveButton.addActionListener(this);
+ saveButton.setToolTipText("Save the plots to an AIDA file.");
+ buttonsPanel.add(saveButton, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 2;
+ c.gridy = 0;
+ c.fill = GridBagConstraints.BOTH;
+ c.insets = buttonInsets;
+ quitButton = new JButton("Quit");
+ quitButton.setActionCommand("quit");
+ quitButton.addActionListener(this);
+ quitButton.setToolTipText("Quit the job.");
+ buttonsPanel.add(quitButton, c);
+ }
+
+ public static MonitoringGui getMonitoringGui() {
+ return MonitoringGui.monitoringGui;
+ }
+
+ public void setJobControlManager(JobControlManager jobMgr) {
+ MonitoringGui.jobMgr = jobMgr;
+ }
+
+ public void incrEventCount() {
+ int e = Integer.parseInt(eventCounterField.getText());
+ e += 1;
+ eventCounterField.setText(Integer.toString(e));
+ }
+
+ public void updateJobStartTime() {
+ this.jobStartTime = System.currentTimeMillis();
+ }
+
+ public void updateAverageEventRate() {
+ double avgProcTime = (System.currentTimeMillis() - jobStartTime) / Double.parseDouble(eventCounterField.getText());
+ double avgEventRate = 1000 / avgProcTime;
+ avgEventRateField.setText(rateFormat.format(avgEventRate));
+ }
+
+ public void updateElapsedTime() {
+ this.elapsedTimeField.setText(Long.toString(System.currentTimeMillis() - jobStartTime));
+ }
+
+ private void resetEventCount() {
+ eventCounterField.setText("0");
+ }
+
+ private void resetElapsedTime() {
+ elapsedTimeField.setText("0");
+ }
+
+ private void resetDrivers() {
+ for (Driver driver : jobMgr.getDriverExecList()) {
+ if (driver instanceof Resettable) {
+ ((Resettable) driver).reset();
+ }
+ }
+ }
+
+ private void resetJobStartTime() {
+ jobStartTime = System.currentTimeMillis();
+ }
+
+ private void resetAverageEventRate() {
+ avgEventRateField.setText("0");
+ }
+
+ public static void createAndShow() {
+ JFrame frame = new JFrame("HPS Monitoring GUI");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ monitoringGui = new MonitoringGui();
+ monitoringGui.setOpaque(true);
+ frame.setContentPane(monitoringGui);
+
+ frame.pack();
+ frame.setVisible(true);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ String cmd = e.getActionCommand();
+ if ("reset".equals(cmd)) {
+ reset();
+ } else if ("save".equals(cmd)) {
+ save();
+ } else if ("quit".equals(cmd)) {
+ quit();
+ }
+ }
+
+ private void reset() {
+ resetDrivers();
+ resetEventCount();
+ resetAverageEventRate();
+ resetElapsedTime();
+ resetJobStartTime();
+ }
+
+ private void save() {
+ JFileChooser fc = new JFileChooser();
+ int r = fc.showSaveDialog(MonitoringGui.this);
+ if (r == JFileChooser.APPROVE_OPTION) {
+ File fileName = fc.getSelectedFile();
+ try {
+ AIDA.defaultInstance().saveAs(fileName);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } else {
+ System.out.println("Save operation was cancelled.");
+ }
+ }
+
+ private void quit() {
+ System.exit(0);
+ }
+
+ public static void main(String[] args) {
+ javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ createAndShow();
+ }
+ });
+ }
+}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -N Resettable.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Resettable.java 22 Mar 2012 22:03:35 -0000 1.1
@@ -0,0 +1,13 @@
+package org.lcsim.hps.monitoring;
+
+/**
+ * Drivers that will be attached to monitoring system should implement
+ * this if they will be reset when the "reset" button is pressed on the
+ * monitoring app.
+ *
+ * @author Jeremy McCormick <[log in to unmask]>
+ *
+ */
+public interface Resettable {
+ void reset();
+}
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -u -r1.1 -r1.2
--- ConnectionPanel.java 22 Mar 2012 03:54:53 -0000 1.1
+++ ConnectionPanel.java 22 Mar 2012 22:03:35 -0000 1.2
@@ -178,6 +178,7 @@
c.gridy = 8;
c.anchor = GridBagConstraints.EAST;
positionField = new JTextField(Integer.toString(connectionParameters.position), 3);
+ positionField.setHorizontalAlignment(JLabel.RIGHT);
add(positionField, c);
c = new GridBagConstraints();
@@ -193,6 +194,7 @@
c.gridy = 9;
c.anchor = GridBagConstraints.EAST;
ppositionField = new JTextField(Integer.toString(connectionParameters.pposition), 3);
+ ppositionField.setHorizontalAlignment(JLabel.RIGHT);
add(ppositionField, c);
}
@@ -216,7 +218,7 @@
}
public static void createAndShow() {
- JFrame frame = new JFrame("Connection Dialog");
+ JFrame frame = new JFrame("ET Connection Dialog");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel c = new ConnectionPanel();
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -u -r1.1 -r1.2
--- MonitoringPlotsDriver.java 22 Mar 2012 07:11:02 -0000 1.1
+++ MonitoringPlotsDriver.java 22 Mar 2012 22:03:35 -0000 1.2
@@ -25,7 +25,7 @@
import org.lcsim.util.aida.AIDA;
// TODO Add Histogram2D of ECal cells. Can plot as color map.
-public class MonitoringPlotsDriver extends Driver {
+public class MonitoringPlotsDriver extends Driver implements Resettable {
private Map<SiSensor,int[]> occupancyMap;
private IPlotter occuPlot;
hps-java/src/main/resources/org/lcsim/hps/steering
diff -u -r1.2 -r1.3
--- EtTest.lcsim 22 Mar 2012 02:21:17 -0000 1.2
+++ EtTest.lcsim 22 Mar 2012 22:03:35 -0000 1.3
@@ -16,6 +16,7 @@
<driver name="EventMarkerDriver"/>
<driver name="TrackerHitDriver"/>
<driver name="TrackerReconDriver"/>
+ <driver name="MonitoringPlotsDriver"/>
</execute>
<drivers>
@@ -41,6 +42,9 @@
<stripMaxSeparation>20.0</stripMaxSeparation>
<stripTolerance>1.0</stripTolerance>
</driver>
+
+ <driver name="MonitoringPlotsDriver"
+ type="org.lcsim.hps.monitoring.MonitoringPlotsDriver"/>
</drivers>
</lcsim>
hps-java/src/test/java/org/lcsim/hps/evio
diff -N Evio4FileDumpTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Evio4FileDumpTest.java 22 Mar 2012 22:03:35 -0000 1.1
@@ -0,0 +1,58 @@
+package org.lcsim.hps.evio;
+
+import java.io.File;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.jlab.coda.jevio.BaseStructure;
+import org.jlab.coda.jevio.CompositeData;
+import org.jlab.coda.jevio.EvioEvent;
+import org.jlab.coda.jevio.EvioReader;
+import org.jlab.coda.jevio.test.CompositeTester;
+import org.lcsim.util.cache.FileCache;
+
+public class Evio4FileDumpTest extends TestCase {
+
+ public void testMe() throws Exception {
+
+ FileCache cache = new FileCache();
+ cache.setCacheDirectory(new File("."));
+ File evioTestData = cache.getCachedFile(new URL("http://www.lcsim.org/test/hps/hps_000246.dat"));
+
+ EvioReader reader = new EvioReader(evioTestData);
+ EvioEvent event = reader.parseNextEvent();
+
+ int eventCount = 1;
+
+ while (true) {
+
+ System.out.println("event #" + eventCount);
+ System.out.println("event has " + event.getChildCount() + " children");
+ if (event.getChildCount() > 0) {
+ for (BaseStructure topBank : event.getChildren()) {
+ System.out.println("top bank has " + topBank.getChildCount() + " children");
+ if (topBank.getChildCount() > 0) {
+ for (BaseStructure subBank : topBank.getChildren()) {
+ System.out.println("subBank has " + subBank.getChildCount() + " children");
+ CompositeData cdata = subBank.getCompositeData();
+ System.out.println("Printing subBank CompositeData...");
+ if (cdata != null)
+ CompositeTester.printCompositeDataObject(cdata);
+ }
+ }
+ }
+ }
+
+ if (reader.getNumEventsRemaining() == 0) {
+ break;
+ }
+ else {
+ event = reader.parseNextEvent();
+ }
+ ++eventCount;
+ System.out.println("--------------------");
+ }
+
+ }
+}
hps-java/src/test/java/org/lcsim/hps/evio
diff -u -r1.1 -r1.2
--- MCRawDataToEvio4Converter_Test.java 21 Mar 2012 20:19:13 -0000 1.1
+++ MCRawDataToEvio4Converter_Test.java 22 Mar 2012 22:03:35 -0000 1.2
@@ -14,6 +14,7 @@
String fileName = "/u1/hps/trackerTest/ap2.2gev050mevsel_SLIC-v2r11p1_geant4-v9r3p2_QGSP_BERT_HPS-Test-JLAB-v4pt0_rawData.slcio";
public void testRawDataCnv() throws Exception {
+
File lcioFile = new File(fileName);
LCSimLoop loop = new LCSimLoop();
loop.setLCIORecordSource(lcioFile);
hps-java/src/test/java/org/lcsim/hps/evio
diff -u -r1.7 -r1.8
--- RawTrackerHitToEvio4Converter.java 16 Mar 2012 20:02:31 -0000 1.7
+++ RawTrackerHitToEvio4Converter.java 22 Mar 2012 22:03:35 -0000 1.8
@@ -24,15 +24,15 @@
* and compares the two to make sure they match.
*
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: RawTrackerHitToEvio4Converter.java,v 1.7 2012/03/16 20:02:31 jeremy Exp $
+ * @version $Id: RawTrackerHitToEvio4Converter.java,v 1.8 2012/03/22 22:03:35 jeremy Exp $
*/
public class RawTrackerHitToEvio4Converter extends Driver {
private final String format = "N(L,I,I)";
private String rawHitCollectionName = "RawTrackerHitMaker_RawTrackerHits";
private static String lcioFileName = "ap2.2gev050mevsel_SLIC-v2r11p1_geant4-v9r3p2_QGSP_BERT_HPS-Test-JLAB-v4pt0_trackRecon.slcio";
- private static String lcioFileUrl = "http://www.lcsim.org/test/hps/" + lcioFileName;
- //private static String lcioFileUrl = "file:///u1/hps/trackerTest/" + lcioFileName;
+ //private static String lcioFileUrl = "http://www.lcsim.org/test/hps/" + lcioFileName;
+ private static String lcioFileUrl = "file:///u1/hps/trackerTest/" + lcioFileName;
private static String evioFileName = "compositeDataTest.evio";
private EventWriter writer;
@@ -75,7 +75,7 @@
private CompositeData convertToCompositeData(List<RawTrackerHit> hits) {
int dataSize = hits.size();
CompositeData.Data data = new CompositeData.Data();
- data.addN(dataSize);
+ data.addN(dataSize);
for (RawTrackerHit hit : hits) {
data.addLong(hit.getCellID());
data.addInt(hit.getTime());
CVSspam 0.2.12