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:

r3649 - 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:

Mon, 21 Sep 2015 00:27:47 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (173 lines)

Author: [log in to unmask]
Date: Sun Sep 20 17:27:43 2015
New Revision: 3649

Log:
add some helper functions. Try to refactor to make things less confusing...not sure I accomplished that.

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	Sun Sep 20 17:27:43 2015
@@ -250,7 +250,7 @@
                     
                     // Extract multisample header
                     if( SvtEvioUtils.isMultisampleHeader(samples) ) 
-                        multisampleHeaders[samplesN/4] = SvtEvioUtils.getMultisampleHeaderWord(samples);
+                        multisampleHeaders[samplesN/4] = SvtEvioUtils.getMultisampleTailWord(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	Sun Sep 20 17:27:43 2015
@@ -117,8 +117,8 @@
         //          + " Hybrid ID: " + SvtEvioUtils.getFebHybridID(data));
         
         Pair<Integer, Integer> daqPair 
-            = new Pair<Integer, Integer>(SvtEvioUtils.getFebID(data), 
-                                         SvtEvioUtils.getFebHybridID(data));
+            = new Pair<Integer, Integer>(SvtEvioUtils.getFebIDFromMultisample(data), 
+                                         SvtEvioUtils.getFebHybridIDFromMultisample(data));
         
         return daqPairToSensor.get(daqPair);
     }

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	Sun Sep 20 17:27:43 2015
@@ -71,34 +71,68 @@
     
     /**
      *  Extract and return the front end board (FEB) ID associated with the
-     *  samples
-     *  
-     *  @param data : sample block of data
+     *  multisample
+     *  
+     *  @param multisample : a header multisample 
      *  @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; 
-    }
+    public static int getFebIDFromMultisample(int[] multisample) { 
+        return getFebIDFromMultisampleTail(getMultisampleTailWord(multisample));
+    }
+
+    /**
+     *  Extract and return the front end board (FEB) ID associated with the
+     *  multisample tail
+     *  
+     *  @param data : a multisample header
+     *  @return A FEB ID in the range 0-10
+     */
+    public static int getFebIDFromMultisampleTail(int multisampleTail) { 
+        return (multisampleTail >>> 8) & FEB_MASK; 
+    }
+
     
     /**
      *  Extract and return the front end board (FEB) hybrid ID associated with 
-     *  the samples
+     *  the multisample
      *
-     *  @param data : sample block of data
+     *  @param multisample : a header multisample
      *  @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; 
-    }
-
-    /**
-     *  Extract and return the APV ID associated with the samples.
-     *  
-     *  @param data : sample block of data
+    public static int getFebHybridIDFromMultisample(int[] multisample) { 
+        return getFebHybridIDFromMultisampleTail(getMultisampleTailWord(multisample));
+    }
+    
+    /**
+     *  Extract and return the front end board (FEB) hybrid ID associated with 
+     *  the multisample tail 
+     *
+     *  @param multisample : a  multisample tail
+     *  @return A FEB hybrid ID in the range 0-3
+     */
+    public static int getFebHybridIDFromMultisampleTail(int multisampleTail) { 
+        return (multisampleTail >>> 26) & FEB_HYBRID_MASK; 
+    }
+    
+
+    /**
+     *  Extract and return the APV ID associated with the multisample.
+     *  
+     *  @param multisample : a multisample of data
      *  @return An APV ID in the range of 0-4
      */
-    public static int getApv(int[] data) { 
-        return (data[ENG_RUN_SAMPLE_HEADER_INDEX] >>> 23) & ENG_RUN_APV_MASK; 
+    public static int getApvFromMultiSample(int[] multisample) { 
+        return getApvFromMultisampleTail(getMultisampleTailWord(multisample)); 
+    }
+    
+    /**
+     * Extract and return the APV ID from the multisample tail.
+     * @param multisampleTail - tail word of a multisample
+     * @return the apv id in the range of 0-4
+     */
+    public static int getApvFromMultisampleTail(int multisampleTail) {
+        return (multisampleTail >>> 23) & ENG_RUN_APV_MASK; 
+        
     }
     
     /**
@@ -124,7 +158,7 @@
         int channel = SvtEvioUtils.getChannelNumber(data);
         
         // Extract the APV ID from the data
-        int apv = SvtEvioUtils.getApv(data);
+        int apv = SvtEvioUtils.getApvFromMultiSample(data);
     
         // Get the physical channel number
         int physicalChannel = (APV25_PER_HYBRID - apv - 1) * CHANNELS_PER_APV25 + channel;
@@ -149,13 +183,11 @@
     }
     
     /**
-     * Get the multisample header word.
-     * @param multisample - block of data
-     * @return the header word
-     */
-    public static int getMultisampleHeaderWord(int[] multisample) {
-        if( !isMultisampleHeader(multisample) )
-            throw new RuntimeException("Need ApvHeader multisample in order to extract the header word.");
+     * Get the multisample tail word from a multisample.
+     * @param multisample - multisample of  data
+     * @return the tail word
+     */
+    public static int getMultisampleTailWord(int[] multisample) {
         return multisample[ENG_RUN_SAMPLE_HEADER_INDEX];
     }
     
@@ -212,7 +244,9 @@
      *  @return value of the error bit.  This is non-zero if there is an error.
      */
     public static int getMultisampleErrorBit(int[] multisample) { 
-        return (getMultisampleHeaderWord(multisample) >>> 28) & ENG_RUN_ERROR_BIT_MASK; 
+        if( !isMultisampleHeader(multisample) )
+            throw new RuntimeException("Need ApvHeader multisample in order to extract the error bit from the tail word.");
+        return (getMultisampleTailWord(multisample) >>> 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