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

HPS-SVN May 2015

Subject:

r2947 - in /java/trunk/record-util/src/main/java/org/hps/record/evio: EventTagBitMask.java EventTagConstant.java

From:

[log in to unmask]

Reply-To:

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

Date:

Mon, 11 May 2015 19:26:21 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (172 lines)

Author: [log in to unmask]
Date: Mon May 11 12:26:13 2015
New Revision: 2947

Log:
Add enums for EVIO event tag values and masks.

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

Added: java/trunk/record-util/src/main/java/org/hps/record/evio/EventTagBitMask.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/evio/EventTagBitMask.java	(added)
+++ java/trunk/record-util/src/main/java/org/hps/record/evio/EventTagBitMask.java	Mon May 11 12:26:13 2015
@@ -0,0 +1,88 @@
+package org.hps.record.evio;
+
+import org.jlab.coda.jevio.EvioEvent;
+
+/**
+ * Encapsulates bit mask values for different types of physics events as described at <a
+ * href="https://confluence.slac.stanford.edu/display/hpsg/EVIO+Data+Format#EVIODataFormat-EVIOEventtypes-2015DataSet"
+ * >EVIO Event types</a>.
+ *
+ * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ */
+public enum EventTagBitMask {
+
+    /** LED or Cosmic trigger. */
+    LED_COSMIC(4),
+    /** Pair 0 trigger. */
+    PAIRS0(2),
+    /** Pair 1 trigger. */
+    PAIRS1(3),
+    /** Physics event. */
+    PHYSICS(7),
+    /** Pulser triggered event. */
+    PULSER(5),
+    /** Single 0 trigger. */
+    SINGLE0(0),
+    /** Single 1 trigger. */
+    SINGLE1(1),
+    /** Physics sync event. */
+    SYNC(6);
+
+    /**
+     * The bit number.
+     */
+    private int bit;
+
+    /**
+     * The bit mask.
+     */
+    int bitMask;
+
+    /**
+     * Constructor with bit number.
+     *
+     * @param bit the bit number
+     */
+    private EventTagBitMask(final int bit) {
+        this.bit = bit;
+        this.bitMask = 1 >> this.bit;
+    }
+
+    /**
+     * Get the bit number.
+     *
+     * @return the bit number
+     */
+    public int getBit() {
+        return this.bit;
+    }
+
+    /**
+     * Get the bit mask.
+     *
+     * @return the bit mask
+     */
+    public int getBitMask() {
+        return this.bitMask;
+    }
+
+    /**
+     * Return <code>true</code> if the event's tag matches this one.
+     *
+     * @param event an <code>EvioEvent</code> to check
+     * @return <code>true</code> if the event's tag matches this one
+     */
+    public boolean isEventTag(final EvioEvent event) {
+        return isEventTag(event.getHeader().getTag());
+    }
+
+    /**
+     * Return <code>true</code> if the tag matches this one.
+     *
+     * @param eventTag the event's tag from the header bank
+     * @return <code>true</code> if the tag matches this one
+     */
+    public boolean isEventTag(final int eventTag) {
+        return (eventTag & this.bitMask) == 1;
+    }
+}

Added: java/trunk/record-util/src/main/java/org/hps/record/evio/EventTagConstant.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/evio/EventTagConstant.java	(added)
+++ java/trunk/record-util/src/main/java/org/hps/record/evio/EventTagConstant.java	Mon May 11 12:26:13 2015
@@ -0,0 +1,61 @@
+package org.hps.record.evio;
+
+import org.jlab.coda.jevio.EvioEvent;
+
+/**
+ * Encapsulates event tag constants for EVIO events as described at <a
+ * href="https://confluence.slac.stanford.edu/display/hpsg/EVIO+Data+Format#EVIODataFormat-EVIOEventtypes-2015DataSet"
+ * >EVIO Event types</a>.
+ *
+ * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ */
+public enum EventTagConstant {
+
+    /** CODA END event inserted at end of run. */
+    END(20),
+    /** EPICS event containing variable values. */
+    EPICS(31),
+    /** CODA GO event indicating event stream is starting. */
+    GO(18),
+    /** CODA PAUSE event indicating the pause button was pressed in the GUI. */
+    PAUSE(19),
+    /** The old physics event tag by HPS convention. */
+    PHYSICS_OLD(1),
+    /** CODA PRESTART event when run initializes. */
+    PRESTART(17),
+    /** CODA SYNC event. */
+    SYNC(16);
+
+    /**
+     * The tag value.
+     */
+    private final int tag;
+
+    /**
+     * Constructor with tag value.
+     * 
+     * @param tag the tag value
+     */
+    private EventTagConstant(final int tag) {
+        this.tag = tag;
+    }
+
+    /**
+     * Return <code>true</code> if the event tag matches this one.
+     * 
+     * @param event the <code>EvioEvent</code> to check
+     * @return <code>true</code> if the event's tag matches this one
+     */
+    public boolean isEventTag(final EvioEvent event) {
+        return event.getHeader().getTag() == this.tag;
+    }
+
+    /**
+     * Get the tag value.
+     * 
+     * @return the tag value
+     */
+    public int tag() {
+        return this.tag;
+    }
+}

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