00001 // $Header: /cvs/lcd/slic/include/SlicApplication.hh,v 1.36 2010/01/08 23:18:56 jeremy Exp $ 00002 00003 #ifndef SLIC_SLICAPPLICATION_HH 00004 #define SLIC_SLICAPPLICATION_HH 1 00005 00006 // slic 00007 #include "Singleton.hh" 00008 #include "Module.hh" 00009 00010 // geant4 00011 #ifdef G4VIS_USE 00012 #include "VisManager.hh" 00013 #endif 00014 #include "G4UIsession.hh" 00015 #include "G4ApplicationState.hh" 00016 00017 // std 00018 #include <cstdlib> 00019 00020 // geant4 00021 class G4RunManager; 00022 00023 namespace slic 00024 { 00025 // slic 00026 class FieldMessenger; 00027 class SlicApplicationMessenger; 00028 class RunManager; 00029 00036 class SlicApplication : public Singleton<SlicApplication>, public Module 00037 { 00038 00039 public: 00040 00044 enum ERunMode { eBatch=1, eInteractive=2 }; 00045 00046 public: 00047 00051 SlicApplication(); 00052 00056 virtual ~SlicApplication(); 00057 00058 public: 00059 00063 RunManager* getRunManager(); 00064 00068 void initialize(); 00069 00073 void run(); 00074 00078 void printUsage(); 00079 00083 void printVersion(); 00084 00088 void printSplashScreen(); 00089 00093 void printStartTime(); 00094 00098 void printEndTime(); 00099 00103 int getReturnCode() const; 00104 00108 ERunMode getMode() const; 00109 00113 void setAborting(bool a = true); 00114 00118 bool isAborting() const; 00119 00123 void setMode(ERunMode rmode); 00124 00128 const std::string& getBinaryName() const; 00129 00133 const std::string& getBinaryBasename() const; 00134 00138 void initialize(int, char**); 00139 00143 void setReturnCode(int rc); 00144 00148 std::string getGeant4VersionString(); 00149 00150 private: 00151 00155 void setBinaryBasename(); 00156 00160 void initializeUserActions(); 00161 00165 void initializeLCDD(); 00166 00170 void initializeNistWriter(); 00171 00175 //void initializePrimaryGeneratorAction(); 00176 00180 void initializeUI(); 00181 00185 #ifdef G4VIS_USE 00186 void initializeVis(); 00187 #endif 00188 00189 protected: 00190 00191 // UI session 00192 G4UIsession* m_session; 00193 00194 // vis manager 00195 #ifdef G4VIS_USE 00196 VisManager* m_visManager; 00197 #endif 00198 00199 // app messenger 00200 SlicApplicationMessenger* m_appMessenger; 00201 00202 // field messenger 00203 FieldMessenger* m_fieldMessenger; 00204 00205 RunManager* m_runManager; 00206 00207 // application run mode: batch or interactive 00208 ERunMode m_mode; 00209 00210 // return code 00211 int m_returnCode; 00212 00213 // hack to make aborting G4 work (doesn't seem to function properly) 00214 bool m_setRunAbort; 00215 00216 // Has the initialize() function been called? 00217 bool m_isInitialized; 00218 00219 // What was the name of the SLIC binary from CL? (used by LcioFileNamer) 00220 std::string m_binaryname; 00221 std::string m_binarybasename; 00222 00223 // Version string of Geant4. 00224 std::string* m_geant4VersionString; 00225 }; 00226 } 00227 00228 #endif
1.5.4