67 using namespace CLHEP;
76 #ifdef theParticleIterator
77 #undef theParticleIterator
81 {
return fRunManager; }
84 :userDetector(0),physicsList(0),
85 userActionInitialization(0),userWorkerInitialization(0),
86 userWorkerThreadInitialization(0),
87 userRunAction(0),userPrimaryGeneratorAction(0),userEventAction(0),
88 userStackingAction(0),userTrackingAction(0),userSteppingAction(0),
89 geometryInitialized(
false),physicsInitialized(
false),
90 runAborted(
false),initializedAtLeastOnce(
false),
91 geometryToBeOptimized(
true),runIDCounter(0),
92 verboseLevel(0),printModulo(-1),DCtable(0),
93 currentRun(0),currentEvent(0),n_perviousEventsToBeStored(0),
94 numberOfEventToBeProcessed(0),storeRandomNumberStatus(
false),
95 storeRandomNumberStatusToG4Event(0),rngStatusEventsFlag(
false),
96 currentWorld(0),nParallelWorlds(0),msgText(
" "),n_select_msg(-1),
97 numberOfEventProcessed(0),selectMacro(
""),fakeRun(
false),
98 isScoreNtupleWriter(
false),geometryDirectlyUpdated(
false)
102 G4Exception(
"G4RunManager::G4RunManager()",
"Run0031",
116 std::ostringstream oss;
117 G4Random::saveFullState(oss);
124 :userDetector(0),physicsList(0),
125 userActionInitialization(0),userWorkerInitialization(0),
126 userWorkerThreadInitialization(0),
127 userRunAction(0),userPrimaryGeneratorAction(0),userEventAction(0),
128 userStackingAction(0),userTrackingAction(0),userSteppingAction(0),
129 geometryInitialized(
false),physicsInitialized(
false),
130 runAborted(
false),initializedAtLeastOnce(
false),
131 geometryToBeOptimized(
true),runIDCounter(0),
132 verboseLevel(0),printModulo(-1),DCtable(0),
133 currentRun(0),currentEvent(0),n_perviousEventsToBeStored(0),
134 numberOfEventToBeProcessed(0),storeRandomNumberStatus(
false),
135 storeRandomNumberStatusToG4Event(0),rngStatusEventsFlag(
false),
136 currentWorld(0),nParallelWorlds(0),msgText(
" "),n_select_msg(-1),
137 numberOfEventProcessed(0),selectMacro(
""),fakeRun(
false),
138 isScoreNtupleWriter(
false),geometryDirectlyUpdated(
false)
141 #ifndef G4MULTITHREADED
143 msg<<
"Geant4 code is compiled without multi-threading support (-DG4MULTITHREADED is set to off).";
144 msg<<
" This type of RunManager can only be used in mult-threaded applications.";
150 G4Exception(
"G4RunManager::G4RunManager()",
"Run0031",
166 msgx<<
" This type of RunManager can only be used in mult-threaded applications.";
180 std::ostringstream oss;
181 G4Random::saveFullState(oss);
267 if(n_event<=0) {
fakeRun =
true; }
289 G4cerr <<
"Illegal application state - BeamOn() ignored." <<
G4endl;
295 G4cerr <<
" Geant4 kernel should be initialized" <<
G4endl;
296 G4cerr <<
"before the first BeamOn(). - BeamOn ignored." <<
G4endl;
307 G4cout <<
"has been modified since last Run." <<
G4endl;
347 std::ostringstream oss;
348 G4Random::saveFullState(oss);
365 std::ostringstream os;
379 for(
G4int i_event=0; i_event<n_event; i_event++ )
451 "G4VUserPrimaryGeneratorAction is not defined!");
459 std::ostringstream oss;
460 G4Random::saveFullState(oss);
468 std::ostringstream os;
485 G4Random::saveEngineStatus(fileN);
491 if(fPersM) fPersM->
Store(anEvent);
526 if(evt && !(evt->
ToBeKept()))
delete evt;
567 {
if(!(anEvent->
ToBeKept()))
delete anEvent; }
581 G4cerr <<
"Illegal application state - "
582 <<
"G4RunManager::Initialize() ignored." <<
G4endl;
598 G4Exception(
"G4RunManager::InitializeGeometry",
"Run0033",
641 G4Exception(
"G4RunManager::InitializePhysics()",
"Run0034",
665 G4cerr <<
"Run is not in progress. AbortRun() ignored." <<
G4endl;
681 G4cerr <<
"Event is not in progress. AbortEevnt() ignored." <<
G4endl;
696 G4cerr <<
"Warning from G4RunManager::rndmSaveThisRun():"
697 <<
" Random number status was not stored prior to this run."
704 std::ostringstream os;
705 os <<
"run" << runNumber <<
".rndm" <<
'\0';
709 G4String copCmd =
"/control/shell copy " + fileIn +
" " + fileOut;
711 G4String copCmd =
"/control/shell cp " + fileIn +
" " + fileOut;
715 {
G4cout << fileIn <<
" is copied to " << fileOut <<
G4endl; }
723 <<
"Warning from G4RunManager::rndmSaveThisEvent():"
724 <<
" there is no currentEvent available."
732 <<
"Warning from G4RunManager::rndmSaveThisEvent():"
733 <<
" Random number engine status is not available."
734 <<
G4endl <<
"/random/setSavingFlag command must be issued "
735 <<
"prior to the start of the run. Command ignored." <<
G4endl;
741 std::ostringstream os;
747 G4String copCmd =
"/control/shell copy " + fileIn +
" " + fileOut;
749 G4String copCmd =
"/control/shell cp " + fileIn +
" " + fileOut;
753 {
G4cout << fileIn <<
" is copied to " << fileOut <<
G4endl; }
759 if(fileN.
index(
"/")==std::string::npos)
762 { fileNameWithDirectory = fileN; }
764 G4Random::restoreEngineStatus(fileNameWithDirectory);
766 << fileNameWithDirectory <<
G4endl;
767 G4Random::showEngineStatus();
787 #include "G4HCofThisEvent.hh"
788 #include "G4VHitsCollection.hh"
806 for(
G4int iw=0;iw<nPar;iw++)
811 if(mesh->
GetShape()!=MeshShape::realWorldLogVol)
820 if(theParallelWorldProcess)
828 theParticleIterator->
reset();
829 while( (*theParticleIterator)() ){
834 pmanager->
AddProcess(theParallelWorldProcess);
867 for(
G4int i=0;i<nColl;i++)
889 { localtimer.
Start(); }
901 G4cout <<
" heads : " << stat.GetNumberHeads() <<
" - nodes : "
902 << stat.GetNumberNodes() <<
" - pointers : "
903 << stat.GetNumberPointers() <<
G4endl;
904 G4cout <<
" Memory used : " << (stat.GetMemoryUse()+512)/1024
905 <<
"k - total time : " << stat.GetTotalTime()
906 <<
" - system time : " << stat.GetSysTime() <<
G4endl;
922 "Base-class G4RunManager cannot take G4UserWorkerInitialization. Use G4MTRunManager.");
928 "Base-class G4RunManager cannot take G4UserWorkerThreadInitialization. Use G4MTRunManager.");
992 G4cout <<
"#### Assemblies, Volumes and Solids Stores are wiped out."
1004 std::vector<G4Region*>::iterator rItr;
1005 for(rItr = regionStore->begin();rItr != regionStore->end(); rItr++)
1007 if((*rItr)->GetName()==
"DefaultRegionForTheWorld")
continue;
1009 std::vector<G4LogicalVolume*>::iterator lvItr
1010 = (*rItr)->GetRootLogicalVolumeIterator();
1011 for(
size_t iRLV = 0;iRLV < (*rItr)->GetNumberOfRootVolumes(); iRLV++)
1013 (*rItr)->RemoveRootLogicalVolume(*lvItr,
false);
1017 {
G4cout<<
"#### Region <"<<(*rItr)->GetName()<<
"> is cleared."<<
G4endl; }