Commit in hps-java/src/main/java/org/lcsim/hps/monitoring on MAIN | |||
CalibrationDriver.java | -105 | 1.1 removed | |
AIDAFrame.java | -51 | 1.6 removed | |
RunControlDialog.java | -104 | 1.2 removed | |
RunControlDriver.java | -84 | 1.5 removed | |
-344 |
moved from monitoring package
diff -N CalibrationDriver.java --- CalibrationDriver.java 25 Feb 2013 22:39:26 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,105 +0,0 @@
-package org.lcsim.hps.monitoring; - -import org.lcsim.conditions.ConditionsEvent; -import org.lcsim.conditions.ConditionsListener; -import org.lcsim.conditions.ConditionsManager; -import org.lcsim.conditions.ConditionsSet; -import org.lcsim.event.EventHeader; -import org.lcsim.geometry.Detector; -import org.lcsim.hps.recon.ecal.EcalConditions; -import org.lcsim.hps.recon.tracking.FieldMap; -import org.lcsim.hps.recon.tracking.HPSSVTCalibrationConstants; -import org.lcsim.hps.recon.tracking.HPSSVTSensorSetup; -import org.lcsim.util.Driver; - -/** - * - * @author Sho Uemura <[log in to unmask]> - * @version $Id: CalibrationDriver.java,v 1.1 2013/02/25 22:39:26 meeg Exp $ - */ -public class CalibrationDriver extends Driver implements ConditionsListener { - - // The test run number of interest. If it equals -1, the default calibrations - // are loaded - private static int runNumber = -1; - private boolean fixRunNumber = false; - - public CalibrationDriver() { - add(new EcalConditions()); - add(new HPSSVTSensorSetup()); - } - - public void setRunNumber(int runNumber) { - CalibrationDriver.runNumber = runNumber; - fixRunNumber = true; - } - - public static int runNumber() { - return runNumber; - } - - @Override - protected void process(EventHeader event) { - super.process(event); - if (!fixRunNumber && runNumber != event.getRunNumber()) { - runNumber = event.getRunNumber(); - } - } - - @Override - protected void detectorChanged(Detector detector) { - super.detectorChanged(detector); - - if (!EcalConditions.calibrationLoaded()) { - EcalConditions.loadCalibration(); - } - if (fixRunNumber && (!HPSSVTCalibrationConstants.pedestalLoaded() || !HPSSVTCalibrationConstants.tpLoaded())) { - System.out.println("Loading calibration for set run: " + runNumber); - loadCalibsByRun(runNumber); - } - } - - @Override - protected void startOfData() { - ConditionsManager.defaultInstance().addConditionsListener(this); - } - - @Override - public void conditionsChanged(ConditionsEvent ce) { - if (!fixRunNumber) { - System.out.println("Got ConditionsEvent with run: " + ce.getConditionsManager().getRun()); - runNumber = ce.getConditionsManager().getRun(); - loadCalibsByRun(runNumber); - } - } - - private void loadCalibsByRun(int run) { - HPSSVTCalibrationConstants.loadCalibration(run); - FieldMap.loadFieldMap(run); - } - - /** - * get specified conditions list, parse as a map of run numbers to calibration file paths; get the appropriate file - * @param calibName - * @param run - * @return - */ - public static String getCalibForRun(String calibName, int run) { - System.out.println("Reading calibrations " + calibName + " for run: " + run); - - ConditionsSet calibSet = ConditionsManager.defaultInstance().getConditions(calibName); - - int mostRecentValid = Integer.MIN_VALUE; - String filePath = null; - for (Object key : calibSet.keySet()) { - int keyRun = Integer.parseInt((String) key); -// System.out.println("Available calibration for run: " + keyRun); - if (keyRun > mostRecentValid && keyRun <= run) { - mostRecentValid = keyRun; - filePath = calibSet.getString((String) key); - } - } - System.out.println("Use this calibration from run " + mostRecentValid + ": " + filePath); - return filePath; - } -}
diff -N AIDAFrame.java --- AIDAFrame.java 23 May 2012 22:43:48 -0000 1.6 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,51 +0,0 @@
-package org.lcsim.hps.monitoring; - -import hep.aida.*; -import hep.aida.ref.plotter.PlotterUtilities; -import java.awt.BorderLayout; -import javax.swing.*; - -/** - * - * @author Sho Uemura <[log in to unmask]> - * @version $Id: AIDAFrame.java,v 1.6 2012/05/23 22:43:48 meeg Exp $ - */ -public class AIDAFrame extends JFrame { - - JPanel controlsPanel; - JMenuBar menubar; - JTabbedPane tabbedPane; - - public AIDAFrame() { - tabbedPane = new JTabbedPane(); - this.getContentPane().setLayout(new BorderLayout()); - - menubar = new JMenuBar(); - this.setJMenuBar(menubar); - - this.add(tabbedPane, BorderLayout.CENTER); - - controlsPanel = new JPanel(); - controlsPanel.setLayout(new BoxLayout(controlsPanel, BoxLayout.X_AXIS)); - this.add(controlsPanel, BorderLayout.SOUTH); - } - - public void addPlotter(IPlotter plotter) { - JPanel plotterPanel = new JPanel(new BorderLayout()); - // Now embed the plotter - plotterPanel.add(PlotterUtilities.componentForPlotter(plotter), BorderLayout.CENTER); - tabbedPane.add(plotter.title(), plotterPanel); - } - - public JTabbedPane getTabbedPane() { - return tabbedPane; - } - - public JPanel getControlsPanel() { - return controlsPanel; - } - - public JMenuBar getMenubar() { - return menubar; - } -}
\ No newline at end of file
diff -N RunControlDialog.java --- RunControlDialog.java 28 May 2012 19:41:56 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,104 +0,0 @@
-package org.lcsim.hps.monitoring; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.io.IOException; -import javax.swing.BoxLayout; -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import org.lcsim.event.EventHeader; -import org.lcsim.util.aida.AIDA; - -/** - * Lightweight driver for stepping through events in offline analysis, without - * running the MonitoringApp. - * - * @author Sho Uemura <[log in to unmask]> - * @version $Id: RunControlDialog.java,v 1.2 2012/05/28 19:41:56 meeg Exp $ - */ -public class RunControlDialog implements ActionListener { - - JButton nextButton; - JButton runButton; - JButton saveButton; - JFrame nextFrame; - boolean run = false; - final Object syncObject = new Object(); - - public RunControlDialog() { - nextFrame = new JFrame(); - nextFrame.setAlwaysOnTop(true); - nextFrame.getContentPane().setLayout(new BoxLayout(nextFrame.getContentPane(), BoxLayout.X_AXIS)); - - nextButton = new JButton("Next event"); - nextButton.addActionListener(this); - nextFrame.add(nextButton); - - runButton = new JButton("Run"); - runButton.addActionListener(this); - nextFrame.add(runButton); - - saveButton = new JButton("Save"); - saveButton.addActionListener(this); - nextFrame.add(saveButton); - - nextFrame.pack(); - nextFrame.setVisible(true); - nextFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - } - - //return true to process the event; return false to discard; waits if in pause mode - public boolean process(EventHeader event) { - if (!run) { - synchronized (syncObject) { - try { - syncObject.wait(); - } catch (InterruptedException e) { - } - } - } - return true; - } - - @Override - public void actionPerformed(ActionEvent ae) { - if (ae.getSource() == nextButton) { - synchronized (syncObject) { - syncObject.notify(); - } - } - if (ae.getSource() == runButton) { - if (!run) { - runButton.setText("Pause"); - run = true; - synchronized (syncObject) { - syncObject.notify(); - } - } else { - run = false; - runButton.setText("Run"); - } - } - if (ae.getSource() == saveButton) { - savePlots(); - } - } - - /** - * Save plots to a selected output file. - */ - private void savePlots() { - JFileChooser fc = new JFileChooser(); - int r = fc.showSaveDialog(nextFrame); - if (r == JFileChooser.APPROVE_OPTION) { - File fileName = fc.getSelectedFile(); - try { - AIDA.defaultInstance().saveAs(fileName); - } catch (IOException e) { - e.printStackTrace(); - } - } - } -}
diff -N RunControlDriver.java --- RunControlDriver.java 27 Sep 2012 01:08:13 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,84 +0,0 @@
-package org.lcsim.hps.monitoring; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import javax.swing.BoxLayout; -import javax.swing.JButton; -import javax.swing.JFrame; -import org.lcsim.event.EventHeader; -import org.lcsim.util.Driver; - -/** - * Lightweight driver for stepping through events in offline analysis, without - * running the MonitoringApp. - * - * @author Sho Uemura <[log in to unmask]> - * @version $Id: RunControlDriver.java,v 1.5 2012/09/27 01:08:13 meeg Exp $ - */ -public class RunControlDriver extends Driver implements ActionListener { - - JButton nextButton; - JButton runButton; - JFrame nextFrame; - boolean run = false; - final Object syncObject; - - public RunControlDriver() { - syncObject = new Object(); - } - - @Override - protected void startOfData() { - nextFrame = new JFrame(); - nextFrame.setAlwaysOnTop(true); - nextFrame.getContentPane().setLayout(new BoxLayout(nextFrame.getContentPane(), BoxLayout.X_AXIS)); - - nextButton = new JButton("Next event"); - nextButton.addActionListener(this); - nextFrame.add(nextButton); - runButton = new JButton("Run"); - runButton.addActionListener(this); - nextFrame.add(runButton); - - nextFrame.pack(); - nextFrame.setVisible(true); - } - - @Override - protected void process(EventHeader event) { - if (!run) { - synchronized (syncObject) { - try { - syncObject.wait(); - } catch (InterruptedException e) { - } - } - } - } - - @Override - protected void endOfData() { - nextFrame.setVisible(false); - } - - @Override - public void actionPerformed(ActionEvent ae) { - if (ae.getSource() == nextButton) { - synchronized (syncObject) { - syncObject.notify(); - } - } - if (ae.getSource() == runButton) { - if (!run) { - runButton.setText("Pause"); - run = true; - synchronized (syncObject) { - syncObject.notify(); - } - } else { - run = false; - runButton.setText("Run"); - } - } - } -}
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1