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

HPS-SVN April 2015

Subject:

r2714 - /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, 15 Apr 2015 21:21:49 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (236 lines)

Author: [log in to unmask]
Date: Wed Apr 15 14:21:43 2015
New Revision: 2714

Log:
Add static method to extract the error bit from a set of APV samples.

Modified:
    java/trunk/evio/src/main/java/org/hps/evio/SvtEvioUtils.java

Modified: java/trunk/evio/src/main/java/org/hps/evio/SvtEvioUtils.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/SvtEvioUtils.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/SvtEvioUtils.java	Wed Apr 15 14:21:43 2015
@@ -1,26 +1,26 @@
 package org.hps.evio;
 
 /**
- *	A set of static utility methods used to decode SVT data.
+ *  A set of static utility methods used to decode SVT data.
  * 
- * 	@author Omar Moreno <[log in to unmask]>
- *	@date November 20, 2014
+ *  @author Omar Moreno <[log in to unmask]>
+ *  @date November 20, 2014
  */
 public class SvtEvioUtils {
 
-	//-----------------//
-	//--- Constants ---//
-	//-----------------//
-	
-	private static final int TOTAL_SAMPLES = 6;
+    //-----------------//
+    //--- Constants ---//
+    //-----------------//
+    
+    private static final int TOTAL_SAMPLES = 6;
     public static final int  SAMPLE_MASK = 0xFFFF;
    
     // TODO: Move these to constants class
     public static final int APV25_PER_HYBRID = 5;
     public static final int CHANNELS_PER_APV25 = 128;
-	
-	//--- Test Run ---//
-	private static final int TEST_RUN_SAMPLE_HEADER_INDEX = 0; 
+    
+    //--- 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;
@@ -33,60 +33,61 @@
     private static final int ENG_RUN_CHANNEL_MASK = 0x7F;
     private static final int ENG_RUN_APV_HEADER_MASK = 0x1;
     private static final int ENG_RUN_APV_TAIL_MASK = 0x1;
-    
-    /**
-     * 	Extract and return the FPGA ID associated with the samples.
-     * 	Note: This method should only be used when looking at test run data.
-     * 
-	 *	@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 ID associated with the samples 
-     * 	Note: This method should only be used when looking at test run data.
-     * 
-	 * 	@param data : sample block of data
-     * 	@return A hybrid number in the range 0-2
+    private static final int ENG_RUN_ERROR_BIT_MASK = 0x1; 
+
+    /**
+     *  Extract and return the FPGA ID associated with the samples.
+     *  Note: This method should only be used when looking at test run data.
+     * 
+     *  @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 ID associated with the samples 
+     *  Note: This method should only be used when looking at test run data.
+     * 
+     *  @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
-     * 	Note: This method should only be used when looking at test run data.
-     * 
-	 * 	@param data : sample block of data
-     * 	@return A channel number in the range 0-127
+    
+    /**
+     *  Extract and return the channel number associated with the samples
+     *  Note: This method should only be used when looking at test run data.
+     * 
+     *  @param data : sample block of data
+     *  @return A channel number in the range 0-127
      */
     public static int getTestRunChannelNumber(int[] data) {
         return (data[TEST_RUN_SAMPLE_HEADER_INDEX] >>> 16) & TEST_RUN_CHANNEL_MASK;
     }
     
     /**
-     *	Extract and return the front end board (FEB) ID associated with the
-     *	samples
-     *	
-	 * 	@param data : sample block of data
-	 * 	@return A FEB ID in the range 0-10
+     *  Extract and return the front end board (FEB) ID associated with the
+     *  samples
+     *  
+     *  @param data : sample block of data
+     *  @return A FEB ID in the range 0-10
      */
     public static int getFebID(int[] data) { 
-    	return (data[ENG_RUN_SAMPLE_HEADER_INDEX] >>> 8) & FEB_MASK; 
-    }
-    
-    /**
-     * 	Extract and return the front end board (FEB) hybrid ID associated with 
-     * 	the samples
-	 *
-	 * 	@param data : sample block of data
-	 * 	@return A FEB hybrid ID in the range 0-3
+        return (data[ENG_RUN_SAMPLE_HEADER_INDEX] >>> 8) & FEB_MASK; 
+    }
+    
+    /**
+     *  Extract and return the front end board (FEB) hybrid ID associated with 
+     *  the samples
+     *
+     *  @param data : sample block of data
+     *  @return A FEB hybrid ID in the range 0-3
      */
     public static int getFebHybridID(int[] data) { 
-    	return (data[ENG_RUN_SAMPLE_HEADER_INDEX] >>> 26) & FEB_HYBRID_MASK; 
+        return (data[ENG_RUN_SAMPLE_HEADER_INDEX] >>> 26) & FEB_HYBRID_MASK; 
     }
 
     /**
@@ -100,10 +101,10 @@
     }
     
     /**
-     *	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
+     *  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[ENG_RUN_SAMPLE_HEADER_INDEX] >>> 16) & ENG_RUN_CHANNEL_MASK;
@@ -114,7 +115,7 @@
      *  
      *  @param data : sample block of data
      *  @return A channel number in the range 0-639
-     * 	@throws RuntimeException if the physical channel number is out of range
+     *  @throws RuntimeException if the physical channel number is out of range
      */
     public static int getPhysicalChannelNumber(int[] data) {
 
@@ -157,14 +158,24 @@
         if (((data[ENG_RUN_SAMPLE_HEADER_INDEX] >>> 29) & ENG_RUN_APV_TAIL_MASK) == 1) return true;
         return false;
     }
-    
-    /**
-     * 	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
+   
+    /**
+     *  Extract the error bit of the samples.
+     *
+     *  @param data : sample block of data
+     *  @return value of the error bit.  This is non-zero if there is an error.
+     */
+    public static int getErrorBit(int[] data) { 
+        return (data[3] >>> 28) & ENG_RUN_ERROR_BIT_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) {
@@ -188,10 +199,10 @@
     }
 
     /**
-     *	Extract and return all SVT samples as an array 
-     * 
-	 * 	@param data : sample block of data
-     * 	@return An array containing all SVT Shaper signal samples
+     *  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];
@@ -203,7 +214,7 @@
     }
 
     /**
-     *	Private constructor to prevent the class from being instantiated.
+     *  Private constructor to prevent the class from being instantiated.
      */
     private SvtEvioUtils(){}; 
 }

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