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  December 2014

HPS-SVN December 2014

Subject:

r1639 - /java/trunk/evio/src/main/java/org/hps/evio/SvtEvioUtils.java

From:

[log in to unmask]

Reply-To:

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

Date:

Wed, 3 Dec 2014 22:29:17 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (113 lines)

Author: [log in to unmask]
Date: Wed Dec  3 14:29:13 2014
New Revision: 1639

Log:
A set of static utility methods used to decode SVT data.

Added:
    java/trunk/evio/src/main/java/org/hps/evio/SvtEvioUtils.java   (with props)

Added: java/trunk/evio/src/main/java/org/hps/evio/SvtEvioUtils.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/SvtEvioUtils.java	(added)
+++ java/trunk/evio/src/main/java/org/hps/evio/SvtEvioUtils.java	Wed Dec  3 14:29:13 2014
@@ -0,0 +1,97 @@
+package org.hps.evio;
+
+/**
+ *	A set of static utility methods used to decode SVT data.
+ * 
+ * 	@author Omar Moreno <[log in to unmask]>
+ *	@date November 20, 2014
+ */
+public class SvtEvioUtils {
+
+	//-----------------//
+	//--- Constants ---//
+	//-----------------//
+	
+	private static final int TOTAL_SAMPLES = 6;
+	
+	// --- Test Run ---//
+	private static final int TEST_RUN_SAMPLE_HEADER_INDEX = 0; 
+    public static final int  FPGA_MASK = 0xFFFF;
+    public static final int  HYBRID_MASK = 0x3;
+    public static final int  TEST_RUN_CHANNEL_MASK = 0x7F;
+    public static final int  SAMPLE_MASK = 0x3FFF;
+
+    /**
+     * 	Extract and return the FPGA ID associated with the samples
+     * 
+	 *	@param data - sample block of data
+     * 	@return An FPGA ID in the range 0-7
+     */
+	public static int getFpgaID(int[] data) { 
+		return data[TEST_RUN_SAMPLE_HEADER_INDEX] & FPGA_MASK; 
+	}
+
+    /**
+     * 	Extract and return the hybrid number associated with the samples 
+     * 
+	 * 	@param data - sample block of data
+     * 	@return A hybrid number in the range 0-2
+     */
+    public static int getHybridID(int[] data) {
+        return (data[TEST_RUN_SAMPLE_HEADER_INDEX] >>> 28) & HYBRID_MASK;
+    }
+	
+    /**
+     *	Extract and return the channel number associated with the samples
+     * 
+	 * 	@param data - sample block of data
+     * 	@return A channel number in the range 0-127
+     */
+    public static int getChannelNumber(int[] data) {
+        return (data[TEST_RUN_SAMPLE_HEADER_INDEX] >>> 16) & TEST_RUN_CHANNEL_MASK;
+    }
+	
+    /**
+     * 	Extract and return the nth SVT sample.
+     * 
+     * 	@param sampleN - The sample number of interest. Valid values are 0 to 5
+	 * 	@param data - sample block of data
+     * 	@throws RuntimeException if the sample number is out of range
+     * 	@return ADC value of the nth sample
+     * 
+     */
+    public static int getSample(int sampleN, int[] data) {
+
+        switch (sampleN) {
+            case 0:
+                return data[1] & SAMPLE_MASK;
+            case 1:
+                return (data[1] >>> 16) & SAMPLE_MASK;
+            case 2:
+                return data[2] & SAMPLE_MASK;
+            case 3:
+                return (data[2] >>> 16) & SAMPLE_MASK;
+            case 4:
+                return data[3] & SAMPLE_MASK;
+            case 5:
+                return (data[3] >>> 16) & SAMPLE_MASK;
+            default:
+                throw new RuntimeException("Invalid sample number! Valid range of values for n are from 0 - 5");
+        }
+    }
+
+    /**
+     *	Extract and return all SVT samples as an array 
+     * 
+	 * 	@param data - sample block of data
+     * 	@return An array containing all SVT Shaper signal samples
+     */
+    public static short[] getSamples(int[] data) {
+        short[] samples = new short[TOTAL_SAMPLES];
+        // Get all SVT Samples
+        for (int sampleN = 0; sampleN < TOTAL_SAMPLES; sampleN++) {
+            samples[sampleN] = (short) getSample(sampleN, data);
+        }
+        return samples;
+    }
+}

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