62 for(
G4int DSecLoop=0 ;
63 DSecLoop<fpParticleChange->GetNumberOfSecondaries() ;
66 tempSecondaryTrack = fpParticleChange->GetSecondary(DSecLoop);
70 ApplyProductionCut(tempSecondaryTrack);
74 tempSecondaryTrack->
SetParentID( fpTrack->GetTrackID() );
86 fpSecondary->push_back( tempSecondaryTrack );
87 fN2ndariesAtRestDoIt++;
89 delete tempSecondaryTrack;
94 fpSecondary->push_back( tempSecondaryTrack );
106 MemStat mem_first, mem_second, mem_diff;
117 mem_diff = mem_intermediaire-mem_first;
118 G4cout <<
"\t\t\t >> || MEM || After CleanProcessor " << track->
GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
121 if(track == 0) return ;
122 fTimeStep = timeStep ;
136 MemStat mem_first, mem_second, mem_diff;
146 exceptionDescription <<
"No process info found for particle :"
147 << fpTrack->GetDefinition()->GetParticleName();
148 G4Exception(
"G4ITStepProcessor::DoStepping",
"ITStepProcessor0012",
158 if(fpProcessInfo->MAXofPostStepLoops == 0
159 && fpProcessInfo->MAXofAlongStepLoops == 0
160 && fpProcessInfo->MAXofAtRestLoops == 0)
163 exceptionDescription <<
"No process was found for particle :"
164 << fpTrack->GetDefinition()->GetParticleName();
165 G4Exception(
"G4ITStepProcessor::DoStepping",
"ITStepProcessorNoProcess",
177 fpNavigator->SetNavigatorState(fpITrack->GetTrackingInfo()->GetNavigatorState());
187 mem_diff = mem_intermediaire-mem_first;
188 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After dealing with navigator with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
193 if( fpProcessInfo->MAXofAtRestLoops>0 &&
194 fpProcessInfo->fpAtRestDoItVector != 0)
199 InvokeAtRestDoItProcs();
201 fpStep->GetPostStepPoint()->SetStepStatus( fpState->fStepStatus );
213 <<
" !!! TrackID : "<< fpTrack->GetTrackID() << G4endl
214 <<
" !!! Track status : "<< fpTrack->GetTrackStatus() << G4endl
215 <<
" !!! Particle Name : "<< fpTrack -> GetDefinition() -> GetParticleName() << G4endl
216 <<
"No G4ITStepProcessor::fpITrack found" <<
G4endl;
218 G4Exception(
"G4ITStepProcessor::DoStepping",
"ITStepProcessor0013",
223 if(fpITrack->GetTrackingInfo()->IsLeadingStep() ==
false)
229 fpStep->GetPostStepPoint()
230 ->SetProcessDefinedStep(fpTransportation);
231 FindTransportationStep();
236 mem_diff = mem_intermediaire-mem_first;
237 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After FindTransportationStep() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
241 fpTrack->SetStepLength( fpState->fPhysicalStep );
242 fpStep->SetStepLength( fpState->fPhysicalStep );
244 G4double GeomStepLength = fpState->fPhysicalStep;
247 fpStep->GetPostStepPoint()->SetStepStatus( fpState->fStepStatus );
250 InvokeAlongStepDoItProcs();
254 mem_diff = mem_intermediaire-mem_first;
255 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After InvokeAlongStepDoItProcs() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
262 fpState->endpointSafOrigin= fpPostStepPoint->GetPosition();
264 fpState->endpointSafety=
std::max( fpState->proposedSafety - GeomStepLength, kCarTolerance);
266 fpStep->GetPostStepPoint()->SetSafety( fpState->endpointSafety );
268 if(
GetIT(fpTrack)->GetTrackingInfo()->IsLeadingStep())
271 InvokePostStepDoItProcs();
275 mem_diff = mem_intermediaire-mem_first;
276 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After InvokePostStepDoItProcs() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
282 InvokeTransportationProc();
286 mem_diff = mem_intermediaire-mem_first;
287 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After InvokeTransportationProc() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
292 fpNavigator->ResetNavigatorState();
296 mem_diff = mem_intermediaire-mem_first;
297 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After fpNavigator->SetNavigatorState with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
305 fpTrack->AddTrackLength(fpStep->GetStepLength());
306 fpTrack->IncrementCurrentStepNumber();
335 fpTrackingManager->AppendStep(fpTrack,fpStep);
341 mem_diff = mem_intermediaire-mem_first;
342 G4cout <<
"\t\t\t >> || MEM || End of DoStepping() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
357 fpStep->SetStepLength( 0. );
358 fpTrack->SetStepLength( 0. );
363 for(
size_t np=0; np < fpProcessInfo->MAXofAtRestLoops; np++)
369 if( selectedAtRestDoItVector[fpProcessInfo->MAXofAtRestLoops-np-1] !=
InActivated)
371 fpCurrentProcess = (
G4VITProcess*) (*fpProcessInfo->fpAtRestDoItVector)[np];
373 fpCurrentProcess->SetProcessState(
374 fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
376 = fpCurrentProcess->AtRestDoIt( *fpTrack, *fpStep);
378 fpCurrentProcess->ResetProcessState();
381 fpStep->GetPostStepPoint()
382 ->SetProcessDefinedStep(fpCurrentProcess);
385 fpParticleChange->UpdateStepForAtRest(fpStep);
388 DealWithSecondaries(fN2ndariesAtRestDoIt) ;
391 fpParticleChange->Clear();
395 fpStep->UpdateTrack();
410 MemStat mem_first, mem_second, mem_diff;
425 for(
size_t ci=0 ; ci<fpProcessInfo->MAXofAlongStepLoops ; ci++ )
427 fpCurrentProcess = (
G4VITProcess*) (*fpProcessInfo->fpAlongStepDoItVector)[ci];
428 if (fpCurrentProcess== 0)
continue;
431 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
432 fpParticleChange = fpCurrentProcess->AlongStepDoIt( *fpTrack, *fpStep );
436 mem_diff = mem_intermediaire-mem_first;
437 G4cout <<
"\t\t\t >> || MEM || After calling AlongStepDoIt for " << fpCurrentProcess->GetProcessName() <<
" and track "<< fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
441 fpCurrentProcess->ResetProcessState();
444 fpParticleChange->UpdateStepForAlongStep(fpStep);
447 DealWithSecondaries(fN2ndariesAlongStepDoIt) ;
451 fpTrack->SetTrackStatus( fpParticleChange->GetTrackStatus() );
454 fpParticleChange->Clear();
459 mem_diff = mem_intermediaire-mem_first;
460 G4cout <<
"\t\t\t >> || MEM || After looping on processes with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
463 fpStep->UpdateTrack();
467 if ( fNewStatus ==
fAlive && fpTrack->GetKineticEnergy() <=
DBL_MIN )
470 if(fpProcessInfo->MAXofAtRestLoops>0) fNewStatus =
fStopButAlive;
472 fpTrack->SetTrackStatus( fNewStatus );
492 for(
size_t np=0; np < fpProcessInfo->MAXofPostStepLoops; np++)
498 G4int Cond = selectedPostStepDoItVector[fpProcessInfo->MAXofPostStepLoops-np-1];
517 for(
size_t np1=np+1; np1 < fpProcessInfo->MAXofPostStepLoops; np1++)
519 G4int Cond2 = selectedPostStepDoItVector[fpProcessInfo->MAXofPostStepLoops-np1-1];
534 fpCurrentProcess = (
G4VITProcess*) (*fpProcessInfo->fpPostStepDoItVector)[np];
536 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
538 = fpCurrentProcess->PostStepDoIt( *fpTrack, *fpStep);
540 fpCurrentProcess->ResetProcessState();
543 fpParticleChange->UpdateStepForPostStep(fpStep);
546 fpStep->UpdateTrack();
549 fpStep->GetPostStepPoint()->SetSafety( CalculateSafety() );
552 DealWithSecondaries(fN2ndariesPostStepDoIt) ;
555 fpTrack->SetTrackStatus( fpParticleChange->GetTrackStatus() );
558 fpParticleChange->Clear();
569 double physicalStep(0.) ;
571 fpTransportation = fpProcessInfo->fpTransportation;
578 <<
"No G4ITStepProcessor::fpTrack found";
579 G4Exception(
"G4ITStepProcessor::FindTransportationStep",
"ITStepProcessor0013",
588 <<
"No G4ITStepProcessor::fITrack" ;
589 G4Exception(
"G4ITStepProcessor::FindTransportationStep",
"ITStepProcessor0014",
593 if(!(fpITrack->GetTrack()))
597 <<
"No G4ITStepProcessor::fITrack->GetTrack()" ;
598 G4Exception(
"G4ITStepProcessor::FindTransportationStep",
"ITStepProcessor0015",
605 fpTransportation->SetProcessState(fpTrackingInfo->GetProcessState(fpTransportation->GetProcessID()));
606 fpTransportation->ComputeStep(*fpTrack, *fpStep, fTimeStep, physicalStep) ;
608 fpTransportation->ResetProcessState();
619 fpState->fPhysicalStep = physicalStep ;
626 size_t _MAXofPostStepLoops = fpProcessInfo->MAXofPostStepLoops;
631 for(
size_t np=0; np < _MAXofPostStepLoops; np++)
637 G4int Cond = selectedPostStepDoItVector[_MAXofPostStepLoops-np-1];
656 for(
size_t np1=np+1; np1 < _MAXofPostStepLoops; np1++)
658 G4int Cond2 = selectedPostStepDoItVector[_MAXofPostStepLoops-np1-1];
678 G4bool tBelowCutEnergyAndSafety =
false;
688 = tCutsTbl->
GetCoupleIndex(fpPreStepPoint->GetMaterialCutsCouple());
693 tBelowCutEnergyAndSafety =
true;
699 fpPreStepPoint->GetMaterialCutsCouple());
700 tBelowCutEnergyAndSafety = (currentRange < CalculateSafety() );
704 if( tBelowCutEnergyAndSafety )
709 fpStep->AddTotalEnergyDeposit(
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4ParticleDefinition * GetDefinition() const
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
static G4LossTableManager * Instance()
static G4int GetIndex(const G4String &name)
std::ostringstream G4ExceptionDescription
const G4DynamicParticle * GetDynamicParticle() const
class std::vector< int, std::allocator< int > > G4SelectedAtRestDoItVector
void InvokeAlongStepDoItProcs()
virtual const G4String & GetName() const =0
G4ProcessManager * GetProcessManager() const
void SetCreatorProcess(const G4VProcess *aValue)
G4IT * GetIT(const G4Track *track)
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4double GetKineticEnergy() const
class std::vector< int, std::allocator< int > > G4SelectedPostStepDoItVector
G4GLOB_DLL std::ostream G4cout
void ApplyProductionCut(G4Track *)
G4int GetCoupleIndex(const G4MaterialCutsCouple *aCouple) const
void FindTransportationStep()
G4double GetCharge() const
void DealWithSecondaries(G4int &)
void InvokeTransportationProc()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4ProductionCutsTable * GetProductionCutsTable()
void InvokeAtRestDoItProcs()
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void Stepping(G4Track *, const double &)
void SetParentID(const G4int aValue)
void InvokePostStepDoItProcs()
G4bool IsGoodForTracking() const
G4bool GetApplyCutsFlag() const
void SetKineticEnergy(const G4double aValue)
G4VITProcess inherits from G4VProcess.
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)