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

#include <G4ErrorPropagatorManager.hh>

Public Member Functions

 G4ErrorPropagatorManager ()
 
 ~G4ErrorPropagatorManager ()
 
void EventTermination ()
 
void RunTermination ()
 
void InitGeant4e ()
 
void InitTrackPropagation ()
 
G4bool InitFieldForBackwards ()
 
G4int Propagate (G4ErrorTrajState *currentTS, const G4ErrorTarget *target, G4ErrorMode mode=G4ErrorMode_PropForwards)
 
G4int PropagateOneStep (G4ErrorTrajState *currentTS, G4ErrorMode mode=G4ErrorMode_PropForwards)
 
G4bool CloseGeometry ()
 
void SetUserInitialization (G4VUserDetectorConstruction *userInit)
 
void SetUserInitialization (G4VPhysicalVolume *userInit)
 
void SetUserInitialization (G4VUserPhysicsList *userInit)
 
void SetUserAction (G4UserTrackingAction *userAction)
 
void SetUserAction (G4UserSteppingAction *userAction)
 
G4String PrintG4ErrorState ()
 
G4String PrintG4ErrorState (G4ErrorState state)
 
G4String PrintG4State ()
 
G4String PrintG4State (G4ApplicationState state)
 
G4ErrorRunManagerHelperGetErrorRunManagerHelper () const
 
void SetSteppingManagerVerboseLevel ()
 
G4ErrorPropagationNavigatorGetErrorPropagationNavigator () const
 
G4ErrorPropagatorGetPropagator () const
 

Static Public Member Functions

static G4ErrorPropagatorManagerGetErrorPropagatorManager ()
 

Detailed Description

Definition at line 62 of file G4ErrorPropagatorManager.hh.

Constructor & Destructor Documentation

◆ G4ErrorPropagatorManager()

G4ErrorPropagatorManager::G4ErrorPropagatorManager ( )

Definition at line 79 of file G4ErrorPropagatorManager.cc.

80{
81 //----- Initialize a few things
82 // o theG4ErrorPropagatorManager = this;
83
84 char* g4emverb = std::getenv("G4EVERBOSE");
85 if(!g4emverb)
86 {
88 }
89 else
90 {
92 }
93
94 thePropagator = 0;
95
96 theEquationOfMotion = 0;
97
98 StartG4ErrorRunManagerHelper();
99
102
103 theG4ErrorPropagationNavigator = 0;
104
105 StartNavigator(); // navigator has to be initialized at the beggining !?!?!
106}
@ G4ErrorState_PreInit
static void SetVerbose(G4int ver)
static G4ErrorPropagatorData * GetErrorPropagatorData()
void SetState(G4ErrorState sta)

Referenced by GetErrorPropagatorManager().

◆ ~G4ErrorPropagatorManager()

G4ErrorPropagatorManager::~G4ErrorPropagatorManager ( )

Definition at line 109 of file G4ErrorPropagatorManager.cc.

110{
111 delete theEquationOfMotion;
112 delete theG4ErrorPropagationNavigator;
113 delete thePropagator;
114 delete theG4ErrorRunManagerHelper;
115 delete theG4ErrorPropagatorManager;
116}

Member Function Documentation

◆ CloseGeometry()

G4bool G4ErrorPropagatorManager::CloseGeometry ( )

Definition at line 335 of file G4ErrorPropagatorManager.cc.

336{
338 geomManager->OpenGeometry();
339 if(G4StateManager::GetStateManager()->GetCurrentState() != G4State_GeomClosed)
340 {
342 }
343
344 return TRUE;
345}
@ G4State_Quit
@ G4State_GeomClosed
static G4GeometryManager * GetInstance()
void OpenGeometry(G4VPhysicalVolume *vol=nullptr)
static G4StateManager * GetStateManager()
G4bool SetNewState(const G4ApplicationState &requestedState)
#define TRUE
Definition globals.hh:41

◆ EventTermination()

void G4ErrorPropagatorManager::EventTermination ( )

◆ GetErrorPropagationNavigator()

G4ErrorPropagationNavigator * G4ErrorPropagatorManager::GetErrorPropagationNavigator ( ) const
inline

Definition at line 133 of file G4ErrorPropagatorManager.hh.

134 {
135 return theG4ErrorPropagationNavigator;
136 }

◆ GetErrorPropagatorManager()

G4ErrorPropagatorManager * G4ErrorPropagatorManager::GetErrorPropagatorManager ( )
static

Definition at line 68 of file G4ErrorPropagatorManager.cc.

69{
70 if(theG4ErrorPropagatorManager == NULL)
71 {
72 theG4ErrorPropagatorManager = new G4ErrorPropagatorManager;
73 }
74
75 return theG4ErrorPropagatorManager;
76}

◆ GetErrorRunManagerHelper()

G4ErrorRunManagerHelper * G4ErrorPropagatorManager::GetErrorRunManagerHelper ( ) const
inline

Definition at line 126 of file G4ErrorPropagatorManager.hh.

127 {
128 return theG4ErrorRunManagerHelper;
129 }

◆ GetPropagator()

G4ErrorPropagator * G4ErrorPropagatorManager::GetPropagator ( ) const
inline

Definition at line 138 of file G4ErrorPropagatorManager.hh.

138{ return thePropagator; }

◆ InitFieldForBackwards()

G4bool G4ErrorPropagatorManager::InitFieldForBackwards ( )

Definition at line 247 of file G4ErrorPropagatorManager.cc.

248{
250 G4cout << " G4ErrorPropagatorManager::InitFieldForBackwards() " << G4endl;
251 //----- Gets the current equation of motion
252 G4FieldManager* fieldMgr =
254 // G4cout << " fieldMgr " << fieldMgr << G4endl;
255 if(!fieldMgr)
256 return 0;
257
258 // G4Field* myfield = fieldMgr->GetDetectorField();
259 G4ChordFinder* cf = fieldMgr->GetChordFinder();
260 if(!cf)
261 return 0;
262 auto driver = cf->GetIntegrationDriver();
263 if(!driver)
264 return 0;
265 auto equation = driver->GetEquationOfMotion();
266
267 //----- Replaces the equation by a G4ErrorMag_UsualEqRhs to handle backwards
268 //tracking
269 if(!dynamic_cast<G4ErrorMag_UsualEqRhs*>(equation))
270 {
271 G4MagneticField* myfield = (G4MagneticField*) fieldMgr->GetDetectorField();
272
273 // G4Mag_UsualEqRhs* fEquation_usual =
274 // dynamic_cast<G4Mag_UsualEqRhs*>(equation);
275 if(theEquationOfMotion == 0)
276 theEquationOfMotion = new G4ErrorMag_UsualEqRhs(myfield);
277
278 //---- Pass the equation of motion to the G4MagIntegratorStepper
279 driver->SetEquationOfMotion(theEquationOfMotion);
280
281 //--- change stepper for speed tests
282 G4MagIntegratorStepper* g4eStepper =
283 new G4ClassicalRK4(theEquationOfMotion);
284 // G4MagIntegratorStepper* g4eStepper = new
285 // G4ExactHelixStepper(theEquationOfMotion);
286
287 //----
288 G4MagneticField* field = static_cast<G4MagneticField*>(
289 const_cast<G4Field*>(fieldMgr->GetDetectorField()));
290 G4ChordFinder* pChordFinder =
291 new G4ChordFinder(field, 1.0e-2 * mm, g4eStepper);
292
293 fieldMgr->SetChordFinder(pChordFinder);
294 }
295
296 return 1;
297}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4VIntegrationDriver * GetIntegrationDriver()
void SetChordFinder(G4ChordFinder *aChordFinder)
const G4Field * GetDetectorField() const
G4ChordFinder * GetChordFinder()
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const
virtual G4EquationOfMotion * GetEquationOfMotion()=0

Referenced by InitGeant4e().

◆ InitGeant4e()

void G4ErrorPropagatorManager::InitGeant4e ( )

Definition at line 177 of file G4ErrorPropagatorManager.cc.

178{
180 G4cout << "InitGeant4e GEANT4e State= " << PrintG4ErrorState()
181 << " GEANT4 State= " << PrintG4State() << G4endl;
182 G4ApplicationState currentState =
184 //----- Initialize run
185 // if( G4StateManager::GetStateManager()->GetCurrentState() ==
186 // G4State_PreInit) {
187
190 {
191 if(currentState == G4State_PreInit || currentState == G4State_Idle)
192 {
193 // G4eRunManager::GetRunManager()->Initialize();
194 theG4ErrorRunManagerHelper->InitializeGeometry();
195 theG4ErrorRunManagerHelper->InitializePhysics();
196 }
197
199
200 //- G4StateManager::GetStateManager()->SetNewState(G4State_Idle);
201
203 G4cout << " bef theG4ErrorPropagatorManager->RunInitialization() "
205 theG4ErrorRunManagerHelper->RunInitialization();
207 G4cout << " aft theG4ErrorPropagatorManager->RunInitialization() "
209
210 if(!thePropagator)
211 thePropagator =
212 new G4ErrorPropagator(); // currently the only propagator possible
213
215 }
216 else
217 {
218 std::ostringstream message;
219 message << "Illegal GEANT4e State= " << PrintG4ErrorState();
220 G4Exception("G4ErrorPropagatorManager::InitGeant4e()", "IllegalState",
221 JustWarning, message);
222 }
223
224 //----- Set the tracking geometry for this propagation
225 // t SetTrackingGeometry();
226 //----- Set the physics list for this propagation
227 // t SetPhysicsList();
228 //----- Set the field propagation parameters for this propagation
229 // t SetFieldPropagationParameters();
231
233 G4cout << "End InitGeant4e GEANT4e State= " << PrintG4ErrorState()
234 << " GEANT4 State= " << PrintG4State() << G4endl;
235}
G4ApplicationState
@ G4State_Idle
@ G4State_PreInit
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
const G4ApplicationState & GetCurrentState() const

◆ InitTrackPropagation()

void G4ErrorPropagatorManager::InitTrackPropagation ( )

Definition at line 238 of file G4ErrorPropagatorManager.cc.

239{
240 thePropagator->SetStepN(0);
241
244}
@ G4ErrorState_Propagating
void SetStepN(const G4int sn)

Referenced by InitGeant4e(), and Propagate().

◆ PrintG4ErrorState() [1/2]

G4String G4ErrorPropagatorManager::PrintG4ErrorState ( )

Definition at line 403 of file G4ErrorPropagatorManager.cc.

404{
405 return PrintG4ErrorState(
407}

Referenced by InitGeant4e(), and PrintG4ErrorState().

◆ PrintG4ErrorState() [2/2]

G4String G4ErrorPropagatorManager::PrintG4ErrorState ( G4ErrorState state)

Definition at line 410 of file G4ErrorPropagatorManager.cc.

411{
412 G4String nam = "";
413 switch(state)
414 {
416 nam = "G4ErrorState_PreInit";
417 break;
419 nam = "G4ErrorState_Init";
420 break;
422 nam = "G4ErrorState_Propagating";
423 break;
425 nam = "G4ErrorState_TargetCloserThanBoundary";
426 break;
428 nam = "G4ErrorState_StoppedAtTarget";
429 break;
430 }
431
432 return nam;
433}
@ G4ErrorState_TargetCloserThanBoundary
@ G4ErrorState_StoppedAtTarget

◆ PrintG4State() [1/2]

G4String G4ErrorPropagatorManager::PrintG4State ( )

Definition at line 436 of file G4ErrorPropagatorManager.cc.

437{
438 return PrintG4State(G4StateManager::GetStateManager()->GetCurrentState());
439}

Referenced by InitGeant4e(), and PrintG4State().

◆ PrintG4State() [2/2]

G4String G4ErrorPropagatorManager::PrintG4State ( G4ApplicationState state)

Definition at line 442 of file G4ErrorPropagatorManager.cc.

443{
444 G4String nam = "";
445 switch(state)
446 {
447 case G4State_PreInit:
448 nam = "G4State_PreInit";
449 break;
450 case G4State_Init:
451 nam = "G4State_Init";
452 break;
453 case G4State_Idle:
454 nam = "G4State_Idle";
455 break;
457 nam = "G4State_GeomClosed";
458 break;
460 nam = "G4State_EventProc";
461 break;
462 case G4State_Quit:
463 nam = "G4State_Quit";
464 break;
465 case G4State_Abort:
466 nam = "G4State_Abort";
467 break;
468 }
469
470 return nam;
471}
@ G4State_EventProc
@ G4State_Init
@ G4State_Abort

◆ Propagate()

G4int G4ErrorPropagatorManager::Propagate ( G4ErrorTrajState * currentTS,
const G4ErrorTarget * target,
G4ErrorMode mode = G4ErrorMode_PropForwards )

Definition at line 300 of file G4ErrorPropagatorManager.cc.

303{
305 if(!thePropagator)
306 thePropagator =
307 new G4ErrorPropagator(); // currently the only propagator possible
308
311
312 G4int ierr = thePropagator->Propagate(currentTS, target, mode);
313
315
316 return ierr;
317}
int G4int
Definition G4Types.hh:85
void SetMode(G4ErrorMode mode)
G4int Propagate(G4ErrorTrajState *currentTS, const G4ErrorTarget *target, G4ErrorMode mode=G4ErrorMode_PropForwards)

◆ PropagateOneStep()

G4int G4ErrorPropagatorManager::PropagateOneStep ( G4ErrorTrajState * currentTS,
G4ErrorMode mode = G4ErrorMode_PropForwards )

Definition at line 320 of file G4ErrorPropagatorManager.cc.

322{
324
325 if(!thePropagator)
326 thePropagator =
327 new G4ErrorPropagator(); // currently the only propagator possible
328
330
331 return thePropagator->PropagateOneStep(currentTS);
332}
G4int PropagateOneStep(G4ErrorTrajState *currentTS)

◆ RunTermination()

void G4ErrorPropagatorManager::RunTermination ( )

Definition at line 395 of file G4ErrorPropagatorManager.cc.

◆ SetSteppingManagerVerboseLevel()

void G4ErrorPropagatorManager::SetSteppingManagerVerboseLevel ( )

Definition at line 381 of file G4ErrorPropagatorManager.cc.

382{
383 G4TrackingManager* trkmgr =
386}
static G4EventManager * GetEventManager()
G4TrackingManager * GetTrackingManager() const
void SetVerboseLevel(G4int vLevel)
G4int GetVerboseLevel() const
G4SteppingManager * GetSteppingManager() const

Referenced by Propagate(), and PropagateOneStep().

◆ SetUserAction() [1/2]

void G4ErrorPropagatorManager::SetUserAction ( G4UserSteppingAction * userAction)

Definition at line 375 of file G4ErrorPropagatorManager.cc.

376{
378}
void SetUserAction(G4UserEventAction *userAction)

◆ SetUserAction() [2/2]

void G4ErrorPropagatorManager::SetUserAction ( G4UserTrackingAction * userAction)

Definition at line 369 of file G4ErrorPropagatorManager.cc.

370{
372}

◆ SetUserInitialization() [1/3]

void G4ErrorPropagatorManager::SetUserInitialization ( G4VPhysicalVolume * userInit)

Definition at line 355 of file G4ErrorPropagatorManager.cc.

357{
358 theG4ErrorRunManagerHelper->SetUserInitialization(userInit);
359}
void SetUserInitialization(G4VUserDetectorConstruction *userInit)

◆ SetUserInitialization() [2/3]

void G4ErrorPropagatorManager::SetUserInitialization ( G4VUserDetectorConstruction * userInit)

Definition at line 348 of file G4ErrorPropagatorManager.cc.

350{
351 theG4ErrorRunManagerHelper->SetUserInitialization(userInit);
352}

◆ SetUserInitialization() [3/3]

void G4ErrorPropagatorManager::SetUserInitialization ( G4VUserPhysicsList * userInit)

Definition at line 362 of file G4ErrorPropagatorManager.cc.

364{
365 theG4ErrorRunManagerHelper->SetUserInitialization(userInit);
366}

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