Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
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 63 of file G4ErrorPropagatorManager.hh.

Constructor & Destructor Documentation

G4ErrorPropagatorManager::G4ErrorPropagatorManager ( )

Definition at line 80 of file G4ErrorPropagatorManager.cc.

References G4ErrorState_PreInit, G4ErrorPropagatorData::GetErrorPropagatorData(), G4ErrorPropagatorData::SetState(), and G4ErrorPropagatorData::SetVerbose().

Referenced by GetErrorPropagatorManager().

81 {
82  //----- Initialize a few things
83  //o theG4ErrorPropagatorManager = this;
84 
85  char* g4emverb = getenv("G4EVERBOSE");
86  if( !g4emverb ) {
88  } else {
90  }
91 
92  thePropagator = 0;
93 
94  theEquationOfMotion = 0;
95 
96  StartG4ErrorRunManagerHelper();
97 
99 
100  theG4ErrorPropagationNavigator = 0;
101 
102  StartNavigator(); //navigator has to be initialized at the beggining !?!?!
103 
104 
105 }
void SetState(G4ErrorState sta)
static void SetVerbose(G4int ver)
static G4ErrorPropagatorData * GetErrorPropagatorData()
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

G4bool G4ErrorPropagatorManager::CloseGeometry ( )

Definition at line 306 of file G4ErrorPropagatorManager.cc.

References G4State_GeomClosed, G4State_Quit, G4GeometryManager::GetInstance(), G4StateManager::GetStateManager(), G4GeometryManager::OpenGeometry(), G4StateManager::SetNewState(), and TRUE.

Referenced by Finalize().

307 {
309  geomManager->OpenGeometry();
310  if( G4StateManager::GetStateManager()->GetCurrentState() != G4State_GeomClosed) {
312  }
313 
314  return TRUE;
315 }
static G4StateManager * GetStateManager()
G4bool SetNewState(G4ApplicationState requestedState)
#define TRUE
Definition: globals.hh:55
static G4GeometryManager * GetInstance()
void OpenGeometry(G4VPhysicalVolume *vol=0)
void G4ErrorPropagatorManager::EventTermination ( )
G4ErrorPropagationNavigator* G4ErrorPropagatorManager::GetErrorPropagationNavigator ( ) const
inline

Definition at line 133 of file G4ErrorPropagatorManager.hh.

134  { return theG4ErrorPropagationNavigator; }
G4ErrorPropagatorManager * G4ErrorPropagatorManager::GetErrorPropagatorManager ( )
static

Definition at line 69 of file G4ErrorPropagatorManager.cc.

References G4ErrorPropagatorManager().

Referenced by Finalize(), Initialize(), and ProcessEvent().

70 {
71  if( theG4ErrorPropagatorManager == NULL ) {
72  theG4ErrorPropagatorManager = new G4ErrorPropagatorManager;
73  }
74 
75  return theG4ErrorPropagatorManager;
76 }
G4ErrorRunManagerHelper* G4ErrorPropagatorManager::GetErrorRunManagerHelper ( ) const
inline

Definition at line 128 of file G4ErrorPropagatorManager.hh.

129  { return theG4ErrorRunManagerHelper; }
G4ErrorPropagator* G4ErrorPropagatorManager::GetPropagator ( ) const
inline

Definition at line 136 of file G4ErrorPropagatorManager.hh.

Referenced by ProcessEvent().

137  { return thePropagator; }
G4bool G4ErrorPropagatorManager::InitFieldForBackwards ( )

Definition at line 230 of file G4ErrorPropagatorManager.cc.

References G4cout, G4endl, G4FieldManager::GetChordFinder(), G4FieldManager::GetDetectorField(), G4MagIntegratorStepper::GetEquationOfMotion(), G4TransportationManager::GetFieldManager(), G4ChordFinder::GetIntegrationDriver(), G4MagInt_Driver::GetStepper(), G4TransportationManager::GetTransportationManager(), python.hepunit::mm, G4FieldManager::SetChordFinder(), G4MagIntegratorStepper::SetEquationOfMotion(), and G4ErrorPropagatorData::verbose().

Referenced by InitGeant4e().

231 {
232 
233  if( G4ErrorPropagatorData::verbose() >= 4 ) G4cout << " G4ErrorPropagatorManager::InitFieldForBackwards() " << G4endl;
234  //----- Gets the current equation of motion
236  // G4cout << " fieldMgr " << fieldMgr << G4endl;
237  if( !fieldMgr ) return 0;
238 
239  // G4Field* myfield = fieldMgr->GetDetectorField();
240  G4ChordFinder* cf = fieldMgr ->GetChordFinder();
241  if( !cf ) return 0;
243  if( !mid ) return 0;
244  G4MagIntegratorStepper* stepper = const_cast<G4MagIntegratorStepper*>(mid->GetStepper());
245  if( !stepper ) return 0;
246  G4EquationOfMotion* equation = stepper->GetEquationOfMotion();
247 
248  //----- Replaces the equation by a G4ErrorMag_UsualEqRhs to handle backwards tracking
249  if ( !dynamic_cast<G4ErrorMag_UsualEqRhs*>(equation) ) {
250 
251  G4MagneticField* myfield = (G4MagneticField*)fieldMgr->GetDetectorField();
252 
253  // G4Mag_UsualEqRhs* fEquation_usual = dynamic_cast<G4Mag_UsualEqRhs*>(equation);
254  if( theEquationOfMotion == 0 ) theEquationOfMotion = new G4ErrorMag_UsualEqRhs(myfield);
255 
256  //---- Pass the equation of motion to the G4MagIntegratorStepper
257  stepper->SetEquationOfMotion( theEquationOfMotion );
258 
259  //--- change stepper for speed tests
260  G4MagIntegratorStepper* g4eStepper = new G4ClassicalRK4(theEquationOfMotion);
261  // G4MagIntegratorStepper* g4eStepper = new G4ExactHelixStepper(theEquationOfMotion);
262 
263  //----
264  G4MagneticField* field = static_cast<G4MagneticField*>(const_cast<G4Field*>(fieldMgr->GetDetectorField()));
265  G4ChordFinder* pChordFinder = new G4ChordFinder(field, 1.0e-2*mm, g4eStepper);
266 
267  fieldMgr->SetChordFinder(pChordFinder);
268 
269  }
270 
271  return 1;
272 }
G4ChordFinder * GetChordFinder()
void SetEquationOfMotion(G4EquationOfMotion *newEquation)
const G4MagIntegratorStepper * GetStepper() const
void SetChordFinder(G4ChordFinder *aChordFinder)
G4EquationOfMotion * GetEquationOfMotion()
G4GLOB_DLL std::ostream G4cout
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const
#define G4endl
Definition: G4ios.hh:61
const G4Field * GetDetectorField() const
G4MagInt_Driver * GetIntegrationDriver()
void G4ErrorPropagatorManager::InitGeant4e ( )

Definition at line 172 of file G4ErrorPropagatorManager.cc.

References G4cerr, G4cout, G4endl, G4ErrorState_Init, G4ErrorState_PreInit, G4State_Idle, G4State_PreInit, G4StateManager::GetCurrentState(), G4ErrorPropagatorData::GetErrorPropagatorData(), G4StateManager::GetStateManager(), InitFieldForBackwards(), G4ErrorRunManagerHelper::InitializeGeometry(), G4ErrorRunManagerHelper::InitializePhysics(), InitTrackPropagation(), PrintG4ErrorState(), PrintG4State(), G4ErrorRunManagerHelper::RunInitialization(), G4ErrorPropagatorData::SetState(), and G4ErrorPropagatorData::verbose().

Referenced by Initialize().

173 {
174  if( G4ErrorPropagatorData::verbose() >= 1 ) G4cout << "InitGeant4e GEANT4e State= " << PrintG4ErrorState() << " GEANT4 State= " << PrintG4State() << G4endl;
176  //----- Initialize run
177  // if( G4StateManager::GetStateManager()->GetCurrentState() == G4State_PreInit) {
178 
180  if ( currentState == G4State_PreInit || currentState == G4State_Idle) {
181  // G4eRunManager::GetRunManager()->Initialize();
182  theG4ErrorRunManagerHelper->InitializeGeometry();
183  theG4ErrorRunManagerHelper->InitializePhysics();
184  }
185 
187 
188  //- G4StateManager::GetStateManager()->SetNewState(G4State_Idle);
189 
190  if( G4ErrorPropagatorData::verbose() >= 4 ) G4cout << " bef theG4ErrorPropagatorManager->RunInitialization() " << G4StateManager::GetStateManager()->GetCurrentState() << G4endl;
191  theG4ErrorRunManagerHelper->RunInitialization();
192  if( G4ErrorPropagatorData::verbose() >= 4 ) G4cout << " aft theG4ErrorPropagatorManager->RunInitialization() " << G4StateManager::GetStateManager()->GetCurrentState() << G4endl;
193 
194  if( !thePropagator ) thePropagator = new G4ErrorPropagator(); // currently the only propagator possible
195 
197  } else {
198  G4cerr << "G4ErrorPropagatorManager::InitGeant4e: Illegal application state - "
199  << "G4ErrorPropagatorManager::InitGeant4e() ignored." << G4endl;
200  G4cerr << " GEANT4e State= " << PrintG4ErrorState()
201  //<< " GEANT4 State= " << PrintG4State()
202  << G4endl;
203  }
204 
205  //----- Set the tracking geometry for this propagation
206  //t SetTrackingGeometry();
207  //----- Set the physics list for this propagation
208  //t SetPhysicsList();
209  //----- Set the field propagation parameters for this propagation
210  //t SetFieldPropagationParameters();
212 
213  if( G4ErrorPropagatorData::verbose() >= 2 ) G4cout << "End InitGeant4e GEANT4e State= " << PrintG4ErrorState() << " GEANT4 State= " << PrintG4State() << G4endl;
214 
215 
216 }
void SetState(G4ErrorState sta)
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
G4ApplicationState GetCurrentState() const
#define G4endl
Definition: G4ios.hh:61
static G4ErrorPropagatorData * GetErrorPropagatorData()
G4ApplicationState
G4GLOB_DLL std::ostream G4cerr
void G4ErrorPropagatorManager::InitTrackPropagation ( )
G4String G4ErrorPropagatorManager::PrintG4ErrorState ( )

Definition at line 377 of file G4ErrorPropagatorManager.cc.

References G4ErrorPropagatorData::GetErrorPropagatorData().

Referenced by InitGeant4e().

378 {
380 }
static G4ErrorPropagatorData * GetErrorPropagatorData()
G4String G4ErrorPropagatorManager::PrintG4ErrorState ( G4ErrorState  state)

Definition at line 384 of file G4ErrorPropagatorManager.cc.

References G4ErrorState_Init, G4ErrorState_PreInit, G4ErrorState_Propagating, G4ErrorState_StoppedAtTarget, and G4ErrorState_TargetCloserThanBoundary.

385 {
386  G4String nam = "";
387  switch (state){
388  case G4ErrorState_PreInit:
389  nam = "G4ErrorState_PreInit";
390  break;
391  case G4ErrorState_Init:
392  nam = "G4ErrorState_Init";
393  break;
395  nam = "G4ErrorState_Propagating";
396  break;
398  nam = "G4ErrorState_TargetCloserThanBoundary";
399  break;
401  nam = "G4ErrorState_StoppedAtTarget";
402  break;
403  }
404 
405  return nam;
406 }
G4String G4ErrorPropagatorManager::PrintG4State ( )

Definition at line 410 of file G4ErrorPropagatorManager.cc.

References G4StateManager::GetStateManager().

Referenced by InitGeant4e().

411 {
412  return PrintG4State(G4StateManager::GetStateManager()->GetCurrentState());
413 }
static G4StateManager * GetStateManager()
G4String G4ErrorPropagatorManager::PrintG4State ( G4ApplicationState  state)

Definition at line 417 of file G4ErrorPropagatorManager.cc.

References G4State_Abort, G4State_EventProc, G4State_GeomClosed, G4State_Idle, G4State_Init, G4State_PreInit, and G4State_Quit.

418 {
419  G4String nam = "";
420  switch ( state ){
421  case G4State_PreInit:
422  nam = "G4State_PreInit";
423  break;
424  case G4State_Init:
425  nam = "G4State_Init";
426  break;
427  case G4State_Idle:
428  nam = "G4State_Idle";
429  break;
430  case G4State_GeomClosed:
431  nam = "G4State_GeomClosed";
432  break;
433  case G4State_EventProc:
434  nam = "G4State_EventProc";
435  break;
436  case G4State_Quit:
437  nam = "G4State_Quit";
438  break;
439  case G4State_Abort:
440  nam = "G4State_Abort";
441  break;
442  }
443 
444  return nam;
445 
446 }
G4int G4ErrorPropagatorManager::Propagate ( G4ErrorTrajState currentTS,
const G4ErrorTarget target,
G4ErrorMode  mode = G4ErrorMode_PropForwards 
)

Definition at line 276 of file G4ErrorPropagatorManager.cc.

References EventTermination(), G4ErrorPropagatorData::GetErrorPropagatorData(), InitTrackPropagation(), G4ErrorPropagator::Propagate(), G4ErrorPropagatorData::SetMode(), and SetSteppingManagerVerboseLevel().

Referenced by ProcessEvent().

277 {
279  if( !thePropagator ) thePropagator = new G4ErrorPropagator(); // currently the only propagator possible
280 
283 
284  G4int ierr = thePropagator->Propagate( currentTS, target, mode );
285 
287 
288  return ierr;
289 }
G4int Propagate(G4ErrorTrajState *currentTS, const G4ErrorTarget *target, G4ErrorMode mode=G4ErrorMode_PropForwards)
int G4int
Definition: G4Types.hh:78
void SetMode(G4ErrorMode mode)
static G4ErrorPropagatorData * GetErrorPropagatorData()
G4int G4ErrorPropagatorManager::PropagateOneStep ( G4ErrorTrajState currentTS,
G4ErrorMode  mode = G4ErrorMode_PropForwards 
)

Definition at line 293 of file G4ErrorPropagatorManager.cc.

References G4ErrorPropagatorData::GetErrorPropagatorData(), G4ErrorPropagator::PropagateOneStep(), G4ErrorPropagatorData::SetMode(), and SetSteppingManagerVerboseLevel().

Referenced by ProcessEvent().

294 {
296 
297  if( !thePropagator ) thePropagator = new G4ErrorPropagator(); // currently the only propagator possible
298 
300 
301  return thePropagator->PropagateOneStep( currentTS );
302 }
G4int PropagateOneStep(G4ErrorTrajState *currentTS)
void SetMode(G4ErrorMode mode)
static G4ErrorPropagatorData * GetErrorPropagatorData()
void G4ErrorPropagatorManager::RunTermination ( )
void G4ErrorPropagatorManager::SetSteppingManagerVerboseLevel ( )
void G4ErrorPropagatorManager::SetUserAction ( G4UserTrackingAction userAction)

Definition at line 340 of file G4ErrorPropagatorManager.cc.

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

341 {
343 }
void SetUserAction(G4UserEventAction *userAction)
static G4EventManager * GetEventManager()
void G4ErrorPropagatorManager::SetUserAction ( G4UserSteppingAction userAction)

Definition at line 347 of file G4ErrorPropagatorManager.cc.

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

348 {
350 }
void SetUserAction(G4UserEventAction *userAction)
static G4EventManager * GetEventManager()
void G4ErrorPropagatorManager::SetUserInitialization ( G4VUserDetectorConstruction userInit)

Definition at line 319 of file G4ErrorPropagatorManager.cc.

References G4ErrorRunManagerHelper::SetUserInitialization().

Referenced by Initialize().

320 {
321  theG4ErrorRunManagerHelper->SetUserInitialization( userInit);
322 }
void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void G4ErrorPropagatorManager::SetUserInitialization ( G4VPhysicalVolume userInit)

Definition at line 326 of file G4ErrorPropagatorManager.cc.

References G4ErrorRunManagerHelper::SetUserInitialization().

327 {
328  theG4ErrorRunManagerHelper->SetUserInitialization( userInit);
329 }
void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void G4ErrorPropagatorManager::SetUserInitialization ( G4VUserPhysicsList userInit)

Definition at line 333 of file G4ErrorPropagatorManager.cc.

References G4ErrorRunManagerHelper::SetUserInitialization().

334 {
335  theG4ErrorRunManagerHelper->SetUserInitialization( userInit);
336 }
void SetUserInitialization(G4VUserDetectorConstruction *userInit)

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