Geant4 11.1.1
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 = true
 

Detailed Description

Definition at line 56 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 57 of file G4MultiRunAction.cc.

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

◆ EndOfRunAction()

void G4MultiRunAction::EndOfRunAction ( const G4Run aRun)
overridevirtual

Reimplemented from G4UserRunAction.

Definition at line 64 of file G4MultiRunAction.cc.

65{
66 std::for_each(begin(), end(),
67 [run](G4UserRunActionUPtr& e) { e->EndOfRunAction(run); });
68}

◆ GenerateRun()

G4Run * G4MultiRunAction::GenerateRun ( )
overridevirtual

Reimplemented from G4UserRunAction.

Definition at line 37 of file G4MultiRunAction.cc.

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

◆ SetMaster()

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

Reimplemented from G4UserRunAction.

Definition at line 71 of file G4MultiRunAction.cc.

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

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