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  December 2014

HPS-SVN December 2014

Subject:

r1763 - /java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java

From:

[log in to unmask]

Reply-To:

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

Date:

Tue, 16 Dec 2014 23:30:41 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (76 lines)

Author: [log in to unmask]
Date: Tue Dec 16 15:30:36 2014
New Revision: 1763

Log:
Okay fix maxEvents so it actually does work correctly.

Modified:
    java/trunk/evio/src/main/java/org/hps/evio/EvioToLcio.java

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	Tue Dec 16 15:30:36 2014
@@ -49,14 +49,14 @@
  * <p>
  * This class attempts to automatically configure itself for Test Run or Engineering Run 
  * based on the run numbers in the EVIO file. It will use an appropriate default detector 
- * unless one is given on the command line, and it will also use the correct event builder. 
- * However, it will NOT correctly handle a mixed list of EVIO files from both runs, so
- * don't do this!
+ * unless one is given on the command line, and it will also use the correct event builder.
+ * It will not handle jobs correctly with files from both the Test and Engineering Run
+ * so don't do this!
  *
  * @author Jeremy McCormick <[log in to unmask]>
+ * @author Sho Uemura <[log in to unmask]>
  */
 public class EvioToLcio {
-
 
     // The default steering resource, which basically does nothing except print event numbers.
     private static final String DEFAULT_STEERING_RESOURCE = "/org/hps/steering/EventMarker.lcsim";
@@ -107,7 +107,7 @@
      */
     public void run(String[] args) {
 
-        int maxEvents = 0;
+        int maxEvents = -1;
         int nEvents = 0;
 
         // Set up command line parsing.
@@ -201,8 +201,11 @@
         }
 
         // Get the max number of events to process.
-        if (cl.hasOption("n")) {
+        if (cl.hasOption("n")) {            
             maxEvents = Integer.valueOf(cl.getOptionValue("n"));
+            if (maxEvents <= 0) {
+                throw new IllegalArgumentException("Value of -n option is invalid: " + maxEvents);
+            }
             logger.config("set max events to " + maxEvents);
         }
 
@@ -308,7 +311,7 @@
             long time = 0; // in ms
 
             // Loop over EVIO events, build LCSim events, process them, and then write events to disk.
-            readLoop: while (maxEvents == 0 || nEvents < maxEvents) {
+            readLoop: while (maxEvents == -1 || nEvents < maxEvents) {
                 EvioEvent evioEvent = null;
                 try {
                     while (evioEvent == null) {
@@ -406,8 +409,8 @@
                 e.printStackTrace();
             }
             
-            if (nEvents >= maxEvents) {
-                logger.info("user maxEvents " + maxEvents + " was reached");
+            if (maxEvents != -1 && nEvents < maxEvents) {
+                logger.info("maxEvents " + maxEvents + " was reached");
                 break fileLoop;
             }
         }

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