79 { KillVerbose =
false; }
80 fVerbose -> SetManager(
this);
84 ->GetNavigatorForTracking());
86 fSelectedAtRestDoItVector
88 fSelectedAlongStepDoItVector
90 fSelectedPostStepDoItVector
94 ->GetNavigatorForTracking());
107 fTouchableHandle = 0;
115 delete fSelectedAtRestDoItVector;
116 delete fSelectedAlongStepDoItVector;
117 delete fSelectedPostStepDoItVector;
118 delete fUserSteppingAction;
120 if(KillVerbose)
delete fVerbose;
128#ifdef GEANT4_USE_TIMEMORY
140 else if (verboseLevel==-1)
162 fN2ndariesAtRestDoIt = 0;
163 fN2ndariesAlongStepDoIt = 0;
164 fN2ndariesPostStepDoIt = 0;
180 if( MAXofAtRestLoops>0 )
182 InvokeAtRestDoItProcs();
203 DefinePhysicalStepLength();
208 G4double GeomStepLength = PhysicalStep;
214 InvokeAlongStepDoItProcs();
226 endpointSafety= std::max( proposedSafety - GeomStepLength, kCarTolerance);
235 InvokePostStepDoItProcs();
253 if(verboseLevel>0) fVerbose->
StepInfo();
263 if( fSensitive != 0 )
265 fSensitive->
Hit(fStep);
271 if( fUserSteppingAction !=
nullptr )
293 PreStepPointIsGeom =
false;
295 fParticleChange =
nullptr;
296 fPreviousStepSize = 0.;
303 GeometricalStep = 0.;
305 PreStepPointIsGeom =
false;
308 TempInitVelocity = 0.;
310 sumEnergyChange = 0.;
335 &direction,
false,
false );
348 if ( newTopVolume != oldTopVolume
375 fCurrentVolume = fTouchableHandle->
GetVolume();
379 if( fCurrentVolume==
nullptr )
384 G4cerr <<
"ERROR - G4SteppingManager::SetInitialStep()" <<
G4endl
385 <<
" Primary particle starting at - "
387 <<
" - is outside of the world volume." <<
G4endl;
388 G4Exception(
"G4SteppingManager::SetInitialStep()",
"Tracking0010",
393 G4cout <<
"WARNING - G4SteppingManager::SetInitialStep()" <<
G4endl
394 <<
" Initial track position is outside world! - "
413 G4cout <<
"G4SteppingManager::GetProcessNumber: is called track="
420 G4cerr <<
"ERROR - G4SteppingManager::GetProcessNumber()" <<
G4endl
421 <<
" ProcessManager is NULL for particle = "
424 G4Exception(
"G4SteppingManager::GetProcessNumber()",
"Tracking0011",
436 G4cout <<
"G4SteppingManager::GetProcessNumber: #ofAtRest="
437 << MAXofAtRestLoops <<
G4endl;
447 G4cout <<
"G4SteppingManager::GetProcessNumber:#ofAlongStp="
448 << MAXofAlongStepLoops <<
G4endl;
458 G4cout <<
"G4SteppingManager::GetProcessNumber: #ofPostStep="
459 << MAXofPostStepLoops <<
G4endl;
462 if (SizeOfSelectedDoItVector<MAXofAtRestLoops ||
463 SizeOfSelectedDoItVector<MAXofAlongStepLoops ||
464 SizeOfSelectedDoItVector<MAXofPostStepLoops )
466 G4cerr <<
"ERROR - G4SteppingManager::GetProcessNumber()" <<
G4endl
467 <<
" SizeOfSelectedDoItVector= " << SizeOfSelectedDoItVector
468 <<
" ; is smaller then one of MAXofAtRestLoops= "
469 << MAXofAtRestLoops <<
G4endl
470 <<
" or MAXofAlongStepLoops= " << MAXofAlongStepLoops
471 <<
" or MAXofPostStepLoops= " << MAXofPostStepLoops <<
G4endl;
472 G4Exception(
"G4SteppingManager::GetProcessNumber()",
474 "The array size is smaller than the actual No of processes.");
485void G4SteppingManager::DefinePhysicalStepLength()
499 fPostStepDoItProcTriggered = MAXofPostStepLoops;
501 for(std::size_t np=0; np<MAXofPostStepLoops; ++np)
503 fCurrentProcess = (*fPostStepGetPhysIntVector)((
G4int)np);
504 if (fCurrentProcess ==
nullptr)
511 fPreviousStepSize, &fCondition );
525 G4Exception(
"G4SteppingManager::DefinePhysicalStepLength()",
527 "This feature no more supported");
530 (*fSelectedPostStepDoItVector)[np] =
Forced;
542 for(std::size_t nrest=np+1; nrest<MAXofPostStepLoops; ++nrest)
544 (*fSelectedPostStepDoItVector)[nrest] =
InActivated;
550 if(physIntLength < PhysicalStep )
552 PhysicalStep = physIntLength;
554 fPostStepDoItProcTriggered =
G4int(np);
560 if (fPostStepDoItProcTriggered<MAXofPostStepLoops)
562 if ((*fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] ==
InActivated)
564 (*fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] =
NotForced;
571 G4double safetyProposedToAndByProcess = proposedSafety;
572 G4bool delegateToTransportation =
false;
574 for(std::size_t kp=0; kp<MAXofAlongStepLoops; ++kp)
576 fCurrentProcess = (*fAlongStepGetPhysIntVector)[(
G4int)kp];
577 if (fCurrentProcess ==
nullptr)
continue;
581 fPreviousStepSize, PhysicalStep,
582 safetyProposedToAndByProcess,
588 if(physIntLength < PhysicalStep)
590 PhysicalStep = physIntLength;
603 delegateToTransportation =
true;
608 if(kp == MAXofAlongStepLoops-1)
613 delegateToTransportation =
false;
620 if (safetyProposedToAndByProcess < proposedSafety)
624 proposedSafety = safetyProposedToAndByProcess;
630 safetyProposedToAndByProcess = proposedSafety;
633 if(delegateToTransportation)
641G4int G4SteppingManager::ProcessSecondariesFromParticleChange()
646 G4int pushedSecondaries = 0;
658 for(
G4int DSecLoop=0; DSecLoop< num2ndaries; ++DSecLoop)
660 tempSecondaryTrack = fParticleChange->
GetSecondary(DSecLoop);
678 ED <<
"A track without proper process manager is pushed\n"
679 <<
"into the track stack.\n"
680 <<
" Particle name : "
683 G4Exception(
"G4SteppingManager::ProcessSecondariesFromParticleChange()",
689 fSecondary->push_back( tempSecondaryTrack );
694 delete tempSecondaryTrack;
699 fSecondary->push_back( tempSecondaryTrack );
704 return pushedSecondaries;
708void G4SteppingManager::InvokeAtRestDoItProcs()
715 G4double lifeTime, shortestLifeTime;
717 fAtRestDoItProcTriggered = 0;
720 for( std::size_t ri=0 ; ri < MAXofAtRestLoops ; ++ri )
722 fCurrentProcess = (*fAtRestGetPhysIntVector)[(
G4int)ri];
723 if (fCurrentProcess ==
nullptr)
729 lifeTime = fCurrentProcess->
AtRestGPIL( *fTrack, &fCondition );
733 (*fSelectedAtRestDoItVector)[ri] =
Forced;
738 if(lifeTime < shortestLifeTime )
740 shortestLifeTime = lifeTime;
741 fAtRestDoItProcTriggered =
G4int(ri);
747 (*fSelectedAtRestDoItVector)[fAtRestDoItProcTriggered] =
NotForced;
756 if(shortestLifeTime < 1.0e+100)
760 for(std::size_t np=0; np<MAXofAtRestLoops; ++np)
766 if( (*fSelectedAtRestDoItVector)[MAXofAtRestLoops-np-1] !=
InActivated)
768 fCurrentProcess = (*fAtRestDoItVector)[(
G4int)np];
769 fParticleChange = fCurrentProcess->
AtRestDoIt(*fTrack, *fStep);
776 fN2ndariesAtRestDoIt += ProcessSecondariesFromParticleChange();
779 fParticleChange->Clear();
795void G4SteppingManager::InvokeAlongStepDoItProcs()
808 for( std::size_t ci=0; ci<MAXofAlongStepLoops; ++ci )
810 fCurrentProcess = (*fAlongStepDoItVector)[(
G4int)ci];
811 if (fCurrentProcess== 0)
continue;
814 fParticleChange = fCurrentProcess->
AlongStepDoIt( *fTrack, *fStep );
824 fN2ndariesAlongStepDoIt += ProcessSecondariesFromParticleChange();
832 fParticleChange->Clear();
847void G4SteppingManager::InvokePostStepDoItProcs()
852 for(std::size_t np=0; np<MAXofPostStepLoops; ++np)
858 G4int Cond = (*fSelectedPostStepDoItVector)[MAXofPostStepLoops-np-1];
880 for(std::size_t np1=np+1; np1<MAXofPostStepLoops; ++np1)
882 G4int Cond2 = (*fSelectedPostStepDoItVector)[MAXofPostStepLoops-np1-1];
894void G4SteppingManager::InvokePSDIP(
size_t np)
897 fCurrentProcess = (*fPostStepDoItVector)[(
G4int)np];
898 fParticleChange = fCurrentProcess->
PostStepDoIt( *fTrack, *fStep);
914 fN2ndariesPostStepDoIt += ProcessSecondariesFromParticleChange();
920 fParticleChange->Clear();
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::vector< G4int > G4SelectedPostStepDoItVector
std::vector< G4int > G4SelectedAtRestDoItVector
std::vector< G4int > G4SelectedAlongStepDoItVector
Definition of the G4SteppingVerboseWithUnits class.
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
G4Region * GetRegion() const
G4TouchableHistory * CreateTouchableHistory() const
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=nullptr, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
virtual G4VPhysicalVolume * ResetHierarchyAndLocate(const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
G4ProcessManager * GetProcessManager() const
G4int GetPDGEncoding() const
const G4String & GetParticleName() const
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
std::size_t entries() const
G4UserSteppingAction * GetRegionalSteppingAction() const
G4StepStatus GetStepStatus() const
void SetSafety(const G4double aValue)
void SetStepStatus(const G4StepStatus aValue)
void SetProcessDefinedStep(const G4VProcess *aValue)
const G4ThreeVector & GetPosition() const
G4VSensitiveDetector * GetSensitiveDetector() const
G4VPhysicalVolume * GetPhysicalVolume() const
void DeleteSecondaryVector()
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *vec)
void InitializeStep(G4Track *aValue)
G4SteppingControl GetControlFlag() const
void ResetTotalEnergyDeposit()
void SetStepLength(G4double value)
void CopyPostToPreStepPoint()
G4StepPoint * GetPreStepPoint() const
G4double GetStepLength() const
G4TrackVector * NewSecondaryVector()
G4StepPoint * GetPostStepPoint() const
void SetTrack(G4Track *value)
void SetNavigator(G4Navigator *value)
void SetInitialStep(G4Track *valueTrack)
static G4int BestUnitPrecision()
G4TrackStatus GetTrackStatus() const
void SetTrackStatus(const G4TrackStatus aTrackStatus)
void SetStepLength(G4double value)
G4VPhysicalVolume * GetVolume() const
void SetVertexPosition(const G4ThreeVector &aValue)
const G4TouchableHandle & GetNextTouchableHandle() const
void SetVertexMomentumDirection(const G4ThreeVector &aValue)
G4VPhysicalVolume * GetNextVolume() const
void SetNextTouchableHandle(const G4TouchableHandle &apValue)
const G4ThreeVector & GetPosition() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4int GetCurrentStepNumber() const
void SetOriginTouchableHandle(const G4TouchableHandle &apValue)
G4ParticleDefinition * GetDefinition() const
void AddTrackLength(const G4double aValue)
const G4DynamicParticle * GetDynamicParticle() const
const G4TouchableHandle & GetTouchableHandle() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
void SetVertexKineticEnergy(const G4double aValue)
G4int GetParentID() const
void SetLogicalVolumeAtVertex(const G4LogicalVolume *)
void SetParentID(const G4int aValue)
void SetCreatorProcess(const G4VProcess *aValue)
static G4TransportationManager * GetTransportationManager()
virtual void UserSteppingAction(const G4Step *)
virtual G4Step * UpdateStepForAlongStep(G4Step *Step)
virtual G4Step * UpdateStepForAtRest(G4Step *Step)
virtual G4Step * UpdateStepForPostStep(G4Step *Step)
G4int GetNumberOfSecondaries() const
G4Track * GetSecondary(G4int anIndex) const
G4LogicalVolume * GetLogicalVolume() const
virtual G4int GetRegularStructureId() const =0
virtual G4VParticleChange * AtRestDoIt(const G4Track &track, const G4Step &stepData)=0
G4ProcessType GetProcessType() const
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)=0
G4double PostStepGPIL(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
G4double AtRestGPIL(const G4Track &track, G4ForceCondition *condition)
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)=0
G4double AlongStepGPIL(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
virtual const G4VProcess * GetCreatorProcess() const
const G4String & GetProcessName() const
G4bool Hit(G4Step *aStep)
static G4VSteppingVerbose * GetInstance()
virtual void AlongStepDoItAllDone()=0
virtual G4VSteppingVerbose * Clone()
virtual void AlongStepDoItOneByOne()=0
virtual void DPSLPostStep()=0
virtual void PostStepDoItAllDone()=0
virtual void AtRestDoItInvoked()=0
virtual void DPSLAlongStep()=0
virtual void StepInfo()=0
virtual void PostStepDoItOneByOne()=0
virtual void DPSLStarted()=0
static void SetSilent(G4int fSilent)
virtual void TrackingStarted()=0
static G4VSteppingVerbose * GetMasterInstance()
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const