66 using namespace CLHEP;
 
   75 #ifdef theParticleIterator 
   76 #undef theParticleIterator 
   80 { 
return fRunManager; }
 
   83 :userDetector(0),physicsList(0),
 
   84  userActionInitialization(0),userWorkerInitialization(0),
 
   85  userWorkerThreadInitialization(0),
 
   86  userRunAction(0),userPrimaryGeneratorAction(0),userEventAction(0),
 
   87  userStackingAction(0),userTrackingAction(0),userSteppingAction(0),
 
   88  geometryInitialized(false),physicsInitialized(false),
 
   89  runAborted(false),initializedAtLeastOnce(false),
 
   90  geometryToBeOptimized(true),runIDCounter(0),
 
   91  verboseLevel(0),printModulo(-1),DCtable(0),
 
   92  currentRun(0),currentEvent(0),n_perviousEventsToBeStored(0),
 
   93  numberOfEventToBeProcessed(0),storeRandomNumberStatus(false),
 
   94  storeRandomNumberStatusToG4Event(0),rngStatusEventsFlag(false),
 
   95  currentWorld(0),nParallelWorlds(0),msgText(
" "),n_select_msg(-1),
 
   96  numberOfEventProcessed(0),selectMacro(
""),fakeRun(false)
 
  100     G4Exception(
"G4RunManager::G4RunManager()", 
"Run0031",
 
  114   std::ostringstream oss;
 
  115   G4Random::saveFullState(oss);
 
  122 :userDetector(0),physicsList(0),
 
  123  userActionInitialization(0),userWorkerInitialization(0),
 
  124  userWorkerThreadInitialization(0),
 
  125  userRunAction(0),userPrimaryGeneratorAction(0),userEventAction(0),
 
  126  userStackingAction(0),userTrackingAction(0),userSteppingAction(0),
 
  127  geometryInitialized(false),physicsInitialized(false),
 
  128  runAborted(false),initializedAtLeastOnce(false),
 
  129  geometryToBeOptimized(true),runIDCounter(0),
 
  130  verboseLevel(0),printModulo(-1),DCtable(0),
 
  131  currentRun(0),currentEvent(0),n_perviousEventsToBeStored(0),
 
  132  numberOfEventToBeProcessed(0),storeRandomNumberStatus(false),
 
  133  storeRandomNumberStatusToG4Event(0),rngStatusEventsFlag(false),
 
  134  currentWorld(0),nParallelWorlds(0),msgText(
" "),n_select_msg(-1),
 
  135  numberOfEventProcessed(0),selectMacro(
""),fakeRun(false)
 
  138 #ifndef G4MULTITHREADED 
  140   msg<<
"Geant4 code is compiled without multi-threading support (-DG4MULTITHREADED is set to off).";
 
  141   msg<<
" This type of RunManager can only be used in mult-threaded applications.";
 
  147     G4Exception(
"G4RunManager::G4RunManager()", 
"Run0031",
 
  163     msgx<<
" This type of RunManager can only be used in mult-threaded applications.";
 
  177   std::ostringstream oss;
 
  178   G4Random::saveFullState(oss);
 
  264   if(n_event<=0) { 
fakeRun = 
true; }
 
  286     G4cerr << 
"Illegal application state - BeamOn() ignored." << 
G4endl;
 
  292     G4cerr << 
" Geant4 kernel should be initialized" << 
G4endl;
 
  293     G4cerr << 
"before the first BeamOn(). - BeamOn ignored." << 
G4endl;
 
  304       G4cout << 
"has been modified since last Run." << 
G4endl;
 
  337   std::ostringstream oss;
 
  338     G4Random::saveFullState(oss);
 
  352           std::ostringstream os;
 
  365   for(
G4int i_event=0; i_event<n_event; i_event++ )
 
  434                 "G4VUserPrimaryGeneratorAction is not defined!");
 
  442     std::ostringstream oss;
 
  443     G4Random::saveFullState(oss);
 
  451           std::ostringstream os;
 
  467     G4Random::saveEngineStatus(fileN);
 
  473   if(fPersM) fPersM->
Store(anEvent);
 
  505     if(evt && !(evt->
ToBeKept())) 
delete evt;
 
  546     { 
if(!(anEvent->
ToBeKept())) 
delete anEvent; }
 
  560     G4cerr << 
"Illegal application state - " 
  561            << 
"G4RunManager::Initialize() ignored." << 
G4endl;
 
  574     G4Exception(
"G4RunManager::InitializeGeometry", 
"Run0033",
 
  597     G4Exception(
"G4RunManager::InitializePhysics()", 
"Run0034",
 
  620     G4cerr << 
"Run is not in progress. AbortRun() ignored." << 
G4endl;
 
  636     G4cerr << 
"Event is not in progress. AbortEevnt() ignored." << 
G4endl;
 
  651      G4cerr << 
"Warning from G4RunManager::rndmSaveThisRun():" 
  652           << 
" Random number status was not stored prior to this run."  
  659   std::ostringstream os;
 
  660   os << 
"run" << runNumber << 
".rndm" << 
'\0';
 
  663   G4String copCmd = 
"/control/shell cp "+fileIn+
" "+fileOut;
 
  671      G4cerr << 
"Warning from G4RunManager::rndmSaveThisEvent():" 
  672           << 
" there is no currentEvent or its RandomEngineStatus is not available." 
  679   std::ostringstream os;
 
  684   G4String copCmd = 
"/control/shell cp "+fileIn+
" "+fileOut;
 
  692   if(fileN.
index(
"/")==std::string::npos)
 
  695   { fileNameWithDirectory = fileN; }
 
  697   G4Random::restoreEngineStatus(fileNameWithDirectory);
 
  699          << fileNameWithDirectory << 
G4endl;
 
  700   G4Random::showEngineStatus();
 
  720 #include "G4HCofThisEvent.hh" 
  721 #include "G4VHitsCollection.hh" 
  736   for(
G4int iw=0;iw<nPar;iw++)
 
  752       if(theParallelWorldProcess)
 
  760         theParticleIterator->
reset();
 
  761         while( (*theParticleIterator)() ){
 
  766             pmanager->
AddProcess(theParallelWorldProcess);
 
  792   for(
G4int i=0;i<nColl;i++)
 
  814   { localtimer.
Start(); }
 
  826     G4cout << 
" heads : " << stat.GetNumberHeads() << 
" - nodes : " 
  827            << stat.GetNumberNodes() << 
" - pointers : "  
  828            << stat.GetNumberPointers() << 
G4endl;
 
  829     G4cout << 
" Memory used : " << (stat.GetMemoryUse()+512)/1024
 
  830            << 
"k - total time : " << stat.GetTotalTime()
 
  831            << 
" - system time : " << stat.GetSysTime() << 
G4endl;
 
  847     "Base-class G4RunManager cannot take G4UserWorkerInitialization. Use G4MTRunManager.");
 
  853     "Base-class G4RunManager cannot take G4UserWorkerThreadInitialization. Use G4MTRunManager.");
 
  912       G4cout<<
"#### G4PhysicalVolumeStore, G4LogicalVolumeStore and G4SolidStore\n" 
  913             <<
"#### are wiped out."<<
G4endl; 
 
  923     std::vector<G4Region*>::iterator rItr;
 
  924     for(rItr = regionStore->begin();rItr != regionStore->end(); rItr++)
 
  926       if((*rItr)->GetName()==
"DefaultRegionForTheWorld") 
continue;
 
  928       std::vector<G4LogicalVolume*>::iterator lvItr
 
  929         = (*rItr)->GetRootLogicalVolumeIterator();
 
  930       for(
size_t iRLV = 0;iRLV < (*rItr)->GetNumberOfRootVolumes(); iRLV++)
 
  932         (*rItr)->RemoveRootLogicalVolume(*lvItr,
false);
 
  936       { 
G4cout<<
"#### Region <"<<(*rItr)->GetName()<<
"> is cleared."<<
G4endl; }
 
virtual G4VPhysicalVolume * Construct()=0
 
void GeometryHasBeenModified(G4bool prop=true)
 
void SetNumberOfEventToBeProcessed(G4int n_ev)
 
G4VPhysicalVolume * IsWorldExisting(const G4String &worldName)
 
virtual void AbortRun(G4bool softAbort=false)
 
G4int numberOfEventToBeProcessed
 
virtual void ProcessOneEvent(G4int i_event)
 
virtual void TerminateEventLoop()
 
void SetDCtable(G4DCtable *DCtbl)
 
G4SmartVoxelHeader * GetVoxelHeader() const 
 
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
 
G4double GetSystemElapsed() const 
 
void SetPhysics(G4VUserPhysicsList *uPhys)
 
void SetParallelWorldProcess(G4ParallelWorldProcess *proc)
 
G4int numberOfEventProcessed
 
G4UserTrackingAction * userTrackingAction
 
G4VHitsCollection * GetHC(G4int i)
 
G4String GetWorldName(G4int i) const 
 
G4String randomNumberStatusForThisRun
 
virtual void RunTermination()
 
std::ostringstream G4ExceptionDescription
 
G4VUserPhysicsList * physicsList
 
G4String randomNumberStatusForThisEvent
 
static G4bool fGeometryHasBeenDestroyed
 
void GeometryHasBeenDestroyed()
 
G4EventManager * GetEventManager() const 
 
void SetNumberOfParallelWorld(G4int i)
 
void SetProcessOrderingToSecond(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
 
G4UImessenger * CreateMessenger()
 
G4VUserActionInitialization * userActionInitialization
 
G4bool storeRandomNumberStatus
 
G4bool IsAtRestRequired(G4ParticleDefinition *)
 
G4int GetNumberOfGrips() const 
 
G4UImessenger * CreateMessenger()
 
virtual void RunInitialization()
 
G4UserWorkerThreadInitialization * userWorkerThreadInitialization
 
void ConstructParallelSD()
 
void CleanUpUnnecessaryEvents(G4int keepNEvents)
 
virtual void EndOfRunAction(const G4Run *aRun)
 
G4bool physicsInitialized
 
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
 
void SetName(const G4String &pName)
 
virtual void InitializePhysics()
 
void ReOptimize(G4LogicalVolume *)
 
G4ProcessManager * GetProcessManager() const 
 
virtual G4bool Store(const G4Event *anEvent)=0
 
void Construct(G4VPhysicalVolume *fWorldPhys)
 
G4bool RunInitialization(G4bool fakeRun=false)
 
virtual void InitializeGeometry()
 
void SetVoxelHeader(G4SmartVoxelHeader *pVoxel)
 
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
 
virtual G4bool ConfirmBeamOnCondition()
 
static G4UImanager * GetUIpointer()
 
static G4ParallelWorldProcessStore * GetInstance()
 
virtual void RestoreRandomNumberStatus(const G4String &fileN)
 
static G4PhysicalVolumeStore * GetInstance()
 
G4bool geometryInitialized
 
static G4RegionStore * GetInstance()
 
G4HCtable * GetHCtable() const 
 
G4VUserPrimaryGeneratorAction * userPrimaryGeneratorAction
 
G4bool initializedAtLeastOnce
 
static G4StateManager * GetStateManager()
 
virtual void rndmSaveThisRun()
 
void SetParallelWorld(G4String parallelWorldName)
 
virtual G4Event * GenerateEvent(G4int i_event)
 
static G4bool IfGeometryHasBeenDestroyed()
 
G4GLOB_DLL std::ostream G4cout
 
G4bool SetNewState(G4ApplicationState requestedState)
 
str_size index(const char *, G4int pos=0) const 
 
void reset(G4bool ifSkipIon=true)
 
static G4ScoringManager * GetScoringManagerIfExist()
 
G4UserWorkerInitialization * userWorkerInitialization
 
void DumpRegion(const G4String &rname) const 
 
G4String randomNumberStatusDir
 
G4bool rngStatusEventsFlag
 
virtual void ConstructScoringWorlds()
 
virtual void AnalyzeEvent(G4Event *anEvent)
 
G4double GetUserElapsed() const 
 
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
 
G4int storeRandomNumberStatusToG4Event
 
G4UserEventAction * userEventAction
 
virtual void rndmSaveThisEvent()
 
virtual void Build() const =0
 
static G4LogicalVolumeStore * GetInstance()
 
void Accumulate(G4VHitsCollection *map)
 
static G4SolidStore * GetInstance()
 
virtual void DeleteUserInitializations()
 
G4ApplicationState GetCurrentState() const 
 
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
 
static G4GeometryManager * GetInstance()
 
G4LogicalVolume * GetMotherLogical() const 
 
std::list< G4Event * > * previousEvents
 
G4UserRunAction * userRunAction
 
void ReinitializeGeometry(G4bool destroyFirst=false, G4bool prop=true)
 
void SetHCtable(G4HCtable *HCtbl)
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
void SetRandomNumberStatus(G4String &st)
 
G4int ConstructParallelGeometries()
 
static G4TransportationManager * GetTransportationManager()
 
static G4RunManager * GetRunManager()
 
void ClearParallelWorlds()
 
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
 
virtual void ConstructSDandField()
 
virtual void GeneratePrimaries(G4Event *anEvent)=0
 
static G4ParticleTable * GetParticleTable()
 
virtual void DoEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
 
void CleanUpPreviousEvents()
 
void SetUserAction(G4UserEventAction *userAction)
 
void ReOptimizeMotherOf(G4VPhysicalVolume *)
 
virtual void InitializeEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
 
virtual void StoreRNGStatus(const G4String &filenamePrefix)
 
void StoreEvent(G4Event *evt)
 
virtual void RecordEvent(const G4Event *)
 
G4ParallelWorldProcess * GetParallelWorldProcess() const 
 
virtual void BeginOfRunAction(const G4Run *aRun)
 
virtual void Initialize()
 
void StackPreviousEvent(G4Event *anEvent)
 
void GeometryHasBeenModified()
 
void OpenGeometry(G4VPhysicalVolume *vol=0)
 
void ProcessOneEvent(G4Event *anEvent)
 
virtual void AbortEvent()
 
G4RunManagerKernel * kernel
 
G4HCofThisEvent * GetHCofThisEvent() const 
 
size_t GetNumberOfMesh() const 
 
G4EventManager * eventManager
 
virtual void TerminateOneEvent()
 
G4VUserDetectorConstruction * userDetector
 
G4UserSteppingAction * userSteppingAction
 
G4VScoringMesh * GetMesh(G4int i) const 
 
void SetRandomNumberStatus(G4String &st)
 
G4RunMessenger * runMessenger
 
virtual G4Run * GenerateRun()
 
static G4ProcessTable * GetProcessTable()
 
G4PTblDicIterator * GetIterator() const 
 
void DumpRegion(const G4String &rname) const 
 
G4int n_perviousEventsToBeStored
 
#define theParticleIterator
 
G4int ApplyCommand(const char *aCommand)
 
static G4ThreadLocal G4RunManager * fRunManager
 
G4GLOB_DLL std::ostream G4cerr
 
void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
 
G4UserStackingAction * userStackingAction
 
virtual void SetUserAction(G4UserRunAction *userAction)
 
static G4VPersistencyManager * GetPersistencyManager()
 
static G4SDManager * GetSDMpointerIfExist()