lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/util/job
diff -u -r1.9 -r1.10
--- JobManager.java 11 Mar 2009 03:21:55 -0000 1.9
+++ JobManager.java 16 Mar 2009 20:44:35 -0000 1.10
@@ -4,11 +4,16 @@
import java.io.PrintStream;
import java.util.*;
+import org.freehep.application.Application;
+import org.freehep.application.studio.Studio;
+import org.freehep.util.FreeHEPLookup;
import org.lcsim.conditions.ConditionsListener;
import org.lcsim.conditions.ConditionsEvent;
import org.lcsim.conditions.ConditionsManager;
import org.lcsim.event.EventHeader;
import org.lcsim.util.aida.AIDA;
+import org.lcsim.util.heprep.HepRepCollectionConverter;
+import org.lcsim.util.heprep.LCSimHepRepConverter;
/**
* Driver that provides miscellaneous services to other classes.
@@ -18,16 +23,21 @@
*
* <li>Accepts listener registration and dispatch events that trigger geometry dependent
* initialization in client classes. Listeners can be registered along with
- * dependencies among them - <tt>JobManager</tt> guaranties that the listeners
+ * dependencies among them - <tt>JobManager</tt> guaranties that listeners
* specified as "prerequisites" for some other listener will receive the event first.
*
* <li>Allows registration and retrieval of singleton objects of any type.
*
* <li>Provides access to the default AIDA object that can be used for histogramming, plotting, etc.
+ *
+ * <li>Accepts {@link HepRepCollectionConverter} registration for visualizing Lists of
+ * objects in the event record using Wired event display.
+ *
+ * <li>Can print message and/or save AIDA tree every specified number of events.
* </ul>
*
* @author D. Onoprienko
- * @version $Id: JobManager.java,v 1.9 2009/03/11 03:21:55 onoprien Exp $
+ * @version $Id: JobManager.java,v 1.10 2009/03/16 20:44:35 onoprien Exp $
*/
public class JobManager extends org.lcsim.util.Driver implements ConditionsListener {
@@ -351,6 +361,24 @@
}
+// -- Registering HepRep converters : -----------------------------------------
+
+ /**
+ * Registers the specified heprep converter with the current application.
+ * The converter will be used to visualize Lists of objects of compatible type
+ * in the event record.
+ */
+ public void registerHepRepConverter(HepRepCollectionConverter converter) {
+ Application app = Application.getApplication();
+ try {
+ FreeHEPLookup lookup = ((Studio)app).getLookup();
+ Object o = lookup.lookup(org.lcsim.util.heprep.LCSimHepRepConverter.class);
+ LCSimHepRepConverter heprep = (LCSimHepRepConverter) o;
+ heprep.register(converter);
+ } catch (Throwable t) {}
+ }
+
+
// -- Printing statistics : ---------------------------------------------------
/** Tells <tt>JobManager</tt> to print a message every <tt>nEvents</tt>. */