Commit in hps-java/src/main/java/org/lcsim/hps on MAIN
monitoring/ecal/EcalEvsX.java+116-1181.6 -> 1.7
evio/TestRunEvioToLcio.java+205-2101.13 -> 1.14
+321-328
2 modified files
-w is now somewhat less dumb

hps-java/src/main/java/org/lcsim/hps/monitoring/ecal
EcalEvsX.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- EcalEvsX.java	16 May 2012 16:05:59 -0000	1.6
+++ EcalEvsX.java	22 May 2012 20:14:18 -0000	1.7
@@ -17,130 +17,128 @@
 
 public class EcalEvsX extends Driver implements Resettable {
 
-    String subdetectorName = "Ecal";
-    String inputCollection = "EcalClusters";
-    AIDA aida = AIDA.defaultInstance();
-    IPlotter plotter;
-    IHistogram2D EvsXPlot;
-    IHistogram1D invMassPlot;
-    IHistogram2D clusterPairEnergyPlot;
-    IHistogram2D clusterPairPositionPlot;
-    Detector detector;
-    int eventn = 0;
-    double targetZ = 0;
-
-    public void setInputCollection(String inputCollection) {
-        this.inputCollection = inputCollection;
-    }
-
-    public void setSubdetectorName(String subdetectorName) {
-        this.subdetectorName = subdetectorName;
-    }
-
-    public void setTargetZ(double targetZ) {
-        this.targetZ = targetZ;
-    }
-
-    protected void detectorChanged(Detector detector) {
-
-        this.detector = detector;
-
-        if (detector.getSubdetector(subdetectorName) == null) {
-            throw new RuntimeException("There is no subdetector called " + subdetectorName + " in this detector");
-        }
-
-        // Setup the plotter.
-        plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal E vs X Plot");
-        plotter.style().dataStyle().errorBarStyle().setVisible(false);
-
-        // Setup plots.
-        aida.tree().cd("/");
-        EvsXPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : E vs X", 50, -350.0, 350.0, 200, -100, 2000);
-        invMassPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Photon Pair Mass", 50, 0.0, 100.0);
-        clusterPairEnergyPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Pair Energies", 1000, -100, 2000, 1000, -100, 2000);
-        clusterPairPositionPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Pair Positions", 50, -350, 350, 50, -350, 350);
+	String subdetectorName = "Ecal";
+	String inputCollection = "EcalClusters";
+	AIDA aida = AIDA.defaultInstance();
+	IPlotter plotter;
+	IHistogram2D EvsXPlot;
+	IHistogram1D invMassPlot;
+	IHistogram2D clusterPairEnergyPlot;
+	IHistogram2D clusterPairPositionPlot;
+	Detector detector;
+	int eventn = 0;
+	double targetZ = 0;
+
+	public void setInputCollection(String inputCollection) {
+		this.inputCollection = inputCollection;
+	}
+
+	public void setSubdetectorName(String subdetectorName) {
+		this.subdetectorName = subdetectorName;
+	}
+
+	public void setTargetZ(double targetZ) {
+		this.targetZ = targetZ;
+	}
+
+	protected void detectorChanged(Detector detector) {
+
+		this.detector = detector;
+
+		if (detector.getSubdetector(subdetectorName) == null) {
+			throw new RuntimeException("There is no subdetector called " + subdetectorName + " in this detector");
+		}
+
+		// Setup the plotter.
+		plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal E vs X Plot");
+		plotter.style().dataStyle().errorBarStyle().setVisible(false);
+
+		// Setup plots.
+		aida.tree().cd("/");
+		EvsXPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : E vs X", 50, -350.0, 350.0, 200, -100, 2000);
+		invMassPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Photon Pair Mass", 50, 0.0, 100.0);
+		clusterPairEnergyPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Pair Energies", 1000, -100, 2000, 1000, -100, 2000);
+		clusterPairPositionPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Cluster Pair Positions", 50, -350, 350, 50, -350, 350);
 
-        // Create the plotter regions.
-        plotter.createRegions(2, 2);
+		// Create the plotter regions.
+		plotter.createRegions(2, 2);
 //        plotter.style().statisticsBoxStyle().setVisible(false);
-        IPlotterStyle style = plotter.region(0).style();
-        style.setParameter("hist2DStyle", "colorMap");
-        style.statisticsBoxStyle().setVisible(false);
-        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        plotter.region(1).style().yAxisStyle().setParameter("scale", "log");
-        plotter.region(0).plot(EvsXPlot);
-        plotter.region(1).plot(invMassPlot);
-        plotter.region(2).plot(clusterPairEnergyPlot);
-        style = plotter.region(2).style();
-        style.setParameter("hist2DStyle", "colorMap");
-        style.statisticsBoxStyle().setVisible(false);
-        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        style.zAxisStyle().setParameter("scale", "log");
-        plotter.region(3).plot(clusterPairPositionPlot);
-        style = plotter.region(3).style();
-        style.setParameter("hist2DStyle", "colorMap");
-        style.statisticsBoxStyle().setVisible(false);
-        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        style.zAxisStyle().setParameter("scale", "log");
-        plotter.show();
-    }
-
-    public void process(EventHeader event) {
-        if (event.hasCollection(Cluster.class, inputCollection)) {
-            List<Cluster> clusters = event.get(Cluster.class, inputCollection);
-            boolean left = false;
-            boolean right = false;
-            for (Cluster cluster : clusters) {
-                if (cluster.getPosition()[0] > 0) {
-                    right = true;
-                }
-                if (cluster.getPosition()[0] < 0) {
-                    left = true;
-                }
-            }
-            if (left && right) {
-                for (Cluster cluster : clusters) {
-                    EvsXPlot.fill(cluster.getPosition()[0], cluster.getEnergy());
-                }
-            }
-            for (int i = 0; i < clusters.size() - 1; i++) {
-                double e1 = clusters.get(i).getEnergy();
-                double x1 = clusters.get(i).getPosition()[0];
-                for (int j = i + 1; j < clusters.size(); j++) {
-                    double e2 = clusters.get(j).getEnergy();
-                    double x2 = clusters.get(j).getPosition()[0];
+		IPlotterStyle style = plotter.region(0).style();
+		style.setParameter("hist2DStyle", "colorMap");
+		style.statisticsBoxStyle().setVisible(false);
+		style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+		plotter.region(1).style().yAxisStyle().setParameter("scale", "log");
+		plotter.region(0).plot(EvsXPlot);
+		plotter.region(1).plot(invMassPlot);
+		plotter.region(2).plot(clusterPairEnergyPlot);
+		style = plotter.region(2).style();
+		style.setParameter("hist2DStyle", "colorMap");
+		style.statisticsBoxStyle().setVisible(false);
+		style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+		style.zAxisStyle().setParameter("scale", "log");
+		plotter.region(3).plot(clusterPairPositionPlot);
+		style = plotter.region(3).style();
+		style.setParameter("hist2DStyle", "colorMap");
+		style.statisticsBoxStyle().setVisible(false);
+		style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+		style.zAxisStyle().setParameter("scale", "log");
+		plotter.show();
+	}
+
+	public void process(EventHeader event) {
+		if (event.hasCollection(Cluster.class, inputCollection)) {
+			List<Cluster> clusters = event.get(Cluster.class, inputCollection);
+			boolean left = false;
+			boolean right = false;
+			for (Cluster cluster : clusters) {
+				if (cluster.getPosition()[0] > 0) {
+					right = true;
+				}
+				if (cluster.getPosition()[0] < 0) {
+					left = true;
+				}
+			}
+			if (left && right) {
+				for (Cluster cluster : clusters) {
+					EvsXPlot.fill(cluster.getPosition()[0], cluster.getEnergy());
+				}
+			}
+			for (int i = 0; i < clusters.size() - 1; i++) {
+				double e1 = clusters.get(i).getEnergy();
+				double x1 = clusters.get(i).getPosition()[0];
+				for (int j = i + 1; j < clusters.size(); j++) {
+					double e2 = clusters.get(j).getEnergy();
+					double x2 = clusters.get(j).getPosition()[0];
 //                    if (clusters.get(i).getPosition()[1] * clusters.get(j).getPosition()[1] > 0) {
 //                        continue;
 //                    }
-                    clusterPairEnergyPlot.fill(Math.max(e1, e2), Math.min(e1, e2));
-                    clusterPairPositionPlot.fill(Math.max(x1, x2), Math.min(x1, x2));
+					clusterPairEnergyPlot.fill(Math.max(e1, e2), Math.min(e1, e2));
+					clusterPairPositionPlot.fill(Math.max(x1, x2), Math.min(x1, x2));
 //                    double e1e2 = clusters.get(i).getEnergy() * clusters.get(j).getEnergy();
 //                    double dx2 = Math.pow(clusters.get(i).getPosition()[0] - clusters.get(j).getPosition()[0], 2) + Math.pow(clusters.get(i).getPosition()[1] - clusters.get(j).getPosition()[1], 2);
 //                    invMassPlot.fill(Math.sqrt(e1e2 * dx2 / (135 * 135)));
-                    invMassPlot.fill(VecOp.add(clusterAsPhoton(clusters.get(i)), clusterAsPhoton(clusters.get(j))).magnitude());
-                }
-            }
-
-            ++eventn;
-        }
-    }
-
-    public HepLorentzVector clusterAsPhoton(Cluster cluster) {
-        Hep3Vector position = new BasicHep3Vector(cluster.getPosition());
-        Hep3Vector direction = VecOp.unit(VecOp.add(position, new BasicHep3Vector(0, 0, targetZ)));
-        return new BasicHepLorentzVector(cluster.getEnergy(), VecOp.mult(cluster.getEnergy(), direction));
-    }
-
-//    public void endOfData() {
-//        if (plotter != null) {
-//            plotter.hide();
-//            plotter.destroyRegions();
-//        }
-//        if (EvsXPlot != null) {
-//            EvsXPlot.reset();
-//        }
-//    }
-    public void reset() {
-        EvsXPlot.reset();
-    }
+					invMassPlot.fill(VecOp.add(clusterAsPhoton(clusters.get(i)), clusterAsPhoton(clusters.get(j))).magnitude());
+				}
+			}
+
+			++eventn;
+		}
+	}
+
+	public HepLorentzVector clusterAsPhoton(Cluster cluster) {
+		Hep3Vector position = new BasicHep3Vector(cluster.getPosition());
+		Hep3Vector direction = VecOp.unit(VecOp.add(position, new BasicHep3Vector(0, 0, targetZ)));
+		return new BasicHepLorentzVector(cluster.getEnergy(), VecOp.mult(cluster.getEnergy(), direction));
+	}
+
+	public void endOfData() {
+		if (plotter != null) {
+			plotter.hide();
+			plotter.destroyRegions();
+		}
+	}
+
+	public void reset() {
+		EvsXPlot.reset();
+	}
 }
\ No newline at end of file

hps-java/src/main/java/org/lcsim/hps/evio
TestRunEvioToLcio.java 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- TestRunEvioToLcio.java	18 May 2012 08:26:35 -0000	1.13
+++ TestRunEvioToLcio.java	22 May 2012 20:14:18 -0000	1.14
@@ -32,215 +32,210 @@
  */
 public class TestRunEvioToLcio {
 
-    private static final String defaultDetectorName = "HPS-TestRun-v2";
-    private static final String defaultSteeringFile = "/org/lcsim/hps/steering/DummyMonitoring.lcsim";
+	private static final String defaultDetectorName = "HPS-TestRun-v2";
+	private static final String defaultSteeringFile = "/org/lcsim/hps/steering/DummyMonitoring.lcsim";
 
-    /**
-     * Defines command line options for this program.
-     *
-     * @return The command line options.
-     */
-    private static Options createCommandLineOptions() {
-        Options options = new Options();
-
-        options.addOption(new Option("l", true, "The name of the output LCIO file."));
-        options.addOption(new Option("d", true, "The name of the detector to use for LCSim conditions."));
-        options.addOption(new Option("x", true, "The LCSim XML file to process the LCIO events."));
-        options.addOption(new Option("s", true, "Sleep duration between events (in ms)"));
-        options.addOption(new Option("e", true, "Stop after N events"));
-        options.addOption(new Option("w", false, "Wait after end of data"));
-
-        return options;
-    }
-
-    /**
-     * This method will execute the EVIO to LCIO conversion and perform an
-     * intermediate LCSim job. Then the resultant LCIO events will be written to
-     * disk.
-     *
-     * @param args The command line arguments.
-     */
-    public static void main(String[] args) {
-        int maxEvents = 0;
-        int nEvents = 0;
-
-        // Set up command line parsing.
-        Options options = createCommandLineOptions();
-        if (args.length == 0) {
-            System.out.println("TestRunEvioToLcio [options] [evioFiles]");
-            HelpFormatter help = new HelpFormatter();
-            help.printHelp(" ", options);
-            System.exit(1);
-        }
-        CommandLineParser parser = new PosixParser();
-
-        // Parse command line arguments.
-        CommandLine cl = null;
-        try {
-            cl = parser.parse(options, args);
-        } catch (ParseException e) {
-            throw new RuntimeException("Problem parsing command line options.", e);
-        }
-
-        String lcioFileName = null;
-        LCIOWriter writer = null;
-        String detectorName = defaultDetectorName;
-        InputStream steeringStream = null;
-        int sleepTime = -1;
-
-        // Remind people not to use -e any more
-        //if (cl.hasOption("e")) {
-        //    System.out.println("Option -e is deprecated; EVIO file name is now a non-option argument");
-        //}
-
-        // LCIO output file.
-        if (cl.hasOption("l")) {
-            lcioFileName = cl.getOptionValue("l");
-        }
-
-        // Name of detector.
-        if (cl.hasOption("d")) {
-            detectorName = cl.getOptionValue("d");
-        }
-
-        // LCSim XML file to execute inline.
-        if (cl.hasOption("x")) {
-            String lcsimXmlName = cl.getOptionValue("x");
-            try {
-                steeringStream = new FileInputStream(lcsimXmlName);
-            } catch (FileNotFoundException e) {
-                throw new RuntimeException(e);
-            }
-        }
-
-        if (steeringStream == null) {
-            steeringStream = TestRunEvioToLcio.class.getResourceAsStream(defaultSteeringFile);
-        }
-
-        // Sleep time.
-        if (cl.hasOption("s")) {
-            sleepTime = Integer.valueOf(cl.getOptionValue("s"));
-        }
-
-        // Sleep time.
-        if (cl.hasOption("e")) {
-            maxEvents = Integer.valueOf(cl.getOptionValue("e"));
-        }
-
-        // LCIO writer.
-        if (lcioFileName != null) {
-            try {
-                writer = new LCIOWriter(new File(lcioFileName));
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
-        }
-
-        // LCSim job manager.
-        JobControlManager jobManager = new JobControlManager();
-        jobManager.setup(steeringStream);
-        jobManager.configure();
-
-        try { //TODO: figure out whether this is the right way to do this
-            ConditionsManager.defaultInstance().setDetector(detectorName, 0);
-        } catch (ConditionsNotFoundException e) {
-            throw new RuntimeException(e);
-        }
-
-        // LCSim event builder.
-        LCSimEventBuilder eventBuilder = new LCSimTestRunEventBuilder();
-        eventBuilder.setDetectorName(detectorName);
-
-        HPSCalibrationListener calibListener = new HPSCalibrationListener();
-        calibListener.begin();
-
-        for (String evioFileName : cl.getArgs()) {
-            // EVIO input file.
-            File evioFile = new File(evioFileName);
-            System.out.println("Opening file " + evioFileName);
-            // EVIO reader.
-            EvioReader reader = null;
-            try {
-                reader = new EvioReader(evioFile);
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
-
-            // Loop over EVIO events, build LCSim events, process them, and then
-            // write events to disk.
-            fileLoop:
-            while (maxEvents == 0 || nEvents < maxEvents) {
-                EvioEvent evioEvent = null;
-                try {
-                    eventLoop:
-                    while (evioEvent == null) {
-                        evioEvent = reader.nextEvent();
-                        if (evioEvent == null) {
-                            break fileLoop;
-                        }
-                        try {
-                            reader.parseEvent(evioEvent);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                            continue eventLoop;
-                        }
-                    }
-                    // Handlers for different event types.
-                    if (EventConstants.isPreStartEvent(evioEvent)) {
-                        int[] data = evioEvent.getIntData();
-                        int seconds = data[0];
-                        int runNumber = data[1];
-                        calibListener.prestart(seconds, runNumber);
-                    } else if (EventConstants.isEndEvent(evioEvent)) {
-                        int[] data = evioEvent.getIntData();
-                        int seconds = data[0];
-                        int nevents = data[2];
-                        calibListener.endRun(seconds, nevents);
-                    } else if (eventBuilder.isPhysicsEvent(evioEvent)) {
-                        EventHeader lcioEvent = eventBuilder.makeLCSimEvent(evioEvent);
-                        jobManager.processEvent(lcioEvent);
-                        if (writer != null) {
-                            writer.write(lcioEvent);
-                            writer.flush();
-                        }
-                    }
-
-                } catch (Exception e) {
-                    // Catch all event processing errors and continue.
-                    e.printStackTrace();
-                    continue;
-                } finally {
-                    if (sleepTime > 0) {
-                        try {
-                            Thread.sleep(sleepTime);
-                        } catch (InterruptedException e) {
-                            throw new RuntimeException(e);
-                        }
-                    }
-
-                }
-                nEvents++;
-            }
-            reader.close();
-        }
-        System.out.println("No more data");
-        
-        if (cl.hasOption("w")) {
-            try { //TODO: this is kind of dumb
-                Thread.sleep(1000000000);
-            } catch (InterruptedException e) {
-                throw new RuntimeException(e);
-            }
-        }
-
-        System.out.println("Exiting");
-        jobManager.finish();
-        if (writer != null) {
-            try {
-                writer.close();
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
-        }
-    }
+	/**
+	 * Defines command line options for this program.
+	 *
+	 * @return The command line options.
+	 */
+	private static Options createCommandLineOptions() {
+		Options options = new Options();
+
+		options.addOption(new Option("l", true, "The name of the output LCIO file."));
+		options.addOption(new Option("d", true, "The name of the detector to use for LCSim conditions."));
+		options.addOption(new Option("x", true, "The LCSim XML file to process the LCIO events."));
+		options.addOption(new Option("s", true, "Sleep duration between events (in ms)"));
+		options.addOption(new Option("e", true, "Stop after N events"));
+		options.addOption(new Option("w", false, "Wait after end of data"));
+
+		return options;
+	}
+
+	/**
+	 * This method will execute the EVIO to LCIO conversion and perform an
+	 * intermediate LCSim job. Then the resultant LCIO events will be written to
+	 * disk.
+	 *
+	 * @param args The command line arguments.
+	 */
+	public static void main(String[] args) {
+		int maxEvents = 0;
+		int nEvents = 0;
+
+		// Set up command line parsing.
+		Options options = createCommandLineOptions();
+		if (args.length == 0) {
+			System.out.println("TestRunEvioToLcio [options] [evioFiles]");
+			HelpFormatter help = new HelpFormatter();
+			help.printHelp(" ", options);
+			System.exit(1);
+		}
+		CommandLineParser parser = new PosixParser();
+
+		// Parse command line arguments.
+		CommandLine cl = null;
+		try {
+			cl = parser.parse(options, args);
+		} catch (ParseException e) {
+			throw new RuntimeException("Problem parsing command line options.", e);
+		}
+
+		String lcioFileName = null;
+		LCIOWriter writer = null;
+		String detectorName = defaultDetectorName;
+		InputStream steeringStream = null;
+		int sleepTime = -1;
+
+		// Remind people not to use -e any more
+		//if (cl.hasOption("e")) {
+		//    System.out.println("Option -e is deprecated; EVIO file name is now a non-option argument");
+		//}
+
+		// LCIO output file.
+		if (cl.hasOption("l")) {
+			lcioFileName = cl.getOptionValue("l");
+		}
+
+		// Name of detector.
+		if (cl.hasOption("d")) {
+			detectorName = cl.getOptionValue("d");
+		}
+
+		// LCSim XML file to execute inline.
+		if (cl.hasOption("x")) {
+			String lcsimXmlName = cl.getOptionValue("x");
+			try {
+				steeringStream = new FileInputStream(lcsimXmlName);
+			} catch (FileNotFoundException e) {
+				throw new RuntimeException(e);
+			}
+		}
+
+		if (steeringStream == null) {
+			steeringStream = TestRunEvioToLcio.class.getResourceAsStream(defaultSteeringFile);
+		}
+
+		// Sleep time.
+		if (cl.hasOption("s")) {
+			sleepTime = Integer.valueOf(cl.getOptionValue("s"));
+		}
+
+		// Sleep time.
+		if (cl.hasOption("e")) {
+			maxEvents = Integer.valueOf(cl.getOptionValue("e"));
+		}
+
+		// LCIO writer.
+		if (lcioFileName != null) {
+			try {
+				writer = new LCIOWriter(new File(lcioFileName));
+			} catch (IOException e) {
+				throw new RuntimeException(e);
+			}
+		}
+
+		// LCSim job manager.
+		JobControlManager jobManager = new JobControlManager();
+		jobManager.setup(steeringStream);
+		jobManager.configure();
+
+		try { //TODO: figure out whether this is the right way to do this
+			ConditionsManager.defaultInstance().setDetector(detectorName, 0);
+		} catch (ConditionsNotFoundException e) {
+			throw new RuntimeException(e);
+		}
+
+		// LCSim event builder.
+		LCSimEventBuilder eventBuilder = new LCSimTestRunEventBuilder();
+		eventBuilder.setDetectorName(detectorName);
+
+		HPSCalibrationListener calibListener = new HPSCalibrationListener();
+		calibListener.begin();
+
+		for (String evioFileName : cl.getArgs()) {
+			// EVIO input file.
+			File evioFile = new File(evioFileName);
+			System.out.println("Opening file " + evioFileName);
+			// EVIO reader.
+			EvioReader reader = null;
+			try {
+				reader = new EvioReader(evioFile);
+			} catch (IOException e) {
+				throw new RuntimeException(e);
+			}
+
+			// Loop over EVIO events, build LCSim events, process them, and then
+			// write events to disk.
+			fileLoop:
+			while (maxEvents == 0 || nEvents < maxEvents) {
+				EvioEvent evioEvent = null;
+				try {
+					eventLoop:
+					while (evioEvent == null) {
+						evioEvent = reader.nextEvent();
+						if (evioEvent == null) {
+							break fileLoop;
+						}
+						try {
+							reader.parseEvent(evioEvent);
+						} catch (Exception e) {
+							e.printStackTrace();
+							continue eventLoop;
+						}
+					}
+					// Handlers for different event types.
+					if (EventConstants.isPreStartEvent(evioEvent)) {
+						int[] data = evioEvent.getIntData();
+						int seconds = data[0];
+						int runNumber = data[1];
+						calibListener.prestart(seconds, runNumber);
+					} else if (EventConstants.isEndEvent(evioEvent)) {
+						int[] data = evioEvent.getIntData();
+						int seconds = data[0];
+						int nevents = data[2];
+						calibListener.endRun(seconds, nevents);
+					} else if (eventBuilder.isPhysicsEvent(evioEvent)) {
+						EventHeader lcioEvent = eventBuilder.makeLCSimEvent(evioEvent);
+						jobManager.processEvent(lcioEvent);
+						if (writer != null) {
+							writer.write(lcioEvent);
+							writer.flush();
+						}
+					}
+
+				} catch (Exception e) {
+					// Catch all event processing errors and continue.
+					e.printStackTrace();
+					continue;
+				} finally {
+					if (sleepTime > 0) {
+						try {
+							Thread.sleep(sleepTime);
+						} catch (InterruptedException e) {
+							throw new RuntimeException(e);
+						}
+					}
+
+				}
+				nEvents++;
+			}
+			reader.close();
+		}
+		System.out.println("No more data");
+
+		if (!cl.hasOption("w")) {
+			System.out.println("Exiting");
+			jobManager.finish();
+		}
+
+		if (writer != null) {
+			try {
+				writer.close();
+			} catch (IOException e) {
+				throw new RuntimeException(e);
+			}
+		}
+	}
 }
\ No newline at end of file
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1