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:

r3334 - in /java/trunk/record-util/src/main/java/org/hps/record/run: RunManager.java RunSummary.java RunSummaryReader.java

From:

[log in to unmask]

Reply-To:

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

Date:

Tue, 4 Aug 2015 23:31:11 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (283 lines)

Author: [log in to unmask]
Date: Tue Aug  4 16:31:09 2015
New Revision: 3334

Log:
Replace dates with UTC time values.

Modified:
    java/trunk/record-util/src/main/java/org/hps/record/run/RunManager.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/RunSummaryReader.java

Modified: java/trunk/record-util/src/main/java/org/hps/record/run/RunManager.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/run/RunManager.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/run/RunManager.java	Tue Aug  4 16:31:09 2015
@@ -72,6 +72,14 @@
      * The {@link RunSummary} for the current run.
      */
     private RunSummary runSummary = null;
+
+    void closeConnection() {
+        try {
+            this.connection.close();
+        } catch (final SQLException e) {
+            e.printStackTrace();
+        }
+    }
 
     /**
      * Load new run information when conditions have changed.
@@ -175,14 +183,11 @@
     }
 
     /**
-     * Set the run number.
-     * <p>
-     * This is public in order for the class to be usable without the conditions system but it should not be called
-     * within a standard lcsim job as it resets the global state of the RunManager.
+     * Set the run number and load the applicable {@link RunSummary} from the db.
      *
      * @param run the run number
      */
-    public synchronized void setRun(final int run) {
+    synchronized void setRun(final int run) {
 
         if (run < 0) {
             throw new IllegalArgumentException("invalid run number: " + 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	Tue Aug  4 16:31:09 2015
@@ -20,26 +20,30 @@
  * This information includes:
  * <ul>
  * <li>run number</li>
- * <li>start date</li>
- * <li>end date</li>
- * <li>total number of events across all files in the run</li>
- * <li>number of files found belonging to the run</li>
- * <li>whether the EVIO END event was found</li>
- * <li>whether the run is considered good</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>whether the run is considered good (all <code>true</code> for now)</li>
+ * <li>list of EVIO files in the run</li>
  * </ul>
+ * There are also associated {@link org.hps.record.epics.EpicsData} and {@link org.hps.record.scalers.ScalerData}
+ * objects representing the EPICS and scaler data summaries for the run. The EPICS data is averaged over the whole run
+ * while the scalers are from the last scaler data bank that was found.
  *
  * @author Jeremy McCormick, SLAC
  */
 public final class RunSummary {
 
     /**
-     * Set up date formatting to display EST (GMT-4).
+     * Default date display format.
      */
     private static final DateFormat DATE_DISPLAY = new SimpleDateFormat();
 
     static {
         /**
-         * Set default time zone to East Coast (JLAB) where data was taken.
+         * Set default time zone for display to East Coast (JLAB) where data was taken.
          */
         DATE_DISPLAY.setCalendar(new GregorianCalendar(TimeZone.getTimeZone("America/New_York")));
     }
@@ -47,16 +51,16 @@
     private Date created;
 
     /**
-     * The end date of the 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 combined EPICS information for the run (uses the mean values for each variable).
      */
     private EpicsData epics;
@@ -87,9 +91,9 @@
     private ScalerData scalerData;
 
     /**
-     * The start date of the run.
-     */
-    private Date startDate;
+     * The run start time in UTC (milliseconds).
+     */
+    private long startTimeUtc;
 
     /**
      * The total events found in the run across all files.
@@ -134,14 +138,12 @@
     }
 
     /**
-     * Get the date when the run ended.
-     * <p>
-     * This will be extracted from the EVIO END event. If there is no END record it will be the last event time.
-     *
-     * @return the date when the run ended
+     * Get the end date.
+     *
+     * @return the end date
      */
     public Date getEndDate() {
-        return this.endDate;
+        return new Date(this.endTimeUtc);
     }
 
     /**
@@ -151,6 +153,15 @@
      */
     public boolean getEndOkay() {
         return this.endOkay;
+    }
+
+    /**
+     * Get the end time in UTC (milliseconds)
+     *
+     * @return the end time in milliseconds
+     */
+    public long getEndTimeUtc() {
+        return this.endTimeUtc;
     }
 
     /**
@@ -223,12 +234,21 @@
     }
 
     /**
-     * Get the start date of the run.
-     *
-     * @return the start date of the run
+     * Get the start date.
+     *
+     * @return the start date
      */
     public Date getStartDate() {
-        return this.startDate;
+        return new Date(this.startTimeUtc);
+    }
+
+    /**
+     * Get the run start time in UTC (milliseconds).
+     *
+     * @return the start time in milliseconds
+     */
+    public long getStartTimeUtc() {
+        return this.startTimeUtc;
     }
 
     /**
@@ -255,13 +275,7 @@
      * @return the total seconds in the run
      */
     public long getTotalSeconds() {
-        if (this.getStartDate() == null) {
-            throw new RuntimeException("missing start date");
-        }
-        if (this.getEndDate() == null) {
-            throw new RuntimeException("missing end date");
-        }
-        return (this.getEndDate().getTime() - this.getStartDate().getTime()) / 1000;
+        return (this.endTimeUtc - this.startTimeUtc) / 1000;
     }
 
     /**
@@ -308,15 +322,6 @@
     }
 
     /**
-     * Set the end date.
-     *
-     * @param endDate the end date
-     */
-    public void setEndDate(final Date endDate) {
-        this.endDate = endDate;
-    }
-
-    /**
      * Set if end is okay.
      *
      * @param endOkay <code>true</code> if end is okay
@@ -326,6 +331,15 @@
     }
 
     /**
+     * Set the end date.
+     *
+     * @param endDate 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
@@ -375,8 +389,8 @@
      *
      * @param startDate the start date of the run
      */
-    public void setStartDate(final Date startDate) {
-        this.startDate = startDate;
+    public void setStartTimeUtc(final long startTimeUtc) {
+        this.startTimeUtc = startTimeUtc;
     }
 
     /**
@@ -420,8 +434,8 @@
      */
     @Override
     public String toString() {
-        return "RunSummary { run: " + this.getRun() + ", startDate: " + this.getStartDate() + ", endDate: "
-                + this.getEndDate() + ", totalEvents: " + this.getTotalEvents() + ", totalFiles: "
+        return "RunSummary { run: " + this.getRun() + ", startTimeUtc: " + this.getStartTimeUtc() + ", endTimeUtc: "
+                + this.getEndTimeUtc() + ", totalEvents: " + this.getTotalEvents() + ", totalFiles: "
                 + this.getTotalFiles() + ", endOkay: " + this.getEndOkay() + ", runOkay: " + this.getRunOkay()
                 + ", updated: " + this.getUpdated() + ", created: " + this.getCreated() + " }";
     }

Modified: java/trunk/record-util/src/main/java/org/hps/record/run/RunSummaryReader.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/run/RunSummaryReader.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/run/RunSummaryReader.java	Tue Aug  4 16:31:09 2015
@@ -18,7 +18,7 @@
     /**
      * The SQL SELECT query string.
      */
-    private final String SELECT_SQL = "SELECT run, start_date, end_date, nevents, nfiles, end_ok, run_ok, updated, created FROM runs WHERE run = ?";
+    private final String SELECT_SQL = "SELECT run, start_time_utc, end_time_utc, nevents, nfiles, end_ok, run_ok, updated, created FROM runs WHERE run = ?";
 
     /**
      * Read data from the database and convert to a {@link RunSummary} object.
@@ -42,8 +42,8 @@
             }
 
             final RunSummary runSummary = new RunSummary(this.getRun());
-            runSummary.setStartDate(resultSet.getTimestamp("start_date"));
-            runSummary.setEndDate(resultSet.getTimestamp("end_date"));
+            runSummary.setStartTimeUtc(resultSet.getLong("start_time_utc"));
+            runSummary.setEndTimeUtc(resultSet.getLong("end_time_utc"));
             runSummary.setTotalEvents(resultSet.getInt("nevents"));
             runSummary.setTotalFiles(resultSet.getInt("nfiles"));
             runSummary.setEndOkay(resultSet.getBoolean("end_ok"));

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