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

#include <G4ErrorRunManagerHelper.hh>

Public Member Functions

 G4ErrorRunManagerHelper ()
 
virtual ~G4ErrorRunManagerHelper ()
 
void SetUserInitialization (G4VUserDetectorConstruction *userInit)
 
void SetUserInitialization (G4VPhysicalVolume *userInit)
 
void SetUserInitialization (G4VUserPhysicsList *userInit)
 
void SetUserAction (G4UserTrackingAction *userAction)
 
void SetUserAction (G4UserSteppingAction *userAction)
 
void RunInitialization ()
 
void InitializeGeometry ()
 
void InitializePhysics ()
 
void RunTermination ()
 
G4VUserPhysicsListGetUserPhysicsList () const
 

Static Public Member Functions

static G4ErrorRunManagerHelperGetRunManagerKernel ()
 

Detailed Description

Definition at line 52 of file G4ErrorRunManagerHelper.hh.

Constructor & Destructor Documentation

◆ G4ErrorRunManagerHelper()

G4ErrorRunManagerHelper::G4ErrorRunManagerHelper ( )

Definition at line 55 of file G4ErrorRunManagerHelper.cc.

56{
57 if(fRunManagerKernel) {
58 G4Exception("G4ErrorRunManagerHelper::G4ErrorRunManagerHelper()",
59 "InvalidSetup", FatalException,
60 "G4eRunManageKernel constructed twice.");
61 }
62 fRunManagerKernel = this;
63
64 //----- Look if somebody has created a G4RunManagerKernel
65 theG4RunManagerKernel = G4RunManagerKernel::GetRunManagerKernel();
66 if( theG4RunManagerKernel == 0 ) {
67 //--- if not create it
68 theG4RunManagerKernel = new G4RunManagerKernel();
69 G4cout << " creating G4RunManagerKernel " << theG4RunManagerKernel << G4endl;
70 }
71
72 theG4RunManagerKernel->SetVerboseLevel(2);
73 theUserPhysicsList = 0;
74 theUserWorld = 0;
75
76}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4RunManagerKernel * GetRunManagerKernel()
void SetVerboseLevel(G4int vl)

◆ ~G4ErrorRunManagerHelper()

G4ErrorRunManagerHelper::~G4ErrorRunManagerHelper ( )
virtual

Definition at line 80 of file G4ErrorRunManagerHelper.cc.

81{
82}

Member Function Documentation

◆ GetRunManagerKernel()

G4ErrorRunManagerHelper * G4ErrorRunManagerHelper::GetRunManagerKernel ( )
static

Definition at line 50 of file G4ErrorRunManagerHelper.cc.

51{ return fRunManagerKernel; }

◆ GetUserPhysicsList()

G4VUserPhysicsList * G4ErrorRunManagerHelper::GetUserPhysicsList ( ) const
inline

Definition at line 88 of file G4ErrorRunManagerHelper.hh.

89 { return theUserPhysicsList; }

Referenced by InitializePhysics().

◆ InitializeGeometry()

void G4ErrorRunManagerHelper::InitializeGeometry ( )

Definition at line 107 of file G4ErrorRunManagerHelper.cc.

108{
109 //check if user world has been directly called or someone initialized the world volume already
110 //----- First option: geometry has been defined to GEANT4e
111 if( theUserWorld != 0 ) {
112 theG4RunManagerKernel->DefineWorldVolume( theUserWorld );
113
114 //----- Second option: geometry has been defined to GEANT4, do nothing GEANT4 should take care
115 } else {
116 //--- Check that indeed geometry has been defined to GEANT4
118 ->GetNavigatorForTracking()->GetWorldVolume() == 0 ) {
119 G4Exception("G4ErrorRunManagerHelper::InitializeGeometry()",
120 "InvalisSetup", FatalException,
121 "No world defined in your geometry!" );
122 }
123
124 }
125}
void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
static G4TransportationManager * GetTransportationManager()

Referenced by G4ErrorPropagatorManager::InitGeant4e().

◆ InitializePhysics()

void G4ErrorRunManagerHelper::InitializePhysics ( )

Definition at line 129 of file G4ErrorRunManagerHelper.cc.

130{
131
132 G4cout << " G4ErrorRunManagerHelper::InitializePhysics " << G4endl;
133
134 //----- First option: physics list has been defined to GEANT4e
135 if( theUserPhysicsList != 0 ) {
136 theG4RunManagerKernel->SetPhysics(theUserPhysicsList);
137 theG4RunManagerKernel->InitializePhysics();
138 }else {
139 //----- Second option: physics list has been defined to GEANT4, do nothing GEANT4 should take care
141 //--- Physics should be G4ErrorPhysicsList, else send a warning
142 if( static_cast<const G4ErrorPhysicsList*>(G4RunManager::GetRunManager()->GetUserPhysicsList()) == 0 ) {
143 std::ostringstream message;
144 message << "Physics list is not G4ErrorPhysicsList. Are you sure?";
145 G4Exception("G4ErrorRunManagerHelper::InitializePhysics()",
146 "GEANT4e-Notification", JustWarning, message);
147 }
148 } else {
149 //----- Third option: no physics list has been defined, define a G4ErrorPhysicsList
150 theG4RunManagerKernel->SetPhysics(new G4ErrorPhysicsList);
151 // theG4RunManagerKernel->SetPhysics(new ExN02PhysicsList);
152 theG4RunManagerKernel->InitializePhysics();
153 }
154 }
155
156}
@ JustWarning
G4VUserPhysicsList * GetUserPhysicsList() const
void SetPhysics(G4VUserPhysicsList *uPhys)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:84

Referenced by G4ErrorPropagatorManager::InitGeant4e().

◆ RunInitialization()

void G4ErrorRunManagerHelper::RunInitialization ( )

Definition at line 160 of file G4ErrorRunManagerHelper.cc.

161{
162 theG4RunManagerKernel->RunInitialization();
163}
G4bool RunInitialization(G4bool fakeRun=false)

Referenced by G4ErrorPropagatorManager::InitGeant4e().

◆ RunTermination()

void G4ErrorRunManagerHelper::RunTermination ( )

Definition at line 182 of file G4ErrorRunManagerHelper.cc.

183{
184 theG4RunManagerKernel->RunTermination();
185}

Referenced by G4ErrorPropagatorManager::RunTermination().

◆ SetUserAction() [1/2]

void G4ErrorRunManagerHelper::SetUserAction ( G4UserSteppingAction userAction)

Definition at line 175 of file G4ErrorRunManagerHelper.cc.

176{
178}
void SetUserAction(G4UserEventAction *userAction)
static G4EventManager * GetEventManager()

◆ SetUserAction() [2/2]

void G4ErrorRunManagerHelper::SetUserAction ( G4UserTrackingAction userAction)

Definition at line 167 of file G4ErrorRunManagerHelper.cc.

168{
169
171}

◆ SetUserInitialization() [1/3]

void G4ErrorRunManagerHelper::SetUserInitialization ( G4VPhysicalVolume userInit)

Definition at line 93 of file G4ErrorRunManagerHelper.cc.

94{
95 theUserWorld = userInit;
96}

◆ SetUserInitialization() [2/3]

void G4ErrorRunManagerHelper::SetUserInitialization ( G4VUserDetectorConstruction userInit)

Definition at line 86 of file G4ErrorRunManagerHelper.cc.

87{
88 theUserWorld = userInit->Construct();
89}
virtual G4VPhysicalVolume * Construct()=0

Referenced by G4ErrorPropagatorManager::SetUserInitialization().

◆ SetUserInitialization() [3/3]

void G4ErrorRunManagerHelper::SetUserInitialization ( G4VUserPhysicsList userInit)

Definition at line 100 of file G4ErrorRunManagerHelper.cc.

101{
102 theUserPhysicsList = userInit;
103}

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