Geant4-11
Public Member Functions | Private Member Functions | Private Attributes
G4ErrorPropagator Class Reference

#include <G4ErrorPropagator.hh>

Public Member Functions

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

Private Member Functions

G4int MakeSteps (G4ErrorFreeTrajState *currentTS_FREE)
 

Private Attributes

G4SteppingManagerfpSteppingManager
 
G4TracktheG4Track
 
G4ErrorTrajStatetheInitialTrajState
 
G4bool thePropIsInitialized
 
G4double theStepLength
 
G4int theStepN
 
G4int verbose
 

Detailed Description

Definition at line 53 of file G4ErrorPropagator.hh.

Constructor & Destructor Documentation

◆ G4ErrorPropagator()

G4ErrorPropagator::G4ErrorPropagator ( )

Definition at line 55 of file G4ErrorPropagator.cc.

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

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

◆ ~G4ErrorPropagator()

G4ErrorPropagator::~G4ErrorPropagator ( )
inline

Definition at line 57 of file G4ErrorPropagator.hh.

57{}

Member Function Documentation

◆ CheckIfLastStep()

G4bool G4ErrorPropagator::CheckIfLastStep ( G4Track aTrack)

Definition at line 539 of file G4ErrorPropagator.cc.

540{
541 G4bool lastG4eStep = false;
542 G4ErrorPropagatorData* g4edata =
544
545#ifdef G4EVERBOSE
546 if(verbose >= 4)
547 {
548 G4cout << " G4ErrorPropagator::CheckIfLastStep G4ErrorState= "
549 << G4int(g4edata->GetState()) << G4endl;
550 }
551#endif
552
553 //----- Check if this is the last step: track has reached the target
554 // or the end of world
555 //
557 {
558 lastG4eStep = true;
559#ifdef G4EVERBOSE
560 if(verbose >= 5)
561 {
562 G4cout << " G4ErrorPropagator::CheckIfLastStep " << lastG4eStep << " "
563 << G4int(g4edata->GetState()) << G4endl;
564 }
565#endif
566 }
567 else if(aTrack->GetNextVolume() == 0)
568 {
569 //----- If particle is out of world, without finding the G4ErrorTarget,
570 // give a n error/warning
571 //
572 lastG4eStep = true;
573 if(verbose >= 1)
574 {
575 std::ostringstream message;
576 message << "Track extrapolated until end of World" << G4endl
577 << "without finding the defined target.";
578 G4Exception("G4ErrorPropagator::CheckIfLastStep()",
579 "GEANT4e-Notification", JustWarning, message);
580 }
581 } //----- not last step from G4e, but track is stopped (energy exhausted)
582 else if(aTrack->GetTrackStatus() == fStopAndKill)
583 {
584 if(verbose >= 1)
585 {
586 std::ostringstream message;
587 message << "Track extrapolated until energy is exhausted" << G4endl
588 << "without finding the defined target.";
589 G4Exception("G4ErrorPropagator::CheckIfLastStep()",
590 "GEANT4e-Notification", JustWarning, message);
591 }
592 lastG4eStep = 1;
593 }
594
595#ifdef G4EVERBOSE
596 if(verbose >= 5)
597 {
598 G4cout << " return CheckIfLastStep " << lastG4eStep << G4endl;
599 }
600#endif
601
602 return lastG4eStep;
603}
@ G4ErrorState_StoppedAtTarget
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
@ fStopAndKill
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4ErrorState GetState() const
static G4ErrorPropagatorData * GetErrorPropagatorData()
G4TrackStatus GetTrackStatus() const
G4VPhysicalVolume * GetNextVolume() const

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

Referenced by MakeSteps().

◆ GetFinalTrajState()

void G4ErrorPropagator::GetFinalTrajState ( G4ErrorTrajState currentTS,
G4ErrorFreeTrajState currentTS_FREE,
const G4ErrorTarget target 
)

Definition at line 494 of file G4ErrorPropagator.cc.

497{
498 G4ErrorPropagatorData* g4edata =
500
501#ifdef G4EVERBOSE
502 if(verbose >= 1)
503 {
504 G4cout << " G4ErrorPropagator::Propagate: final state "
505 << G4int(g4edata->GetState()) << " TSType " << currentTS->GetTSType()
506 << G4endl;
507 }
508#endif
509
510 if((currentTS->GetTSType() == G4eTS_FREE) ||
512 {
513 currentTS = currentTS_FREE;
514 }
515 else if(currentTS->GetTSType() == G4eTS_OS)
516 {
517 if(target->GetType() == G4ErrorTarget_TrkL)
518 {
519 G4Exception("G4ErrorPropagator:GetFinalTrajState()", "InvalidSetup",
521 "Using a G4ErrorSurfaceTrajState with wrong target");
522 }
523 const G4ErrorTanPlaneTarget* targetWTP =
524 static_cast<const G4ErrorTanPlaneTarget*>(target);
525 *currentTS = G4ErrorSurfaceTrajState(
526 *(static_cast<G4ErrorFreeTrajState*>(currentTS_FREE)),
527 targetWTP->GetTangentPlane(currentTS_FREE->GetPosition()));
528#ifdef G4EVERBOSE
529 if(verbose >= 1)
530 {
531 G4cout << currentTS << " returning tssd " << *currentTS << G4endl;
532 }
533#endif
534 delete currentTS_FREE;
535 }
536}
@ G4ErrorTarget_TrkL
@ G4eTS_FREE
@ G4eTS_OS
@ FatalException
virtual G4Plane3D GetTangentPlane(const G4ThreeVector &point) const =0
G4ErrorTargetType GetType() const
virtual G4eTSType GetTSType() const
G4Point3D GetPosition() const

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

Referenced by Propagate(), and PropagateOneStep().

◆ GetInitialTrajState()

const G4ErrorTrajState * G4ErrorPropagator::GetInitialTrajState ( ) const
inline

Definition at line 98 of file G4ErrorPropagator.hh.

99 {
100 return theInitialTrajState;
101 }

References theInitialTrajState.

◆ GetStepLength()

G4double G4ErrorPropagator::GetStepLength ( ) const
inline

Definition at line 103 of file G4ErrorPropagator.hh.

103{ return theStepLength; }

References theStepLength.

◆ InitFreeTrajState()

G4ErrorFreeTrajState * G4ErrorPropagator::InitFreeTrajState ( G4ErrorTrajState currentTS)

Definition at line 466 of file G4ErrorPropagator.cc.

468{
469 G4ErrorFreeTrajState* currentTS_FREE = 0;
470
471 //----- Transform the TrajState to Free coordinates if it is OnSurface
472 //
473 if(currentTS->GetTSType() == G4eTS_OS)
474 {
476 static_cast<G4ErrorSurfaceTrajState*>(currentTS);
477 currentTS_FREE = new G4ErrorFreeTrajState(*tssd);
478 }
479 else if(currentTS->GetTSType() == G4eTS_FREE)
480 {
481 currentTS_FREE = static_cast<G4ErrorFreeTrajState*>(currentTS);
482 }
483 else
484 {
485 std::ostringstream message;
486 message << "Wrong trajectory state: " << currentTS->GetTSType();
487 G4Exception("G4ErrorPropagator::InitFreeTrajState()", "InvalidState",
488 FatalException, message);
489 }
490 return currentTS_FREE;
491}

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

Referenced by Propagate(), and PropagateOneStep().

◆ InitG4Track()

G4Track * G4ErrorPropagator::InitG4Track ( G4ErrorTrajState initialTS)

Definition at line 264 of file G4ErrorPropagator.cc.

265{
266 if(verbose >= 5)
267 {
268 G4cout << "InitG4Track " << G4endl;
269 }
270
271 //----- Create Particle
272 //
273 const G4String partType = initialTS.GetParticleType();
275 G4ParticleDefinition* particle = particleTable->FindParticle(partType);
276 if(particle == 0)
277 {
278 std::ostringstream message;
279 message << "Particle type not defined: " << partType;
280 G4Exception("G4ErrorPropagator::InitG4Track()", "InvalidSetup",
281 FatalException, message);
282 }
283
285 new G4DynamicParticle(particle, initialTS.GetMomentum());
286
287 DP->SetPolarization(0., 0., 0.);
288
289 // Set Charge
290 //
291 if(particle->GetPDGCharge() < 0)
292 {
293 DP->SetCharge(-eplus);
294 }
295 else
296 {
297 DP->SetCharge(eplus);
298 }
299
300 //----- Create Track
301 //
302 theG4Track = new G4Track(DP, 0., initialTS.GetPosition());
304
305#ifdef G4EVERBOSE
306 if(verbose >= 3)
307 {
308 G4cout << " G4ErrorPropagator new track of energy: "
310 }
311#endif
312
313 //---- Reproduce G4TrackingManager::ProcessOneTrack initialization
315
316 if(fpSteppingManager == 0)
317 {
318 G4Exception("G4ErrorPropagator::InitG4Track()", "InvalidSetup",
319 FatalException, "G4SteppingManager not initialized yet!");
320 }
321 else
322 {
324 }
325
326 // Give SteppingManger the maximum number of processes
327 //
329
330 // Give track the pointer to the Step
331 //
333
334 // Inform beginning of tracking to physics processes
335 //
337
338 initialTS.SetG4Track(theG4Track);
339
340 return theG4Track;
341}
static constexpr double eplus
Definition: G4SIunits.hh:184
void SetPolarization(const G4ThreeVector &)
void SetCharge(G4double charge)
void InvokePreUserTrackingAction(G4Track *fpTrack)
void SetG4Track(G4Track *trk)
G4Vector3D GetMomentum() const
const G4String & GetParticleType() const
G4ProcessManager * GetProcessManager() const
G4double GetPDGCharge() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
void StartTracking(G4Track *aTrack=nullptr)
void SetInitialStep(G4Track *valueTrack)
G4Step * GetStep() const
void SetStep(const G4Step *aValue)
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
void SetParentID(const G4int aValue)

References eplus, FatalException, G4ParticleTable::FindParticle(), fpSteppingManager, 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(), G4ProcessManager::StartTracking(), theG4Track, and verbose.

Referenced by Propagate(), and PropagateOneStep().

◆ InvokePostUserTrackingAction()

void G4ErrorPropagator::InvokePostUserTrackingAction ( G4Track fpTrack)

Definition at line 618 of file G4ErrorPropagator.cc.

619{
620 const G4UserTrackingAction* fpUserTrackingAction =
622 if(fpUserTrackingAction != 0)
623 {
624 const_cast<G4UserTrackingAction*>(fpUserTrackingAction)
625 ->PostUserTrackingAction((fpTrack));
626 }
627}
G4UserTrackingAction * GetUserTrackingAction()

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

Referenced by Propagate().

◆ InvokePreUserTrackingAction()

void G4ErrorPropagator::InvokePreUserTrackingAction ( G4Track fpTrack)

Definition at line 606 of file G4ErrorPropagator.cc.

607{
608 const G4UserTrackingAction* fpUserTrackingAction =
610 if(fpUserTrackingAction != 0)
611 {
612 const_cast<G4UserTrackingAction*>(fpUserTrackingAction)
613 ->PreUserTrackingAction((fpTrack));
614 }
615}

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

Referenced by InitG4Track().

◆ MakeOneStep()

G4int G4ErrorPropagator::MakeOneStep ( G4ErrorFreeTrajState currentTS_FREE)

Definition at line 372 of file G4ErrorPropagator.cc.

373{
374 G4ErrorPropagatorData* g4edata =
376 G4int ierr = 0;
377
378 //---------- Track one step
379#ifdef G4EVERBOSE
380 if(verbose >= 2)
381 {
382 G4cout << G4endl << "@@@@@@@@@@@@@@@@@@@@@@@@@ NEW STEP " << G4endl;
383 }
384#endif
385
387
389
390 //---------- Check if Target has been reached (and then set G4ErrorState)
391
392 // G4ErrorPropagationNavigator limits the step if target is closer than
393 // boundary (but the winner process is always "Transportation": then
394 // error propagator will stop the track
395
396 if(theG4Track->GetStep()
399 ->GetProcessName() == "Transportation")
400 {
401 if(g4edata->GetState() ==
403 { // target or step length reached
404
405#ifdef G4EVERBOSE
406 if(verbose >= 5)
407 {
408 G4cout << " transportation determined by geant4e " << G4endl;
409 }
410#endif
412 }
413 else if(g4edata->GetTarget()->GetType() == G4ErrorTarget_GeomVolume)
414 {
416 (G4ErrorGeomVolumeTarget*) (g4edata->GetTarget());
417 if(static_cast<G4ErrorGeomVolumeTarget*>(target)->TargetReached(
419 {
421 }
422 }
423 }
424 else if(theG4Track->GetStep()
427 ->GetProcessName() == "G4ErrorTrackLengthTarget")
428 {
430 }
431
432 //---------- Propagate error
433
434#ifdef G4EVERBOSE
435 if(verbose >= 2)
436 {
437 G4cout << " propagating error " << *currentTS_FREE << G4endl;
438 }
439#endif
440 const G4Track* cTrack = const_cast<G4Track*>(theG4Track);
441 ierr = currentTS_FREE->PropagateError(cTrack);
442
443#ifdef G4EVERBOSE
444 if(verbose >= 3)
445 {
446 G4cout << " PropagateError returns " << ierr << G4endl;
447 }
448#endif
449
450 currentTS_FREE->Update(cTrack);
451
453
454 if(ierr != 0)
455 {
456 std::ostringstream message;
457 message << "Error returned: " << ierr;
458 G4Exception("G4ErrorPropagator::MakeOneStep()", "GEANT4e-Notification",
459 JustWarning, message, "Geant4 tracking will be stopped !");
460 }
461
462 return ierr;
463}
@ G4ErrorState_TargetCloserThanBoundary
@ G4ErrorTarget_GeomVolume
virtual G4int Update(const G4Track *aTrack)
virtual G4int PropagateError(const G4Track *aTrack)
virtual G4bool TargetReached(const G4Step *aStep)
const G4ErrorTarget * GetTarget(G4bool mustExist=false) const
void SetState(G4ErrorState sta)
const G4VProcess * GetProcessDefinedStep() const
G4StepPoint * GetPostStepPoint() const
G4StepStatus Stepping()
G4double GetStepLength() const
void IncrementCurrentStepNumber()
const G4Step * GetStep() const
const G4String & GetProcessName() const
Definition: G4VProcess.hh:382

References fpSteppingManager, G4cout, G4endl, G4ErrorState_StoppedAtTarget, G4ErrorState_TargetCloserThanBoundary, G4ErrorTarget_GeomVolume, G4Exception(), G4ErrorPropagatorData::GetErrorPropagatorData(), G4Step::GetPostStepPoint(), G4StepPoint::GetProcessDefinedStep(), G4VProcess::GetProcessName(), G4ErrorPropagatorData::GetState(), G4Track::GetStep(), G4Track::GetStepLength(), G4ErrorPropagatorData::GetTarget(), G4ErrorTarget::GetType(), G4Track::IncrementCurrentStepNumber(), JustWarning, G4ErrorFreeTrajState::PropagateError(), G4ErrorPropagatorData::SetState(), G4SteppingManager::Stepping(), G4ErrorGeomVolumeTarget::TargetReached(), theG4Track, theStepLength, G4ErrorFreeTrajState::Update(), and verbose.

Referenced by MakeSteps(), and PropagateOneStep().

◆ MakeSteps()

G4int G4ErrorPropagator::MakeSteps ( G4ErrorFreeTrajState currentTS_FREE)
private

Definition at line 344 of file G4ErrorPropagator.cc.

345{
346 G4int ierr = 0;
347
348 //----- Track the particle Step-by-Step while it is alive
349 //
350 theStepLength = 0.;
351
352 while((theG4Track->GetTrackStatus() == fAlive) ||
354 {
355 ierr = MakeOneStep(currentTS_FREE);
356 if(ierr != 0)
357 {
358 break;
359 }
360
361 //----- Check if last step for error propagation
362 //
364 {
365 break;
366 }
367 } // Loop checking, 06.08.2015, G.Cosmo
368 return ierr;
369}
@ fAlive
@ fStopButAlive
G4bool CheckIfLastStep(G4Track *aTrack)
G4int MakeOneStep(G4ErrorFreeTrajState *currentTS_FREE)

References CheckIfLastStep(), fAlive, fStopButAlive, G4Track::GetTrackStatus(), MakeOneStep(), theG4Track, and theStepLength.

Referenced by Propagate().

◆ Propagate()

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

Definition at line 76 of file G4ErrorPropagator.cc.

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

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

Referenced by G4ErrorPropagatorManager::Propagate().

◆ PropagateOneStep()

G4int G4ErrorPropagator::PropagateOneStep ( G4ErrorTrajState currentTS)

Definition at line 189 of file G4ErrorPropagator.cc.

190{
191 G4ErrorPropagatorData* g4edata =
193
194 if((g4edata->GetState() == G4ErrorState_PreInit) ||
197 {
198 std::ostringstream message;
199 message << "Called before initialization is done for this track!";
200 G4Exception("G4ErrorPropagator::PropagateOneStep()", "InvalidCall",
201 FatalException, message,
202 "Please call G4ErrorPropagatorManager::InitGeant4e().");
203 }
204
205 // to start ierror is set to 0 (= OK)
206 //
207 G4int ierr = 0;
208
209 //--- Do not propagate zero or too low energy particles
210 //
211 if(currentTS->GetMomentum().mag() < 1.E-9 * MeV)
212 {
213 std::ostringstream message;
214 message << "Energy too low to be propagated: "
215 << G4BestUnit(currentTS->GetMomentum().mag(), "Energy");
216 G4Exception("G4ErrorPropagator::PropagateOneStep()", "GEANT4e-Notification",
217 JustWarning, message);
218 return -3;
219 }
220
221#ifdef G4EVERBOSE
222 if(verbose >= 1)
223 {
224 G4cout << " =====> starting GEANT4E tracking for "
225 << currentTS->GetParticleType()
226 << " Forwards= " << g4edata->GetMode() << G4endl;
227 }
228 if(verbose >= 3)
229 {
230 G4cout << " G4ErrorPropagator::Propagate initialTS ";
231 G4cout << *currentTS << G4endl;
232 }
233#endif
234
235 //----- If it is the first step, create a track
236 //
237 if(theStepN == 0)
238 {
239 if(theG4Track != 0)
240 {
241 delete theG4Track;
242 }
243 theG4Track = InitG4Track(*currentTS);
244 }
245 // set to 0 by the initialization in G4ErrorPropagatorManager
246 theStepN++;
247
248 //----- Create a G4ErrorFreeTrajState
249 //
250 G4ErrorFreeTrajState* currentTS_FREE = InitFreeTrajState(currentTS);
251
252 //----- Track the particle one step
253 //
254 ierr = MakeOneStep(currentTS_FREE);
255
256 //----- Get the state on target
257 //
258 GetFinalTrajState(currentTS, currentTS_FREE, g4edata->GetTarget());
259
260 return ierr;
261}
@ G4State_GeomClosed
@ G4ErrorState_PreInit
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()

References FatalException, G4BestUnit, 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(), JustWarning, HepGeom::BasicVector3D< T >::mag(), MakeOneStep(), MeV, theG4Track, theStepN, and verbose.

Referenced by G4ErrorPropagatorManager::PropagateOneStep().

◆ SetStepLength()

void G4ErrorPropagator::SetStepLength ( const G4double  sl)
inline

Definition at line 105 of file G4ErrorPropagator.hh.

105{ theStepLength = sl; }

References theStepLength.

◆ SetStepN()

void G4ErrorPropagator::SetStepN ( const G4int  sn)
inline

Definition at line 107 of file G4ErrorPropagator.hh.

107{ theStepN = sn; }

References theStepN.

Referenced by G4ErrorPropagatorManager::InitTrackPropagation().

Field Documentation

◆ fpSteppingManager

G4SteppingManager* G4ErrorPropagator::fpSteppingManager
private

Definition at line 122 of file G4ErrorPropagator.hh.

Referenced by G4ErrorPropagator(), InitG4Track(), and MakeOneStep().

◆ theG4Track

G4Track* G4ErrorPropagator::theG4Track
private

◆ theInitialTrajState

G4ErrorTrajState* G4ErrorPropagator::theInitialTrajState
private

Definition at line 116 of file G4ErrorPropagator.hh.

Referenced by GetInitialTrajState().

◆ thePropIsInitialized

G4bool G4ErrorPropagator::thePropIsInitialized
private

Definition at line 126 of file G4ErrorPropagator.hh.

Referenced by G4ErrorPropagator().

◆ theStepLength

G4double G4ErrorPropagator::theStepLength
private

Definition at line 114 of file G4ErrorPropagator.hh.

Referenced by GetStepLength(), MakeOneStep(), MakeSteps(), and SetStepLength().

◆ theStepN

G4int G4ErrorPropagator::theStepN
private

Definition at line 118 of file G4ErrorPropagator.hh.

Referenced by PropagateOneStep(), and SetStepN().

◆ verbose

G4int G4ErrorPropagator::verbose
private

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