Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
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 ()
 
G4VUserPhysicsList * GetUserPhysicsList () const
 

Static Public Member Functions

static G4ErrorRunManagerHelper * GetRunManagerKernel ()
 

Detailed Description

Definition at line 51 of file G4ErrorRunManagerHelper.hh.

Constructor & Destructor Documentation

G4ErrorRunManagerHelper::G4ErrorRunManagerHelper ( )

Definition at line 56 of file G4ErrorRunManagerHelper.cc.

References FatalException, G4cout, G4endl, G4Exception(), G4RunManagerKernel::GetRunManagerKernel(), and G4RunManagerKernel::SetVerboseLevel().

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

Definition at line 81 of file G4ErrorRunManagerHelper.cc.

82 {
83 }

Member Function Documentation

G4ErrorRunManagerHelper * G4ErrorRunManagerHelper::GetRunManagerKernel ( )
static

Definition at line 51 of file G4ErrorRunManagerHelper.cc.

52 { return fRunManagerKernel; }
G4VUserPhysicsList* G4ErrorRunManagerHelper::GetUserPhysicsList ( ) const
inline

Definition at line 87 of file G4ErrorRunManagerHelper.hh.

Referenced by InitializePhysics().

88  { return theUserPhysicsList; }
void G4ErrorRunManagerHelper::InitializeGeometry ( )

Definition at line 108 of file G4ErrorRunManagerHelper.cc.

References G4RunManagerKernel::DefineWorldVolume(), FatalException, G4Exception(), and G4TransportationManager::GetTransportationManager().

Referenced by G4ErrorPropagatorManager::InitGeant4e().

109 {
110  //check if user world has been directly called or someone initialized the world volume already
111  //----- First option: geometry has been defined to GEANT4e
112  if( theUserWorld != 0 ) {
113  theG4RunManagerKernel->DefineWorldVolume( theUserWorld );
114 
115  //----- Second option: geometry has been defined to GEANT4, do nothing GEANT4 should take care
116  } else {
117  // G4cerr << "G4 TM " << G4TransportationManager::GetTransportationManager()
118  // << " NAV " << G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()
119  // << " WORLD " << G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume() << G4endl;
120  //--- Check that indeed geometry has been defined to GEANT4
122  ->GetNavigatorForTracking()->GetWorldVolume() == 0 ) {
123  G4Exception("G4ErrorRunManagerHelper::InitializeGeometry()",
124  "InvalisSetup", FatalException,
125  "No world defined in your geometry!" );
126  }
127 
128  }
129 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4TransportationManager * GetTransportationManager()
void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
void G4ErrorRunManagerHelper::InitializePhysics ( )

Definition at line 133 of file G4ErrorRunManagerHelper.cc.

References G4cerr, G4cout, G4endl, G4RunManager::GetRunManager(), GetUserPhysicsList(), G4RunManagerKernel::InitializePhysics(), and G4RunManagerKernel::SetPhysics().

Referenced by G4ErrorPropagatorManager::InitGeant4e().

134 {
135 
136  G4cout << " G4ErrorRunManagerHelper::InitializePhysics " << G4endl;
137 
138  //----- First option: physics list has been defined to GEANT4e
139  if( theUserPhysicsList != 0 ) {
140  theG4RunManagerKernel->SetPhysics(theUserPhysicsList);
141  theG4RunManagerKernel->InitializePhysics();
142  }else {
143  //----- Second option: physics list has been defined to GEANT4, do nothing GEANT4 should take care
145  //--- Physics should be G4ErrorPhysicsList, else send a warning
146  if( static_cast<const G4ErrorPhysicsList*>(G4RunManager::GetRunManager()->GetUserPhysicsList()) == 0 ) {
147  G4cerr << " WARNING G4ErrorRunManagerHelper::InitializePhysics() physics list is not G4ErrorPhysicsList. Are you sure? " << G4endl;
148  }
149  } else {
150  //----- Third option: no physics list has been defined, define a G4ErrorPhysicsList
151  theG4RunManagerKernel->SetPhysics(new G4ErrorPhysicsList);
152  // theG4RunManagerKernel->SetPhysics(new ExN02PhysicsList);
153  theG4RunManagerKernel->InitializePhysics();
154  }
155  }
156 
157 }
void SetPhysics(G4VUserPhysicsList *uPhys)
G4VUserPhysicsList * GetUserPhysicsList() const
G4GLOB_DLL std::ostream G4cout
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
void G4ErrorRunManagerHelper::RunInitialization ( )

Definition at line 161 of file G4ErrorRunManagerHelper.cc.

References G4RunManagerKernel::RunInitialization().

Referenced by G4ErrorPropagatorManager::InitGeant4e().

162 {
163  theG4RunManagerKernel->RunInitialization();
164 }
G4bool RunInitialization(G4bool fakeRun=false)
void G4ErrorRunManagerHelper::RunTermination ( )

Definition at line 183 of file G4ErrorRunManagerHelper.cc.

References G4RunManagerKernel::RunTermination().

Referenced by G4ErrorPropagatorManager::RunTermination().

184 {
185  theG4RunManagerKernel->RunTermination();
186 }
void G4ErrorRunManagerHelper::SetUserAction ( G4UserTrackingAction *  userAction)

Definition at line 168 of file G4ErrorRunManagerHelper.cc.

References G4EventManager::GetEventManager(), and G4EventManager::SetUserAction().

169 {
170 
172 }
void SetUserAction(G4UserEventAction *userAction)
static G4EventManager * GetEventManager()
void G4ErrorRunManagerHelper::SetUserAction ( G4UserSteppingAction *  userAction)

Definition at line 176 of file G4ErrorRunManagerHelper.cc.

References G4EventManager::GetEventManager(), and G4EventManager::SetUserAction().

177 {
179 }
void SetUserAction(G4UserEventAction *userAction)
static G4EventManager * GetEventManager()
void G4ErrorRunManagerHelper::SetUserInitialization ( G4VUserDetectorConstruction *  userInit)

Definition at line 87 of file G4ErrorRunManagerHelper.cc.

References G4VUserDetectorConstruction::Construct().

Referenced by G4ErrorPropagatorManager::SetUserInitialization().

88 {
89  theUserWorld = userInit->Construct();
90 }
virtual G4VPhysicalVolume * Construct()=0
void G4ErrorRunManagerHelper::SetUserInitialization ( G4VPhysicalVolume *  userInit)

Definition at line 94 of file G4ErrorRunManagerHelper.cc.

95 {
96  theUserWorld = userInit;
97 }
void G4ErrorRunManagerHelper::SetUserInitialization ( G4VUserPhysicsList *  userInit)

Definition at line 101 of file G4ErrorRunManagerHelper.cc.

102 {
103  theUserPhysicsList = userInit;
104 }

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