GGS(GenericGEANT4Simulation)Software  2.99.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Macros
Public Member Functions
GGSRunManager Class Reference

A run manager for GGS simulations. More...

#include <GGSRunManager.h>

Inheritance diagram for GGSRunManager:
Inheritance graph
[legend]
Collaboration diagram for GGSRunManager:
Collaboration graph
[legend]

Public Member Functions

void DoEventLoop (G4int n_event, const char *macroFile, G4int n_select)
 Run the event loop. More...
 
void ProcessOneEvent (G4int i_event)
 Process a single event. More...
 
- Public Member Functions inherited from GGSRunManagerExtensions
 GGSRunManagerExtensions ()
 Constructor.
 
virtual ~GGSRunManagerExtensions ()=default
 Destructor. More...
 
int GetNKilledEvents ()
 Getter method for number of killed events. More...
 
void KillEvent ()
 Kills the current event. More...
 
void SimulateAgainKilledEvent ()
 Simulates again a killed event. More...
 
bool IsCurrentEventKilled ()
 Getter method for killed event flag. More...
 
const std::string & GetRandomStateAtBeginOfEvent ()
 Getter method for random engine state at the beginning of the current event. More...
 
void SetGGSGeneratorAction (G4VUserPrimaryGeneratorAction *userAction)
 Replacement of the SetUserAction method. More...
 
int GetNDiscardedEvents ()
 Getter method for number of discarded events. More...
 
const std::string & RngStateRestoredFrom ()
 The random engine state file for this event. More...
 

Additional Inherited Members

- Protected Member Functions inherited from GGSRunManagerExtensions
void BeginOfEventProcessing ()
 Method for storing the random engine state and resetting the internal flags at the beginning event generation. More...
 
void BeginOfEventSimulation ()
 Reset the internal flags at the beginning of event simulation. More...
 
void DumpStatus (G4int eventID)
 Prints the status of the random number generator. More...
 
bool IsKilledAndToBeSimulatedAgain (const G4Event *ev)
 Checks if the event has been killed and has to be re-simulated. More...
 
void PrintLogVols ()
 Print a list of logical volumes in current geometries.
 
void HandleEventRngStateFile (int runID, int eventID)
 Handles the read/write operations to/from the random generator state file for each event. More...
 

Detailed Description

A run manager for GGS simulations.

This class extends the G4 run manager interface with some GGS-specific features through the GGSRunManagerExtensions interface. For homogeneity with the multi-threaded case, the extension interface must be queried as:

auto &rme = dynamic_cast<GGSRunManagerExtensions &>(*(G4RunManager::GetRunManager()));

Definition at line 25 of file GGSRunManager.h.

Member Function Documentation

void GGSRunManager::DoEventLoop ( G4int  n_event,
const char *  macroFile,
G4int  n_select 
)

Run the event loop.

This override is a copy-paste of the base class method and has the only purpose to bind the non-polymorphic call to ProcessOneEvent to the override defined in this class.

Parameters
n_event
macroFile
n_select

Definition at line 16 of file GGSRunManager.cpp.

16  {
17  // Implementation copy-pasted from G4 10.06.p02 with no modification, to just allow for binding the call to
18  // ProcessOneEvent to the override defined in this class.
19  TIMEMORY_AUTO_TIMER("");
20  InitializeEventLoop(n_event, macroFile, n_select);
21 
22  // Event loop
23  for (G4int i_event = 0; i_event < n_event; i_event++) {
24  ProcessOneEvent(i_event);
25  TerminateOneEvent();
26  if (runAborted)
27  break;
28  }
29 
30  // For G4MTRunManager, TerminateEventLoop() is invoked after all threads are finished.
31  if (runManagerType == sequentialRM)
32  TerminateEventLoop();
33 }
void ProcessOneEvent(G4int i_event)
Process a single event.
void GGSRunManager::ProcessOneEvent ( G4int  i_event)

Process a single event.

This override implements some of the features of the GGSRunManagerExtensions, by saving the random engine seeds at the begin of the event generation and re-simulating killed events.

Definition at line 35 of file GGSRunManager.cpp.

35  {
36  TIMEMORY_AUTO_TIMER("");
37  currentEvent = _SetupRandomNumbers(i_event);
39  userPrimaryGeneratorAction->GeneratePrimaries(currentEvent);
40  DumpStatus(i_event);
41  bool resim = true;
42  while (resim) {
44  eventManager->ProcessOneEvent(currentEvent);
45  resim = IsKilledAndToBeSimulatedAgain(currentEvent);
46  if (resim) {
47  G4Event *newEvent = new G4Event(currentEvent->GetEventID());
48  delete currentEvent;
49  currentEvent = newEvent;
50  userPrimaryGeneratorAction->GeneratePrimaries(newEvent);
51  }
52  }
53  AnalyzeEvent(currentEvent);
54  UpdateScoring();
55  if (i_event < n_select_msg)
56  G4UImanager::GetUIpointer()->ApplyCommand(msgText);
57 }
bool IsKilledAndToBeSimulatedAgain(const G4Event *ev)
Checks if the event has been killed and has to be re-simulated.
void DumpStatus(G4int eventID)
Prints the status of the random number generator.
void BeginOfEventSimulation()
Reset the internal flags at the beginning of event simulation.
void BeginOfEventProcessing()
Method for storing the random engine state and resetting the internal flags at the beginning event ge...

The documentation for this class was generated from the following files: