Geant4  10.00.p02
G4RunManager.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4RunManager.cc 77649 2013-11-27 08:39:54Z gcosmo $
28 //
29 //
30 
31 // On Sun, to prevent conflict with ObjectSpace, G4Timer.hh has to be
32 // loaded *before* globals.hh...
33 #include "G4Timer.hh"
34 
35 #include "G4RunManager.hh"
36 #include "G4RunManagerKernel.hh"
37 #include "G4MTRunManagerKernel.hh"
39 
40 #include "G4StateManager.hh"
41 #include "G4ApplicationState.hh"
42 #include "Randomize.hh"
43 #include "G4Run.hh"
44 #include "G4RunMessenger.hh"
45 #include "G4VUserPhysicsList.hh"
50 #include "G4UserRunAction.hh"
52 #include "G4VPersistencyManager.hh"
53 #include "G4ParticleTable.hh"
54 #include "G4ProcessTable.hh"
55 #include "G4UnitsTable.hh"
56 #include "G4VVisManager.hh"
57 #include "G4Material.hh"
58 #include "G4SDManager.hh"
59 #include "G4UImanager.hh"
60 #include "G4ProductionCutsTable.hh"
61 #include "G4ios.hh"
62 #include <sstream>
63 
64 using namespace CLHEP;
65 
67 
68 //The following lines are needed since G4VUserPhysicsList
69 //uses a #define theParticleIterator
70 #ifdef theParticleIterator
71 #undef theParticleIterator
72 #endif
73 
75 { return fRunManager; }
76 
78 :userDetector(0),physicsList(0),
79  userActionInitialization(0),userWorkerInitialization(0),
80  userWorkerThreadInitialization(0),
81  userRunAction(0),userPrimaryGeneratorAction(0),userEventAction(0),
82  userStackingAction(0),userTrackingAction(0),userSteppingAction(0),
83  geometryInitialized(false),physicsInitialized(false),
84  runAborted(false),initializedAtLeastOnce(false),
85  geometryToBeOptimized(true),runIDCounter(0),
86  verboseLevel(0),printModulo(-1),DCtable(0),
87  currentRun(0),currentEvent(0),n_perviousEventsToBeStored(0),
88  numberOfEventToBeProcessed(0),storeRandomNumberStatus(false),
89  storeRandomNumberStatusToG4Event(0),rngStatusEventsFlag(false),
90  currentWorld(0),nParallelWorlds(0),msgText(" "),n_select_msg(-1),
91  numberOfEventProcessed(0),selectMacro(""),fakeRun(false)
92 {
93  if(fRunManager)
94  {
95  G4Exception("G4RunManager::G4RunManager()", "Run0031",
96  FatalException, "G4RunManager constructed twice.");
97  }
98  fRunManager = this;
99 
100  kernel = new G4RunManagerKernel();
102 
103  timer = new G4Timer();
104  runMessenger = new G4RunMessenger(this);
105  previousEvents = new std::vector<G4Event*>;
108  randomNumberStatusDir = "./";
109  std::ostringstream oss;
110  G4Random::saveFullState(oss);
111  randomNumberStatusForThisRun = oss.str();
112  randomNumberStatusForThisEvent = oss.str();
114 }
115 
117 :userDetector(0),physicsList(0),
118  userActionInitialization(0),userWorkerInitialization(0),
119  userWorkerThreadInitialization(0),
120  userRunAction(0),userPrimaryGeneratorAction(0),userEventAction(0),
121  userStackingAction(0),userTrackingAction(0),userSteppingAction(0),
122  geometryInitialized(false),physicsInitialized(false),
123  runAborted(false),initializedAtLeastOnce(false),
124  geometryToBeOptimized(true),runIDCounter(0),
125  verboseLevel(0),printModulo(-1),DCtable(0),
126  currentRun(0),currentEvent(0),n_perviousEventsToBeStored(0),
127  numberOfEventToBeProcessed(0),storeRandomNumberStatus(false),
128  storeRandomNumberStatusToG4Event(0),rngStatusEventsFlag(false),
129  currentWorld(0),nParallelWorlds(0),msgText(" "),n_select_msg(-1),
130  numberOfEventProcessed(0),selectMacro(""),fakeRun(false)
131 {
132  //This version of the constructor should never be called in sequential mode!
133 #ifndef G4MULTITHREADED
135  msg<<"Geant4 code is compiled without multi-threading support (-DG4MULTITHREADED is set to off).";
136  msg<<" This type of RunManager can only be used in mult-threaded applications.";
137  G4Exception("G4RunManager::G4RunManager(G4bool)","Run0035",FatalException,msg);
138 #endif
139 
140  if(fRunManager)
141  {
142  G4Exception("G4RunManager::G4RunManager()", "Run0031",
143  FatalException, "G4RunManager constructed twice.");
144  }
145  fRunManager = this;
146 
147  switch(rmType)
148  {
149  case masterRM:
151  break;
152  case workerRM:
154  break;
155  default:
157  msgx<<" This type of RunManager can only be used in mult-threaded applications.";
158  G4Exception("G4RunManager::G4RunManager(G4bool)","Run0035",FatalException,msgx);
159  }
160  runManagerType = rmType;
161 
163 
164  timer = new G4Timer();
165  runMessenger = new G4RunMessenger(this);
166  previousEvents = new std::vector<G4Event*>;
169  randomNumberStatusDir = "./";
170  std::ostringstream oss;
171  G4Random::saveFullState(oss);
172  randomNumberStatusForThisRun = oss.str();
173  randomNumberStatusForThisEvent = oss.str();
174 }
175 
177 {
179  // set the application state to the quite state
180  if(pStateManager->GetCurrentState()!=G4State_Quit)
181  {
182  if(verboseLevel>0) G4cout << "G4 kernel has come to Quit state." << G4endl;
183  pStateManager->SetNewState(G4State_Quit);
184  }
185 
186  if(currentRun) delete currentRun;
187  delete timer;
188  delete runMessenger;
191  delete previousEvents;
192 
193  //The following will work for all RunManager types
194  //if derived class does the correct thing in derived
195  //destructor that is set to zero pointers of
196  //user initialization objects for which does not have
197  //ownership
199  if(userRunAction)
200  {
201  delete userRunAction;
202  userRunAction = 0;
203  if(verboseLevel>1) G4cout << "UserRunAction deleted." << G4endl;
204  }
206  {
209  if(verboseLevel>1) G4cout << "UserPrimaryGenerator deleted." << G4endl;
210  }
211 
212  if(verboseLevel>1) G4cout << "RunManager is deleting RunManagerKernel." << G4endl;
213 
214  delete kernel;
215 
216  fRunManager = 0;
217 }
218 
220 {
221  if( userDetector )
222  {
223  delete userDetector;
224  userDetector = 0;
225  if(verboseLevel>1) G4cout << "UserDetectorConstruction deleted." << G4endl;
226  }
227  if(physicsList)
228  {
229  delete physicsList;
230  physicsList = 0;
231  if(verboseLevel>1) G4cout << "UserPhysicsList deleted." << G4endl;
232  }
234  {
237  if(verboseLevel>1) G4cout <<"UserActionInitialization deleted." << G4endl;
238  }
240  {
243  if(verboseLevel>1) G4cout <<"UserWorkerInitialization deleted." << G4endl;
244  }
246  {
249  if(verboseLevel>1) G4cout <<"UserWorkerThreadInitialization deleted." << G4endl;
250  }
251 
252 }
253 
254 void G4RunManager::BeamOn(G4int n_event,const char* macroFile,G4int n_select)
255 {
256  if(n_event<=0) { fakeRun = true; }
257  else { fakeRun = false; }
259  if(cond)
260  {
261  numberOfEventToBeProcessed = n_event;
264  DoEventLoop(n_event,macroFile,n_select);
265  RunTermination();
266  }
267  fakeRun = false;
268 }
269 
271 {
273 
274  G4ApplicationState currentState = stateManager->GetCurrentState();
275  if(currentState!=G4State_PreInit && currentState!=G4State_Idle)
276  {
277  G4cerr << "Illegal application state - BeamOn() ignored." << G4endl;
278  return false;
279  }
280 
282  {
283  G4cerr << " Geant4 kernel should be initialized" << G4endl;
284  G4cerr << "before the first BeamOn(). - BeamOn ignored." << G4endl;
285  return false;
286  }
287 
289  {
290  if(verboseLevel>0)
291  {
292  G4cout << "Start re-initialization because " << G4endl;
293  if(!geometryInitialized) G4cout << " Geometry" << G4endl;
294  if(!physicsInitialized) G4cout << " Physics processes" << G4endl;
295  G4cout << "has been modified since last Run." << G4endl;
296  }
297  Initialize();
298  }
299  return true;
300 }
301 
303 {
304  if(!(kernel->RunInitialization(fakeRun))) return;
305  if(fakeRun) return;
306 
307  if(currentRun) delete currentRun;
308  currentRun = 0;
309 
311  if(!currentRun) currentRun = new G4Run();
312 
315 
318  if(fSDM)
319  { currentRun->SetHCtable(fSDM->GetHCtable()); }
320 
321  std::ostringstream oss;
322  G4Random::saveFullState(oss);
323  randomNumberStatusForThisRun = oss.str();
325 
326  previousEvents->clear();
327  for(G4int i_prev=0;i_prev<n_perviousEventsToBeStored;i_prev++)
328  { previousEvents->push_back((G4Event*)0); }
329 
330  if(printModulo>=0 || verboseLevel>0)
331  { G4cout << "### Run " << currentRun->GetRunID() << " starts." << G4endl; }
333 
335  G4String fileN = "currentRun";
336  if ( rngStatusEventsFlag ) {
337  std::ostringstream os;
338  os << "run" << currentRun->GetRunID();
339  fileN = os.str();
340  }
341  StoreRNGStatus(fileN);
342  }
343 
344  runAborted = false;
346 }
347 
348 void G4RunManager::DoEventLoop(G4int n_event,const char* macroFile,G4int n_select)
349 {
350  InitializeEventLoop(n_event,macroFile,n_select);
351 
352 // Event loop
353  for(G4int i_event=0; i_event<n_event; i_event++ )
354  {
355  ProcessOneEvent(i_event);
357  if(runAborted) break;
358  }
359 
361 }
362 
363 void G4RunManager::InitializeEventLoop(G4int n_event,const char* macroFile,G4int n_select)
364 {
365  if(verboseLevel>0)
366  { timer->Start(); }
367 
368  n_select_msg = n_select;
369  if(macroFile!=0)
370  {
371  if(n_select_msg<0) n_select_msg = n_event;
372  msgText = "/control/execute ";
373  msgText += macroFile;
374  selectMacro = macroFile;
375  }
376  else
377  {
378  n_select_msg = -1;
379  selectMacro = "";
380  }
381 }
382 
384 {
385  currentEvent = GenerateEvent(i_event);
388  UpdateScoring();
390 }
391 
393 {
395  currentEvent = 0;
397 }
398 
400 {
401  if(verboseLevel>0)
402  {
403  timer->Stop();
404  G4cout << "Run terminated." << G4endl;
405  G4cout << "Run Summary" << G4endl;
406  if(runAborted)
407  { G4cout << " Run Aborted after " << numberOfEventProcessed << " events processed." << G4endl; }
408  else
409  { G4cout << " Number of events processed : " << numberOfEventProcessed << G4endl; }
410  G4cout << " " << *timer << G4endl;
411  }
413 }
414 
416 {
418  {
419  G4Exception("G4RunManager::GenerateEvent()", "Run0032", FatalException,
420  "G4VUserPrimaryGeneratorAction is not defined!");
421  return 0;
422  }
423 
424  G4Event* anEvent = new G4Event(i_event);
425 
427  {
428  std::ostringstream oss;
429  G4Random::saveFullState(oss);
430  randomNumberStatusForThisEvent = oss.str();
432  }
433 
435  G4String fileN = "currentEvent";
436  if ( rngStatusEventsFlag ) {
437  std::ostringstream os;
438  os << "run" << currentRun->GetRunID() << "evt" << anEvent->GetEventID();
439  fileN = os.str();
440  }
441  StoreRNGStatus(fileN);
442  }
443 
444  if(printModulo > 0 && anEvent->GetEventID()%printModulo == 0 )
445  { G4cout << "--> Event " << anEvent->GetEventID() << " starts." << G4endl; }
447  return anEvent;
448 }
449 
451 {
452  G4String fileN = randomNumberStatusDir + fnpref+".rndm";
453  G4Random::saveEngineStatus(fileN);
454 }
455 
457 {
459  if(fPersM) fPersM->Store(anEvent);
460  currentRun->RecordEvent(anEvent);
461 }
462 
464 {
465  if(!fakeRun)
466  {
467  for(size_t itr=0;itr<previousEvents->size();itr++)
468  {
469  G4Event* prevEv = (*previousEvents)[itr];
470  if((prevEv) && !(prevEv->ToBeKept())) delete prevEv;
471  }
472  previousEvents->clear();
473  for(G4int i_prev=0;i_prev<n_perviousEventsToBeStored;i_prev++)
474  { previousEvents->push_back((G4Event*)0); }
475 
477 
479  if(fPersM) fPersM->Store(currentRun);
480  runIDCounter++;
481  }
482 
484 }
485 
487 {
488  if(anEvent->ToBeKept()) currentRun->StoreEvent(anEvent);
489  G4Event* evt;
491  { evt = anEvent; }
492  else
493  {
494  previousEvents->insert(previousEvents->begin(),anEvent);
495  evt = previousEvents->back();
496  previousEvents->pop_back();
497  }
498  if(evt && !(evt->ToBeKept())) delete evt;
499 }
500 
502 {
504  G4ApplicationState currentState = stateManager->GetCurrentState();
505  if(currentState!=G4State_PreInit && currentState!=G4State_Idle)
506  {
507  G4cerr << "Illegal application state - "
508  << "G4RunManager::Initialize() ignored." << G4endl;
509  return;
510  }
511 
514  initializedAtLeastOnce = true;
515 }
516 
518 {
519  if(!userDetector)
520  {
521  G4Exception("G4RunManager::InitializeGeometry", "Run0033",
522  FatalException, "G4VUserDetectorConstruction is not defined!");
523  return;
524  }
525 
526  if(verboseLevel>1) G4cout << "userDetector->Construct() start." << G4endl;
527 
533  geometryInitialized = true;
534 }
535 
537 {
538  if(physicsList)
539  {
541  }
542  else
543  {
544  G4Exception("G4RunManager::InitializePhysics()", "Run0034",
545  FatalException, "G4VUserPhysicsList is not defined!");
546  }
547  physicsInitialized = true;
548 
549 }
550 
552 {
553  // This method is valid only for GeomClosed or EventProc state
554  G4ApplicationState currentState =
556  if(currentState==G4State_GeomClosed || currentState==G4State_EventProc)
557  {
558  runAborted = true;
559  if(currentState==G4State_EventProc && !softAbort)
560  {
563  }
564  }
565  else
566  {
567  G4cerr << "Run is not in progress. AbortRun() ignored." << G4endl;
568  }
569 }
570 
572 {
573  // This method is valid only for EventProc state
574  G4ApplicationState currentState =
576  if(currentState==G4State_EventProc)
577  {
580  }
581  else
582  {
583  G4cerr << "Event is not in progress. AbortEevnt() ignored." << G4endl;
584  }
585 }
586 
588  G4bool topologyIsChanged)
589 {
590  kernel->DefineWorldVolume(worldVol,topologyIsChanged);
591 }
592 
594 {
595  G4int runNumber = 0;
596  if(currentRun) runNumber = currentRun->GetRunID();
598  G4cerr << "Warning from G4RunManager::rndmSaveThisRun():"
599  << " Random number status was not stored prior to this run."
600  << G4endl << "Command ignored." << G4endl;
601  return;
602  }
603 
604  G4String fileIn = randomNumberStatusDir + "currentRun.rndm";
605 
606  std::ostringstream os;
607  os << "run" << runNumber << ".rndm" << '\0';
608  G4String fileOut = randomNumberStatusDir + os.str();
609 
610  G4String copCmd = "/control/shell cp "+fileIn+" "+fileOut;
612  if(verboseLevel>0) G4cout << "currentRun.rndm is copied to file: " << fileOut << G4endl;
613 }
614 
616 {
618  G4cerr << "Warning from G4RunManager::rndmSaveThisEvent():"
619  << " there is no currentEvent or its RandomEngineStatus is not available."
620  << G4endl << "Command ignored." << G4endl;
621  return;
622  }
623 
624  G4String fileIn = randomNumberStatusDir + "currentEvent.rndm";
625 
626  std::ostringstream os;
627  os << "run" << currentRun->GetRunID() << "evt" << currentEvent->GetEventID()
628  << ".rndm" << '\0';
629  G4String fileOut = randomNumberStatusDir + os.str();
630 
631  G4String copCmd = "/control/shell cp "+fileIn+" "+fileOut;
633  if(verboseLevel>0) G4cout << "currentEvent.rndm is copied to file: " << fileOut << G4endl;
634 }
635 
637 {
638  G4String fileNameWithDirectory;
639  if(fileN.index("/")==std::string::npos)
640  { fileNameWithDirectory = randomNumberStatusDir+fileN; }
641  else
642  { fileNameWithDirectory = fileN; }
643 
644  G4Random::restoreEngineStatus(fileNameWithDirectory);
645  if(verboseLevel>0) G4cout << "RandomNumberEngineStatus restored from file: "
646  << fileNameWithDirectory << G4endl;
647  G4Random::showEngineStatus();
648 }
649 
650 void G4RunManager::DumpRegion(const G4String& rname) const
651 {
652  kernel->DumpRegion(rname);
653 }
654 
656 {
657  kernel->DumpRegion(region);
658 }
659 
660 #include "G4ScoringManager.hh"
662 #include "G4VScoringMesh.hh"
663 #include "G4ParticleTable.hh"
664 #include "G4ParticleDefinition.hh"
665 #include "G4ProcessManager.hh"
666 #include "G4ParallelWorldProcess.hh"
667 #include "G4HCofThisEvent.hh"
668 #include "G4VHitsCollection.hh"
669 
670 #include "G4ScoringBox.hh"
671 #include "G4ScoringCylinder.hh"
672 
674 {
676  if(!ScM) return;
677 
678  G4int nPar = ScM->GetNumberOfMesh();
679  if(nPar<1) return;
680 
683  for(G4int iw=0;iw<nPar;iw++)
684  {
685  G4VScoringMesh* mesh = ScM->GetMesh(iw);
686 
687  G4VPhysicalVolume* pWorld
689  ->IsWorldExisting(ScM->GetWorldName(iw));
690  if(!pWorld)
691  {
693  ->GetParallelWorld(ScM->GetWorldName(iw));
694  pWorld->SetName(ScM->GetWorldName(iw));
695 
696  G4ParallelWorldProcess* theParallelWorldProcess
697  = new G4ParallelWorldProcess(ScM->GetWorldName(iw));
698  theParallelWorldProcess->SetParallelWorld(ScM->GetWorldName(iw));
699 
700  theParticleIterator->reset();
701  while( (*theParticleIterator)() ){
702  G4ParticleDefinition* particle = theParticleIterator->value();
703  G4ProcessManager* pmanager = particle->GetProcessManager();
704  if(pmanager)
705  {
706  pmanager->AddProcess(theParallelWorldProcess);
707  if(theParallelWorldProcess->IsAtRestRequired(particle))
708  { pmanager->SetProcessOrdering(theParallelWorldProcess, idxAtRest, 9999); }
709  pmanager->SetProcessOrderingToSecond(theParallelWorldProcess, idxAlongStep);
710  pmanager->SetProcessOrdering(theParallelWorldProcess, idxPostStep, 9999);
711  }
712  }
713  }
714 
715  mesh->Construct(pWorld);
716  }
717 
719 }
720 
722 {
724  if(!ScM) return;
725  G4int nPar = ScM->GetNumberOfMesh();
726  if(nPar<1) return;
727 
729  if(!HCE) return;
730  G4int nColl = HCE->GetCapacity();
731  for(G4int i=0;i<nColl;i++)
732  {
733  G4VHitsCollection* HC = HCE->GetHC(i);
734  if(HC) ScM->Accumulate(HC);
735  }
736 }
737 
738 #include "G4VPhysicalVolume.hh"
739 #include "G4LogicalVolume.hh"
740 #include "G4SmartVoxelHeader.hh"
741 #include "G4SmartVoxelStat.hh"
742 
744 {
745  G4LogicalVolume* pMotherL = pPhys->GetMotherLogical();
746  if(pMotherL) ReOptimize(pMotherL);
747 }
748 
750 {
751  G4Timer localtimer;
752  if(verboseLevel>1)
753  { localtimer.Start(); }
754  G4SmartVoxelHeader* header = pLog->GetVoxelHeader();
755  delete header;
756  header = new G4SmartVoxelHeader(pLog);
757  pLog->SetVoxelHeader(header);
758  if(verboseLevel>1)
759  {
760  localtimer.Stop();
761  G4SmartVoxelStat stat(pLog,header,localtimer.GetSystemElapsed(),
762  localtimer.GetUserElapsed());
763  G4cout << G4endl << "Voxelisation of logical volume <"
764  << pLog->GetName() << ">" << G4endl;
765  G4cout << " heads : " << stat.GetNumberHeads() << " - nodes : "
766  << stat.GetNumberNodes() << " - pointers : "
767  << stat.GetNumberPointers() << G4endl;
768  G4cout << " Memory used : " << (stat.GetMemoryUse()+512)/1024
769  << "k - total time : " << stat.GetTotalTime()
770  << " - system time : " << stat.GetSysTime() << G4endl;
771  }
772 }
773 
775 { userDetector = userInit; }
776 
778 {
779  physicsList = userInit;
780  kernel->SetPhysics(userInit);
781 }
782 
784 {
785  G4Exception("G4RunManager::SetUserInitialization()", "Run3001", FatalException,
786  "Base-class G4RunManager cannot take G4UserWorkerInitialization. Use G4MTRunManager.");
787 }
788 
790 {
791  G4Exception("G4RunManager::SetUserThreadInitialization()", "Run3001", FatalException,
792  "Base-class G4RunManager cannot take G4UserWorkerThreadInitialization. Use G4MTRunManager.");
793 }
794 
796 {
797  userActionInitialization = userInit;
799 }
800 
802 { userRunAction = userAction; }
803 
805 { userPrimaryGeneratorAction = userAction; }
806 
808 {
809  eventManager->SetUserAction(userAction);
810  userEventAction = userAction;
811 }
812 
814 {
815  eventManager->SetUserAction(userAction);
816  userStackingAction = userAction;
817 }
818 
820 {
821  eventManager->SetUserAction(userAction);
822  userTrackingAction = userAction;
823 }
824 
826 {
827  eventManager->SetUserAction(userAction);
828  userSteppingAction = userAction;
829 }
830 
832 {
833  if(prop)
834  { G4UImanager::GetUIpointer()->ApplyCommand("/run/geometryModified"); }
835  else
837 }
838 
839 #include "G4GeometryManager.hh"
840 #include "G4PhysicalVolumeStore.hh"
841 #include "G4LogicalVolumeStore.hh"
842 #include "G4SolidStore.hh"
843 
845 {
846  if(destroyFirst && !(G4Threading::IsWorkerThread()))
847  {
848  if(verboseLevel>0)
849  {
850  G4cout<<"#### G4PhysicalVolumeStore, G4LogicalVolumeStore and G4SolidStore\n"
851  <<"#### are wiped out. Command-based scorer, layerd mass geometry,\n"
852  <<"#### biasing with parallel world, etc. are not functioning any longer."
853  <<G4endl;
854  }
859  }
860  if(prop)
861  { G4UImanager::GetUIpointer()->ApplyCommand("/run/reinitializeGeometry"); }
862  else
863  {
865  geometryInitialized = false;
866  }
867 }
868 
virtual G4VPhysicalVolume * Construct()=0
G4Timer * timer
void GeometryHasBeenModified(G4bool prop=true)
void SetNumberOfEventToBeProcessed(G4int n_ev)
Definition: G4Run.hh:97
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)
Definition: G4Run.hh:101
G4SmartVoxelHeader * GetVoxelHeader() const
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
G4int n_select_msg
G4double GetSystemElapsed() const
Definition: G4Timer.cc:119
void SetPhysics(G4VUserPhysicsList *uPhys)
G4int numberOfEventProcessed
G4UserTrackingAction * userTrackingAction
G4VHitsCollection * GetHC(G4int i)
G4String GetWorldName(G4int i) const
G4String randomNumberStatusForThisRun
virtual void RunTermination()
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4String GetName() const
G4VUserPhysicsList * physicsList
G4String randomNumberStatusForThisEvent
G4EventManager * GetEventManager() const
void SetNumberOfParallelWorld(G4int i)
void SetProcessOrderingToSecond(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
G4UImessenger * CreateMessenger()
G4VUserActionInitialization * userActionInitialization
G4bool storeRandomNumberStatus
G4bool IsAtRestRequired(G4ParticleDefinition *)
G4UImessenger * CreateMessenger()
virtual void RunInitialization()
G4UserWorkerThreadInitialization * userWorkerThreadInitialization
virtual void EndOfRunAction(const G4Run *aRun)
G4bool physicsInitialized
static void Clean()
Definition: G4SolidStore.cc:79
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
virtual void Construct(G4VPhysicalVolume *fWorldPhys)=0
#define G4ThreadLocal
Definition: tls.hh:52
void SetName(const G4String &pName)
virtual void InitializePhysics()
RMType runManagerType
void ReOptimize(G4LogicalVolume *)
G4ProcessManager * GetProcessManager() const
G4String msgText
int G4int
Definition: G4Types.hh:78
virtual G4bool Store(const G4Event *anEvent)=0
G4bool runAborted
G4bool RunInitialization(G4bool fakeRun=false)
G4Event * currentEvent
virtual void InitializeGeometry()
void SetVoxelHeader(G4SmartVoxelHeader *pVoxel)
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
virtual G4bool ConfirmBeamOnCondition()
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
virtual void RestoreRandomNumberStatus(const G4String &fileN)
G4int GetEventID() const
Definition: G4Event.hh:140
static G4PhysicalVolumeStore * GetInstance()
G4bool geometryInitialized
G4HCtable * GetHCtable() const
Definition: G4SDManager.hh:101
G4VUserPrimaryGeneratorAction * userPrimaryGeneratorAction
G4bool initializedAtLeastOnce
G4bool ToBeKept() const
Definition: G4Event.hh:136
static G4StateManager * GetStateManager()
virtual void rndmSaveThisRun()
void SetParallelWorld(G4String parallelWorldName)
virtual G4Event * GenerateEvent(G4int i_event)
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
bool G4bool
Definition: G4Types.hh:79
G4bool rngStatusEventsFlag
virtual void ConstructScoringWorlds()
virtual void AnalyzeEvent(G4Event *anEvent)
G4double GetUserElapsed() const
Definition: G4Timer.cc:130
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
G4int storeRandomNumberStatusToG4Event
G4int GetRunID() const
Definition: G4Run.hh:76
G4UserEventAction * userEventAction
virtual void rndmSaveThisEvent()
Definition: G4Run.hh:46
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
G4UserRunAction * userRunAction
void SetEventAborted()
Definition: G4Event.hh:122
void ReinitializeGeometry(G4bool destroyFirst=false, G4bool prop=true)
void SetHCtable(G4HCtable *HCtbl)
Definition: G4Run.hh:99
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void SetRandomNumberStatus(G4String &st)
Definition: G4Event.hh:124
G4bool IsWorkerThread()
Definition: G4Threading.cc:104
static G4TransportationManager * GetTransportationManager()
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
G4VPhysicalVolume * GetParallelWorld(const G4String &worldName)
G4int runIDCounter
G4String selectMacro
virtual void GeneratePrimaries(G4Event *anEvent)=0
static G4ParticleTable * GetParticleTable()
G4int nParallelWorlds
virtual void DoEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
void SetUserAction(G4UserEventAction *userAction)
void Stop()
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)
Definition: G4Run.cc:62
virtual void RecordEvent(const G4Event *)
Definition: G4Run.cc:51
void AbortCurrentEvent()
virtual void BeginOfRunAction(const G4Run *aRun)
virtual void Initialize()
void StackPreviousEvent(G4Event *anEvent)
G4Run * currentRun
#define G4endl
Definition: G4ios.hh:61
void OpenGeometry(G4VPhysicalVolume *vol=0)
void ProcessOneEvent(G4Event *anEvent)
virtual void AbortEvent()
G4RunManagerKernel * kernel
void Start()
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:174
size_t GetNumberOfMesh() const
G4EventManager * eventManager
virtual void TerminateOneEvent()
void SetRunID(G4int id)
Definition: G4Run.hh:95
G4VUserDetectorConstruction * userDetector
G4UserSteppingAction * userSteppingAction
G4VScoringMesh * GetMesh(G4int i) const
void SetRandomNumberStatus(G4String &st)
Definition: G4Run.hh:103
G4RunMessenger * runMessenger
virtual G4Run * GenerateRun()
std::vector< G4Event * > * previousEvents
static G4ProcessTable * GetProcessTable()
G4PTblDicIterator * GetIterator() const
void UpdateScoring()
G4DCtable * DCtable
void DumpRegion(const G4String &rname) const
G4int n_perviousEventsToBeStored
#define theParticleIterator
G4ApplicationState
virtual ~G4RunManager()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432
G4int verboseLevel
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()
Definition: G4SDManager.cc:49