79 nworkers(2),forcedNwokers(-1),pinAffinity(0),
82 eventModuloDef(0),eventModulo(1),
83 nSeedsUsed(0),nSeedsFilled(0),
84 nSeedsMax(10000),nSeedsPerEvent(2)
89 "Another instance of a G4MTRunManager already exists.");
93 #ifndef G4MULTITHREADED
95 msg <<
"Geant4 code is compiled without multi-threading support"
96 <<
"(-DG4MULTITHREADED is set to off).\n";
97 msg <<
"G4MTRunManager can only be used in multi-threaded applications.";
102 if(numberOfStaticAllocators>0)
105 msg1 <<
"There are " << numberOfStaticAllocators
106 <<
" static G4Allocator objects detected.\n"
107 <<
"In multi-threaded mode, all G4Allocator objects must be dynamicly instantiated.";
123 char* env = std::getenv(
"G4FORCENUMBEROFTHREADS");
127 if(envS==
"MAX"||envS==
"max")
131 std::istringstream is(env);
139 msg2 <<
"Environment variable G4FORCENUMBEROFTHREADS has an invalid value <"
140 << envS <<
">. It has to be an integer or a word \"max\".\n"
141 <<
"G4FORCENUMBEROFTHREADS is ignored.";
149 <<
" by Environment variable G4FORCENUMBEROFTHREADS." <<
G4endl;
166 std::ostringstream os;
168 G4Random::saveEngineStatus(os.str().c_str());
177 G4cerr <<
"Warning from G4RunManager::rndmSaveThisRun():"
178 <<
" Random number status was not stored prior to this run."
179 <<
G4endl <<
"/random/setSavingFlag command must be issued. "
180 <<
"Command ignored." <<
G4endl;
186 std::ostringstream os;
187 os <<
"run" << runNumber <<
".rndm" <<
'\0';
190 G4String copCmd =
"/control/shell copy " + fileIn +
" " + fileOut;
192 G4String copCmd =
"/control/shell cp " + fileIn +
" " + fileOut;
196 {
G4cout << fileIn <<
" is copied to " << fileOut <<
G4endl; }
201 G4Exception(
"G4MTRunManager::rndmSaveThisEvent",
"RUN_RNDM001",
210 msg <<
"Number of threads cannot be changed at this moment \n"
211 <<
"(old threads are still alive). Method ignored.";
212 G4Exception(
"G4MTRunManager::SetNumberOfThreads(G4int)",
219 <<
" by G4FORCENUMBEROFTHREADS shell variable.\n"
220 <<
"Method ignored.";
221 G4Exception(
"G4MTRunManager::SetNumberOfThreads(G4int)",
257 for ( std::vector<G4String>::const_iterator
it = cmdCopy->begin() ;
258 it != cmdCopy->end(); ++
it )
331 msgd <<
"Event modulo is reduced to " <<
eventModulo
332 <<
" to distribute events to all threads.";
333 G4Exception(
"G4MTRunManager::InitializeEventLoop()",
359 <<
"> of seedOncePerCommunication is invalid. It is reset to 0." ;
360 G4Exception(
"G4MTRunManager::InitializeEventLoop()",
362 seedOncePerCommunication = 0;
433 std::vector<G4VPhysicalVolume*>::iterator itrW
435 for(
size_t iWorld=0;iWorld<nWorlds;iWorld++)
478 "For multi-threaded version, define G4VUserPrimaryGeneratorAction in G4VUserActionInitialization.");
484 "For multi-threaded version, define G4UserEventAction in G4VUserActionInitialization.");
490 "For multi-threaded version, define G4UserStackingAction in G4VUserActionInitialization.");
496 "For multi-threaded version, define G4UserTrackingAction in G4VUserActionInitialization.");
502 "For multi-threaded version, define G4UserSteppingAction in G4VUserActionInitialization.");
527 s1 = helper->
GetSeed(idx_rndm);
528 s2 = helper->
GetSeed(idx_rndm+1);
553 for(
int i=0;i<nevRnd;i++)
576 #ifdef G4MULTITHREADED //protect here to prevent warning in compilation
601 G4cerr <<
"Run is not in progress. AbortRun() ignored." <<
G4endl;
659 "Pin affinity must be >0 or <0.");