Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4ErrorPropagator Class Reference

#include <G4ErrorPropagator.hh>

Public Member Functions

 G4ErrorPropagator ()
 
 ~G4ErrorPropagator ()
 
G4TrackInitG4Track (G4ErrorTrajState &initialTS)
 
G4int Propagate (G4ErrorTrajState *currentTS, const G4ErrorTarget *target, G4ErrorMode mode=G4ErrorMode_PropForwards)
 
G4int PropagateOneStep (G4ErrorTrajState *currentTS)
 
G4int MakeOneStep (G4ErrorFreeTrajState *currentTS_FREE)
 
G4ErrorFreeTrajStateInitFreeTrajState (G4ErrorTrajState *currentTS)
 
void GetFinalTrajState (G4ErrorTrajState *currentTS, G4ErrorFreeTrajState *currentTS_FREE, const G4ErrorTarget *target)
 
void InvokePreUserTrackingAction (G4Track *fpTrack)
 
void InvokePostUserTrackingAction (G4Track *fpTrack)
 
G4bool CheckIfLastStep (G4Track *aTrack)
 
const G4ErrorTrajStateGetInitialTrajState () const
 
G4double GetStepLength () const
 
void SetStepLength (const G4double sl)
 
void SetStepN (const G4int sn)
 

Detailed Description

Definition at line 54 of file G4ErrorPropagator.hh.

Constructor & Destructor Documentation

G4ErrorPropagator::G4ErrorPropagator ( )

Definition at line 57 of file G4ErrorPropagator.cc.

References G4cout, G4endl, G4EventManager::GetEventManager(), G4TrackingManager::GetSteppingManager(), G4EventManager::GetTrackingManager(), and G4ErrorPropagatorData::verbose().

58  : theStepLength(0.), theInitialTrajState(0), theStepN(0), theG4Track(0)
59 {
61 #ifdef G4EVERBOSE
62  if(verbose >= 5) { G4cout << "G4ErrorPropagator " << this << G4endl; }
63 #endif
64 
65  fpSteppingManager = G4EventManager::GetEventManager()
67  thePropIsInitialized = false;
68 }
G4SteppingManager * GetSteppingManager() const
G4TrackingManager * GetTrackingManager() const
G4GLOB_DLL std::ostream G4cout
static G4EventManager * GetEventManager()
#define G4endl
Definition: G4ios.hh:61
G4ErrorPropagator::~G4ErrorPropagator ( )
inline

Definition at line 59 of file G4ErrorPropagator.hh.

59 {}

Member Function Documentation

G4bool G4ErrorPropagator::CheckIfLastStep ( G4Track aTrack)

Definition at line 520 of file G4ErrorPropagator.cc.

References FatalException, fStopAndKill, G4cerr, G4cout, G4endl, G4ErrorState_StoppedAtTarget, G4Exception(), G4ErrorPropagatorData::GetErrorPropagatorData(), G4Track::GetNextVolume(), G4ErrorPropagatorData::GetState(), and G4Track::GetTrackStatus().

Referenced by ProcessEvent().

521 {
522  G4bool exception = 0;
523  G4bool lastG4eStep = false;
524  G4ErrorPropagatorData* g4edata =
526 
527 #ifdef G4EVERBOSE
528  if( verbose >= 4 )
529  {
530  G4cout << " G4ErrorPropagator::CheckIfLastStep G4ErrorState= "
531  << G4int(g4edata->GetState()) << G4endl;
532  }
533 #endif
534 
535  //----- Check if this is the last step: track has reached the target
536  // or the end of world
537  //
539  {
540  lastG4eStep = true;
541 #ifdef G4EVERBOSE
542  if(verbose >= 5 )
543  {
544  G4cout << " G4ErrorPropagator::CheckIfLastStep " << lastG4eStep
545  << " " << G4int(g4edata->GetState()) << G4endl;
546  }
547 #endif
548  }
549  else if( aTrack->GetNextVolume() == 0 )
550  {
551  //----- If particle is out of world, without finding the G4ErrorTarget,
552  // give a n error/warning
553  //
554  lastG4eStep = true;
555  if( exception )
556  {
557  std::ostringstream message;
558  message << "Track extrapolated until end of World" << G4endl
559  << "without finding the defined target!";
560  G4Exception("G4ErrorPropagator::CheckIfLastStep()",
561  "InvalidSetup", FatalException, message);
562  }
563  else
564  {
565  if( verbose >= 1 )
566  {
567  G4cerr << "ERROR - G4ErrorPropagator::CheckIfLastStep()" << G4endl
568  << " Track extrapolated until end of World" << G4endl
569  << " without finding the defined target " << G4endl;
570  }
571  }
572  } //----- not last step from G4e, but track is stopped (energy exhausted)
573  else if( aTrack->GetTrackStatus() == fStopAndKill )
574  {
575  if( exception )
576  {
577  std::ostringstream message;
578  message << "Track extrapolated until energy is exhausted" << G4endl
579  << "without finding the defined target!";
580  G4Exception("G4ErrorPropagator::CheckIfLastStep()",
581  "InvalidSetup", FatalException, message);
582  }
583  else
584  {
585  if( verbose >= 1 )
586  {
587  G4cerr << "ERROR - G4ErrorPropagator::CheckIfLastStep()" << G4endl
588  << " Track extrapolated until energy is exhausted" << G4endl
589  << " without finding the defined target !" << G4endl;
590  }
591  lastG4eStep = 1;
592  }
593  }
594 
595 #ifdef G4EVERBOSE
596  if( verbose >= 5 )
597  {
598  G4cout << " return CheckIfLastStep " << lastG4eStep << G4endl;
599  }
600 #endif
601 
602  return lastG4eStep;
603 }
G4TrackStatus GetTrackStatus() const
int G4int
Definition: G4Types.hh:78
G4VPhysicalVolume * GetNextVolume() const
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
static G4ErrorPropagatorData * GetErrorPropagatorData()
G4ErrorState GetState() const
G4GLOB_DLL std::ostream G4cerr
void G4ErrorPropagator::GetFinalTrajState ( G4ErrorTrajState currentTS,
G4ErrorFreeTrajState currentTS_FREE,
const G4ErrorTarget target 
)

Definition at line 474 of file G4ErrorPropagator.cc.

References FatalException, G4cout, G4endl, G4ErrorState_StoppedAtTarget, G4ErrorTarget_TrkL, G4eTS_FREE, G4eTS_OS, G4Exception(), G4ErrorPropagatorData::GetErrorPropagatorData(), G4ErrorTrajState::GetPosition(), G4ErrorPropagatorData::GetState(), G4ErrorTanPlaneTarget::GetTangentPlane(), G4ErrorTrajState::GetTSType(), and G4ErrorTarget::GetType().

Referenced by Propagate(), and PropagateOneStep().

477 {
478  G4ErrorPropagatorData* g4edata =
480 
481 #ifdef G4EVERBOSE
482  if(verbose >= 1 )
483  {
484  G4cout << " G4ErrorPropagator::Propagate: final state "
485  << G4int(g4edata->GetState()) << " TSType "
486  << currentTS->GetTSType() << G4endl;
487  }
488 #endif
489 
490  if( (currentTS->GetTSType() == G4eTS_FREE) ||
491  (g4edata->GetState() != G4ErrorState_StoppedAtTarget) )
492  {
493  currentTS = currentTS_FREE;
494  }
495  else if( currentTS->GetTSType() == G4eTS_OS )
496  {
497  if( target->GetType() == G4ErrorTarget_TrkL )
498  {
499  G4Exception("G4ErrorPropagator:GetFinalTrajState()",
500  "InvalidSetup", FatalException,
501  "Using a G4ErrorSurfaceTrajState with wrong target");
502  }
503  const G4ErrorTanPlaneTarget* targetWTP =
504  static_cast<const G4ErrorTanPlaneTarget*>(target);
505  *currentTS = G4ErrorSurfaceTrajState(
506  *(static_cast<G4ErrorFreeTrajState*>(currentTS_FREE)),
507  targetWTP->GetTangentPlane( currentTS_FREE->GetPosition() ) );
508 #ifdef G4EVERBOSE
509  if(verbose >= 1 )
510  {
511  G4cout << currentTS << " returning tssd " << *currentTS << G4endl;
512  }
513 #endif
514  delete currentTS_FREE;
515  }
516 }
G4Point3D GetPosition() const
const XML_Char * target
G4ErrorTargetType GetType() const
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual G4Plane3D GetTangentPlane(const G4ThreeVector &point) const =0
virtual G4eTSType GetTSType() const
#define G4endl
Definition: G4ios.hh:61
static G4ErrorPropagatorData * GetErrorPropagatorData()
G4ErrorState GetState() const
const G4ErrorTrajState* G4ErrorPropagator::GetInitialTrajState ( ) const
inline

Definition at line 99 of file G4ErrorPropagator.hh.

100  { return theInitialTrajState; }
G4double G4ErrorPropagator::GetStepLength ( ) const
inline

Definition at line 102 of file G4ErrorPropagator.hh.

103  { return theStepLength; }
G4ErrorFreeTrajState * G4ErrorPropagator::InitFreeTrajState ( G4ErrorTrajState currentTS)

Definition at line 446 of file G4ErrorPropagator.cc.

References FatalException, G4eTS_FREE, G4eTS_OS, G4Exception(), and G4ErrorTrajState::GetTSType().

Referenced by Propagate(), and PropagateOneStep().

447 {
448  G4ErrorFreeTrajState* currentTS_FREE = 0;
449 
450  //----- Transform the TrajState to Free coordinates if it is OnSurface
451  //
452  if( currentTS->GetTSType() == G4eTS_OS )
453  {
455  static_cast<G4ErrorSurfaceTrajState*>(currentTS);
456  currentTS_FREE = new G4ErrorFreeTrajState( *tssd );
457  }
458  else if( currentTS->GetTSType() == G4eTS_FREE )
459  {
460  currentTS_FREE = static_cast<G4ErrorFreeTrajState*>(currentTS);
461  }
462  else
463  {
464  std::ostringstream message;
465  message << "Wrong trajectory state: " << currentTS->GetTSType();
466  G4Exception("G4ErrorPropagator::InitFreeTrajState()", "InvalidState",
467  FatalException, message);
468  }
469  return currentTS_FREE;
470 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual G4eTSType GetTSType() const
G4Track * G4ErrorPropagator::InitG4Track ( G4ErrorTrajState initialTS)

Definition at line 250 of file G4ErrorPropagator.cc.

References python.hepunit::eplus, FatalException, G4ParticleTable::FindParticle(), G4cout, G4endl, G4Exception(), G4Track::GetDefinition(), G4Track::GetKineticEnergy(), G4ErrorTrajState::GetMomentum(), G4ParticleTable::GetParticleTable(), G4ErrorTrajState::GetParticleType(), G4ParticleDefinition::GetPDGCharge(), G4ErrorTrajState::GetPosition(), G4ParticleDefinition::GetProcessManager(), G4SteppingManager::GetProcessNumber(), G4SteppingManager::GetStep(), InvokePreUserTrackingAction(), G4DynamicParticle::SetCharge(), G4ErrorTrajState::SetG4Track(), G4SteppingManager::SetInitialStep(), G4Track::SetParentID(), G4DynamicParticle::SetPolarization(), G4Track::SetStep(), and G4ProcessManager::StartTracking().

Referenced by Propagate(), and PropagateOneStep().

251 {
252  if( verbose >= 5 ) { G4cout << "InitG4Track " << G4endl; }
253 
254  //----- Create Particle
255  //
256  const G4String partType = initialTS.GetParticleType();
258  G4ParticleDefinition* particle = particleTable->FindParticle(partType);
259  if( particle == 0)
260  {
261  std::ostringstream message;
262  message << "Particle type not defined: " << partType;
263  G4Exception( "G4ErrorPropagator::InitG4Track()", "InvalidSetup",
264  FatalException, message );
265  }
266 
267  G4DynamicParticle* DP =
268  new G4DynamicParticle(particle,initialTS.GetMomentum());
269 
270  DP->SetPolarization(0.,0.,0.);
271 
272  // Set Charge
273  //
274  if( particle->GetPDGCharge() < 0 )
275  {
276  DP->SetCharge(-eplus);
277  }
278  else
279  {
280  DP->SetCharge(eplus);
281  }
282 
283  //----- Create Track
284  //
285  theG4Track = new G4Track(DP, 0., initialTS.GetPosition() );
286  theG4Track->SetParentID(0);
287 
288 #ifdef G4EVERBOSE
289  if(verbose >= 3)
290  {
291  G4cout << " G4ErrorPropagator new track of energy: "
292  << theG4Track->GetKineticEnergy() << G4endl;
293  }
294 #endif
295 
296  //---- Reproduce G4TrackingManager::ProcessOneTrack initialization
297  InvokePreUserTrackingAction( theG4Track );
298 
299  if( fpSteppingManager == 0 )
300  {
301  G4Exception("G4ErrorPropagator::InitG4Track()", "InvalidSetup",
302  FatalException, "G4SteppingManager not initialized yet!");
303  }
304  else
305  {
306  fpSteppingManager->SetInitialStep(theG4Track);
307  }
308 
309  // Give SteppingManger the maximum number of processes
310  //
311  fpSteppingManager->GetProcessNumber();
312 
313  // Give track the pointer to the Step
314  //
315  theG4Track->SetStep(fpSteppingManager->GetStep());
316 
317  // Inform beginning of tracking to physics processes
318  //
319  theG4Track->GetDefinition()->GetProcessManager()->StartTracking(theG4Track);
320 
321  initialTS.SetG4Track( theG4Track );
322 
323  return theG4Track;
324 }
G4ParticleDefinition * GetDefinition() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void SetG4Track(G4Track *trk)
G4Point3D GetPosition() const
G4ProcessManager * GetProcessManager() const
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
G4Vector3D GetMomentum() const
void InvokePreUserTrackingAction(G4Track *fpTrack)
void SetPolarization(G4double polX, G4double polY, G4double polZ)
void SetInitialStep(G4Track *valueTrack)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4ParticleTable * GetParticleTable()
void StartTracking(G4Track *aTrack=0)
const G4String & GetParticleType() const
void SetParentID(const G4int aValue)
#define G4endl
Definition: G4ios.hh:61
void SetCharge(G4double charge)
G4double GetPDGCharge() const
void SetStep(const G4Step *aValue)
G4Step * GetStep() const
void G4ErrorPropagator::InvokePostUserTrackingAction ( G4Track fpTrack)

Definition at line 620 of file G4ErrorPropagator.cc.

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

Referenced by ProcessEvent(), and Propagate().

621 {
622  const G4UserTrackingAction* fpUserTrackingAction =
624  if( fpUserTrackingAction != 0 )
625  {
626  const_cast<G4UserTrackingAction*>(fpUserTrackingAction)
627  ->PostUserTrackingAction((fpTrack) );
628  }
629 }
G4UserTrackingAction * GetUserTrackingAction()
static G4EventManager * GetEventManager()
void G4ErrorPropagator::InvokePreUserTrackingAction ( G4Track fpTrack)

Definition at line 607 of file G4ErrorPropagator.cc.

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

Referenced by InitG4Track().

608 {
609  const G4UserTrackingAction* fpUserTrackingAction =
611  if( fpUserTrackingAction != 0 )
612  {
613  const_cast<G4UserTrackingAction*>(fpUserTrackingAction)
614  ->PreUserTrackingAction((fpTrack) );
615  }
616 }
G4UserTrackingAction * GetUserTrackingAction()
static G4EventManager * GetEventManager()
G4int G4ErrorPropagator::MakeOneStep ( G4ErrorFreeTrajState currentTS_FREE)

Definition at line 354 of file G4ErrorPropagator.cc.

References G4cerr, G4cout, G4endl, G4ErrorState_StoppedAtTarget, G4ErrorState_TargetCloserThanBoundary, G4ErrorTarget_GeomVolume, G4ErrorPropagatorData::GetErrorPropagatorData(), G4Step::GetPostStepPoint(), G4StepPoint::GetProcessDefinedStep(), G4VProcess::GetProcessName(), G4ErrorPropagatorData::GetState(), G4Track::GetStep(), G4Track::GetStepLength(), G4ErrorPropagatorData::GetTarget(), G4ErrorTarget::GetType(), G4Track::IncrementCurrentStepNumber(), G4ErrorFreeTrajState::PropagateError(), G4ErrorPropagatorData::SetState(), G4SteppingManager::Stepping(), and G4ErrorFreeTrajState::Update().

Referenced by PropagateOneStep().

355 {
356  G4ErrorPropagatorData* g4edata =
358  G4int ierr = 0;
359 
360  //---------- Track one step
361 #ifdef G4EVERBOSE
362  if(verbose >= 2 )
363  {
364  G4cout << G4endl
365  << "@@@@@@@@@@@@@@@@@@@@@@@@@ NEW STEP " << G4endl;
366  }
367 #endif
368 
369  theG4Track->IncrementCurrentStepNumber();
370 
371  fpSteppingManager->Stepping();
372 
373  //---------- Check if Target has been reached (and then set G4ErrorState)
374 
375  // G4ErrorPropagationNavigator limits the step if target is closer than
376  // boundary (but the winner process is always "Transportation": then
377  // error propagator will stop the track
378 
379  if( theG4Track->GetStep()->GetPostStepPoint()
380  ->GetProcessDefinedStep()->GetProcessName() == "Transportation" )
381  {
382  if( g4edata->GetState()
384  { // target or step length reached
385 
386 #ifdef G4EVERBOSE
387  if(verbose >= 5 )
388  {
389  G4cout << " transportation determined by geant4e " << G4endl;
390  }
391 #endif
393  }
394  else if( g4edata->GetTarget()->GetType() == G4ErrorTarget_GeomVolume )
395  {
397  (G4ErrorGeomVolumeTarget*)(g4edata->GetTarget());
398  if( static_cast<G4ErrorGeomVolumeTarget*>( target )
399  ->TargetReached( theG4Track->GetStep() ) )
400  {
402  }
403  }
404  }
405  else if( theG4Track->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()
406  ->GetProcessName() == "G4ErrorTrackLengthTarget" )
407  {
409  }
410 
411  //---------- Propagate error
412 
413 #ifdef G4EVERBOSE
414  if(verbose >= 2 )
415  {
416  G4cout << " propagating error " << *currentTS_FREE << G4endl;
417  }
418 #endif
419  const G4Track* cTrack = const_cast<G4Track*>(theG4Track);
420  ierr = currentTS_FREE->PropagateError( cTrack );
421 
422 #ifdef G4EVERBOSE
423  if(verbose >= 3 )
424  {
425  G4cout << " PropagateError returns " << ierr << G4endl;
426  }
427 #endif
428 
429  currentTS_FREE->Update( cTrack );
430 
431  theStepLength += theG4Track->GetStepLength();
432 
433  if(ierr != 0 )
434  {
435  G4cerr << "ERROR - G4ErrorPropagator:MakeOneStep()" << G4endl
436  << " Error returned: " << ierr << G4endl
437  << " Geant4 tracking will be stopped !" << G4endl;
438  }
439 
440  return ierr;
441 }
const XML_Char * target
G4ErrorTargetType GetType() const
const G4Step * GetStep() const
int G4int
Definition: G4Types.hh:78
void SetState(G4ErrorState sta)
G4GLOB_DLL std::ostream G4cout
G4StepStatus Stepping()
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
const G4VProcess * GetProcessDefinedStep() const
void IncrementCurrentStepNumber()
G4StepPoint * GetPostStepPoint() const
const G4ErrorTarget * GetTarget(G4bool mustExist=0) const
virtual G4int Update(const G4Track *aTrack)
#define G4endl
Definition: G4ios.hh:61
static G4ErrorPropagatorData * GetErrorPropagatorData()
virtual G4int PropagateError(const G4Track *aTrack)
G4ErrorState GetState() const
G4double GetStepLength() const
G4GLOB_DLL std::ostream G4cerr
G4int G4ErrorPropagator::Propagate ( G4ErrorTrajState currentTS,
const G4ErrorTarget target,
G4ErrorMode  mode = G4ErrorMode_PropForwards 
)

Definition at line 72 of file G4ErrorPropagator.cc.

References G4ErrorTarget::Dump(), G4ProcessManager::EndTracking(), G4BestUnit, G4cerr, G4cout, G4endl, G4ErrorState_StoppedAtTarget, G4Track::GetDefinition(), G4ErrorPropagatorData::GetErrorPropagatorData(), GetFinalTrajState(), G4Track::GetKineticEnergy(), G4ErrorPropagatorData::GetMode(), G4ErrorTrajState::GetMomentum(), G4ErrorTrajState::GetParticleType(), G4ParticleDefinition::GetProcessManager(), G4ErrorPropagatorData::GetState(), InitFreeTrajState(), InitG4Track(), InvokePostUserTrackingAction(), HepGeom::BasicVector3D< T >::mag(), python.hepunit::MeV, G4ErrorPropagatorData::SetMode(), and G4ErrorPropagatorData::SetTarget().

Referenced by G4ErrorPropagatorManager::Propagate().

74 {
75  // to start ierror is set to 1 (= OK)
76  //
77  G4int ierr = 1;
78 
79  G4ErrorPropagatorData* g4edata =
81 
82  //----- Do not propagate zero or too low energy particles
83  //
84  if( currentTS->GetMomentum().mag() < 1.E-9*MeV )
85  {
86  G4cerr << "ERROR - G4ErrorPropagator::Propagate()" << G4endl
87  << " Energy too low to be propagated: "
88  << G4BestUnit(currentTS->GetMomentum().mag(),"Energy") << G4endl;
89  return -3;
90  }
91 
92  g4edata->SetMode( mode );
93 
94 #ifdef G4EVERBOSE
95  if( verbose >= 1 )
96  {
97  G4cout << " =====> starting GEANT4E tracking for "
98  << currentTS->GetParticleType()
99  << " Forwards= " << g4edata->GetMode() << G4endl;
100  }
101  if(verbose >= 1 )
102  {
103  G4cout << G4endl << "@@@@@@@@@@@@@@@@@@@@@@@@@ NEW STEP " << G4endl;
104  }
105 
106  if( verbose >= 3 )
107  {
108  G4cout << " G4ErrorPropagator::Propagate initialTS ";
109  G4cout << *currentTS << G4endl;
110  target->Dump(G4String(" to target "));
111  }
112 #endif
113 
114  g4edata->SetTarget( target );
115 
116  //----- Create a track
117  //
118  if( theG4Track != 0 ) { delete theG4Track; }
119  theG4Track = InitG4Track( *currentTS );
120 
121  //----- Create a G4ErrorFreeTrajState
122  //
123  G4ErrorFreeTrajState* currentTS_FREE = InitFreeTrajState( currentTS );
124 
125  //----- Track the particle
126  //
127  ierr = MakeSteps( currentTS_FREE );
128 
129  //------ Tracking ended, check if target has been reached
130  // if target not found
131  //
132  if( g4edata->GetState() != G4ErrorState_StoppedAtTarget )
133  {
134  if( theG4Track->GetKineticEnergy() > 0. )
135  {
136  ierr = -ierr - 10;
137  }
138  else
139  {
140  ierr = -ierr - 20;
141  }
142  *currentTS = *currentTS_FREE;
143  if(verbose >= 0 )
144  {
145  G4cerr << "ERROR - G4ErrorPropagator::Propagate()" << G4endl
146  << " Particle does not reach target: " << *currentTS
147  << G4endl;
148  }
149  }
150  else
151  {
152  GetFinalTrajState( currentTS, currentTS_FREE, target );
153  }
154 
155 #ifdef G4EVERBOSE
156  if( verbose >= 1 )
157  {
158  G4cout << " G4ErrorPropagator: propagation ended " << G4endl;
159  }
160  if( verbose >= 2 )
161  {
162  G4cout << " Current TrajState " << currentTS << G4endl;
163  }
164 #endif
165 
166  // Inform end of tracking to physics processes
167  //
168  theG4Track->GetDefinition()->GetProcessManager()->EndTracking();
169 
170  InvokePostUserTrackingAction( theG4Track );
171 
172  // delete currentTS_FREE;
173 
174  return ierr;
175 }
G4ParticleDefinition * GetDefinition() const
void InvokePostUserTrackingAction(G4Track *fpTrack)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
virtual void Dump(const G4String &msg) const =0
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
void SetMode(G4ErrorMode mode)
G4Vector3D GetMomentum() const
void GetFinalTrajState(G4ErrorTrajState *currentTS, G4ErrorFreeTrajState *currentTS_FREE, const G4ErrorTarget *target)
G4ErrorMode GetMode() const
G4Track * InitG4Track(G4ErrorTrajState &initialTS)
void SetTarget(const G4ErrorTarget *target)
const G4String & GetParticleType() const
#define G4endl
Definition: G4ios.hh:61
static G4ErrorPropagatorData * GetErrorPropagatorData()
G4ErrorFreeTrajState * InitFreeTrajState(G4ErrorTrajState *currentTS)
G4ErrorState GetState() const
G4GLOB_DLL std::ostream G4cerr
G4int G4ErrorPropagator::PropagateOneStep ( G4ErrorTrajState currentTS)

Definition at line 179 of file G4ErrorPropagator.cc.

References FatalException, G4BestUnit, G4cerr, G4cout, G4endl, G4ErrorState_PreInit, G4Exception(), G4State_GeomClosed, G4StateManager::GetCurrentState(), G4ErrorPropagatorData::GetErrorPropagatorData(), GetFinalTrajState(), G4ErrorPropagatorData::GetMode(), G4ErrorTrajState::GetMomentum(), G4ErrorTrajState::GetParticleType(), G4ErrorPropagatorData::GetState(), G4StateManager::GetStateManager(), G4ErrorPropagatorData::GetTarget(), InitFreeTrajState(), InitG4Track(), HepGeom::BasicVector3D< T >::mag(), MakeOneStep(), and python.hepunit::MeV.

Referenced by G4ErrorPropagatorManager::PropagateOneStep().

180 {
181  G4ErrorPropagatorData* g4edata =
183 
184  if ( (g4edata->GetState() == G4ErrorState_PreInit)
186  != G4State_GeomClosed) )
187  {
188  std::ostringstream message;
189  message << "Called before initialization is done for this track!";
190  G4Exception("G4ErrorPropagator::PropagateOneStep()",
191  "InvalidCall", FatalException, message,
192  "Please call G4ErrorPropagatorManager::InitGeant4e().");
193  }
194 
195  // to start ierror is set to 0 (= OK)
196  //
197  G4int ierr = 0;
198 
199  //--- Do not propagate zero or too low energy particles
200  //
201  if( currentTS->GetMomentum().mag() < 1.E-9*MeV )
202  {
203  G4cerr << "ERROR - G4ErrorPropagator::PropagateOneStep()" << G4endl
204  << " Energy too low to be propagated: "
205  << G4BestUnit(currentTS->GetMomentum().mag(),"Energy") << G4endl;
206  return -3;
207  }
208 
209 #ifdef G4EVERBOSE
210  if( verbose >= 1 )
211  {
212  G4cout << " =====> starting GEANT4E tracking for "
213  << currentTS->GetParticleType()
214  << " Forwards= " << g4edata->GetMode() << G4endl;
215  }
216  if( verbose >= 3 )
217  {
218  G4cout << " G4ErrorPropagator::Propagate initialTS ";
219  G4cout << *currentTS << G4endl;
220  }
221 #endif
222 
223  //----- If it is the first step, create a track
224  //
225  if( theStepN == 0 )
226  {
227  if( theG4Track != 0 ) { delete theG4Track; }
228  theG4Track = InitG4Track( *currentTS );
229  }
230  // set to 0 by the initialization in G4ErrorPropagatorManager
231  theStepN++;
232 
233  //----- Create a G4ErrorFreeTrajState
234  //
235  G4ErrorFreeTrajState* currentTS_FREE = InitFreeTrajState( currentTS );
236 
237  //----- Track the particle one step
238  //
239  ierr = MakeOneStep( currentTS_FREE );
240 
241  //----- Get the state on target
242  //
243  GetFinalTrajState( currentTS, currentTS_FREE, g4edata->GetTarget() );
244 
245  return ierr;
246 }
G4int MakeOneStep(G4ErrorFreeTrajState *currentTS_FREE)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
int G4int
Definition: G4Types.hh:78
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
G4Vector3D GetMomentum() const
void GetFinalTrajState(G4ErrorTrajState *currentTS, G4ErrorFreeTrajState *currentTS_FREE, const G4ErrorTarget *target)
G4ErrorMode GetMode() const
G4ApplicationState GetCurrentState() const
G4Track * InitG4Track(G4ErrorTrajState &initialTS)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4String & GetParticleType() const
const G4ErrorTarget * GetTarget(G4bool mustExist=0) const
#define G4endl
Definition: G4ios.hh:61
static G4ErrorPropagatorData * GetErrorPropagatorData()
G4ErrorFreeTrajState * InitFreeTrajState(G4ErrorTrajState *currentTS)
G4ErrorState GetState() const
G4GLOB_DLL std::ostream G4cerr
void G4ErrorPropagator::SetStepLength ( const G4double  sl)
inline

Definition at line 105 of file G4ErrorPropagator.hh.

106  { theStepLength = sl; }
void G4ErrorPropagator::SetStepN ( const G4int  sn)
inline

Definition at line 108 of file G4ErrorPropagator.hh.

Referenced by G4ErrorPropagatorManager::InitTrackPropagation().

109  { theStepN = sn; }

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