Print

Print


Author: [log in to unmask]
Date: Thu Jul 16 18:49:33 2015
New Revision: 3264

Log:
Add method for getting event ID data from EVIO event.

Modified:
    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/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	Thu Jul 16 18:49:33 2015
@@ -207,7 +207,25 @@
             evioEvent.setEventNumber(eventNumber);
         }
     }
-
+    
+    /**
+     * Get integer data from the event ID bank of an EVIO event.
+     * 
+     * @param evioEvent the input EVIO event
+     * @return the event ID integer array or <code>null</code> if not found
+     */
+    public static int[] getEventIdData(EvioEvent evioEvent) {
+        int[] eventId = null;
+        if (evioEvent.getChildCount() > 0) {
+            for (final BaseStructure bank : evioEvent.getChildrenList()) {
+                if (bank.getHeader().getTag() == EvioEventConstants.EVENTID_BANK_TAG) {
+                    eventId = bank.getIntData();
+                }
+            }
+        }
+        return eventId;
+    }
+    
     /**
      * Class should not be instantiated.
      */