Print

Print


Commit in slic on MAIN
slic.cc+38-351.15 -> 1.16
include/CmdManager.hh+8-11.10 -> 1.11
       /G4Application.hh+49-601.40 -> 1.41
       /TimeUtil.hh+5-11.7 -> 1.8
src/CmdManager.cc+31-21.19 -> 1.20
   /G4Application.cc+180-1001.66 -> 1.67
   /G4ApplicationMessenger.cc+6-61.11 -> 1.12
   /LcioFileNamer.cc+5-31.13 -> 1.14
   /LcioManager.cc+9-81.67 -> 1.68
   /LogMessenger.cc+4-11.7 -> 1.8
   /TimeUtil.cc+14-11.7 -> 1.8
+349-218
11 modified files
JM: Cleanup usage and version output.

slic
slic.cc 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- slic.cc	28 Sep 2005 18:52:26 -0000	1.15
+++ slic.cc	17 May 2006 02:51:45 -0000	1.16
@@ -1,7 +1,30 @@
-// $Header: /cvs/lcd/slic/slic.cc,v 1.15 2005/09/28 18:52:26 jeremy Exp $
+// $Header: /cvs/lcd/slic/slic.cc,v 1.16 2006/05/17 02:51:45 jeremy Exp $
 
-// SLIC
+/**
+   @mainpage
+
+   The SLIC simulator is a Geant4 package that uses LCDD as its geometry input.
+
+   Refer to the
+   <a href="http://nicadd.niu.edu/~jeremy/docbook/projects/slic/html/jmccormick_slic_GettingStarted/t1.html">Getting Started Guide</a>
+   for detailed usage and installation instructions.
+
+   Print command line usage instructions by executing <i>slic --help</i>.
+
+   Valid LCDD is defined by the <a href="http://nicadd.niu.edu/~jeremy/lcd/lcdd/doc/schemas/lcdd.xsd.html">LCDDSchema</a>.
+
+   <a href="http://nicadd.niu.edu/~jeremy/lcd/lcdd/doc/html/">Source code documentation</a> is also available for the LCDD package.
+
+   Any questions can be directed to <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+   or posted in the <a href="http://forum.linearcollider.org/index.php?t=threadt&frm_id=7&rid=0&S=012b8714798313e7abf7c4d092eb9d0a">Full Simulations Area</a>
+   of the <a href="http://forum.linearcollider.org/">LinearCollider.org Forum</a>.
+
+   --Jeremy McCormick, SLAC
+*/
+
+// slic
 #include "G4Application.hh"
+#include "TimeUtil.hh"
 
 // std
 #include <iostream>
@@ -10,63 +33,43 @@
 
 int main(int argc, char** argv)
 {
-  // print starting time (should be first in logfile)
-  G4Application::printStartTime(std::cout);
+  // Print start time as first in log.
+  TimeUtil::printStartTime(std::cout);
 
-  // return code defaults to err
-  int returnCode = 1;
+  // Default return code.
+  int returnCode = 0;
 
-  // use g4 app base class
   G4Application* slicApp = 0;
 
-  // try block does not handle G4Exceptions, which kill the app immediately
+  // Top-level try block.
   try {
 
-    // create new slic simulator app
+    // Create the SLIC application with the command line arguments.
     slicApp = new G4Application(argc, argv);
 
-    // run with CL args
+    // Run the simulator.
     slicApp->run();
 
-    // set return code from app
+    // Set the application return code.
     returnCode = slicApp->getReturnCode();
   }
-  // catch std exception
+  // Catch an std::exception.
   catch(std::exception& stde) {
     std::cerr << "FATAL ERROR: " << stde.what() << std::endl;
   }
-  // catch unknown exception
+  // Catch an unknown exception.
   catch(...) {
     std::cerr << "Top-level flak catcher caught unknown exception in main()!" << std::endl;
   }
 
-  // done, so delete the app
   if ( slicApp ) {
     delete slicApp;
   }
 
-  // return code from above
+  // Print end time as last in log.
+  TimeUtil::printEndTime(std::cout);
+
   return returnCode;
 }
 
-/**
-   @mainpage
-
-   The SLIC simulator is a Geant4 package that uses LCDD as its geometry input.
-
-   Refer to the
-   <a href="http://nicadd.niu.edu/~jeremy/docbook/projects/slic/html/jmccormick_slic_GettingStarted/t1.html">Getting Started Guide</a>
-   for detailed usage and installation instructions.
-
-   Print command line usage instructions by executing <i>slic --help</i>.
 
-   Valid LCDD is defined by the <a href="http://nicadd.niu.edu/~jeremy/lcd/lcdd/doc/schemas/lcdd.xsd.html">LCDDSchema</a>.
-
-   <a href="http://nicadd.niu.edu/~jeremy/lcd/lcdd/doc/html/">Source code documentation</a> is also available for the LCDD package.
-
-   Any questions can be directed to <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
-   or posted in the <a href="http://forum.linearcollider.org/index.php?t=threadt&frm_id=7&rid=0&S=012b8714798313e7abf7c4d092eb9d0a">Full Simulations Area</a>
-   of the <a href="http://forum.linearcollider.org/">LinearCollider.org Forum</a>.
-
-   --Jeremy McCormick, SLAC
-*/

slic/include
CmdManager.hh 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- CmdManager.hh	19 Oct 2005 22:51:07 -0000	1.10
+++ CmdManager.hh	17 May 2006 02:51:45 -0000	1.11
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/CmdManager.hh,v 1.10 2005/10/19 22:51:07 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/CmdManager.hh,v 1.11 2006/05/17 02:51:45 jeremy Exp $
 #ifndef slic_CommandManager_hh
 #define slic_CommandManager_hh 1
 
@@ -51,6 +51,10 @@
 
     void clearG4CmdQueue();
 
+    bool isPrintUsage() const;
+
+    bool isPrintVersion() const;
+
   private:
 
     // manager singleton instance
@@ -64,6 +68,9 @@
 
     // strings of G4 commands to be executed
     G4CmdQueue m_cmdQueue;
+
+    bool m_printUsage;
+    bool m_printVersion;
   };
 }
 

slic/include
G4Application.hh 1.40 -> 1.41
diff -u -r1.40 -r1.41
--- G4Application.hh	8 May 2006 20:08:29 -0000	1.40
+++ G4Application.hh	17 May 2006 02:51:45 -0000	1.41
@@ -1,29 +1,40 @@
-// $Header: /cvs/lcd/slic/include/G4Application.hh,v 1.40 2006/05/08 20:08:29 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/G4Application.hh,v 1.41 2006/05/17 02:51:45 jeremy Exp $
 #ifndef slic_G4Application_hh
 #define slic_G4Application_hh 1
 
 // slic
-#include "RunManager.hh"
 #include "StringUtil.hh"
 
 // geant4
-#include "G4ApplicationState.hh"
 #ifdef G4VIS_USE
 #include "VisManager.hh"
 #endif
 #include "G4UIsession.hh"
-
-#include "G4MatScanMessenger.hh"
+#include "G4ApplicationState.hh"
 
 // std
 #include <iostream>
-#include <string>
+#include <cstdlib>
+
+// geant4
+class G4RunManager;
+
+// lcdd
+class LCDDObjectStoreInspector;
 
 namespace slic
 {
-
-  class G4ApplicationMessenger;
+  // slic
+  class CmdManager;
+  class EventDebugger;
+  class EventSourceManager;
   class FieldMessenger;
+  class LcioManager;
+  class LogManager;
+  class G4ApplicationMessenger;
+  class PhysicsListManager;
+  class RunManager;
+  class TrajectoryManager;
 
   /**
    * @class G4Application
@@ -42,28 +53,27 @@
     /* Indicates batch or interactive mode */
     enum ERunMode { eBatch=1, eInteractive=2 };
 
-    typedef int ReturnCodeType;
-
   public:
 
     G4Application(int, char**);
 
   public:
 
-    /* Returns application instance.  Must be constructed first. */
+    // Returns the application instance, which must have been constructed first.
     static G4Application* instance();
 
-    static G4ApplicationState getG4ApplicationState();
-
+    // Return SLIC's RunManager instance.
     RunManager* getRunManager();
 
-    // initialize the application
+    // Initialize the application.
     void initialize();
 
-    // run the application
+    // Run the application.
     void run();
 
-    void printOutUsage(std::ostream& os);
+    void printUsage(std::ostream& os);
+
+    void printVersion(std::ostream& os);
 
     void printSplashScreen(std::ostream& os) const;
 
@@ -73,39 +83,19 @@
     // print end time
     static void printEndTime(std::ostream& os);
 
-    ReturnCodeType getReturnCode() const
-    {
-      return m_returnCode;
-    }
+    int getReturnCode() const;
 
     ERunMode getMode() const;
 
-    void setAborting(bool a = true)
-    {
-      if ( a ) {
-	// does this actually do anything to current G4Event?!
-	G4RunManager::GetRunManager()->AbortRun(false);
-      }
-
-      m_setRunAbort = a;
-    }
-
-    bool isAborting()
-    {
-      return m_setRunAbort;
-    }
+    void setAborting(bool a = true);
+
+    bool isAborting() const;
 
     void setMode(ERunMode rmode);
 
-    const std::string& getBinaryName()
-    {
-      return m_binaryname;
-    }
-
-    const std::string& getBinaryBasename()
-    {
-      return m_binarybasename;
-    }
+    const std::string& getBinaryName() const;
+
+    const std::string& getBinaryBasename() const;
 
   protected:
 
@@ -113,20 +103,11 @@
 
     void registerCmdLineOpts();
 
-    void setReturnCode(ReturnCodeType rc)
-    {
-      m_returnCode = rc;
-    }
+    void setReturnCode(int rc);
 
   private:
 
-    void setBinaryBasename()
-    {
-      std::string::size_type sidx = m_binaryname.find_last_of('/');
-      if (sidx != std::string::npos) {
-	m_binarybasename = std::string(m_binaryname, sidx + 1);
-      }
-    }
+    void setBinaryBasename();
 
     void setupUserActions();
 
@@ -141,15 +122,12 @@
     // instance
     static G4Application* m_instance;
 
-    // g4 run manager
-    RunManager* m_runManager;
-
     // UI session
     G4UIsession* m_session;
 
     // vis manager
 #ifdef G4VIS_USE
-    VisManager* sVisManager;
+    VisManager* m_visManager;
 #endif
 
     // app messenger
@@ -158,16 +136,27 @@
     // field messenger
     FieldMessenger* m_fieldMessenger;
 
+    // FIXME: Should be managed generically using templated instantiation/deletion manager class.
+    LCDDObjectStoreInspector* m_objManager;
+    CmdManager* m_cmdManager;
+    PhysicsListManager* m_physicsManager;
+    LogManager* m_logManager;
+    EventDebugger* m_eventDebugger;
+    LcioManager* m_lcioManager;
+    TrajectoryManager* m_trajectoryManager;
+    EventSourceManager* m_genManager;
+    RunManager* m_runManager;
+
     // application run mode: batch or interactive
     ERunMode m_mode;
 
     // return code
-    ReturnCodeType m_returnCode;
+    int m_returnCode;
 
     // hack to make aborting G4 work (doesn't seem to function properly)
     bool m_setRunAbort;
 
-    /* Has the application been initialized yet? */
+    // Has the initialize() function been called?
     bool m_isInitialized;
 
     // What was the name of the SLIC binary from CL? (used by LcioFileNamer)

slic/include
TimeUtil.hh 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- TimeUtil.hh	19 Oct 2005 22:51:10 -0000	1.7
+++ TimeUtil.hh	17 May 2006 02:51:45 -0000	1.8
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/TimeUtil.hh,v 1.7 2005/10/19 22:51:10 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/TimeUtil.hh,v 1.8 2006/05/17 02:51:45 jeremy Exp $
 #ifndef slic_TimeUtil_hh
 #define slic_TimeUtil_hh 1
 
@@ -36,6 +36,10 @@
     /* @return time since the epoch with second resolution, converted to NS */
     static TimeUtil::long64 getTimeNS();
 
+    static void printStartTime(std::ostream& os);
+
+    static void printEndTime(std::ostream& os);
+
   private:
 
     /* @return timeinfo processed with localtime() */

slic/src
CmdManager.cc 1.19 -> 1.20
diff -u -r1.19 -r1.20
--- CmdManager.cc	19 Oct 2005 22:51:15 -0000	1.19
+++ CmdManager.cc	17 May 2006 02:51:45 -0000	1.20
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/CmdManager.cc,v 1.19 2005/10/19 22:51:15 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/CmdManager.cc,v 1.20 2006/05/17 02:51:45 jeremy Exp $
 #include "CmdManager.hh"
 
 #include "G4Application.hh"
@@ -12,7 +12,9 @@
   CmdManager* CmdManager::m_instance = 0;
 
   CmdManager::CmdManager()
-    : Module("CmdManager")
+    : Module("CmdManager"),
+      m_printUsage(false),
+      m_printVersion(false)
   {}
 
   CmdManager::~CmdManager()
@@ -86,6 +88,23 @@
 
 	  // find cmd by opt
 	  curr_g4_cmd = m_cmdRegistry.findG4CmdStrByOpt( curr_tok );
+
+	  // Got a print usage.
+	  if (curr_g4_cmd == "/slic/usage") {
+	    m_printUsage = true;
+	    m_cmdQueue.clear();
+	    m_cmdQueue.addCmd(curr_g4_cmd);
+	    break;
+	  }
+
+	  // Got a print version.
+	  if (curr_g4_cmd == "/slic/version" ) {
+	    m_printVersion = true;
+	    m_cmdQueue.clear();
+	    m_cmdQueue.addCmd(curr_g4_cmd);
+	    break;
+	  }
+
 	  lineOpt = m_cmdRegistry.findCmdLineOptByOpt( curr_tok );
 
 	  if ( curr_g4_cmd == std::string("") ) {
@@ -239,4 +258,14 @@
   {
     m_cmdQueue.clear();
   }
+
+  bool CmdManager::isPrintUsage() const
+  {
+    return m_printUsage;
+  }
+
+  bool CmdManager::isPrintVersion() const
+  {
+    return m_printVersion;
+  }
 }

slic/src
G4Application.cc 1.66 -> 1.67
diff -u -r1.66 -r1.67
--- G4Application.cc	8 May 2006 20:08:30 -0000	1.66
+++ G4Application.cc	17 May 2006 02:51:46 -0000	1.67
@@ -1,37 +1,39 @@
-// $Header: /cvs/lcd/slic/src/G4Application.cc,v 1.66 2006/05/08 20:08:30 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/G4Application.cc,v 1.67 2006/05/17 02:51:46 jeremy Exp $
 #include "G4Application.hh"
 
 // slic
-#include "PackageInfo.hh"
+#include "CmdManager.hh"
+#include "EventAction.hh"
+#include "EventDebugger.hh"
+#include "EventSourceManager.hh"
 #include "FieldMessenger.hh"
 #include "G4ApplicationMessenger.hh"
 #include "LcioManager.hh"
-#include "PhysicsListManager.hh"
 #include "LogManager.hh"
-#include "CmdManager.hh"
 #include "ModuleRegistry.hh"
-#include "EventSourceManager.hh"
-#include "LCDDDetectorConstruction.hh"
+#include "PackageInfo.hh"
+#include "PhysicsListManager.hh"
 #include "PrimaryGeneratorAction.hh"
-#include "EventAction.hh"
 #include "RunAction.hh"
-#include "TrackingAction.hh"
+#include "RunManager.hh"
 #include "SteppingAction.hh"
 #include "TimeUtil.hh"
-#include "EventDebugger.hh"
+#include "TrackingAction.hh"
 #include "TrajectoryManager.hh"
 
+// Makoto's mat scanner
+#include "G4MatScanMessenger.hh"
+#include "G4MaterialScanner.hh"
+
 // lcdd
+#include "LCDDDetectorConstruction.hh"
+#include "LCDDObjectStoreInspector.hh"
 #include "LCDDParser.hh"
 #include "StoreInspector.hh"
 
-#include "G4MatScanMessenger.hh"
-#include "G4MaterialScanner.hh"
-
 // geant4
-#include "G4RunManager.hh"
-#include "G4StateManager.hh"
 #include "G4ApplicationState.hh"
+#include "G4StateManager.hh"
 
 #ifndef G4UI_NONE
 #include "G4UImanager.hh"
@@ -61,70 +63,95 @@
   G4Application* G4Application::m_instance = 0 ;
 
   G4Application::G4Application(int argc, char** argv)
-    : m_runManager(0),
-      m_session(0),
+    : m_session(0),
+#ifdef G4VIS_USE
+      m_visManager(0),
+#endif
+      m_appMessenger(0),
+      m_fieldMessenger(0),
+      m_objManager(0),
+      m_cmdManager(0),
+      m_physicsManager(0),
+      m_logManager(0),
+      m_eventDebugger(0),
+      m_lcioManager(0),
+      m_trajectoryManager(0),
+      m_runManager(0),
       m_mode(G4Application::eBatch),
       m_returnCode(0),
       m_setRunAbort(false),
       m_isInitialized(false)
   {
-    /* Set the G4Application instance variable. */
+    // Set the G4Application instance variable.
     if ( 0 != m_instance ) {
       G4Exception("G4Application constructed twice.");
     }
     m_instance = this;
 
-    /* Initialize the application messenger. */
-    m_appMessenger = new G4ApplicationMessenger(this);
-
-    /* Initialize the log manager. */
-    LogManager::instance();
-
-    /* Initialize the command manager for handling command-line arguments. */
-    CmdManager::instance();
-
-    /* Initialize the event generation manager. */
-    EventSourceManager::instance();
+    // Register the map of command line options to Geant4 commands.
+    registerCmdLineOpts();
 
-    /* Setup the queue of Geant4 commands from the command-line arguments. */
+    // Setup the queue of Geant4 commands from the command-line arguments.
     setupFromCommandLine(argc, argv);
   }
 
   G4Application::~G4Application()
   {
-    /* FIXME: The ModuleManager should be handling these deletions. */
+    // FIXME: The ModuleManager should be handling these deletions.
 
 #ifdef G4VIS_USE
-    if ( sVisManager != 0 ) {
-      delete sVisManager;
+    if (m_visManager != 0) {
+      delete m_visManager;
     }
 #endif
 
-    if ( m_session != 0 ) {
+    if (m_session != 0) {
       delete m_session;
     }
 
-    delete m_runManager;
+    if (m_runManager != 0) {
+      delete m_runManager;
+    }
 
-    delete m_appMessenger;
+    if (m_appMessenger != 0) {
+      delete m_appMessenger;
+    }
 
-    delete m_fieldMessenger;
+    if (m_fieldMessenger != 0) {
+      delete m_fieldMessenger;
+    }
 
-    delete CmdManager::instance();
+    if (m_objManager != 0) {
+      delete m_objManager;
+    }
 
-    delete PhysicsListManager::instance();
+    if (m_cmdManager != 0) {
+      delete m_cmdManager;
+    }
 
-    delete LogManager::instance();
+    if (m_physicsManager != 0) {
+      delete m_physicsManager;
+    }
 
-    delete EventSourceManager::instance();
+    if (m_logManager != 0) {
+      delete m_logManager;
+    }
 
-    delete EventDebugger::instance();
+    if (m_genManager != 0) {
+      delete m_genManager;
+    }
 
-    delete LcioManager::instance();
+    if (m_eventDebugger != 0) {
+      delete m_eventDebugger;
+    }
 
-    delete TrajectoryManager::instance();
+    if (m_lcioManager != 0) {
+      delete m_lcioManager;
+    }
 
-    printEndTime(cout);
+    if (m_trajectoryManager != 0) {
+      delete m_trajectoryManager;
+    }
   }
 
   G4Application* G4Application::instance()
@@ -144,12 +171,6 @@
     m_binaryname = std::string(argv[0]);
     setBinaryBasename();
 
-    /*
-     * Register the mappings of command line options to Geant4 commands
-     * with the CmdManager.
-     */
-    registerCmdLineOpts();
-
     /* Get the command manager. */
     CmdManager* mgr = CmdManager::instance();
 
@@ -170,52 +191,64 @@
   {
     if (!m_isInitialized) {
 
+      // Initialize the application messenger.
+      m_appMessenger = new G4ApplicationMessenger(this);
+
+      // Initialize the log manager.
+      m_logManager = LogManager::instance();
+
+      // Initialize the event generation manager.
+      m_genManager = EventSourceManager::instance();
+
 #ifdef SLIC_VERBOSE
       std::cout << "SLIC verbose system is enabled." << std::endl;
 #else
       std::cout << "SLIC verbose system is disabled." << std::endl;
 #endif
 
-      /* Create a new RunManager. */
+      // Create a new RunManager.
       m_runManager = new RunManager();
 
-      /* Initialize the physics list manager. */
-      PhysicsListManager::instance();
+      // Object store manager.
+      m_objManager = new LCDDObjectStoreInspector();
 
-      /* Setup the default event source AFTER PHYSICS. */
+      // Initialize the physics list manager.
+      m_physicsManager = PhysicsListManager::instance();
+
+      // Setup the default event source AFTER PHYSICS.
       EventSourceManager::instance()->setupEventSource();
 
-      /* Print the SLIC splash screen. */
+      // Print the SLIC splash screen.
       printSplashScreen( cout );
 
-      /* Initialize the LcioManager. */
-      LcioManager::instance();
+      // Initialize the LcioManager.
+      m_lcioManager = LcioManager::instance();
 
-      /* Initialize the EventDebugger. */
-      EventDebugger::instance();
+      // Initialize the EventDebugger.
+      m_eventDebugger = EventDebugger::instance();
 
-      /* Initialize the magnetic field messenger. */
+      // Initialize the magnetic field messenger.
       m_fieldMessenger = new FieldMessenger();
 
-      /* Construct and register the UserAction classes. */
+      // Construct and register the UserAction classes.
       setupUserActions();
 
-      /* Initialize visualization. */
+      // Initialize visualization.
 #ifdef G4VIS_USE
       initializeVis();
 #endif
 
-      /* Initialize the UI. */
+      // Initialize the UI.
 #ifndef G4UI_NONE
       initializeUI();
 #endif
 
-      /* Print list of registered modules. */
+      // Print list of registered modules.
 #ifdef SLIC_VERBOSE
       ModuleRegistry::instance()->print(cout);
 #endif
 
-      /* Set state variable. */
+      // Set state variable.
       m_isInitialized = true;
     }
     else {
@@ -262,8 +295,8 @@
 #ifdef G4VIS_USE
   void G4Application::initializeVis()
   {
-    sVisManager = new VisManager();
-    sVisManager->Initialize();
+    m_visManager = new VisManager();
+    m_visManager->Initialize();
   }
 #endif
 
@@ -271,13 +304,13 @@
   {
     if ( m_runManager != 0 ) {
 
-      /* Primary generator. */
+      // Primary generator.
       m_runManager->SetUserAction(new PrimaryGeneratorAction);
 
-      /* LCDD geometry subsystem. */
+      // LCDD geometry subsystem.
       m_runManager->SetUserInitialization(new LCDDDetectorConstruction);
 
-      /* SLIC's UserAction handlers. */
+      // SLIC's UserAction handlers.
       m_runManager->SetUserAction(new RunAction);
       m_runManager->SetUserAction(new EventAction);
       m_runManager->SetUserAction(new TrackingAction);
@@ -293,11 +326,54 @@
     m_mode = rmode;
   }
 
+  const std::string& G4Application::getBinaryName() const
+  {
+    return m_binaryname;
+  }
+
+  const std::string& G4Application::getBinaryBasename() const
+  {
+    return m_binarybasename;
+  }
+
+  int G4Application::getReturnCode() const
+  {
+    return m_returnCode;
+  }
+
+  void G4Application::setReturnCode(int rc)
+  {
+    m_returnCode = rc;
+  }
+
+  void G4Application::setBinaryBasename()
+  {
+    std::string::size_type sidx = m_binaryname.find_last_of('/');
+    if (sidx != std::string::npos) {
+      m_binarybasename = std::string(m_binaryname, sidx + 1);
+    }
+  }
+
   G4Application::ERunMode G4Application::getMode() const
   {
     return m_mode;
   }
 
+  void G4Application::setAborting(bool a)
+  {
+    if (a) {
+      // FIXME: Does this actually do anything to current G4Event?
+      G4RunManager::GetRunManager()->AbortRun(false);
+    }
+
+    m_setRunAbort = a;
+  }
+
+  bool G4Application::isAborting() const
+  {
+    return m_setRunAbort;
+  }
+
   RunManager* G4Application::getRunManager()
   {
     return m_runManager;
@@ -305,31 +381,42 @@
 
   void G4Application::run()
   {
-    if (!m_isInitialized) {
-      initialize();
-    }
-    cout << endl;
+    // Get the command manager.
+    CmdManager* cmgr = CmdManager::instance();
 
-    /* Execute the current queue of Geant4 commands. */
-    CmdManager::instance()->execCurrG4CmdQueue(true);
+    // Print usage was selected.
+    if (cmgr->isPrintUsage()) {
+      printUsage(std::cout);
+    }
 
-    /* Start the UI session if in interactive mode. */
-#ifndef G4UI_NONE
-    if ( getMode() == eInteractive ) {
-      m_session->SessionStart();
+    // Print version was selected.
+    if (cmgr->isPrintVersion()) {
+      printVersion(std::cout);
     }
-#endif
 
-    /* Set the application return code. */
-    setReturnCode(0);
-  }
+    // Run the simulator if not print usage or version.
+    if ((!cmgr->isPrintUsage()) && (!cmgr->isPrintVersion())) {
 
-  G4ApplicationState G4Application::getG4ApplicationState()
-  {
-    return G4StateManager::GetStateManager()->GetCurrentState();
+      // Initialize.
+      if (!m_isInitialized) {
+	initialize();
+      }
+
+      cout << endl;
+
+      // Execute the queue of Geant4 commands built from command-line arguments.
+      cmgr->execCurrG4CmdQueue(true);
+
+      // Start the UI session if in interactive mode.
+#ifndef G4UI_NONE
+      if ( getMode() == eInteractive ) {
+	m_session->SessionStart();
+      }
+#endif
+    }
   }
 
-  void G4Application::printOutUsage(std::ostream& os)
+  void G4Application::printUsage(std::ostream& os)
   {
     os << std::endl;
     os << "**************" << std::endl;
@@ -356,6 +443,11 @@
     os << std::endl;
   }
 
+  void G4Application::printVersion(std::ostream& os)
+  {
+    os << std::endl << PackageInfo::getFullApplicationString() << std::endl << std::endl;
+  }
+
   void G4Application::printSplashScreen(std::ostream& os) const
   {
     // splash screen
@@ -371,18 +463,6 @@
     os << endl;
   }
 
-  // print startup time
-  void G4Application::printStartTime(std::ostream& os)
-  {
-    os << "Start Time <" << TimeUtil::getAscTime() << ">" << endl;
-  }
-
-  // print end time
-  void G4Application::printEndTime(std::ostream& os)
-  {
-    os << "End Time <" << TimeUtil::getAscTime() << ">" << endl;
-  }
-
   void G4Application::registerCmdLineOpts()
   {
     CmdManager* cmd_mgr = CmdManager::instance();

slic/src
G4ApplicationMessenger.cc 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- G4ApplicationMessenger.cc	9 Dec 2005 01:58:34 -0000	1.11
+++ G4ApplicationMessenger.cc	17 May 2006 02:51:46 -0000	1.12
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/G4ApplicationMessenger.cc,v 1.11 2005/12/09 01:58:34 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/G4ApplicationMessenger.cc,v 1.12 2006/05/17 02:51:46 jeremy Exp $
 #include "G4ApplicationMessenger.hh"
 
 // slic
@@ -19,14 +19,14 @@
 
   void G4ApplicationMessenger::SetNewValue(G4UIcommand* cmd, G4String)
   {
-    if ( cmd == m_interactive ) {
+    if (cmd == m_interactive) {
       m_app->setMode(G4Application::eInteractive);
     }
-    else if ( cmd == m_slicVersion ) {
-      std::cout << std::endl << PackageInfo::getFullApplicationString() << std::endl << std::endl;
+    else if (cmd == m_slicVersion) {
+      m_app->printVersion(std::cout);
     }
-    else if ( cmd == m_slicUsage ) {
-      m_app->printOutUsage( std::cout );
+    else if (cmd == m_slicUsage) {
+      m_app->printUsage(std::cout);
     }
     else {
       std::cerr << "Unknown command to G4ApplicationMessenger." << std::endl;

slic/src
LcioFileNamer.cc 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- LcioFileNamer.cc	10 Apr 2006 21:05:07 -0000	1.13
+++ LcioFileNamer.cc	17 May 2006 02:51:46 -0000	1.14
@@ -1,19 +1,21 @@
-// $Header: /cvs/lcd/slic/src/LcioFileNamer.cc,v 1.13 2006/04/10 21:05:07 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioFileNamer.cc,v 1.14 2006/05/17 02:51:46 jeremy Exp $
 #include "LcioFileNamer.hh"
 
 // lcdd
-#include "StringUtil.hh"
 #include "FileUtil.hh"
 #include "LCDDProcessor.hh"
+#include "StringUtil.hh"
 
 // slic
+#include "EventSourceManager.hh"
 #include "G4Application.hh"
 #include "PackageInfo.hh"
-#include "EventSourceManager.hh"
+#include "RunManager.hh"
 #include "TimeUtil.hh"
 
 // geant4
 #include "G4Run.hh"
+#include "G4RunManager.hh"
 
 using std::endl;
 using std::cout;

slic/src
LcioManager.cc 1.67 -> 1.68
diff -u -r1.67 -r1.68
--- LcioManager.cc	19 Oct 2005 22:51:16 -0000	1.67
+++ LcioManager.cc	17 May 2006 02:51:46 -0000	1.68
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioManager.cc,v 1.67 2005/10/19 22:51:16 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioManager.cc,v 1.68 2006/05/17 02:51:46 jeremy Exp $
 #include "LcioManager.hh"
 
 // slic
@@ -13,24 +13,25 @@
 #include "lStdHep.hh"
 
 // lcdd
-#include "LCDDProcessor.hh"
 #include "G4CalorimeterHit.hh"
 #include "G4TrackerHit.hh"
+#include "LCDDProcessor.hh"
 #include "StringUtil.hh"
 
 // lcio
 #include "EVENT/LCIO.h"
+#include "IMPL/LCCollectionVec.h"
 #include "IOIMPL/LCFactory.h"
 #include "IO/LCWriter.h"
-#include "IMPL/LCCollectionVec.h"
 #include "UTIL/LCTOOLS.h"
 
 // geant4
+#include "G4EventManager.hh"
 #include "G4Run.hh"
+#include "G4RunManager.hh"
+#include "G4TrajectoryContainer.hh"
 #include "G4VHitsCollection.hh"
 #include "G4SDManager.hh"
-#include "G4TrajectoryContainer.hh"
-#include "G4EventManager.hh"
 
 // std
 #include <ctime>
@@ -227,10 +228,10 @@
     // create new LCRunHeader
     createRunHeader( aRun );
 
-    /* 
-     * Make autoname from stored fields.  
+    /*
+     * Make autoname from stored fields.
      * Needs to be delayed until this point
-     * so that run and event IDs are correct. 
+     * so that run and event IDs are correct.
      */
     if ( m_usingAutoname ) {
       makeAutoname();

slic/src
LogMessenger.cc 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- LogMessenger.cc	9 Dec 2005 01:58:34 -0000	1.7
+++ LogMessenger.cc	17 May 2006 02:51:46 -0000	1.8
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LogMessenger.cc,v 1.7 2005/12/09 01:58:34 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LogMessenger.cc,v 1.8 2006/05/17 02:51:46 jeremy Exp $
 #include "LogMessenger.hh"
 
 // slic
@@ -6,6 +6,9 @@
 #include "G4Application.hh"
 #include "TimeUtil.hh"
 
+// geant4
+#include "G4RunManagerKernel.hh"
+
 namespace slic
 {
 

slic/src
TimeUtil.cc 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- TimeUtil.cc	19 Oct 2005 22:51:18 -0000	1.7
+++ TimeUtil.cc	17 May 2006 02:51:46 -0000	1.8
@@ -1,9 +1,12 @@
-// $Header: /cvs/lcd/slic/src/TimeUtil.cc,v 1.7 2005/10/19 22:51:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/TimeUtil.cc,v 1.8 2006/05/17 02:51:46 jeremy Exp $
 #include "TimeUtil.hh"
 
 // std
 #include <ctime>
 #include <cstdio>
+#include <iostream>
+
+using std::endl;
 
 namespace slic
 {
@@ -42,4 +45,14 @@
 
     return timeinfo;
   }
+
+  void TimeUtil::printStartTime(std::ostream& os)
+  {
+    os << "Start Time <" << TimeUtil::getAscTime() << ">" << endl;
+  }
+
+  void TimeUtil::printEndTime(std::ostream& os)
+  {
+    os << "End Time <" << TimeUtil::getAscTime() << ">" << endl;
+  }
 }
CVSspam 0.2.8