Geant4 10.7.0
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
 
virtual ~G4MultiRunAction ()=default
 
virtual G4RunGenerateRun () override
 
virtual void BeginOfRunAction (const G4Run *aRun) override
 
virtual void EndOfRunAction (const G4Run *aRun) override
 
virtual void SetMaster (G4bool val=true) override
 
- Public Member Functions inherited from G4UserRunAction
 G4UserRunAction ()
 
virtual ~G4UserRunAction ()
 
virtual G4RunGenerateRun ()
 
virtual void BeginOfRunAction (const G4Run *aRun)
 
virtual void EndOfRunAction (const G4Run *aRun)
 
virtual void SetMaster (G4bool val=true)
 
G4bool IsMaster () const
 

Additional Inherited Members

- Protected Attributes inherited from G4UserRunAction
G4bool isMaster
 

Detailed Description

Definition at line 63 of file G4MultiRunAction.hh.

Constructor & Destructor Documentation

◆ G4MultiRunAction()

G4MultiRunAction::G4MultiRunAction ( )
default

◆ ~G4MultiRunAction()

virtual G4MultiRunAction::~G4MultiRunAction ( )
virtualdefault

Member Function Documentation

◆ BeginOfRunAction()

void G4MultiRunAction::BeginOfRunAction ( const G4Run aRun)
overridevirtual

Reimplemented from G4UserRunAction.

Definition at line 61 of file G4MultiRunAction.cc.

62{
63 std::for_each(begin(), end(),
64 [run](G4UserRunActionUPtr& e) { e->BeginOfRunAction(run); });
65}
std::unique_ptr< G4UserRunAction > G4UserRunActionUPtr

◆ EndOfRunAction()

void G4MultiRunAction::EndOfRunAction ( const G4Run aRun)
overridevirtual

Reimplemented from G4UserRunAction.

Definition at line 67 of file G4MultiRunAction.cc.

68{
69 std::for_each(begin(), end(),
70 [run](G4UserRunActionUPtr& e) { e->EndOfRunAction(run); });
71}

◆ GenerateRun()

G4Run * G4MultiRunAction::GenerateRun ( )
overridevirtual

Reimplemented from G4UserRunAction.

Definition at line 42 of file G4MultiRunAction.cc.

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

◆ SetMaster()

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

Reimplemented from G4UserRunAction.

Definition at line 73 of file G4MultiRunAction.cc.

74{
76 std::for_each(begin(), end(),
77 [val](G4UserRunActionUPtr& e) { e->SetMaster(val); });
78}
virtual void SetMaster(G4bool val=true)

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