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

HPS-SVN July 2015

Subject:

r3284 - /java/trunk/record-util/src/main/java/org/hps/record/evio/EvioBankTag.java

From:

[log in to unmask]

Reply-To:

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

Date:

Tue, 28 Jul 2015 21:10:27 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (113 lines)

Author: [log in to unmask]
Date: Tue Jul 28 14:10:25 2015
New Revision: 3284

Log:
Add convenience enum for representing EVIO bank tag values.

Added:
    java/trunk/record-util/src/main/java/org/hps/record/evio/EvioBankTag.java

Added: java/trunk/record-util/src/main/java/org/hps/record/evio/EvioBankTag.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/evio/EvioBankTag.java	(added)
+++ java/trunk/record-util/src/main/java/org/hps/record/evio/EvioBankTag.java	Tue Jul 28 14:10:25 2015
@@ -0,0 +1,97 @@
+package org.hps.record.evio;
+
+import org.jlab.coda.jevio.BaseStructure;
+
+/**
+ * Convenience enum for representing bank tag values in HPS-formatted EVIO events.
+ * <p>
+ * Documentation of the bank tags and contents can be found at<br/>
+ * <a href="https://confluence.slac.stanford.edu/display/hpsg/EVIO+Data+Format">EVIO Data Format</a>.
+ *
+ * @author Jeremy McCormick, SLAC
+ */
+public enum EvioBankTag {
+
+    /** EPICS header bank. */
+    EPICS_HEADER(57618),
+    /** EPICS mother bank. */
+    EPICS_MOTHER(129),
+    /** EPICS string data bank. */
+    EPICS_STRING(57620),
+    /** Event ID bank containing the EVIO event number in the run. */
+    EVENT_ID(0xC000),
+    /** Head bank with run number, etc. */
+    HEAD(0xe10F),
+    /** Scaler data bank. */
+    SCALERS(57621),
+    /** Trigger configuration bank. */
+    TRIGGER_CONFIG(0xE10E);
+
+    /**
+     * The bank's tag value.
+     */
+    private int bankTag;
+
+    /**
+     * Create a new bank enum.
+     *
+     * @param bankTag the bank value (tag value in the bank's header)
+     */
+    private EvioBankTag(final int bankTag) {
+        this.bankTag = bankTag;
+    }
+
+    /**
+     * Find a bank matching the tag value by looking through a bank and all its child banks.
+     *
+     * @param startBank the starting bank
+     * @return the first bank matching the tag or <code>null<code> if not found
+     */
+    public BaseStructure findBank(final BaseStructure startBank) {
+        BaseStructure foundBank = null;
+        System.out.println("findBank: " + startBank.getHeader().getTag());
+        if (this.isBankTag(startBank)) {
+            foundBank = startBank;
+            System.out.println("found bank: " + foundBank.getHeader().getTag());
+        } else if (startBank.getChildrenList() != null) {
+            System.out.println("looking in children ...");
+            for (final BaseStructure subBank : startBank.getChildrenList()) {
+                System.out.println("looking in bank: " + subBank.getHeader().getTag());
+                foundBank = this.findBank(subBank);
+                if (foundBank != null) {
+                    break;
+                }
+            }
+        }
+        return foundBank;
+    }
+
+    /**
+     * Get the bank tag value.
+     *
+     * @return the bank tag value
+     */
+    public int getBankTag() {
+        return bankTag;
+    }
+
+    /**
+     * Return <code>true</code> if bank's tag matches this one.
+     *
+     * @param bank the EVIO data bank
+     * @return <code>true</code> if bank's tag matches this one
+     */
+    public boolean isBankTag(final BaseStructure bank) {
+        return bank.getHeader().getTag() == bankTag;
+    }
+
+    /**
+     * Return <code>true</code> if the tag value matches this one.
+     *
+     * @param bankTag the bank tag value
+     * @return <code>true</code> if the bank tag value matches this one
+     */
+    public boolean isBankTag(final int bankTag) {
+        return bankTag == this.getBankTag();
+    }
+}

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