Author: [log in to unmask]
Date: Mon May 11 12:31:07 2015
New Revision: 2949
Log:
Add utility method for setting event number from event ID bank.
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 Mon May 11 12:31:07 2015
@@ -189,6 +189,26 @@
}
/**
+ * Manually set the event number on an <code>EvioEvent</code> from its "EVENT ID" bank.
+ *
+ * @param evioEvent the input <code>EvioEvent</code>
+ */
+ public static void setEventNumber(final EvioEvent evioEvent) {
+ int eventNumber = -1;
+ if (evioEvent.getChildrenList() != null) {
+ for (final BaseStructure bank : evioEvent.getChildrenList()) {
+ if (bank.getHeader().getTag() == EvioEventConstants.EVENTID_BANK_TAG) {
+ eventNumber = bank.getIntData()[0];
+ break;
+ }
+ }
+ }
+ if (eventNumber != -1) {
+ evioEvent.setEventNumber(eventNumber);
+ }
+ }
+
+ /**
* Class should not be instantiated.
*/
private EvioEventUtilities() {
|