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

HPS-SVN September 2015

Subject:

r3637 - in /java/trunk/evio/src/main/java/org/hps/evio: AbstractSvtEvioReader.java SvtEvioReader.java SvtEvioUtils.java

From:

[log in to unmask]

Reply-To:

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

Date:

Fri, 18 Sep 2015 20:29:46 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (136 lines)

Author: [log in to unmask]
Date: Fri Sep 18 13:29:43 2015
New Revision: 3637

Log:
Refactor and make bank numbers public.

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

Modified: java/trunk/evio/src/main/java/org/hps/evio/AbstractSvtEvioReader.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/AbstractSvtEvioReader.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/AbstractSvtEvioReader.java	Fri Sep 18 13:29:43 2015
@@ -249,8 +249,8 @@
                     System.arraycopy(data, this.getDataHeaderLength() + samplesN, samples, 0, samples.length);
                     
                     // Extract multisample header
-                    if( SvtEvioUtils.isApvHeader(samples) ) 
-                        multisampleHeaders[samplesN/4] = SvtEvioUtils.getApvHeaderWord(samples);
+                    if( SvtEvioUtils.isMultisampleHeader(samples) ) 
+                        multisampleHeaders[samplesN/4] = SvtEvioUtils.getMultisampleHeaderWord(samples);
                     
                     // If a set of samples is associated with an APV header or tail, skip it
                     if (!this.isValidSampleSet(samples)) continue;

Modified: java/trunk/evio/src/main/java/org/hps/evio/SvtEvioReader.java
 =============================================================================
--- java/trunk/evio/src/main/java/org/hps/evio/SvtEvioReader.java	(original)
+++ java/trunk/evio/src/main/java/org/hps/evio/SvtEvioReader.java	Fri Sep 18 13:29:43 2015
@@ -25,8 +25,8 @@
     //-----------------//
     private static final int DATA_HEADER_LENGTH = 1;
     private static final int DATA_TAIL_LENGTH = 1; 
-    private static final int MIN_ROC_BANK_TAG = 51;
-    private static final int MAX_ROC_BANK_TAG = 66;
+    public static final int MIN_ROC_BANK_TAG = 51;
+    public static final int MAX_ROC_BANK_TAG = 66;
     private static final int ROC_BANK_NUMBER = 0; 
     
     /**
@@ -155,7 +155,7 @@
      * @return true if the samples are valid, false otherwise
      */
     protected boolean isValidSampleSet(int[] data) {
-        return !(SvtEvioUtils.isApvHeader(data) || SvtEvioUtils.isApvTail(data));        
+        return !(SvtEvioUtils.isMultisampleHeader(data) || SvtEvioUtils.isMultisampleTail(data));        
     }
    
     /**

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	Fri Sep 18 13:29:43 2015
@@ -1,6 +1,5 @@
 package org.hps.evio;
 
-import org.apache.commons.math3.analysis.function.Rint;
 
 /**
  *  A set of static utility methods used to decode SVT data.
@@ -141,21 +140,21 @@
      *  Check if the samples are APV headers
      *  
      * 
-     *  @param data : sample block of data
+     *  @param multisample : sample block of data
      *  @return true if the samples belong to APV headers, false otherwise
      */
-    public static boolean isApvHeader(int[] data) {
-        if (((data[ENG_RUN_SAMPLE_HEADER_INDEX] >>> 30) & ENG_RUN_APV_HEADER_MASK) == 1) return true;
+    public static boolean isMultisampleHeader(int[] multisample) {
+        if (((multisample[ENG_RUN_SAMPLE_HEADER_INDEX] >>> 30) & ENG_RUN_APV_HEADER_MASK) == 1) return true;
         return false;
     }
     
     /**
      * Get the multisample header word.
-     * @param multisample
+     * @param multisample - block of data
      * @return the header word
      */
-    public static int getApvHeaderWord(int[] multisample) {
-        if( !isApvHeader(multisample) )
+    public static int getMultisampleHeaderWord(int[] multisample) {
+        if( !isMultisampleHeader(multisample) )
             throw new RuntimeException("Need ApvHeader multisample in order to extract the header word.");
         return multisample[ENG_RUN_SAMPLE_HEADER_INDEX];
     }
@@ -165,11 +164,11 @@
      *  Check if the samples are APV tails
      *  
      * 
-     *  @param data : sample block of data
+     *  @param multisample : sample block of data
      *  @return true if the samples belong to APV tails, false otherwise
      */
-    public static boolean isApvTail(int[] data) {
-        if (((data[ENG_RUN_SAMPLE_HEADER_INDEX] >>> 29) & ENG_RUN_APV_TAIL_MASK) == 1) return true;
+    public static boolean isMultisampleTail(int[] multisample) {
+        if (((multisample[ENG_RUN_SAMPLE_HEADER_INDEX] >>> 29) & ENG_RUN_APV_TAIL_MASK) == 1) return true;
         return false;
     }
     
@@ -207,13 +206,23 @@
 
     
     /**
-     *  Extract the error bit of the samples.
+     *  Extract the error bit from a multisample.
      *
-     *  @param data : sample block of data
+     *  @param multisample : multisample 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; 
+    public static int getMultisampleErrorBit(int[] multisample) { 
+        return (getMultisampleHeaderWord(multisample) >>> 28) & ENG_RUN_ERROR_BIT_MASK; 
+    }
+    
+    /**
+     *  Extract the error bit from the multisample header.
+     *
+     *  @param data : multisample of data
+     *  @return value of the error bit.  This is non-zero if there is an error.
+     */
+    public static int getErrorBitFromMultisampleHeader(int multisampleHeader) { 
+        return (multisampleHeader >>> 28) & ENG_RUN_ERROR_BIT_MASK; 
     }
 
     /**

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