LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  August 2015

HPS-SVN August 2015

Subject:

r3411 - in /java/trunk/record-util/src/main/java/org/hps/record: evio/ evio/crawler/ run/ triggerbank/

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Thu, 27 Aug 2015 02:31:41 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (1863 lines)

Author: [log in to unmask]
Date: Wed Aug 26 19:31:38 2015
New Revision: 3411

Log:
Various changes in record-util module for getting a stable version of run database API.

Added:
    java/trunk/record-util/src/main/java/org/hps/record/run/RunSummaryImpl.java
    java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigIntDao.java
      - copied, changed from r3409, java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigDao.java
    java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigIntDaoImpl.java
      - copied, changed from r3409, java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigDaoImpl.java
    java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TiTimeOffsetEvioProcessor.java
      - copied, changed from r3409, java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerEvioProcessor.java
    java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerConfigInt.java
    java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerConfigVariable.java
Removed:
    java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfig.java
    java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigDao.java
    java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigDaoImpl.java
    java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerEvioProcessor.java
Modified:
    java/trunk/record-util/src/main/java/org/hps/record/evio/EvioBankTag.java
    java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/Crawler.java
    java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/EvioFileVisitor.java
    java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunProcessor.java
    java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunSummaryMap.java
    java/trunk/record-util/src/main/java/org/hps/record/run/RunSummary.java
    java/trunk/record-util/src/main/java/org/hps/record/run/RunSummaryDaoImpl.java

Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/EvioBankTag.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/evio/EvioBankTag.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/evio/EvioBankTag.java	Wed Aug 26 19:31:38 2015
@@ -49,7 +49,7 @@
      */
     public BaseStructure findBank(final BaseStructure startBank) {
         BaseStructure foundBank = null;
-        if (this.isBankTag(startBank)) {
+        if (this.equals(startBank)) {
             foundBank = startBank;
         } else if (startBank.getChildrenList() != null) {
             for (final BaseStructure subBank : startBank.getChildrenList()) {
@@ -77,7 +77,7 @@
      * @param bank the EVIO data bank
      * @return <code>true</code> if bank's tag matches this one
      */
-    public boolean isBankTag(final BaseStructure bank) {
+    public boolean equals(final BaseStructure bank) {
         return bank.getHeader().getTag() == bankTag;
     }
 
@@ -87,7 +87,7 @@
      * @param bankTag the bank tag value
      * @return <code>true</code> if the bank tag value matches this one
      */
-    public boolean isBankTag(final int bankTag) {
+    public boolean equals(final int bankTag) {
         return bankTag == this.getBankTag();
     }
 }

Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/Crawler.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/Crawler.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/Crawler.java	Wed Aug 26 19:31:38 2015
@@ -23,6 +23,7 @@
 import org.hps.conditions.database.ConnectionParameters;
 import org.hps.record.run.RunSummary;
 import org.hps.record.run.RunSummaryDaoImpl;
+import org.hps.record.run.RunSummaryImpl;
 import org.lcsim.util.log.DefaultLogFormatter;
 import org.lcsim.util.log.LogUtil;
 
@@ -53,7 +54,6 @@
      * Statically define the command options.
      */
     static {
-        // TODO: add -f argument with file name to include; others would be excluded if they do not match
         OPTIONS.addOption("b", "min-date", true, "min date for a file (example \"2015-03-26 11:28:59\")");
         OPTIONS.addOption("c", "cache", false, "automatically cache files from MSS to cache disk (JLAB only)");
         OPTIONS.addOption("C", "connection-properties", true, "database connection properties file (required)");
@@ -65,8 +65,7 @@
         OPTIONS.addOption("r", "run", true, "add a run number to accept (when used others will be excluded)");
         OPTIONS.addOption("t", "timestamp-file", true, "existing or new timestamp file name");
         OPTIONS.addOption("w", "max-cache-wait", true, "total time to allow for file caching (seconds)");
-        OPTIONS.addOption("u", "update", false,
-                "allow replacement of existing data in the run db (not allowed by default)");
+        OPTIONS.addOption("u", "update", false, "allow replacement of existing data in the run db (not allowed by default)");
         OPTIONS.addOption("x", "max-depth", true, "max depth to crawl in the directory tree");
     }
 
@@ -278,8 +277,6 @@
 
     /**
      * Run the full crawler job.
-     * <p>
-     * This might take quite a long time!
      *
      * @throws Exception if there is some error during the job
      */
@@ -302,12 +299,12 @@
 
         // Process all the files, performing caching from the MSS if necessary.
         LOGGER.info("processing all runs");
-        RunProcessor.processAllRuns(this.cacheManager, runs, config);
+        processRuns(this.cacheManager, runs, config.useFileCache());
         LOGGER.getHandlers()[0].flush();
 
         // Execute the run database update.
         LOGGER.info("updating run database");
-        this.updateRunDatabase(runs);
+        this.updateRunDatabase(runs);       
         LOGGER.getHandlers()[0].flush();
 
         // Update the timestamp output file.
@@ -333,7 +330,7 @@
             // Open a DB connection.
             final Connection connection = config.connectionParameters().createConnection();
 
-            // Insert all run summaries into the database.
+            // Insert all run summaries into the database.            
             new RunSummaryDaoImpl(connection).insertFullRunSummaries(new ArrayList<RunSummary>(runs.getRunSummaries()),
                     config.allowUpdates());
 
@@ -396,4 +393,33 @@
             throw new RuntimeException("Error while walking the directory tree.", e);
         }
     }
+    
+    /**
+     * Process all the runs that were found.
+     *
+     * @param runs the run log containing the list of run summaries
+     * @throws Exception if there is an error processing one of the runs
+     */
+    static void processRuns(JCacheManager cacheManager, final RunSummaryMap runs, boolean useFileCache) 
+            throws Exception {
+
+        // Process all of the runs that were found.
+        for (final RunSummary runSummary : runs.getRunSummaries()) {
+
+            // Clear the cache manager.
+            if (useFileCache) {
+                LOGGER.info("clearing file cache");
+                cacheManager.clear();
+            }
+
+            // Create a processor to process all the EVIO events in the run.
+            LOGGER.info("creating run processor for " + runSummary.getRun());
+            final RunProcessor runProcessor = new RunProcessor(cacheManager, (RunSummaryImpl) runSummary, useFileCache);
+
+            // Process all of the files from the run.
+            LOGGER.info("processing run " + runSummary.getRun());
+            runProcessor.processRun();
+        }
+    }
+    
 }

Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/EvioFileVisitor.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/EvioFileVisitor.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/EvioFileVisitor.java	Wed Aug 26 19:31:38 2015
@@ -110,6 +110,7 @@
 
             // Add this file to the file list for the run.
             this.runs.getRunSummary(run).addFile(file);
+            
         } else {
             // File was rejected by one of the filters.
             LOGGER.finer("rejected file " + file.getPath());

Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunProcessor.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunProcessor.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunProcessor.java	Wed Aug 26 19:31:38 2015
@@ -1,25 +1,28 @@
 package org.hps.record.evio.crawler;
 
 import java.io.File;
+import java.util.Collections;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+
 import org.hps.record.epics.EpicsRunProcessor;
 import org.hps.record.evio.EvioFileMetaData;
 import org.hps.record.evio.EvioFileMetaDataReader;
+import org.hps.record.evio.EvioFileSequenceComparator;
 import org.hps.record.evio.EvioFileSource;
 import org.hps.record.evio.EvioLoop;
-import org.hps.record.run.RunSummary;
+import org.hps.record.run.RunSummaryImpl;
 import org.hps.record.scalers.ScalersEvioProcessor;
-import org.hps.record.triggerbank.TriggerEvioProcessor;
+import org.hps.record.triggerbank.TiTimeOffsetEvioProcessor;
+import org.hps.record.triggerbank.TriggerConfigInt;
 import org.lcsim.util.log.DefaultLogFormatter;
 import org.lcsim.util.log.LogUtil;
 
 /**
- * Processes EVIO files from a run in order to extract various meta data
- * information including start and end dates.
+ * Processes EVIO files from a run in order to extract various meta data information including start and end dates.
  * <p>
- * This class is a wrapper for activating different sub-tasks, including
- * optionally caching all files from the JLAB MSS to the cache disk.
+ * This class is a wrapper for activating different sub-tasks, including optionally caching all files from the JLAB MSS
+ * to the cache disk.
  * <p>
  * There is also a list of processors which is run on all events from the run.
  *
@@ -31,35 +34,7 @@
      * Setup logger.
      */
     private static final Logger LOGGER = LogUtil.create(RunProcessor.class, new DefaultLogFormatter(), Level.FINE);
-
-    /**
-     * Process all the runs that were found.
-     *
-     * @param runs the run log containing the list of run summaries
-     * @throws Exception if there is an error processing one of the runs
-     */
-    static void processAllRuns(final JCacheManager cacheManager, final RunSummaryMap runs, final CrawlerConfig config)
-            throws Exception {
-
-        // Process all of the runs that were found.
-        for (final RunSummary runSummary : runs.getRunSummaries()) {
-
-            // Clear the cache manager.
-            if (config.useFileCache()) {
-                LOGGER.info("clearing file cache");
-                cacheManager.clear();
-            }
-
-            // Create a processor to process all the EVIO events in the run.
-            LOGGER.info("creating run processor for " + runSummary.getRun());
-            final RunProcessor runProcessor = new RunProcessor(cacheManager, runSummary, config);
-
-            // Process all of the run's files.
-            LOGGER.info("processing run " + runSummary.getRun());
-            runProcessor.processRun();
-        }
-    }
-
+    
     /**
      * The cache manager.
      */
@@ -68,7 +43,7 @@
     /**
      * Processor for extracting EPICS information.
      */
-    private final EpicsRunProcessor epicsLog;
+    private final EpicsRunProcessor epicsProcessor;
 
     /**
      * The data source with the list of EVIO files to process.
@@ -83,7 +58,7 @@
     /**
      * The run summary information updated by running this processor.
      */
-    private final RunSummary runSummary;
+    private final RunSummaryImpl runSummary;
 
     /**
      * Processor for extracting scaler data.
@@ -91,9 +66,9 @@
     private final ScalersEvioProcessor scalersProcessor;
 
     /**
-     * Processor for extracting trigger config.
-     */
-    private final TriggerEvioProcessor triggerProcessor;
+     * Processor for extracting TI time offset.
+     */
+    private final TiTimeOffsetEvioProcessor triggerTimeProcessor;
 
     /**
      * Set to <code>true</code> to use file caching.
@@ -106,45 +81,47 @@
      * @param runSummary the run summary object for the run
      * @return the run processor
      */
-    RunProcessor(final JCacheManager cacheManager, final RunSummary runSummary, final CrawlerConfig config) {
+    RunProcessor(final JCacheManager cacheManager, final RunSummaryImpl runSummary, boolean useFileCache) {
 
         this.runSummary = runSummary;
         this.cacheManager = cacheManager;
 
+        // Set whether file caching from MSS is enabled.
+        this.useFileCache = useFileCache;
+        
+        // Sort the list of EVIO files.
+        Collections.sort(runSummary.getEvioFiles(), new EvioFileSequenceComparator());
+
         // Setup record loop.
-        runSummary.sortFiles();
-        evioFileSource = new EvioFileSource(runSummary.getEvioFileList());
+        evioFileSource = new EvioFileSource(runSummary.getEvioFiles());
         evioLoop.setEvioFileSource(evioFileSource);
 
         // Add EPICS processor.
-        epicsLog = new EpicsRunProcessor();
-        evioLoop.addEvioEventProcessor(epicsLog);
-
-        // Add Scaler data processor.
+        epicsProcessor = new EpicsRunProcessor();
+        evioLoop.addEvioEventProcessor(epicsProcessor);
+
+        // Add scaler data processor.
         scalersProcessor = new ScalersEvioProcessor();
         scalersProcessor.setResetEveryEvent(false);
         evioLoop.addEvioEventProcessor(scalersProcessor);
-        
-        triggerProcessor = new TriggerEvioProcessor();
-        evioLoop.addEvioEventProcessor(triggerProcessor);
-
-        // Set whether file caching from MSS is enabled.
-        this.useFileCache(config.useFileCache());
+
+        // Add processor for extracting TI time offset. 
+        triggerTimeProcessor = new TiTimeOffsetEvioProcessor();
+        evioLoop.addEvioEventProcessor(triggerTimeProcessor);
     }
 
     /**
      * Cache all files and wait for the operation to complete.
      * <p>
-     * Potentially, this operation can take a very long time. This can be
-     * managed using the {@link JCacheManager#setWaitTime(long)} method to set a
-     * timeout.
+     * Potentially, this operation can take a very long time. This can be managed using the
+     * {@link JCacheManager#setWaitTime(long)} method to set a timeout.
      */
     private void cacheFiles() {
 
         LOGGER.info("caching files from run " + this.runSummary.getRun());
 
-        // Cache all the files and wait for the operation to complete (it will take awhile!).
-        this.cacheManager.cache(this.runSummary.getEvioFileList());
+        // Cache all the files and wait for the operation to complete.
+        this.cacheManager.cache(this.runSummary.getEvioFiles());
         final boolean cached = this.cacheManager.waitForCache();
 
         // If the files weren't cached then die.
@@ -156,18 +133,16 @@
     }
 
     /**
-     * Process the run by executing the registered
-     * {@link org.hps.record.evio.EvioEventProcessor}s and extracting the start
-     * and end dates.
+     * Process the run by executing the registered {@link org.hps.record.evio.EvioEventProcessor}s and extracting the
+     * start and end dates.
      * <p>
-     * This method will also execute file caching from MSS, if enabled by the
-     * {@link #useFileCache} option.
+     * This method will also execute file caching from MSS, if enabled by the {@link #useFileCache} option.
      *
      * @throws Exception if there is an error processing a file
      */
     void processRun() throws Exception {
 
-        LOGGER.info("processing " + this.runSummary.getEvioFileList().size() + " files from run "
+        LOGGER.info("processing " + this.runSummary.getEvioFiles().size() + " files from run "
                 + this.runSummary.getRun());
 
         // Cache files from MSS if this is enabled.
@@ -181,11 +156,11 @@
         evioLoop.loop(-1);
 
         // Get run start date.
-        LOGGER.info("setting run start date");
+        LOGGER.info("processing first file");
         this.processFirstFile();
 
         // Get run end date.
-        LOGGER.info("setting run end date");
+        LOGGER.info("processing last file");
         this.processLastFile();
 
         // Update run summary from processors.
@@ -196,11 +171,10 @@
     }
 
     /**
-     * Set the run end date by getting meta data from the last file and copying
-     * it to the run summary.
+     * Extract meta data from last file in run.
      */
     private void processLastFile() {
-        final File lastEvioFile = runSummary.getEvioFileList().get(runSummary.getEvioFileList().size() - 1);
+        final File lastEvioFile = runSummary.getEvioFiles().get(runSummary.getEvioFiles().size() - 1);
         LOGGER.info("getting meta data for " + lastEvioFile.getPath());
         final EvioFileMetaDataReader metaDataReader = new EvioFileMetaDataReader();
         final EvioFileMetaData metaData = metaDataReader.getMetaData(lastEvioFile);
@@ -215,11 +189,10 @@
     }
 
     /**
-     * Set the run start date by getting meta data from the first file and
-     * copying it to the run summary.
+     * Extract meta data from first file in run.
      */
     private void processFirstFile() {
-        final File firstEvioFile = runSummary.getEvioFileList().get(0);
+        final File firstEvioFile = runSummary.getEvioFiles().get(0);
         LOGGER.info("getting meta data for " + firstEvioFile.getPath());
         final EvioFileMetaDataReader metaDataReader = new EvioFileMetaDataReader();
         final EvioFileMetaData metaData = metaDataReader.getMetaData(firstEvioFile);
@@ -233,8 +206,7 @@
     }
 
     /**
-     * Update the current run summary by copying data to it from the EVIO
-     * processors.
+     * Update the current run summary by copying data to it from the EVIO processors and the event loop.
      */
     private void updateRunSummary() {
 
@@ -245,23 +217,11 @@
         runSummary.setScalerData(this.scalersProcessor.getScalerData());
 
         // Add EPICS data from the EPICS EVIO processor.
-        runSummary.setEpicsData(this.epicsLog.getEpicsData());
-        
-        // Add trigger config from the trigger EVIO processor.
-        runSummary.setTriggerConfig(this.triggerProcessor.getTriggerConfig());
-    }
-
-    /**
-     * Set whether or not to use the file caching, which copies files from the
-     * JLAB MSS to the cache disk.
-     * <p>
-     * Since EVIO data files at JLAB are primarily kept on the MSS, running
-     * without this option enabled there will likely cause the job to fail.
-     *
-     * @param cacheFiles <code>true</code> to enabled file caching
-     */
-    void useFileCache(final boolean cacheFiles) {
-        this.useFileCache = cacheFiles;
-        LOGGER.config("file caching enabled");
-    }
+        runSummary.setEpicsData(this.epicsProcessor.getEpicsData());
+
+        // Add trigger config from the trigger time processor.
+        TriggerConfigInt triggerConfig = new TriggerConfigInt();
+        this.triggerTimeProcessor.updateTriggerConfig(triggerConfig);
+        runSummary.setTriggerConfigInt(triggerConfig);
+    }  
 }

Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunSummaryMap.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunSummaryMap.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunSummaryMap.java	Wed Aug 26 19:31:38 2015
@@ -5,6 +5,7 @@
 import java.util.logging.Logger;
 
 import org.hps.record.run.RunSummary;
+import org.hps.record.run.RunSummaryImpl;
 import org.lcsim.util.log.LogUtil;
 
 /**
@@ -13,7 +14,7 @@
  * @author Jeremy McCormick, SLAC
  */
 @SuppressWarnings("serial")
-final class RunSummaryMap extends HashMap<Integer, RunSummary> {
+final class RunSummaryMap extends HashMap<Integer, RunSummaryImpl> {
 
     /**
      * Setup logging.
@@ -25,7 +26,7 @@
      *
      * @return the collection of {@link RunSummary} objects
      */
-    public Collection<RunSummary> getRunSummaries() {
+    Collection<RunSummaryImpl> getRunSummaries() {
         return this.values();
     }
 
@@ -37,10 +38,10 @@
      * @param run the run number
      * @return the <code>RunSummary</code> for the run number
      */
-    public RunSummary getRunSummary(final int run) {
+    RunSummaryImpl getRunSummary(final int run) {
         if (!this.containsKey(run)) {
             LOGGER.info("creating new RunSummary for run " + run);
-            this.put(run, new RunSummary(run));
+            this.put(run, new RunSummaryImpl(run));
         }
         return this.get(run);
     }

Modified: java/trunk/record-util/src/main/java/org/hps/record/run/RunSummary.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/run/RunSummary.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/run/RunSummary.java	Wed Aug 26 19:31:38 2015
@@ -1,471 +1,143 @@
 package org.hps.record.run;
 
 import java.io.File;
-import java.io.PrintStream;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Date;
-import java.util.GregorianCalendar;
 import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
 
 import org.hps.record.epics.EpicsData;
-import org.hps.record.evio.EvioFileSequenceComparator;
 import org.hps.record.scalers.ScalerData;
+import org.hps.record.triggerbank.TriggerConfigInt;
 
 /**
- * This class models the run summary information which is persisted as a row in
- * the <i>run_log</i> table of the run database.
+ * This is an API for accessing run summary information which is persisted as a row in the <i>runs</i> table of the run
+ * database.
  * <p>
  * This information includes:
  * <ul>
  * <li>run number</li>
- * <li>start time (UTC)</li>
- * <li>end time (UTC)</li>
- * <li>total number of events in the run</li>
- * <li>number of EVIO files in the run</li>
- * <li>whether the END event was found indicating that the DAQ did not
- * crash</li>
+ * <li>start date</li>
+ * <li>end date</li>
+ * <li>number of events</li>
+ * <li>number of EVIO files</li>
+ * <li>whether the END event was found indicating that the DAQ did not crash</li>
  * <li>whether the run is considered good (all <code>true</code> for now)</li>
  * </ul>
  * <p>
- * It also references several complex objects including lists of
- * {@link org.hps.record.epics.EpicsData} and
- * {@link org.hps.record.scalers.ScalerData} for the run, as well as a list of
- * EVIO files.
+ * It also references several complex objects including lists of {@link org.hps.record.epics.EpicsData} and
+ * {@link org.hps.record.scalers.ScalerData} for the run, as well as a list of EVIO files.
  *
+ * @see RunSummaryImpl
+ * @see RunSummaryDao
+ * @see RunSummaryDaoImpl
+ * @see RunManager
+ * 
  * @author Jeremy McCormick, SLAC
  */
-public final class RunSummary {
-
-    /**
-     * Default date display format.
-     */
-    private static final DateFormat DATE_DISPLAY = new SimpleDateFormat();
-
-    static {
-        /**
-         * Set default time zone for display to East Coast (JLAB) where data was
-         * taken.
-         */
-        DATE_DISPLAY.setCalendar(new GregorianCalendar(TimeZone.getTimeZone("America/New_York")));
-    }
-
-    /**
-     * Date this record was created.
-     */
-    private Date created;
-
-    /**
-     * End date of run.
-     */
-    private Date endDate;
-
-    /**
-     * This is <code>true</code> if the END event is found in the data.
-     */
-    private boolean endOkay;
-
-    /**
-     * The run end time in UTC (milliseconds).
-     */
-    private long endTimeUtc;
-
-    /**
-     * The EPICS data from the run.
-     */
-    private List<EpicsData> epicsDataList;
-
-    /**
-     * The counts of different types of events that were found.
-     */
-    private Map<Object, Integer> eventTypeCounts;
-
-    /**
-     * The list of EVIO files in the run.
-     */
-    private List<File> evioFileList = new ArrayList<File>();
-
-    /**
-     * The run number.
-     */
-    private final int run;
-
-    /**
-     * Flag to indicate run was okay.
-     */
-    private boolean runOkay = true;
-
-    /**
-     * The scaler data for the run.
-     */
-    private List<ScalerData> scalerDataList;
-
-    /**
-     * The trigger data for the run.
-     */
-    private TriggerConfig triggerConfig;
-
-    /**
-     * Start date of run.
-     */
-    private Date startDate;
-
-    /**
-     * The total events found in the run across all files.
-     */
-    private int totalEvents = -1;
-
-    /**
-     * The total number of files in the run.
-     */
-    private int totalFiles = 0;
-
-    /**
-     * Date when the run record was last updated.
-     */
-    private Date updated;
-
-    /**
-     * Create a run summary.
-     *
-     * @param run the run number
-     */
-    public RunSummary(final int run) {
-        this.run = run;
-    }
-
-    /**
-     * Add an EVIO file from this run to the list.
-     *
-     * @param file the file to add
-     */
-    public void addFile(final File file) {
-        this.evioFileList.add(file);
-    }
-
+public interface RunSummary {
+  
     /**
      * Get the creation date of this run record.
      *
      * @return the creation date of this run record
      */
-    public Date getCreated() {
-        return this.created;
-    }
+    Date getCreated();
 
     /**
      * Get the end date.
      *
      * @return the end date
      */
-    public Date getEndDate() {
-        return endDate;
-    }
+    Date getEndDate();
 
     /**
      * Return <code>true</code> if END event was found in the data.
      *
      * @return <code>true</code> if END event was in the data
      */
-    public boolean getEndOkay() {
-        return this.endOkay;
-    }
+    boolean getEndOkay();
 
     /**
      * Get the EPICS data from the run.
      *
      * @return the EPICS data from the run
      */
-    public List<EpicsData> getEpicsDataSet() {
-        return this.epicsDataList;
-    }
+    List<EpicsData> getEpicsData();
 
     /**
-     * Get the event rate (effectively the trigger rate) which is the total
-     * events divided by the number of seconds in the run.
+     * Get the event rate (effectively the trigger rate) which is the total events divided by the number of seconds in
+     * the run.
      *
      * @return the event rate
      */
-    public double getEventRate() {
-        if (this.getTotalEvents() <= 0) {
-            throw new RuntimeException("Total events is zero or invalid.");
-        }
-        return (double) this.getTotalEvents() / (double) this.getTotalSeconds();
-    }
-
-    /**
-     * Get the counts of different event types.
-     *
-     * @return the counts of different event types
-     */
-    public Map<Object, Integer> getEventTypeCounts() {
-        return this.eventTypeCounts;
-    }
+    double getEventRate();
 
     /**
      * Get the list of EVIO files in this run.
      *
      * @return the list of EVIO files in this run
      */
-    public List<File> getEvioFileList() {
-        return this.evioFileList;
-    }
+    List<File> getEvioFiles();
 
     /**
      * Get the run number.
      *
      * @return the run number
      */
-    public int getRun() {
-        return this.run;
-    }
+    int getRun();
 
     /**
-     * Return <code>true</code> if the run was okay (no major errors or data
-     * corruption occurred).
+     * Return <code>true</code> if the run was okay (no major errors or data corruption occurred).
      *
      * @return <code>true</code> if the run was okay
      */
-    public boolean getRunOkay() {
-        return this.runOkay;
-    }
+    boolean getRunOkay();
 
     /**
      * Get the scaler data of this run.
      *
      * @return the scaler data of this run
      */
-    public List<ScalerData> getScalerData() {
-        return this.scalerDataList;
-    }
+    List<ScalerData> getScalerData();
 
     /**
-     * Get the trigger config of this run.
+     * Get the trigger config int values.
      *
-     * @return the trigger config of this run
+     * @return the trigger config int values
      */
-    public TriggerConfig getTriggerConfig() {
-        return triggerConfig;
-    }
+    TriggerConfigInt getTriggerConfigInt();
 
     /**
      * Get the start date.
      *
      * @return the start date
      */
-    public Date getStartDate() {
-        return startDate;
-    }
+    Date getStartDate();
 
     /**
      * Get the total events in the run.
      *
      * @return the total events in the run
      */
-    public int getTotalEvents() {
-        return this.totalEvents;
-    }
+    int getTotalEvents();
 
     /**
      * Get the total number of files for this run.
      *
      * @return the total number of files for this run
      */
-    public int getTotalFiles() {
-        return this.totalFiles;
-    }
+    int getTotalFiles();
 
     /**
-     * Get the number of seconds in the run which is the difference between the
-     * start and end times.
+     * Get the number of seconds in the run which is the difference between the start and end times.
      *
      * @return the total seconds in the run
      */
-    public long getTotalSeconds() {
-        return (endDate.getTime() - startDate.getTime()) / 1000;
-    }
+    long getTotalSeconds();
 
     /**
      * Get the date when this run record was last updated.
      *
      * @return the date when this run record was last updated
      */
-    public Date getUpdated() {
-        return updated;
-    }
-
-    /**
-     * Print the run summary.
-     *
-     * @param ps the print stream for output
-     */
-    public void printOut(final PrintStream ps) {
-        ps.println("--------------------------------------------");
-        ps.println("run: " + this.run);
-        ps.println("first file: " + this.evioFileList.get(0));
-        ps.println("last file: " + this.evioFileList.get(evioFileList.size() - 1));
-        ps.println("started: " + DATE_DISPLAY.format(this.getStartDate()));
-        ps.println("ended: " + DATE_DISPLAY.format(this.getEndDate()));
-        ps.println("total events: " + this.getTotalEvents());
-        ps.println("end OK: " + this.getEndOkay());
-        ps.println("event rate: " + this.getEventRate());
-        ps.println("event types");
-        for (final Object key : this.eventTypeCounts.keySet()) {
-            ps.println("  " + key + ": " + this.eventTypeCounts.get(key));
-        }
-        ps.println(this.evioFileList.size() + " files");
-        for (final File file : this.evioFileList) {
-            ps.println("  " + file.getPath());
-        }
-    }
-
-    /**
-     * Set the creation date of the run record.
-     *
-     * @param created the creation date of the run record
-     */
-    public void setCreated(final Date created) {
-        this.created = created;
-    }
-
-    /**
-     * Set the start date.
-     *
-     * @param startDate the start date
-     */
-    public void setEndDate(final Date endDate) {
-        this.endDate = endDate;
-    }
-
-    /**
-     * Set if end is okay.
-     *
-     * @param endOkay <code>true</code> if end is okay
-     */
-    public void setEndOkay(final boolean endOkay) {
-        this.endOkay = endOkay;
-    }
-
-    /**
-     * Set the end date.
-     *
-     * @param endTimeUtc the end date
-     */
-    public void setEndTimeUtc(final long endTimeUtc) {
-        this.endTimeUtc = endTimeUtc;
-    }
-
-    /**
-     * Set the EPICS data for the run.
-     *
-     * @param epics the EPICS data for the run
-     */
-    public void setEpicsData(final List<EpicsData> epicsDataList) {
-        this.epicsDataList = epicsDataList;
-    }
-
-    /**
-     * Set the event type counts for the run.
-     *
-     * @param eventTypeCounts the event type counts for the run
-     */
-    public void setEventTypeCounts(final Map<Object, Integer> eventTypeCounts) {
-        this.eventTypeCounts = eventTypeCounts;
-    }
-
-    /**
-     * Set the list of EVIO files for the run.
-     *
-     * @param evioFileList the list of EVIO files for the run
-     */
-    public void setEvioFileList(final List<File> evioFileList) {
-        this.evioFileList = evioFileList;
-    }
-
-    /**
-     * Set whether the run was "okay" meaning the data is usable for physics
-     * analysis.
-     *
-     * @param runOkay <code>true</code> if the run is okay
-     */
-    public void setRunOkay(final boolean runOkay) {
-        this.runOkay = runOkay;
-    }
-
-    /**
-     * Set the scaler data of the run.
-     *
-     * @param scalerData the scaler data
-     */
-    public void setScalerData(final List<ScalerData> scalerDataList) {
-        this.scalerDataList = scalerDataList;
-    }
-
-    /**
-     * Set the trigger config of the run.
-     *
-     * @param triggerConfig the trigger config
-     */
-    public void setTriggerConfig(final TriggerConfig triggerConfig) {
-        this.triggerConfig = triggerConfig;
-    }
-
-    /**
-     * Set the start date.
-     *
-     * @param startDate the start date
-     */
-    public void setStartDate(final Date startDate) {
-        this.startDate = startDate;
-    }
-
-    /**
-     * Set the total number of physics events in the run.
-     *
-     * @param totalEvents the total number of physics events in the run
-     */
-    public void setTotalEvents(final int totalEvents) {
-        this.totalEvents = totalEvents;
-    }
-
-    /**
-     * Set the total number of EVIO files in the run.
-     *
-     * @param totalFiles the total number of EVIO files in the run
-     */
-    public void setTotalFiles(final int totalFiles) {
-        this.totalFiles = totalFiles;
-    }
-
-    /**
-     * Set the date when this run record was last updated.
-     *
-     * @param updated the date when the run record was last updated
-     */
-    public void setUpdated(final Date updated) {
-        this.updated = updated;
-    }
-
-    /**
-     * Sort the files in the run by sequence number in place.
-     */
-    public void sortFiles() {
-        Collections.sort(this.evioFileList, new EvioFileSequenceComparator());
-    }
-
-    /**
-     * Convert this object to a string.
-     *
-     * @return this object converted to a string
-     */
-    @Override
-    public String toString() {
-        return "RunSummary { run: " + this.getRun() + ", startDate: " + DATE_DISPLAY.format(this.getStartDate())
-                + ", endDate: " + DATE_DISPLAY.format(this.getEndDate()) + ", totalEvents: " + this.getTotalEvents()
-                + ", totalFiles: " + this.getTotalFiles() + ", endOkay: " + this.getEndOkay() + ", runOkay: "
-                + this.getRunOkay() + ", updated: " + this.getUpdated() + ", created: " + this.getCreated() + " }";
-    }
+    Date getUpdated();
 }

Modified: java/trunk/record-util/src/main/java/org/hps/record/run/RunSummaryDaoImpl.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/run/RunSummaryDaoImpl.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/run/RunSummaryDaoImpl.java	Wed Aug 26 19:31:38 2015
@@ -78,6 +78,11 @@
      * The database API for scaler data.
      */
     private ScalerDataDao scalerDataDao = null;
+    
+    /**
+     * The database API for integer trigger config.
+     */
+    private TriggerConfigIntDao triggerConfigIntDao = null;
 
     /**
      * Create a new DAO object for run summary information.
@@ -95,6 +100,7 @@
         epicsDataDao = new EpicsDataDaoImpl(this.connection);
         scalerDataDao = new ScalerDataDaoImpl(this.connection);
         evioFilesDao = new EvioFilesDaoImpl(this.connection);
+        triggerConfigIntDao = new TriggerConfigIntDaoImpl(this.connection);
     }
 
     /**
@@ -104,17 +110,23 @@
      */
     @Override
     public void deleteFullRunSummary(final RunSummary runSummary) {
+        
+        int run = runSummary.getRun();
+        
         // Delete EPICS log.
-        epicsDataDao.deleteEpicsData(runSummary.getRun());
+        this.epicsDataDao.deleteEpicsData(run);
 
         // Delete scaler data.
-        scalerDataDao.deleteScalerData(runSummary.getRun());
+        this.scalerDataDao.deleteScalerData(run);
 
         // Delete file list.
-        evioFilesDao.deleteEvioFiles(runSummary.getRun());
+        this.evioFilesDao.deleteEvioFiles(run);
+        
+        // Delete trigger config.
+        this.triggerConfigIntDao.deleteTriggerConfigInt(run);
 
         // Finally delete the run summary information.
-        this.deleteRunSummary(runSummary.getRun());
+        this.deleteRunSummary(run);
     }
 
     /**
@@ -210,7 +222,7 @@
             statement = this.connection.prepareStatement(RunSummaryQuery.SELECT_ALL);
             final ResultSet resultSet = statement.executeQuery();
             while (resultSet.next()) {
-                final RunSummary runSummary = new RunSummary(resultSet.getInt("run"));
+                final RunSummaryImpl runSummary = new RunSummaryImpl(resultSet.getInt("run"));
                 runSummary.setStartDate(resultSet.getTimestamp("start_date"));
                 runSummary.setEndDate(resultSet.getTimestamp("end_date"));
                 runSummary.setTotalEvents(resultSet.getInt("nevents"));
@@ -244,7 +256,7 @@
     @Override
     public RunSummary getRunSummary(final int run) {
         PreparedStatement statement = null;
-        RunSummary runSummary = null;
+        RunSummaryImpl runSummary = null;
         try {
             statement = this.connection.prepareStatement(RunSummaryQuery.SELECT_RUN);
             statement.setInt(1, run);
@@ -253,7 +265,7 @@
                 throw new IllegalArgumentException("No record exists for run " + run + " in database.");
             }
 
-            runSummary = new RunSummary(run);
+            runSummary = new RunSummaryImpl(run);
             runSummary.setStartDate(resultSet.getTimestamp("start_date"));
             runSummary.setEndDate(resultSet.getTimestamp("end_date"));
             runSummary.setTotalEvents(resultSet.getInt("nevents"));
@@ -370,16 +382,21 @@
         this.insertRunSummary(runSummary);
 
         // Insert list of files.
-        LOGGER.info("inserting EVIO " + runSummary.getEvioFileList().size() + " files");
-        evioFilesDao.insertEvioFiles(runSummary.getEvioFileList(), runSummary.getRun());
+        LOGGER.info("inserting EVIO " + runSummary.getEvioFiles().size() + " files");
+        evioFilesDao.insertEvioFiles(runSummary.getEvioFiles(), runSummary.getRun());
 
         // Insert EPICS data.
-        LOGGER.info("inserting " + runSummary.getEpicsDataSet().size() + " EPICS records");
-        epicsDataDao.insertEpicsData(runSummary.getEpicsDataSet());
+        LOGGER.info("inserting " + runSummary.getEpicsData().size() + " EPICS records");
+        epicsDataDao.insertEpicsData(runSummary.getEpicsData());
 
         // Insert scaler data.
         LOGGER.info("inserting " + runSummary.getScalerData().size() + " scaler data records");
         scalerDataDao.insertScalerData(runSummary.getScalerData(), runSummary.getRun());
+        
+        // Insert trigger config.
+        LOGGER.info("inserting " + runSummary.getTriggerConfigInt().size() + " trigger config variables");
+        triggerConfigIntDao.insertTriggerConfigInt(runSummary.getTriggerConfigInt(), runSummary.getRun());
+        
     }
 
     /**
@@ -396,7 +413,7 @@
             preparedStatement.setTimestamp(2, new java.sql.Timestamp(runSummary.getStartDate().getTime()), CALENDAR);
             preparedStatement.setTimestamp(3, new java.sql.Timestamp(runSummary.getEndDate().getTime()), CALENDAR);
             preparedStatement.setInt(4, runSummary.getTotalEvents());
-            preparedStatement.setInt(5, runSummary.getEvioFileList().size());
+            preparedStatement.setInt(5, runSummary.getEvioFiles().size());
             preparedStatement.setBoolean(6, runSummary.getEndOkay());
             preparedStatement.executeUpdate();
         } catch (final SQLException e) {
@@ -422,7 +439,7 @@
     public RunSummary readFullRunSummary(final int run) {
 
         // Read main run summary but not referenced objects.
-        final RunSummary runSummary = this.getRunSummary(run);
+        final RunSummaryImpl runSummary = (RunSummaryImpl) this.getRunSummary(run);
 
         // Read EPICS data and set on RunSummary.
         runSummary.setEpicsData(epicsDataDao.getEpicsData(run));
@@ -431,7 +448,10 @@
         runSummary.setScalerData(scalerDataDao.getScalerData(run));
 
         // Read EVIO file list and set on RunSummary.
-        runSummary.setEvioFileList(evioFilesDao.getEvioFiles(run));
+        runSummary.setEvioFiles(evioFilesDao.getEvioFiles(run));
+        
+        // Read trigger config.
+        runSummary.setTriggerConfigInt(triggerConfigIntDao.getTriggerConfigInt(run));
 
         return runSummary;
     }
@@ -476,7 +496,7 @@
             preparedStatement.setTimestamp(1, new java.sql.Timestamp(runSummary.getStartDate().getTime()), CALENDAR);
             preparedStatement.setTimestamp(2, new java.sql.Timestamp(runSummary.getEndDate().getTime()), CALENDAR);
             preparedStatement.setInt(3, runSummary.getTotalEvents());
-            preparedStatement.setInt(4, runSummary.getEvioFileList().size());
+            preparedStatement.setInt(4, runSummary.getEvioFiles().size());
             preparedStatement.setBoolean(5, runSummary.getEndOkay());
             preparedStatement.setBoolean(6, runSummary.getRunOkay());
             preparedStatement.setInt(7, runSummary.getRun());

Added: java/trunk/record-util/src/main/java/org/hps/record/run/RunSummaryImpl.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/run/RunSummaryImpl.java	(added)
+++ java/trunk/record-util/src/main/java/org/hps/record/run/RunSummaryImpl.java	Wed Aug 26 19:31:38 2015
@@ -0,0 +1,381 @@
+package org.hps.record.run;
+
+import java.io.File;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.List;
+import java.util.TimeZone;
+
+import org.hps.record.epics.EpicsData;
+import org.hps.record.scalers.ScalerData;
+import org.hps.record.triggerbank.TriggerConfigInt;
+
+/**
+ * Implementation of {@link RunSummary} for retrieving information from the run database.
+ *
+ * @author Jeremy McCormick, SLAC
+ */
+public final class RunSummaryImpl implements RunSummary {
+
+    /**
+     * Default date display format.
+     */
+    private static final DateFormat DATE_DISPLAY = new SimpleDateFormat();
+
+    static {
+        /**
+         * Set default time zone for display to East Coast (JLAB) where data was
+         * taken.
+         */
+        DATE_DISPLAY.setCalendar(new GregorianCalendar(TimeZone.getTimeZone("America/New_York")));
+    }
+
+    /**
+     * Date this record was created.
+     */
+    private Date created;
+
+    /**
+     * End date of run.
+     */
+    private Date endDate;
+
+    /**
+     * This is <code>true</code> if the END event is found in the data.
+     */
+    private boolean endOkay;
+
+    /**
+     * The EPICS data from the run.
+     */
+    private List<EpicsData> epicsDataList;
+
+    /**
+     * The list of EVIO files in the run.
+     */
+    private List<File> evioFileList = new ArrayList<File>();
+
+    /**
+     * The run number.
+     */
+    private final int run;
+
+    /**
+     * Flag to indicate run was okay.
+     */
+    private boolean runOkay = true;
+
+    /**
+     * The scaler data for the run.
+     */
+    private List<ScalerData> scalerDataList;
+
+    /**
+     * The trigger data for the run.
+     */
+    private TriggerConfigInt triggerConfigInt;
+
+    /**
+     * Start date of run.
+     */
+    private Date startDate;
+
+    /**
+     * The total events found in the run across all files.
+     */
+    private int totalEvents = -1;
+
+    /**
+     * The total number of files in the run.
+     */
+    private int totalFiles = 0;
+
+    /**
+     * Date when the run record was last updated.
+     */
+    private Date updated;
+
+    /**
+     * Create a run summary.
+     *
+     * @param run the run number
+     */
+    public RunSummaryImpl(final int run) {
+        this.run = run;
+    }
+
+    /**
+     * Add an EVIO file from this run to the list.
+     *
+     * @param file the file to add
+     */
+    public void addFile(final File file) {
+        this.evioFileList.add(file);
+    }
+
+    /**
+     * Get the creation date of this run record.
+     *
+     * @return the creation date of this run record
+     */
+    public Date getCreated() {
+        return this.created;
+    }
+
+    /**
+     * Get the end date.
+     *
+     * @return the end date
+     */
+    public Date getEndDate() {
+        return endDate;
+    }
+
+    /**
+     * Return <code>true</code> if END event was found in the data.
+     *
+     * @return <code>true</code> if END event was in the data
+     */
+    public boolean getEndOkay() {
+        return this.endOkay;
+    }
+
+    /**
+     * Get the EPICS data from the run.
+     *
+     * @return the EPICS data from the run
+     */
+    public List<EpicsData> getEpicsData() {
+        return this.epicsDataList;
+    }
+
+    /**
+     * Get the event rate (effectively the trigger rate) which is the total
+     * events divided by the number of seconds in the run.
+     *
+     * @return the event rate
+     */
+    public double getEventRate() {
+        if (this.getTotalEvents() <= 0) {
+            throw new RuntimeException("Total events is zero or invalid.");
+        }
+        return (double) this.getTotalEvents() / (double) this.getTotalSeconds();
+    }
+
+    /**
+     * Get the list of EVIO files in this run.
+     *
+     * @return the list of EVIO files in this run
+     */
+    public List<File> getEvioFiles() {
+        return this.evioFileList;
+    }
+
+    /**
+     * Get the run number.
+     *
+     * @return the run number
+     */
+    public int getRun() {
+        return this.run;
+    }
+
+    /**
+     * Return <code>true</code> if the run was okay (no major errors or data
+     * corruption occurred).
+     *
+     * @return <code>true</code> if the run was okay
+     */
+    public boolean getRunOkay() {
+        return this.runOkay;
+    }
+
+    /**
+     * Get the scaler data of this run.
+     *
+     * @return the scaler data of this run
+     */
+    public List<ScalerData> getScalerData() {
+        return this.scalerDataList;
+    }
+
+    /**
+     * Get the trigger config of this run.
+     *
+     * @return the trigger config of this run
+     */
+    public TriggerConfigInt getTriggerConfigInt() {
+        return triggerConfigInt;
+    }
+
+    /**
+     * Get the start date.
+     *
+     * @return the start date
+     */
+    public Date getStartDate() {
+        return startDate;
+    }
+
+    /**
+     * Get the total events in the run.
+     *
+     * @return the total events in the run
+     */
+    public int getTotalEvents() {
+        return this.totalEvents;
+    }
+
+    /**
+     * Get the total number of files for this run.
+     *
+     * @return the total number of files for this run
+     */
+    public int getTotalFiles() {
+        return this.totalFiles;
+    }
+
+    /**
+     * Get the number of seconds in the run which is the difference between the
+     * start and end times.
+     *
+     * @return the total seconds in the run
+     */
+    public long getTotalSeconds() {
+        return (endDate.getTime() - startDate.getTime()) / 1000;
+    }
+
+    /**
+     * Get the date when this run record was last updated.
+     *
+     * @return the date when this run record was last updated
+     */
+    public Date getUpdated() {
+        return updated;
+    }
+    
+    /**
+     * Set the creation date of the run record.
+     *
+     * @param created the creation date of the run record
+     */
+    void setCreated(final Date created) {
+        this.created = created;
+    }
+
+    /**
+     * Set the start date.
+     *
+     * @param startDate the start date
+     */
+    public void setEndDate(final Date endDate) {
+        this.endDate = endDate;
+    }
+
+    /**
+     * Set if end is okay.
+     *
+     * @param endOkay <code>true</code> if end is okay
+     */
+    public void setEndOkay(final boolean endOkay) {
+        this.endOkay = endOkay;
+    }
+   
+    /**
+     * Set the EPICS data for the run.
+     *
+     * @param epics the EPICS data for the run
+     */
+    public void setEpicsData(final List<EpicsData> epicsDataList) {
+        this.epicsDataList = epicsDataList;
+    }
+
+    /**
+     * Set the list of EVIO files for the run.
+     *
+     * @param evioFileList the list of EVIO files for the run
+     */
+    public void setEvioFiles(final List<File> evioFileList) {
+        this.evioFileList = evioFileList;
+    }
+
+    /**
+     * Set whether the run was "okay" meaning the data is usable for physics
+     * analysis.
+     *
+     * @param runOkay <code>true</code> if the run is okay
+     */
+    public void setRunOkay(final boolean runOkay) {
+        this.runOkay = runOkay;
+    }
+
+    /**
+     * Set the scaler data of the run.
+     *
+     * @param scalerData the scaler data
+     */
+    public void setScalerData(final List<ScalerData> scalerDataList) {
+        this.scalerDataList = scalerDataList;
+    }
+
+    /**
+     * Set the trigger config of the run.
+     *
+     * @param triggerConfig the trigger config
+     */
+    public void setTriggerConfigInt(final TriggerConfigInt triggerConfigInt) {
+        this.triggerConfigInt = triggerConfigInt;
+    }
+
+    /**
+     * Set the start date.
+     *
+     * @param startDate the start date
+     */
+    public void setStartDate(final Date startDate) {
+        this.startDate = startDate;
+    }
+
+    /**
+     * Set the total number of physics events in the run.
+     *
+     * @param totalEvents the total number of physics events in the run
+     */
+    public void setTotalEvents(final int totalEvents) {
+        this.totalEvents = totalEvents;
+    }
+
+    /**
+     * Set the total number of EVIO files in the run.
+     *
+     * @param totalFiles the total number of EVIO files in the run
+     */
+    public void setTotalFiles(final int totalFiles) {
+        this.totalFiles = totalFiles;
+    }
+
+    /**
+     * Set the date when this run record was last updated.
+     *
+     * @param updated the date when the run record was last updated
+     */
+    public void setUpdated(final Date updated) {
+        this.updated = updated;
+    }
+
+    /**
+     * Convert this object to a string.
+     *
+     * @return this object converted to a string
+     */
+    @Override
+    public String toString() {
+        return "RunSummary { run: " + this.getRun() + ", startDate: " + DATE_DISPLAY.format(this.getStartDate())
+                + ", endDate: " + DATE_DISPLAY.format(this.getEndDate()) + ", totalEvents: " + this.getTotalEvents()
+                + ", totalFiles: " + this.getTotalFiles() + ", endOkay: " + this.getEndOkay() + ", runOkay: "
+                + this.getRunOkay() + ", updated: " + this.getUpdated() + ", created: " + this.getCreated() + " }";
+    }        
+}

Copied: java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigIntDao.java (from r3409, java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigDao.java)
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigDao.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigIntDao.java	Wed Aug 26 19:31:38 2015
@@ -1,11 +1,13 @@
 package org.hps.record.run;
+
+import org.hps.record.triggerbank.TriggerConfigInt;
 
 /**
  * Database interface to trigger config.
  * 
  * @author Jeremy McCormick, SLAC
  */
-public interface TriggerConfigDao {
+public interface TriggerConfigIntDao {
    
     /**
      * Get the trigger config by run.
@@ -13,7 +15,7 @@
      * @param run the run number
      * @return the trigger config
      */
-    TriggerConfig getTriggerConfig(int run);
+    TriggerConfigInt getTriggerConfigInt(int run);
     
     /**
      * Insert a trigger config for a run.
@@ -21,21 +23,12 @@
      * @param run the run number
      * @param triggerConfig the trigger config
      */
-    void insertTriggerConfig(int run, TriggerConfig triggerConfig);
-    
-
-    /**
-     * Update a trigger config by run number.
-     * 
-     * @param run the run number
-     * @param triggerConfig the trigger config
-     */
-    void updateTriggerConfig(int run, TriggerConfig triggerConfig);
-    
+    void insertTriggerConfigInt(TriggerConfigInt triggerConfig, int run);
+   
     /**
      * Delete a trigger config by run number.
      * 
      * @param run the run number
      */
-    void deleteTriggerConfig(int run);
+    void deleteTriggerConfigInt(int run);
 }

Copied: java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigIntDaoImpl.java (from r3409, java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigDaoImpl.java)
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigDaoImpl.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/run/TriggerConfigIntDaoImpl.java	Wed Aug 26 19:31:38 2015
@@ -4,13 +4,16 @@
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.Map;
+
+import org.hps.record.triggerbank.TriggerConfigInt;
 
 /**
  * Implementation of trigger config database interface.
  * 
  * @author Jeremy McCormick, SLAC
  */
-public class TriggerConfigDaoImpl implements TriggerConfigDao {
+public class TriggerConfigIntDaoImpl implements TriggerConfigIntDao {
 
     /**
      * The database connection.
@@ -24,19 +27,15 @@
         /**
          * Select by run.
          */
-        static final String SELECT_RUN = "SELECT * FROM run_trigger_config WHERE run = ?";
+        static final String SELECT_RUN = "SELECT * FROM run_trigger_config_int WHERE run = ?";
         /**
          * Insert by run.
          */
-        static final String INSERT_RUN = "INSERT INTO run_trigger_config (run, ti_time_offset) VALUES (?, ?)";
-        /**
-         * Update by run.
-         */
-        static final String UPDATE_RUN = "UPDATE run_trigger_config SET ti_time_offset = ? WHERE run = ?";
+        static final String INSERT_VARIABLE = "INSERT INTO run_trigger_config_int (run, variable_name, value) VALUES (?, ?, ?)";
         /**
          * Delete by run.
          */
-        static final String DELETE_RUN = "DELETE FROM run_trigger_config WHERE run = ?";
+        static final String DELETE_RUN = "DELETE FROM run_trigger_config_int WHERE run = ?";
     }
     
     /**
@@ -44,27 +43,19 @@
      * 
      * @param connection the database connection
      */
-    TriggerConfigDaoImpl(Connection connection) { 
+    TriggerConfigIntDaoImpl(Connection connection) { 
         this.connection = connection;
     }
-    
-    /**
-     * Get the trigger config by run.
-     * 
-     * @param run the run number
-     * @return the trigger config
-     */
+
     @Override
-    public TriggerConfig getTriggerConfig(int run) {
+    public TriggerConfigInt getTriggerConfigInt(int run) {
         PreparedStatement preparedStatement = null;
-        TriggerConfig triggerConfig = null;
+        TriggerConfigInt triggerConfig = new TriggerConfigInt();
         try {
             preparedStatement = connection.prepareStatement(TriggerConfigQuery.SELECT_RUN);
-            preparedStatement.setInt(1, run);
-            final ResultSet resultSet = preparedStatement.executeQuery();
-            if (resultSet.next()) {
-                triggerConfig = new TriggerConfig();
-                triggerConfig.setTiTimeOffset(resultSet.getLong("ti_time_offset"));
+            ResultSet resultSet = preparedStatement.executeQuery();
+            while (resultSet.next()) {
+                triggerConfig.put(resultSet.getString("variable_name"), resultSet.getLong("value"));
             }
         } catch (final SQLException e) {
             throw new RuntimeException(e);
@@ -78,47 +69,17 @@
         return triggerConfig;
     }
 
-    /**
-     * Insert a trigger config for a run.
-     * 
-     * @param run the run number
-     * @param triggerConfig the trigger config
-     */
     @Override
-    public void insertTriggerConfig(int run, TriggerConfig triggerConfig) {
+    public void insertTriggerConfigInt(TriggerConfigInt triggerConfig, int run) {
         PreparedStatement preparedStatement = null;
         try {
-            preparedStatement = connection.prepareStatement(TriggerConfigQuery.INSERT_RUN);            
-            preparedStatement.setInt(1, run);
-            preparedStatement.setLong(2, triggerConfig.getTiTimeOffset());
-            preparedStatement.executeUpdate();
-        } catch (final SQLException e) {
-            throw new RuntimeException(e);
-        } finally {
-            if (preparedStatement != null) {
-                try {
-                    preparedStatement.close();
-                } catch (final SQLException e) {
-                    e.printStackTrace();
-                }
+            preparedStatement = connection.prepareStatement(TriggerConfigQuery.INSERT_VARIABLE);
+            for (Map.Entry<String, Long> entry : triggerConfig.entrySet()) {
+                preparedStatement.setInt(1, run);
+                preparedStatement.setString(2, entry.getKey());
+                preparedStatement.setLong(3, entry.getValue());
+                preparedStatement.executeUpdate();
             }
-        }
-    }
-
-    /**
-     * Update a trigger config by run number.
-     * 
-     * @param run the run number
-     * @param triggerConfig the trigger config
-     */
-    @Override
-    public void updateTriggerConfig(int run, TriggerConfig triggerConfig) {
-        PreparedStatement preparedStatement = null;
-        try {
-            preparedStatement = connection.prepareStatement(TriggerConfigQuery.UPDATE_RUN);
-            preparedStatement.setLong(1, triggerConfig.getTiTimeOffset());
-            preparedStatement.setInt(2, run);
-            preparedStatement.executeUpdate();
         } catch (final SQLException e) {
             throw new RuntimeException(e);
         } finally {
@@ -133,13 +94,8 @@
         
     }
 
-    /**
-     * Delete a trigger config by run number.
-     * 
-     * @param run the run number
-     */
     @Override
-    public void deleteTriggerConfig(int run) {
+    public void deleteTriggerConfigInt(int run) {
         PreparedStatement preparedStatement = null;
         try {
             preparedStatement = connection.prepareStatement(TriggerConfigQuery.DELETE_RUN);
@@ -155,6 +111,6 @@
                     e.printStackTrace();
                 }
             }
-        }        
-    }
+        }                
+    }   
 }

Copied: java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TiTimeOffsetEvioProcessor.java (from r3409, java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerEvioProcessor.java)
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerEvioProcessor.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TiTimeOffsetEvioProcessor.java	Wed Aug 26 19:31:38 2015
@@ -1,24 +1,23 @@
 package org.hps.record.triggerbank;
 
 import org.hps.record.evio.EvioEventProcessor;
-import org.hps.record.run.TriggerConfig;
 import org.hps.record.triggerbank.AbstractIntData.IntBankDefinition;
 import org.jlab.coda.jevio.BaseStructure;
 import org.jlab.coda.jevio.EvioEvent;
 
 /**
- *
+ * Extract trigger time offset from EVIO data.
+ * 
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: $
  */
-public class TriggerEvioProcessor extends EvioEventProcessor {
+public class TiTimeOffsetEvioProcessor extends EvioEventProcessor {
 
     private final IntBankDefinition headBankDefinition;
     private final IntBankDefinition tiBankDefinition;
     private long minOffset = 0;
     private long maxOffset = 0;
 
-    public TriggerEvioProcessor() {
+    public TiTimeOffsetEvioProcessor() {
         headBankDefinition = new IntBankDefinition(HeadBankData.class, new int[]{0x2e, 0xe10f});
         tiBankDefinition = new IntBankDefinition(TIData.class, new int[]{0x2e, 0xe10a});
     }
@@ -42,15 +41,13 @@
             }
         }
     }
-
-    public TriggerConfig getTriggerConfig() {
-        TriggerConfig triggerConfig = new TriggerConfig();
+    
+    public void updateTriggerConfig(TriggerConfigInt triggerConfig) {
         long offsetRange = maxOffset - minOffset;
         if (offsetRange > 0.99 * 1e9 && offsetRange < 1.01 * 1e9) {
-            triggerConfig.setTiTimeOffset(minOffset);
+            triggerConfig.put(TriggerConfigVariable.TI_TIME_OFFSET.name(), minOffset);
         } else {
-            triggerConfig.setTiTimeOffset(0);
+            triggerConfig.put(TriggerConfigVariable.TI_TIME_OFFSET.name(), 0L);
         }
-        return triggerConfig;
     }
 }

Added: java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerConfigInt.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerConfigInt.java	(added)
+++ java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerConfigInt.java	Wed Aug 26 19:31:38 2015
@@ -0,0 +1,25 @@
+package org.hps.record.triggerbank;
+
+import java.util.HashMap;
+
+/**
+ * Trigger config information in the form of string keys and long values.
+ * <p>
+ * This is not the "standard" interface using in LCSim to access trigger configuration.  
+ * It is used as a simplistic representation for the run database.
+ * 
+ * @author Jeremy McCormick, SLAC
+ */
+@SuppressWarnings("serial")
+public class TriggerConfigInt extends HashMap<String, Long> {
+    
+    /**
+     * Get a particular trigger config variable's value.
+     * 
+     * @param variable the variable enum
+     * @return the variable's value
+     */
+    Long getValue(TriggerConfigVariable variable) {
+        return this.get(variable.name());
+    }
+}

Added: java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerConfigVariable.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerConfigVariable.java	(added)
+++ java/trunk/record-util/src/main/java/org/hps/record/triggerbank/TriggerConfigVariable.java	Wed Aug 26 19:31:38 2015
@@ -0,0 +1,13 @@
+package org.hps.record.triggerbank;
+
+/**
+ * Enum for trigger config variables.
+ * 
+ * @author Jeremy McCormick, SLAC
+ */
+public enum TriggerConfigVariable {
+    /**
+     * TI time offset
+     */
+    TI_TIME_OFFSET
+}

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use