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  March 2015

HPS-SVN March 2015

Subject:

r2539 - /java/trunk/record-util/src/main/java/org/hps/record/scalars/ScalarUtilities.java

From:

[log in to unmask]

Reply-To:

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

Date:

Wed, 25 Mar 2015 18:54:44 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (106 lines)

Author: [log in to unmask]
Date: Wed Mar 25 11:54:34 2015
New Revision: 2539

Log:
Add scalar utility methods for computing live time from standard scalar data.

Added:
    java/trunk/record-util/src/main/java/org/hps/record/scalars/ScalarUtilities.java

Added: java/trunk/record-util/src/main/java/org/hps/record/scalars/ScalarUtilities.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/scalars/ScalarUtilities.java	(added)
+++ java/trunk/record-util/src/main/java/org/hps/record/scalars/ScalarUtilities.java	Wed Mar 25 11:54:34 2015
@@ -0,0 +1,90 @@
+package org.hps.record.scalars;
+
+/**
+ * Utilities methods for scalar data.
+ * <p>
+ * Currently this is used only for computing live time measurements from standard
+ * scalar data.
+ * 
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class ScalarUtilities {
+    
+    /**
+     * This class shouldn't be instantiated.
+     */
+    private ScalarUtilities() {        
+    }
+    
+    /**
+     * Indices for getting live time measurements.     
+     */
+    public enum LiveTimeIndex {
+        FCUP_TDC, /* Faraday cup TDC */
+        FCUP_TRG, /* Faraday cup TRG */
+        CLOCK; /* clock */
+    }
+    
+    /**
+     * Get the live time measurements from standard scalar data.
+     * <p>
+     * This is returned as a double array of size 3 containing:</br>
+     * <pre>
+     * [0] = FCUP TDC measurement
+     * [1] = FCUP TRG measurement
+     * [2] = CLOCK measurement
+     * </pre>
+     * This method assumes the standard scalar data structure as outlined in
+     * <a href="https://jira.slac.stanford.edu/browse/HPSJAVA-470">HPSJAVA-470</a>. 
+     * 
+     * @param data The scalar data.
+     * @return The live time measurements.
+     */
+    public static double[] getLiveTimes(ScalarData data) {
+        
+        // [03] - gated faraday cup with "TDC" threshold
+        int word03 = data.getValue(3);
+        
+        // [19] - gated faraday cup with "TRG" threshold
+        int word19 = data.getValue(19);
+
+        // [35] - ungated faraday cup with "TDC" threshold
+        int word35 = data.getValue(35);
+        
+        // [51] - ungated faraday cup with "TRG" threshold
+        int word51 = data.getValue(51);
+
+        // [67] - gated clock
+        int word67 = data.getValue(67);
+
+        // [68] - ungated clock
+        int word68 = data.getValue(68);
+        
+        // [03]/[35] = FCUP TDC
+        double fcupTdc = (double) word03 / (double) word35;
+        
+        // [19]/[51] = FCUP TRG
+        double fcupTrg = (double) word19 / (double) word51;
+        
+        // [67]/[68] = CLOCK
+        double clock = (double) word67 / (double) word68;
+        
+        // Compute the live times.
+        double[] liveTimes = new double[3];
+        liveTimes[0] = fcupTdc;
+        liveTimes[1] = fcupTrg;
+        liveTimes[2] = clock;
+        
+        return liveTimes;
+    }
+    
+    /**
+     * Get a specific live time measurement by index.
+     * @param index The enum of the index type.
+     * 
+     * @see LiveTimeIndex
+     */
+    public static double getLiveTime(ScalarData data, LiveTimeIndex index) {
+        return getLiveTimes(data)[index.ordinal()];
+    }
+}

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