Print

Print


Author: [log in to unmask]
Date: Tue Mar 24 09:39:54 2015
New Revision: 2521

Log:
Add method for checking if an event has the EPICS tag.

Modified:
    java/trunk/record-util/src/main/java/org/hps/record/evio/EvioEventConstants.java
    java/trunk/record-util/src/main/java/org/hps/record/evio/EvioEventUtilities.java

Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/EvioEventConstants.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/evio/EvioEventConstants.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/evio/EvioEventConstants.java	Tue Mar 24 09:39:54 2015
@@ -2,19 +2,31 @@
 
 public class EvioEventConstants {
     
+    // This is the old tag for physics events.
     public static final int PHYSICS_EVENT_TAG = 1;
+    
+    // CODA control event tags.
     public static final int SYNC_EVENT_TAG = 16;
     public static final int PRESTART_EVENT_TAG = 17;
     public static final int GO_EVENT_TAG = 18;
     public static final int PAUSE_EVENT_TAG = 19;
     public static final int END_EVENT_TAG = 20;
     
+    // Special tag for events with EPICS scalars.
+    public static final int EPICS_EVENT_TAG = 31;
+    
+    // Event tags greater than or equal to this will be physics events.
+    public static final int PHYSICS_START_TAG = 32;
+    
     public static final int EVENTID_BANK_TAG = 0xC000;
-    
+  
+    // Bank tag for header bank with run and event numbers in physics events.
     public static final int HEAD_BANK_TAG = 0xe10F;
   
-    public static final int EPICS_EVENT_TAG = 31;
     public static final int EPICS_BANK_TAG = 57620;
     public static final int EPICS_BANK_TAG_2s = -1;
     public static final int EPICS_BANK_TAG_20s = -1;
+    //public static final int EPICS_BANK_TAG_2s = -1;
+    //public static final int EPICS_BANK_TAG_20s = -1;
+    
 }

Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/EvioEventUtilities.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/evio/EvioEventUtilities.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/evio/EvioEventUtilities.java	Tue Mar 24 09:39:54 2015
@@ -1,10 +1,6 @@
 package org.hps.record.evio;
 
-import static org.hps.record.evio.EvioEventConstants.END_EVENT_TAG;
-import static org.hps.record.evio.EvioEventConstants.GO_EVENT_TAG;
-import static org.hps.record.evio.EvioEventConstants.PAUSE_EVENT_TAG;
-import static org.hps.record.evio.EvioEventConstants.PRESTART_EVENT_TAG;
-import static org.hps.record.evio.EvioEventConstants.SYNC_EVENT_TAG;
+import static org.hps.record.evio.EvioEventConstants.*;
 
 import org.jlab.coda.jevio.BaseStructure;
 import org.jlab.coda.jevio.EvioEvent;
@@ -20,6 +16,11 @@
     private EvioEventUtilities() {
     }
     
+    /**
+     * Get the event tag from the header bank.
+     * @param event The input EvioEvent.
+     * @return The event tag from the header bank.
+     */
     public static int getEventTag(EvioEvent event) {
         return event.getHeader().getTag();
     }
@@ -72,7 +73,7 @@
      * @return True if this event is a physics event.
      */
     public static boolean isPhysicsEvent(EvioEvent event) {
-        return (event.getHeader().getTag() >= SYNC_EVENT_TAG+16 ||
+        return (event.getHeader().getTag() >= PHYSICS_START_TAG ||
                 event.getHeader().getTag() < SYNC_EVENT_TAG);
         // return event.getHeader().getTag() == PHYSICS_EVENT_TAG;
     }
@@ -88,6 +89,16 @@
     }
     
     /**
+     * Check if this event is an EPICS event containing scalar data.
+     * 
+     * @param event The EvioEvent.
+     * @return True if this event is an EPICS event.
+     */
+    public static boolean isEpicsEvent(EvioEvent event) {
+        return event.getHeader().getTag() == EPICS_EVENT_TAG;
+    }
+    
+    /**
      * True if <code>event</code> is an EVIO control event.
      * @return True if event is a control event.
      */
@@ -96,7 +107,8 @@
                 isGoEvent(event) || 
                 isPauseEvent(event) || 
                 isEndEvent(event) || 
-                isSyncEvent(event);
+                isSyncEvent(event) ||
+                isEpicsEvent(event);
     }
 
     /**