Author: [log in to unmask] Date: Mon May 11 15:02:56 2015 New Revision: 2954 Log: Merge in EVIO sequential read branch. HPSJAVA-494 Modified: java/trunk/evio/src/main/java/org/hps/evio/BasicEvioFileReader.java java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java java/trunk/parent/pom.xml java/trunk/record-util/src/main/java/org/hps/record/evio/EvioFileProducer.java java/trunk/record-util/src/main/java/org/hps/record/evio/EvioFileSource.java Modified: java/trunk/evio/src/main/java/org/hps/evio/BasicEvioFileReader.java ============================================================================= --- java/trunk/evio/src/main/java/org/hps/evio/BasicEvioFileReader.java (original) +++ java/trunk/evio/src/main/java/org/hps/evio/BasicEvioFileReader.java Mon May 11 15:02:56 2015 @@ -20,7 +20,7 @@ throw new RuntimeException("File " + evioFileName + " does not exist."); } try { - org.jlab.coda.jevio.EvioReader reader = new org.jlab.coda.jevio.EvioReader(evioFile); + org.jlab.coda.jevio.EvioReader reader = new org.jlab.coda.jevio.EvioReader(evioFile,true,false); int eventN = 1; int badEvents = 0; fileLoop: Modified: java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java ============================================================================= --- java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java (original) +++ java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java Mon May 11 15:02:56 2015 @@ -115,6 +115,7 @@ options.addOption(new Option("v", false, "print EVIO XML for each event")); options.addOption(new Option("m", true, "set the max event buffer size")); options.addOption(new Option("t", true, "specify a conditions system tag to use")); + options.addOption(new Option("M", false,"Memory map file before reading")); logger.setLevel(Level.FINE); } @@ -342,7 +343,7 @@ // Open the EVIO reader. try { - reader = new EvioReader(evioFile); + reader = new EvioReader(evioFile,false,!cl.hasOption("M")); } catch (Exception e) { throw new RuntimeException("Error opening the EVIO file reader.", e); } @@ -531,15 +532,10 @@ EvioEvent evioEvent = null; while (eventQueue.size() < maxBufferSize) { try { - // Break if no more events from reader. - if (reader.getNumEventsRemaining() == 0) { - break; - } - // Read the next event. evioEvent = reader.nextEvent(); - if (evioEvent == null) { + if (evioEvent == null) { // This catches an end of file or bad event. break; } Modified: java/trunk/parent/pom.xml ============================================================================= --- java/trunk/parent/pom.xml (original) +++ java/trunk/parent/pom.xml Mon May 11 15:02:56 2015 @@ -31,6 +31,11 @@ <id>lcsim-repo-public</id> <name>LCSIM Public Maven Repository</name> <url>http://srs.slac.stanford.edu/nexus/content/groups/lcsim-maven2-public/</url> + </repository> + <repository> + <id>jlab-coda-repo-public</id> + <name>JLAB CODA Maven Repository</name> + <url>https://coda.jlab.org/maven/</url> </repository> <repository> <id>maven-central-repo</id> @@ -184,7 +189,7 @@ <dependency> <groupId>org.jlab.coda</groupId> <artifactId>jevio</artifactId> - <version>4.4.3</version> + <version>4.4.6-SNAPSHOT</version> </dependency> <dependency> <groupId>org.jlab.coda</groupId> Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/EvioFileProducer.java ============================================================================= --- java/trunk/record-util/src/main/java/org/hps/record/evio/EvioFileProducer.java (original) +++ java/trunk/record-util/src/main/java/org/hps/record/evio/EvioFileProducer.java Mon May 11 15:02:56 2015 @@ -338,13 +338,10 @@ // Loop over input EVIO file list. for (final File evioFile : this.evioFiles) { - // Open a new EVIO reader. + // Open a new EVIO reader in sequential read mode so events are immediately streamed to server. LOGGER.info("Opening next EVIO file " + evioFile.getPath() + " ..."); - reader = new EvioReader(evioFile.getPath(), false); + reader = new EvioReader(evioFile.getPath(), false, true); LOGGER.info("Done opening file!"); - - // Print the number of events. - LOGGER.info("EVIO file opened with " + reader.getEventCount() + " events."); // Reference to the current EVIO event. EvioEvent event; @@ -423,6 +420,7 @@ LOGGER.finest("Sucessfully wrote " + eventCount + " event to ET which was EVIO event number " + event.getEventNumber() + " from file " + evioFile.getPath() + "."); } + LOGGER.info(eventCount + " events were read from " + evioFile.getPath()); reader.close(); } Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/EvioFileSource.java ============================================================================= --- java/trunk/record-util/src/main/java/org/hps/record/evio/EvioFileSource.java (original) +++ java/trunk/record-util/src/main/java/org/hps/record/evio/EvioFileSource.java Mon May 11 15:02:56 2015 @@ -151,7 +151,7 @@ private void openReader() { try { System.out.println("Opening reader for file " + this.files.get(this.fileIndex) + " ..."); - this.reader = new EvioReader(this.files.get(this.fileIndex), false); + this.reader = new EvioReader(this.files.get(this.fileIndex), false,true); System.out.println("Done opening file."); } catch (EvioException | IOException e) { throw new RuntimeException(e);