00001 // $Header: /cvs/lcd/slic/src/RunManager.cc,v 1.16 2007/04/27 01:54:35 jeremy Exp $ 00002 #include "RunManager.hh" 00003 00004 // lcdd 00005 #include "LCDDParser.hh" 00006 #include "LCDDProcessor.hh" 00007 00008 // slic 00009 #include "PhysicsListManager.hh" 00010 00011 // geant4 00012 #include "G4StateManager.hh" 00013 #include "G4UImanager.hh" 00014 00015 namespace slic 00016 { 00017 00018 RunManager::RunManager() : 00019 Module("RunManager", false) 00020 {} 00021 00022 RunManager::~RunManager() 00023 {} 00024 00025 void RunManager::InitializePhysics() 00026 { 00027 /* Initialize the physics list in SLIC. */ 00028 PhysicsListManager::instance()->initializePhysicsList(); 00029 00030 /* Call G4RunManager's init function to setup physics. */ 00031 G4RunManager::InitializePhysics(); 00032 00033 /* Check if the LCDD subsystem got some limits from the input file. */ 00034 LCDDProcessor* lcdd = LCDDProcessor::instance(); 00035 PhysicsListManager* pmgr = PhysicsListManager::instance(); 00036 if ( lcdd->getLimitSetsBegin() != lcdd->getLimitSetsEnd() ) { 00037 pmgr->enableLimits(true); 00038 } 00039 /* enable physics limits, if necessary */ 00040 if ( pmgr->enableLimits() ) { 00041 pmgr->setupUserLimitsProcesses(); 00042 } 00043 } 00044 00045 // called before InitializePhysics() 00046 void RunManager::InitializeGeometry() 00047 { 00048 if ( !LCDDParser::instance()->isValidSetup() ) { 00049 G4Exception("FATAL ERROR: Current LCDD geometry setup is not valid."); 00050 } 00051 00052 G4RunManager::InitializeGeometry(); 00053 } 00054 00055 void RunManager::BeamOn(G4int n_event, const char* macroFile, G4int n_select) 00056 { 00057 /* Attempt to initialize Geant4 if not in idle state. */ 00058 if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_Idle ) { 00059 this->Initialize(); 00060 } 00061 00062 m_numberOfEventsToRun = n_event; 00063 00064 G4RunManager::BeamOn(n_event, macroFile, n_select); 00065 } 00066 00067 int RunManager::getNumberOfEventsToRun() 00068 { 00069 return m_numberOfEventsToRun; 00070 } 00071 }
1.5.4