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;
}
/**
|