Geant4 10.7.0
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 ) {
87 } else {
89 }
90
91 thePropagator = 0;
92
93 theEquationOfMotion = 0;
94
95 StartG4ErrorRunManagerHelper();
96
98
99 theG4ErrorPropagationNavigator = 0;
100
101 StartNavigator(); //navigator has to be initialized at the beggining !?!?!
102
103
104}
@ G4ErrorState_PreInit
static void SetVerbose(G4int ver)
static G4ErrorPropagatorData * GetErrorPropagatorData()
void SetState(G4ErrorState sta)

Referenced by GetErrorPropagatorManager().

◆ ~G4ErrorPropagatorManager()

G4ErrorPropagatorManager::~G4ErrorPropagatorManager ( )

Definition at line 108 of file G4ErrorPropagatorManager.cc.

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

Member Function Documentation

◆ CloseGeometry()

G4bool G4ErrorPropagatorManager::CloseGeometry ( )

Definition at line 302 of file G4ErrorPropagatorManager.cc.

303{
305 geomManager->OpenGeometry();
306 if( G4StateManager::GetStateManager()->GetCurrentState() != G4State_GeomClosed) {
308 }
309
310 return TRUE;
311}
@ G4State_Quit
@ G4State_GeomClosed
#define TRUE
Definition: Globals.hh:27
static G4GeometryManager * GetInstance()
void OpenGeometry(G4VPhysicalVolume *vol=nullptr)
static G4StateManager * GetStateManager()
G4bool SetNewState(const G4ApplicationState &requestedState)

◆ EventTermination()

void G4ErrorPropagatorManager::EventTermination ( )

◆ GetErrorPropagationNavigator()

G4ErrorPropagationNavigator * G4ErrorPropagatorManager::GetErrorPropagationNavigator ( ) const
inline

Definition at line 132 of file G4ErrorPropagatorManager.hh.

133 { return theG4ErrorPropagationNavigator; }

◆ GetErrorPropagatorManager()

G4ErrorPropagatorManager * G4ErrorPropagatorManager::GetErrorPropagatorManager ( )
static

Definition at line 68 of file G4ErrorPropagatorManager.cc.

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

◆ GetErrorRunManagerHelper()

G4ErrorRunManagerHelper * G4ErrorPropagatorManager::GetErrorRunManagerHelper ( ) const
inline

Definition at line 127 of file G4ErrorPropagatorManager.hh.

128 { return theG4ErrorRunManagerHelper; }

◆ GetPropagator()

G4ErrorPropagator * G4ErrorPropagatorManager::GetPropagator ( ) const
inline

Definition at line 135 of file G4ErrorPropagatorManager.hh.

136 { return thePropagator; }

◆ InitFieldForBackwards()

G4bool G4ErrorPropagatorManager::InitFieldForBackwards ( )

Definition at line 228 of file G4ErrorPropagatorManager.cc.

229{
230
231 if( G4ErrorPropagatorData::verbose() >= 4 ) G4cout << " G4ErrorPropagatorManager::InitFieldForBackwards() " << G4endl;
232 //----- Gets the current equation of motion
234 // G4cout << " fieldMgr " << fieldMgr << G4endl;
235 if( !fieldMgr ) return 0;
236
237 // G4Field* myfield = fieldMgr->GetDetectorField();
238 G4ChordFinder* cf = fieldMgr ->GetChordFinder();
239 if( !cf ) return 0;
240 auto driver = cf->GetIntegrationDriver();
241 if( !driver ) return 0;
242 auto equation = driver->GetEquationOfMotion();
243
244 //----- Replaces the equation by a G4ErrorMag_UsualEqRhs to handle backwards tracking
245 if ( !dynamic_cast<G4ErrorMag_UsualEqRhs*>(equation) ) {
246
247 G4MagneticField* myfield = (G4MagneticField*)fieldMgr->GetDetectorField();
248
249 // G4Mag_UsualEqRhs* fEquation_usual = dynamic_cast<G4Mag_UsualEqRhs*>(equation);
250 if( theEquationOfMotion == 0 ) theEquationOfMotion = new G4ErrorMag_UsualEqRhs(myfield);
251
252 //---- Pass the equation of motion to the G4MagIntegratorStepper
253 driver->SetEquationOfMotion( theEquationOfMotion );
254
255 //--- change stepper for speed tests
256 G4MagIntegratorStepper* g4eStepper = new G4ClassicalRK4(theEquationOfMotion);
257 // G4MagIntegratorStepper* g4eStepper = new G4ExactHelixStepper(theEquationOfMotion);
258
259 //----
260 G4MagneticField* field = static_cast<G4MagneticField*>(const_cast<G4Field*>(fieldMgr->GetDetectorField()));
261 G4ChordFinder* pChordFinder = new G4ChordFinder(field, 1.0e-2*mm, g4eStepper);
262
263 fieldMgr->SetChordFinder(pChordFinder);
264
265 }
266
267 return 1;
268}
#define G4endl
Definition: G4ios.hh:57
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 171 of file G4ErrorPropagatorManager.cc.

172{
173 if( G4ErrorPropagatorData::verbose() >= 1 ) G4cout << "InitGeant4e GEANT4e State= " << PrintG4ErrorState() << " GEANT4 State= " << PrintG4State() << G4endl;
175 //----- Initialize run
176 // if( G4StateManager::GetStateManager()->GetCurrentState() == G4State_PreInit) {
177
179 if ( currentState == G4State_PreInit || currentState == G4State_Idle) {
180 // G4eRunManager::GetRunManager()->Initialize();
181 theG4ErrorRunManagerHelper->InitializeGeometry();
182 theG4ErrorRunManagerHelper->InitializePhysics();
183 }
184
186
187 //- G4StateManager::GetStateManager()->SetNewState(G4State_Idle);
188
189 if( G4ErrorPropagatorData::verbose() >= 4 ) G4cout << " bef theG4ErrorPropagatorManager->RunInitialization() " << G4StateManager::GetStateManager()->GetCurrentState() << G4endl;
190 theG4ErrorRunManagerHelper->RunInitialization();
191 if( G4ErrorPropagatorData::verbose() >= 4 ) G4cout << " aft theG4ErrorPropagatorManager->RunInitialization() " << G4StateManager::GetStateManager()->GetCurrentState() << G4endl;
192
193 if( !thePropagator ) thePropagator = new G4ErrorPropagator(); // currently the only propagator possible
194
196 } else {
197 std::ostringstream message;
198 message << "Illegal GEANT4e State= " << PrintG4ErrorState();
199 G4Exception("G4ErrorPropagatorManager::InitGeant4e()",
200 "IllegalState", JustWarning, message);
201 }
202
203 //----- Set the tracking geometry for this propagation
204 //t SetTrackingGeometry();
205 //----- Set the physics list for this propagation
206 //t SetPhysicsList();
207 //----- Set the field propagation parameters for this propagation
208 //t SetFieldPropagationParameters();
210
211 if( G4ErrorPropagatorData::verbose() >= 2 ) G4cout << "End InitGeant4e GEANT4e State= " << PrintG4ErrorState() << " GEANT4 State= " << PrintG4State() << G4endl;
212
213
214}
G4ApplicationState
@ G4State_Idle
@ G4State_PreInit
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
const G4ApplicationState & GetCurrentState() const

◆ InitTrackPropagation()

void G4ErrorPropagatorManager::InitTrackPropagation ( )

Definition at line 218 of file G4ErrorPropagatorManager.cc.

219{
220 thePropagator->SetStepN( 0 );
221
223
224}
@ G4ErrorState_Propagating
void SetStepN(const G4int sn)

Referenced by InitGeant4e(), and Propagate().

◆ PrintG4ErrorState() [1/2]

G4String G4ErrorPropagatorManager::PrintG4ErrorState ( )

Definition at line 373 of file G4ErrorPropagatorManager.cc.

374{
376}

Referenced by InitGeant4e(), and PrintG4ErrorState().

◆ PrintG4ErrorState() [2/2]

G4String G4ErrorPropagatorManager::PrintG4ErrorState ( G4ErrorState  state)

Definition at line 380 of file G4ErrorPropagatorManager.cc.

381{
382 G4String nam = "";
383 switch (state){
385 nam = "G4ErrorState_PreInit";
386 break;
387 case G4ErrorState_Init:
388 nam = "G4ErrorState_Init";
389 break;
391 nam = "G4ErrorState_Propagating";
392 break;
394 nam = "G4ErrorState_TargetCloserThanBoundary";
395 break;
397 nam = "G4ErrorState_StoppedAtTarget";
398 break;
399 }
400
401 return nam;
402}
@ G4ErrorState_TargetCloserThanBoundary
@ G4ErrorState_StoppedAtTarget

◆ PrintG4State() [1/2]

G4String G4ErrorPropagatorManager::PrintG4State ( )

Definition at line 406 of file G4ErrorPropagatorManager.cc.

407{
408 return PrintG4State(G4StateManager::GetStateManager()->GetCurrentState());
409}

Referenced by InitGeant4e(), and PrintG4State().

◆ PrintG4State() [2/2]

G4String G4ErrorPropagatorManager::PrintG4State ( G4ApplicationState  state)

Definition at line 413 of file G4ErrorPropagatorManager.cc.

414{
415 G4String nam = "";
416 switch ( state ){
417 case G4State_PreInit:
418 nam = "G4State_PreInit";
419 break;
420 case G4State_Init:
421 nam = "G4State_Init";
422 break;
423 case G4State_Idle:
424 nam = "G4State_Idle";
425 break;
427 nam = "G4State_GeomClosed";
428 break;
430 nam = "G4State_EventProc";
431 break;
432 case G4State_Quit:
433 nam = "G4State_Quit";
434 break;
435 case G4State_Abort:
436 nam = "G4State_Abort";
437 break;
438 }
439
440 return nam;
441
442}
@ G4State_EventProc
@ G4State_Init
@ G4State_Abort

◆ Propagate()

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

Definition at line 272 of file G4ErrorPropagatorManager.cc.

273{
275 if( !thePropagator ) thePropagator = new G4ErrorPropagator(); // currently the only propagator possible
276
279
280 G4int ierr = thePropagator->Propagate( currentTS, target, mode );
281
283
284 return ierr;
285}
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 289 of file G4ErrorPropagatorManager.cc.

290{
292
293 if( !thePropagator ) thePropagator = new G4ErrorPropagator(); // currently the only propagator possible
294
296
297 return thePropagator->PropagateOneStep( currentTS );
298}
G4int PropagateOneStep(G4ErrorTrajState *currentTS)

◆ RunTermination()

void G4ErrorPropagatorManager::RunTermination ( )

Definition at line 365 of file G4ErrorPropagatorManager.cc.

◆ SetSteppingManagerVerboseLevel()

void G4ErrorPropagatorManager::SetSteppingManagerVerboseLevel ( )

Definition at line 350 of file G4ErrorPropagatorManager.cc.

351{
353 trkmgr->GetSteppingManager()->SetVerboseLevel( trkmgr->GetVerboseLevel() );
354}
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 343 of file G4ErrorPropagatorManager.cc.

344{
346}
void SetUserAction(G4UserEventAction *userAction)

◆ SetUserAction() [2/2]

void G4ErrorPropagatorManager::SetUserAction ( G4UserTrackingAction userAction)

Definition at line 336 of file G4ErrorPropagatorManager.cc.

337{
339}

◆ SetUserInitialization() [1/3]

void G4ErrorPropagatorManager::SetUserInitialization ( G4VPhysicalVolume userInit)

Definition at line 322 of file G4ErrorPropagatorManager.cc.

323{
324 theG4ErrorRunManagerHelper->SetUserInitialization( userInit);
325}
void SetUserInitialization(G4VUserDetectorConstruction *userInit)

◆ SetUserInitialization() [2/3]

void G4ErrorPropagatorManager::SetUserInitialization ( G4VUserDetectorConstruction userInit)

Definition at line 315 of file G4ErrorPropagatorManager.cc.

316{
317 theG4ErrorRunManagerHelper->SetUserInitialization( userInit);
318}

◆ SetUserInitialization() [3/3]

void G4ErrorPropagatorManager::SetUserInitialization ( G4VUserPhysicsList userInit)

Definition at line 329 of file G4ErrorPropagatorManager.cc.

330{
331 theG4ErrorRunManagerHelper->SetUserInitialization( userInit);
332}

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