Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4MultiRunAction Class Reference

#include <G4MultiRunAction.hh>

+ Inheritance diagram for G4MultiRunAction:

Public Member Functions

 G4MultiRunAction ()=default
 
 ~G4MultiRunAction () override=default
 
G4RunGenerateRun () override
 
void BeginOfRunAction (const G4Run *aRun) override
 
void EndOfRunAction (const G4Run *aRun) override
 
void SetMaster (G4bool val=true) override
 
- Public Member Functions inherited from G4UserRunAction
 G4UserRunAction ()
 
virtual ~G4UserRunAction ()=default
 
G4bool IsMaster () const
 

Additional Inherited Members

- Protected Attributes inherited from G4UserRunAction
G4bool isMaster = true
 

Detailed Description

Definition at line 56 of file G4MultiRunAction.hh.

Constructor & Destructor Documentation

◆ G4MultiRunAction()

G4MultiRunAction::G4MultiRunAction ( )
default

◆ ~G4MultiRunAction()

G4MultiRunAction::~G4MultiRunAction ( )
overridedefault

Member Function Documentation

◆ BeginOfRunAction()

void G4MultiRunAction::BeginOfRunAction ( const G4Run * aRun)
overridevirtual

Reimplemented from G4UserRunAction.

Definition at line 55 of file G4MultiRunAction.cc.

56{
57 std::for_each(begin(), end(), [run](G4UserRunActionUPtr& e) { e->BeginOfRunAction(run); });
58}
std::unique_ptr< G4UserRunAction > G4UserRunActionUPtr

◆ EndOfRunAction()

void G4MultiRunAction::EndOfRunAction ( const G4Run * aRun)
overridevirtual

Reimplemented from G4UserRunAction.

Definition at line 61 of file G4MultiRunAction.cc.

62{
63 std::for_each(begin(), end(), [run](G4UserRunActionUPtr& e) { e->EndOfRunAction(run); });
64}

◆ GenerateRun()

G4Run * G4MultiRunAction::GenerateRun ( )
overridevirtual

Reimplemented from G4UserRunAction.

Definition at line 38 of file G4MultiRunAction.cc.

39{
40 G4Run* aRun = nullptr;
41 for (auto& ru : *this) {
42 auto anotherRun = ru->GenerateRun();
43 if (aRun != nullptr && anotherRun != nullptr) {
44 G4Exception("G4MultiRunAction::GenerateRun()", "Run0036", FatalException,
45 "More than one registered UserRunAction return an instance"
46 " of G4Run, not allowed.");
47 return nullptr;
48 }
49 if (anotherRun != nullptr) aRun = anotherRun;
50 }
51 return aRun;
52}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition G4Run.hh:49

◆ SetMaster()

void G4MultiRunAction::SetMaster ( G4bool val = true)
overridevirtual

Reimplemented from G4UserRunAction.

Definition at line 67 of file G4MultiRunAction.cc.

68{
70 std::for_each(begin(), end(), [val](G4UserRunActionUPtr& e) { e->SetMaster(val); });
71}
virtual void SetMaster(G4bool val=true)

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