Commit in slic on MAIN
include/G4Application.hh+19-161.27 -> 1.28
src/G4Application.cc+22-11.41 -> 1.42
   /RunManager.cc+2-21.5 -> 1.6
+43-19
3 modified files
G4Application will now automatically attempt simulator initialization if geometry URI is set.

slic/include
G4Application.hh 1.27 -> 1.28
diff -u -r1.27 -r1.28
--- G4Application.hh	27 Jun 2005 19:17:36 -0000	1.27
+++ G4Application.hh	6 Sep 2005 17:25:49 -0000	1.28
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/G4Application.hh,v 1.27 2005/06/27 19:17:36 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/G4Application.hh,v 1.28 2005/09/06 17:25:49 jeremy Exp $
 #ifndef slic_G4Application_hh
 #define slic_G4Application_hh 1
 
@@ -8,6 +8,7 @@
 #include "StringUtil.hh"
 
 // G4
+#include "G4ApplicationState.hh"
 #ifdef G4VIS_USE
 #include "VisManager.hh"
 #endif
@@ -27,8 +28,8 @@
    * @class G4Application
    * @brief Singleton class for an extendable Geant4 application.
    * @note  Instantiates a number of global static manager classes,
-   *        including user actions, G4RunManager, CmdManager, and 
-   *        GeneratorManager and PhysicsListManager.   
+   *        including user actions, G4RunManager, CmdManager, and
+   *        GeneratorManager and PhysicsListManager.
    */
   class G4Application
   {
@@ -50,7 +51,7 @@
     // initialize the application
     virtual void initialize();
 
-    // run the application 
+    // run the application
     virtual void run();
 
     // virtuals for specific app
@@ -63,7 +64,7 @@
 
     virtual void printOutUsage(std::ostream& os);
 
-    virtual void printOutMacroCommands(std::ostream& os) 
+    virtual void printOutMacroCommands(std::ostream& os)
     {
       os << "Control:" << std::endl;
       os << "/control/interactive" << std::endl;
@@ -74,17 +75,17 @@
     }
 
     // application ID strings to be overridden in user app
-    virtual const std::string& getVersionString() const 
+    virtual const std::string& getVersionString() const
     {
       return StringUtil::NULL_STR;
     }
-    
-    virtual const std::string& getAuthorString() const 
+
+    virtual const std::string& getAuthorString() const
     {
       return StringUtil::NULL_STR;
     }
 
-    virtual const std::string& getNameString() const 
+    virtual const std::string& getNameString() const
     {
       return StringUtil::NULL_STR;
     }
@@ -94,23 +95,23 @@
       return StringUtil::NULL_STR;
     }
 
-    virtual const std::string& getInstitutionString() const 
+    virtual const std::string& getInstitutionString() const
     {
       return StringUtil::NULL_STR;
     }
 
     // app should return CVS Date keyword
-    virtual const std::string& getChangeDateString() const 
+    virtual const std::string& getChangeDateString() const
     {
       return StringUtil::NULL_STR;
     }
 
-    virtual const std::string& getWWW() const 
+    virtual const std::string& getWWW() const
     {
       return StringUtil::NULL_STR;
     }
 
-    virtual const std::string& getEmail() const 
+    virtual const std::string& getEmail() const
     {
       return StringUtil::NULL_STR;
     }
@@ -129,6 +130,8 @@
       m_returnCode = rc;
     }
 
+    static G4ApplicationState getG4ApplicationState();
+
   public:
 
     RunManager* getRunManager();
@@ -161,7 +164,7 @@
       return m_setRunAbort;
     }
 
-    // print startup time 
+    // print startup time
     static void printStartTime(std::ostream& os);
 
     // print end time
@@ -171,7 +174,7 @@
 
     // instance
     static G4Application* m_instance;
-  
+
     // g4 run manager
     RunManager* m_runManager;
 
@@ -190,7 +193,7 @@
     ERunMode m_mode;
 
     // return code
-    ReturnCodeType m_returnCode;    
+    ReturnCodeType m_returnCode;
 
     // hack to make aborting G4 work (doesn't seem to function properly)
     bool m_setRunAbort;

slic/src
G4Application.cc 1.41 -> 1.42
diff -u -r1.41 -r1.42
--- G4Application.cc	3 Aug 2005 23:17:11 -0000	1.41
+++ G4Application.cc	6 Sep 2005 17:25:49 -0000	1.42
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/G4Application.cc,v 1.41 2005/08/03 23:17:11 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/G4Application.cc,v 1.42 2005/09/06 17:25:49 jeremy Exp $
 #include "G4Application.hh"
 
 // SLIC
@@ -21,7 +21,14 @@
 #include "TrackingAction.hh"
 #include "SteppingAction.hh"
 
+// LCDD
+#include "LCDDParser.hh"
+
 // G4
+#include "G4RunManager.hh"
+#include "G4StateManager.hh"
+#include "G4ApplicationState.hh"
+
 #ifndef G4UI_NONE
 #include "G4UImanager.hh"
 #include "G4UIterminal.hh"
@@ -255,6 +262,15 @@
     CmdManager::instance()->getG4CmdQueue()->printOut(std::cout);
     CmdManager::instance()->execCurrG4CmdQueue(true);
 
+    /* If geometry is set, then attempt automatic simulator initialization. */
+    G4ApplicationState state = getG4ApplicationState();
+    if ( state==G4State_PreInit ) {
+      LCDDParser* parser = LCDDParser::instance();
+      if ( parser->isValidSetup() ) {
+	G4RunManager::GetRunManager()->Initialize();
+      }
+    }
+
     // init UI and start session if interactive mode and not G4UI_NONE
 #ifndef G4UI_NONE
     if ( getMode() == eInteractive ) {
@@ -266,6 +282,11 @@
     setReturnCode(0);
   }
 
+  G4ApplicationState G4Application::getG4ApplicationState()
+  {
+    return G4StateManager::GetStateManager()->GetCurrentState();
+  }
+
   void G4Application::printOutUsage(std::ostream& os)
   {
     CmdManager::instance()->getCmdRegistry()->printOut( os );

slic/src
RunManager.cc 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- RunManager.cc	27 Jun 2005 18:20:50 -0000	1.5
+++ RunManager.cc	6 Sep 2005 17:25:49 -0000	1.6
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/RunManager.cc,v 1.5 2005/06/27 18:20:50 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/RunManager.cc,v 1.6 2005/09/06 17:25:49 jeremy Exp $
 #include "RunManager.hh"
 
 // LCDD
@@ -29,7 +29,7 @@
 
   void RunManager::InitializeGeometry()
   {
-    if ( !LCDDParser::instance()->isValid() ) {
+    if ( !LCDDParser::instance()->isValidSetup() ) {
       G4Exception("FATAL ERROR: Current LCDD geometry setup is not valid.");
     }
 
CVSspam 0.2.8