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().

00081 {
00082   //----- Initialize a few things
00083   //o  theG4ErrorPropagatorManager = this;
00084 
00085   char* g4emverb = getenv("G4EVERBOSE");
00086   if( !g4emverb ) {
00087     G4ErrorPropagatorData::GetErrorPropagatorData()->SetVerbose( 0 );
00088   } else {
00089     G4ErrorPropagatorData::GetErrorPropagatorData()->SetVerbose( atoi( g4emverb ) );
00090   }
00091 
00092   thePropagator = 0;
00093 
00094   theEquationOfMotion = 0;
00095 
00096   StartG4ErrorRunManagerHelper(); 
00097   
00098   G4ErrorPropagatorData::GetErrorPropagatorData()->SetState( G4ErrorState_PreInit );
00099 
00100   theG4ErrorPropagationNavigator = 0;
00101 
00102   StartNavigator(); //navigator has to be initialized at the beggining !?!?!
00103 
00104 
00105 }

G4ErrorPropagatorManager::~G4ErrorPropagatorManager (  ) 

Definition at line 109 of file G4ErrorPropagatorManager.cc.

00110 {
00111   delete theEquationOfMotion;
00112   delete theG4ErrorPropagationNavigator;
00113   delete thePropagator;
00114   delete theG4ErrorRunManagerHelper;
00115   delete theG4ErrorPropagatorManager;
00116 }


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.

00307 {
00308   G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
00309   geomManager->OpenGeometry();
00310   if(  G4StateManager::GetStateManager()->GetCurrentState() != G4State_GeomClosed) {
00311     G4StateManager::GetStateManager()->SetNewState(G4State_Quit);
00312   }
00313 
00314   return TRUE;
00315 }

void G4ErrorPropagatorManager::EventTermination (  ) 

Definition at line 362 of file G4ErrorPropagatorManager.cc.

References G4ErrorState_Init, G4ErrorPropagatorData::GetErrorPropagatorData(), and G4ErrorPropagatorData::SetState().

Referenced by Propagate().

G4ErrorPropagationNavigator* G4ErrorPropagatorManager::GetErrorPropagationNavigator (  )  const [inline]

Definition at line 133 of file G4ErrorPropagatorManager.hh.

00134     { return theG4ErrorPropagationNavigator; }

G4ErrorPropagatorManager * G4ErrorPropagatorManager::GetErrorPropagatorManager (  )  [static]

Definition at line 69 of file G4ErrorPropagatorManager.cc.

00070 {
00071   if( !theG4ErrorPropagatorManager ) {
00072     theG4ErrorPropagatorManager = new G4ErrorPropagatorManager;
00073   }
00074 
00075   return theG4ErrorPropagatorManager;
00076 }

G4ErrorRunManagerHelper* G4ErrorPropagatorManager::GetErrorRunManagerHelper (  )  const [inline]

Definition at line 128 of file G4ErrorPropagatorManager.hh.

00129     { return theG4ErrorRunManagerHelper; }

G4ErrorPropagator* G4ErrorPropagatorManager::GetPropagator (  )  const [inline]

Definition at line 136 of file G4ErrorPropagatorManager.hh.

00137     { 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(), G4FieldManager::SetChordFinder(), G4MagIntegratorStepper::SetEquationOfMotion(), and G4ErrorPropagatorData::verbose().

Referenced by InitGeant4e().

00231 {
00232 
00233   if( G4ErrorPropagatorData::verbose() >= 4 ) G4cout << " G4ErrorPropagatorManager::InitFieldForBackwards() " << G4endl;
00234   //----- Gets the current equation of motion
00235   G4FieldManager* fieldMgr= G4TransportationManager::GetTransportationManager()->GetFieldManager();
00236   //  G4cout << " fieldMgr " << fieldMgr << G4endl;
00237   if( !fieldMgr ) return 0;
00238 
00239   //  G4Field* myfield = fieldMgr->GetDetectorField();
00240   G4ChordFinder* cf = fieldMgr ->GetChordFinder();
00241   if( !cf ) return 0;
00242   G4MagInt_Driver* mid = cf->GetIntegrationDriver();
00243   if( !mid ) return 0;
00244   G4MagIntegratorStepper* stepper = const_cast<G4MagIntegratorStepper*>(mid->GetStepper());
00245   if( !stepper ) return 0;
00246   G4EquationOfMotion* equation = stepper->GetEquationOfMotion();
00247 
00248   //----- Replaces the equation by a G4ErrorMag_UsualEqRhs to handle backwards tracking
00249   if ( !dynamic_cast<G4ErrorMag_UsualEqRhs*>(equation) ) {
00250 
00251     G4MagneticField* myfield = (G4MagneticField*)fieldMgr->GetDetectorField();
00252     
00253     //    G4Mag_UsualEqRhs* fEquation_usual = dynamic_cast<G4Mag_UsualEqRhs*>(equation);
00254     if( theEquationOfMotion == 0 ) theEquationOfMotion = new G4ErrorMag_UsualEqRhs(myfield);
00255  
00256     //---- Pass the equation of motion to the G4MagIntegratorStepper
00257     stepper->SetEquationOfMotion( theEquationOfMotion );
00258 
00259     //--- change stepper for speed tests
00260    G4MagIntegratorStepper* g4eStepper = new G4ClassicalRK4(theEquationOfMotion);
00261    // G4MagIntegratorStepper* g4eStepper = new G4ExactHelixStepper(theEquationOfMotion);
00262     
00263     //---- 
00264     G4MagneticField* field = static_cast<G4MagneticField*>(const_cast<G4Field*>(fieldMgr->GetDetectorField()));
00265     G4ChordFinder* pChordFinder = new G4ChordFinder(field, 1.0e-2*mm, g4eStepper);
00266 
00267     fieldMgr->SetChordFinder(pChordFinder);
00268 
00269   }
00270 
00271   return 1;
00272 }

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().

00173 {
00174   if( G4ErrorPropagatorData::verbose() >= 1 ) G4cout << "InitGeant4e GEANT4e State= " << PrintG4ErrorState() << " GEANT4 State= " << PrintG4State() << G4endl;
00175   G4ApplicationState currentState = G4StateManager::GetStateManager()->GetCurrentState();
00176   //----- Initialize run
00177   //  if( G4StateManager::GetStateManager()->GetCurrentState() == G4State_PreInit) {
00178   
00179   if( G4ErrorPropagatorData::GetErrorPropagatorData()->GetState() == G4ErrorState_PreInit ) {
00180     if ( currentState == G4State_PreInit || currentState == G4State_Idle) {
00181       //    G4eRunManager::GetRunManager()->Initialize();
00182       theG4ErrorRunManagerHelper->InitializeGeometry();
00183       theG4ErrorRunManagerHelper->InitializePhysics();
00184     }
00185     
00186     InitFieldForBackwards();
00187     
00188     //-    G4StateManager::GetStateManager()->SetNewState(G4State_Idle);
00189     
00190     if( G4ErrorPropagatorData::verbose() >= 4 )   G4cout << " bef  theG4ErrorPropagatorManager->RunInitialization() " <<  G4StateManager::GetStateManager()->GetCurrentState() << G4endl;
00191     theG4ErrorRunManagerHelper->RunInitialization();
00192     if( G4ErrorPropagatorData::verbose() >= 4 ) G4cout << " aft  theG4ErrorPropagatorManager->RunInitialization() " <<  G4StateManager::GetStateManager()->GetCurrentState() << G4endl;
00193     
00194     if( !thePropagator ) thePropagator = new G4ErrorPropagator();  // currently the only propagator possible
00195     
00196     InitTrackPropagation();
00197   } else {
00198     G4cerr << "G4ErrorPropagatorManager::InitGeant4e: Illegal application state - "
00199            << "G4ErrorPropagatorManager::InitGeant4e() ignored." << G4endl;
00200     G4cerr << " GEANT4e State= " << PrintG4ErrorState() 
00201       //<< " GEANT4 State= " <<  PrintG4State() 
00202            << G4endl;
00203   }
00204   
00205   //----- Set the tracking geometry for this propagation
00206   //t  SetTrackingGeometry();
00207   //----- Set the physics list for this propagation
00208   //t  SetPhysicsList();
00209   //----- Set the field propagation parameters for this propagation
00210   //t  SetFieldPropagationParameters();
00211   G4ErrorPropagatorData::GetErrorPropagatorData()->SetState( G4ErrorState_Init );
00212 
00213   if( G4ErrorPropagatorData::verbose() >= 2 ) G4cout << "End InitGeant4e GEANT4e State= " << PrintG4ErrorState() << " GEANT4 State= " << PrintG4State() << G4endl;
00214 
00215 
00216 }

void G4ErrorPropagatorManager::InitTrackPropagation (  ) 

Definition at line 220 of file G4ErrorPropagatorManager.cc.

References G4ErrorState_Propagating, G4ErrorPropagatorData::GetErrorPropagatorData(), G4ErrorPropagatorData::SetState(), and G4ErrorPropagator::SetStepN().

Referenced by InitGeant4e(), and Propagate().

00221 {
00222   thePropagator->SetStepN( 0 );
00223 
00224   G4ErrorPropagatorData::GetErrorPropagatorData()->SetState( G4ErrorState_Propagating );
00225 
00226 }

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.

00385 {
00386   G4String nam = "";
00387   switch (state){
00388   case G4ErrorState_PreInit: 
00389     nam = "G4ErrorState_PreInit"; 
00390     break;
00391   case G4ErrorState_Init: 
00392     nam = "G4ErrorState_Init"; 
00393     break;
00394   case G4ErrorState_Propagating:
00395     nam = "G4ErrorState_Propagating";
00396     break;
00397   case G4ErrorState_TargetCloserThanBoundary:
00398     nam = "G4ErrorState_TargetCloserThanBoundary";
00399     break;
00400   case G4ErrorState_StoppedAtTarget:
00401     nam = "G4ErrorState_StoppedAtTarget";
00402     break;
00403   }
00404 
00405   return nam;
00406 }

G4String G4ErrorPropagatorManager::PrintG4ErrorState (  ) 

Definition at line 377 of file G4ErrorPropagatorManager.cc.

References G4ErrorPropagatorData::GetErrorPropagatorData().

Referenced by InitGeant4e().

00378 {
00379   return PrintG4ErrorState( G4ErrorPropagatorData::GetErrorPropagatorData()->GetState() );
00380 }

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.

00418 {
00419   G4String nam = "";
00420   switch ( state ){
00421   case G4State_PreInit:
00422     nam = "G4State_PreInit";
00423     break;
00424   case G4State_Init:
00425     nam = "G4State_Init";
00426     break;
00427   case G4State_Idle:
00428     nam = "G4State_Idle";
00429     break;
00430   case G4State_GeomClosed:
00431     nam = "G4State_GeomClosed";
00432     break;
00433   case G4State_EventProc:
00434     nam = "G4State_EventProc"; 
00435     break;
00436   case G4State_Quit:
00437     nam = "G4State_Quit";
00438     break;
00439   case G4State_Abort:
00440     nam = "G4State_Abort";
00441     break;
00442   }
00443   
00444   return nam;
00445 
00446 }

G4String G4ErrorPropagatorManager::PrintG4State (  ) 

Definition at line 410 of file G4ErrorPropagatorManager.cc.

References G4StateManager::GetStateManager().

Referenced by InitGeant4e().

00411 {
00412   return PrintG4State(G4StateManager::GetStateManager()->GetCurrentState());
00413 }

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().

00277 {
00278   G4ErrorPropagatorData::GetErrorPropagatorData()->SetMode( mode );
00279   if( !thePropagator ) thePropagator = new G4ErrorPropagator();  // currently the only propagator possible
00280 
00281   SetSteppingManagerVerboseLevel();
00282   InitTrackPropagation();
00283 
00284   G4int ierr = thePropagator->Propagate( currentTS, target, mode );
00285 
00286   EventTermination();
00287 
00288   return ierr;
00289 }

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().

00294 {
00295   G4ErrorPropagatorData::GetErrorPropagatorData()->SetMode( mode );
00296 
00297   if( !thePropagator ) thePropagator = new G4ErrorPropagator();  // currently the only propagator possible
00298 
00299   SetSteppingManagerVerboseLevel();
00300 
00301   return thePropagator->PropagateOneStep( currentTS );
00302 }

void G4ErrorPropagatorManager::RunTermination (  ) 

Definition at line 369 of file G4ErrorPropagatorManager.cc.

References G4ErrorState_PreInit, G4ErrorPropagatorData::GetErrorPropagatorData(), G4ErrorRunManagerHelper::RunTermination(), and G4ErrorPropagatorData::SetState().

00370 {
00371 G4ErrorPropagatorData::GetErrorPropagatorData()->SetState( G4ErrorState_PreInit );
00372   theG4ErrorRunManagerHelper->RunTermination(); 
00373 }

void G4ErrorPropagatorManager::SetSteppingManagerVerboseLevel (  ) 

Definition at line 354 of file G4ErrorPropagatorManager.cc.

References G4EventManager::GetEventManager(), G4TrackingManager::GetSteppingManager(), G4EventManager::GetTrackingManager(), G4TrackingManager::GetVerboseLevel(), and G4SteppingManager::SetVerboseLevel().

Referenced by Propagate(), and PropagateOneStep().

void G4ErrorPropagatorManager::SetUserAction ( G4UserSteppingAction userAction  ) 

Definition at line 347 of file G4ErrorPropagatorManager.cc.

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

00348 {
00349   G4EventManager::GetEventManager()->SetUserAction( userAction ); 
00350 }

void G4ErrorPropagatorManager::SetUserAction ( G4UserTrackingAction userAction  ) 

Definition at line 340 of file G4ErrorPropagatorManager.cc.

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

00341 {
00342   G4EventManager::GetEventManager()->SetUserAction( userAction ); 
00343 }

void G4ErrorPropagatorManager::SetUserInitialization ( G4VUserPhysicsList userInit  ) 

Definition at line 333 of file G4ErrorPropagatorManager.cc.

References G4ErrorRunManagerHelper::SetUserInitialization().

00334 { 
00335   theG4ErrorRunManagerHelper->SetUserInitialization( userInit); 
00336 }

void G4ErrorPropagatorManager::SetUserInitialization ( G4VPhysicalVolume userInit  ) 

Definition at line 326 of file G4ErrorPropagatorManager.cc.

References G4ErrorRunManagerHelper::SetUserInitialization().

00327 { 
00328   theG4ErrorRunManagerHelper->SetUserInitialization( userInit); 
00329 }

void G4ErrorPropagatorManager::SetUserInitialization ( G4VUserDetectorConstruction userInit  ) 

Definition at line 319 of file G4ErrorPropagatorManager.cc.

References G4ErrorRunManagerHelper::SetUserInitialization().

00320 {
00321   theG4ErrorRunManagerHelper->SetUserInitialization( userInit); 
00322 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:51:55 2013 for Geant4 by  doxygen 1.4.7