54 G4cout <<
"G4SteppingManager::GetProcessNumber: is called track="
61 G4cerr <<
"ERROR - G4SteppingManager::GetProcessNumber()" <<
G4endl
62 <<
" ProcessManager is NULL for particle = "
65 G4Exception(
"G4SteppingManager::GetProcessNumber()",
"Tracking0011",
77 G4cout <<
"G4SteppingManager::GetProcessNumber: #ofAtRest="
78 << MAXofAtRestLoops <<
G4endl;
88 G4cout <<
"G4SteppingManager::GetProcessNumber:#ofAlongStp="
89 << MAXofAlongStepLoops <<
G4endl;
99 G4cout <<
"G4SteppingManager::GetProcessNumber: #ofPostStep="
100 << MAXofPostStepLoops <<
G4endl;
103 if (SizeOfSelectedDoItVector<MAXofAtRestLoops ||
104 SizeOfSelectedDoItVector<MAXofAlongStepLoops ||
105 SizeOfSelectedDoItVector<MAXofPostStepLoops )
107 G4cerr <<
"ERROR - G4SteppingManager::GetProcessNumber()" <<
G4endl
108 <<
" SizeOfSelectedDoItVector= " << SizeOfSelectedDoItVector
109 <<
" ; is smaller then one of MAXofAtRestLoops= "
110 << MAXofAtRestLoops <<
G4endl
111 <<
" or MAXofAlongStepLoops= " << MAXofAlongStepLoops
112 <<
" or MAXofPostStepLoops= " << MAXofPostStepLoops <<
G4endl;
113 G4Exception(
"G4SteppingManager::GetProcessNumber()",
115 "The array size is smaller than the actual No of processes.");
126void G4SteppingManager::DefinePhysicalStepLength()
140 fPostStepDoItProcTriggered = MAXofPostStepLoops;
142 for(std::size_t np=0; np<MAXofPostStepLoops; ++np)
144 fCurrentProcess = (*fPostStepGetPhysIntVector)(np);
145 if (fCurrentProcess ==
nullptr)
152 fPreviousStepSize, &fCondition );
166 G4Exception(
"G4SteppingManager::DefinePhysicalStepLength()",
168 "This feature no more supported");
171 (*fSelectedPostStepDoItVector)[np] =
Forced;
183 for(std::size_t nrest=np+1; nrest<MAXofPostStepLoops; ++nrest)
185 (*fSelectedPostStepDoItVector)[nrest] =
InActivated;
191 if(physIntLength < PhysicalStep )
193 PhysicalStep = physIntLength;
195 fPostStepDoItProcTriggered =
G4int(np);
201 if (fPostStepDoItProcTriggered<MAXofPostStepLoops)
203 if ((*fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] ==
InActivated)
205 (*fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] =
NotForced;
212 G4double safetyProposedToAndByProcess = proposedSafety;
214 for(std::size_t kp=0; kp<MAXofAlongStepLoops; ++kp)
216 fCurrentProcess = (*fAlongStepGetPhysIntVector)[kp];
217 if (fCurrentProcess ==
nullptr)
continue;
221 fPreviousStepSize, PhysicalStep,
222 safetyProposedToAndByProcess,
228 if(physIntLength < PhysicalStep)
230 PhysicalStep = physIntLength;
243 if(kp == MAXofAlongStepLoops-1) { fStepStatus =
fGeomBoundary; }
249 if (safetyProposedToAndByProcess < proposedSafety)
253 proposedSafety = safetyProposedToAndByProcess;
259 safetyProposedToAndByProcess = proposedSafety;
265void G4SteppingManager::InvokeAtRestDoItProcs()
272 G4double lifeTime, shortestLifeTime;
274 fAtRestDoItProcTriggered = 0;
277 unsigned int NofInactiveProc = 0;
278 for( std::size_t ri=0 ; ri < MAXofAtRestLoops ; ++ri )
280 fCurrentProcess = (*fAtRestGetPhysIntVector)[ri];
281 if (fCurrentProcess ==
nullptr)
288 lifeTime = fCurrentProcess->
AtRestGPIL( *fTrack, &fCondition );
292 (*fSelectedAtRestDoItVector)[ri] =
Forced;
297 if(lifeTime < shortestLifeTime )
299 shortestLifeTime = lifeTime;
300 fAtRestDoItProcTriggered =
G4int(ri);
305 (*fSelectedAtRestDoItVector)[fAtRestDoItProcTriggered] =
NotForced;
309 if(NofInactiveProc==MAXofAtRestLoops)
311 G4Exception(
"G4SteppingManager::InvokeAtRestDoItProcs()",
"Tracking0013",
320 for(std::size_t np=0; np<MAXofAtRestLoops; ++np)
326 if( (*fSelectedAtRestDoItVector)[MAXofAtRestLoops-np-1] !=
InActivated)
328 fCurrentProcess = (*fAtRestDoItVector)[np];
329 fParticleChange = fCurrentProcess->
AtRestDoIt(*fTrack, *fStep);
346 for(
G4int DSecLoop=0; DSecLoop< num2ndaries; ++DSecLoop)
348 tempSecondaryTrack = fParticleChange->
GetSecondary(DSecLoop);
352 ApplyProductionCut(tempSecondaryTrack);
371 ED <<
"A track without proper process manager is pushed\n"
372 <<
"into the track stack.\n"
373 <<
" Particle name : "
378 ED <<
"created by a primary particle generator.";
386 { ED <<
"creaded by unknown process."; }
388 G4Exception(
"G4SteppingManager::InvokeAtRestDoItProcs()",
394 fSecondary->push_back( tempSecondaryTrack );
395 ++fN2ndariesAtRestDoIt;
399 delete tempSecondaryTrack;
404 fSecondary->push_back( tempSecondaryTrack );
405 ++fN2ndariesAtRestDoIt;
410 fParticleChange->
Clear();
420void G4SteppingManager::InvokeAlongStepDoItProcs()
433 for( std::size_t ci=0; ci<MAXofAlongStepLoops; ++ci )
435 fCurrentProcess = (*fAlongStepDoItVector)[ci];
436 if (fCurrentProcess== 0)
continue;
439 fParticleChange = fCurrentProcess->
AlongStepDoIt( *fTrack, *fStep );
455 for(
G4int DSecLoop=0; DSecLoop<num2ndaries; ++DSecLoop)
457 tempSecondaryTrack = fParticleChange->
GetSecondary(DSecLoop);
461 ApplyProductionCut(tempSecondaryTrack);
480 ED <<
"A track without proper process manager is pushed\n"
481 <<
"into the track stack.\n"
482 <<
" Particle name : "
487 ED <<
"created by a primary particle generator.";
495 { ED <<
"creaded by unknown process."; }
497 G4Exception(
"G4SteppingManager::InvokeAlongStepDoItProcs()",
503 fSecondary->push_back( tempSecondaryTrack );
504 ++fN2ndariesAlongStepDoIt;
508 delete tempSecondaryTrack;
513 fSecondary->push_back( tempSecondaryTrack );
514 ++fN2ndariesAlongStepDoIt;
524 fParticleChange->
Clear();
539void G4SteppingManager::InvokePostStepDoItProcs()
544 for(std::size_t np=0; np<MAXofPostStepLoops; ++np)
550 G4int Cond = (*fSelectedPostStepDoItVector)[MAXofPostStepLoops-np-1];
572 for(std::size_t np1=np+1; np1<MAXofPostStepLoops; ++np1)
574 G4int Cond2 = (*fSelectedPostStepDoItVector)[MAXofPostStepLoops-np1-1];
586void G4SteppingManager::InvokePSDIP(
size_t np)
589 fCurrentProcess = (*fPostStepDoItVector)[np];
590 fParticleChange = fCurrentProcess->
PostStepDoIt( *fTrack, *fStep);
612 for(
G4int DSecLoop=0; DSecLoop<num2ndaries; ++DSecLoop)
614 tempSecondaryTrack = fParticleChange->
GetSecondary(DSecLoop);
618 ApplyProductionCut(tempSecondaryTrack);
637 ED <<
"A track without proper process manager is pushed\n"
638 <<
"into the track stack.\n"
639 <<
" Particle name : "
644 ED <<
"created by a primary particle generator.";
652 { ED <<
"creaded by unknown process."; }
654 G4Exception(
"G4SteppingManager::InvokePSDIP()",
"Tracking10053",
660 fSecondary->push_back( tempSecondaryTrack );
661 ++fN2ndariesPostStepDoIt;
665 delete tempSecondaryTrack;
670 fSecondary->push_back( tempSecondaryTrack );
671 ++fN2ndariesPostStepDoIt;
679 fParticleChange->
Clear();
683void G4SteppingManager::ApplyProductionCut(
G4Track* aSecondary)
686 G4bool tBelowCutEnergyAndSafety =
false;
689 if (tPtclIdx<0) {
return; }
694 if (tCoupleIdx<0) {
return; }
699 tBelowCutEnergyAndSafety =
true;
706 tBelowCutEnergyAndSafety = (currentRange < CalculateSafety() );
710 if( tBelowCutEnergyAndSafety )
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
G4double GetCharge() const
static G4LossTableManager * Instance()
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4ProcessManager * GetProcessManager() const
G4int GetPDGEncoding() const
G4bool GetApplyCutsFlag() 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
const std::vector< G4double > * GetEnergyCutsVector(std::size_t pcIdx) const
static G4ProductionCutsTable * GetProductionCutsTable()
G4int GetCoupleIndex(const G4MaterialCutsCouple *aCouple) const
static G4int GetIndex(const G4String &name)
void SetSafety(const G4double aValue)
void SetStepStatus(const G4StepStatus aValue)
void SetProcessDefinedStep(const G4VProcess *aValue)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
void SetStepLength(G4double value)
void AddTotalEnergyDeposit(G4double value)
G4StepPoint * GetPostStepPoint() const
G4TrackStatus GetTrackStatus() const
void SetTrackStatus(const G4TrackStatus aTrackStatus)
void SetStepLength(G4double value)
const G4VProcess * GetCreatorProcess() const
G4VPhysicalVolume * GetNextVolume() const
G4ParticleDefinition * GetDefinition() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetKineticEnergy() const
G4int GetParentID() const
void SetKineticEnergy(const G4double aValue)
G4bool IsGoodForTracking() const
void SetParentID(const G4int aValue)
void SetCreatorProcess(const G4VProcess *aValue)
virtual G4Step * UpdateStepForAlongStep(G4Step *Step)
virtual G4Step * UpdateStepForAtRest(G4Step *Step)
virtual G4Step * UpdateStepForPostStep(G4Step *Step)
G4int GetNumberOfSecondaries() const
G4Track * GetSecondary(G4int anIndex) const
G4TrackStatus GetTrackStatus() const
virtual G4VParticleChange * AtRestDoIt(const G4Track &track, const G4Step &stepData)=0
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)
const G4String & GetProcessName() const
virtual void AlongStepDoItOneByOne()=0
virtual void DPSLPostStep()=0
virtual void DPSLAlongStep()=0
virtual void PostStepDoItOneByOne()=0
virtual void DPSLStarted()=0