61 using namespace G4MemStat;
70 for(
G4int DSecLoop = 0; DSecLoop < fpParticleChange->GetNumberOfSecondaries();
73 tempSecondaryTrack = fpParticleChange->GetSecondary(DSecLoop);
77 ApplyProductionCut(tempSecondaryTrack);
81 tempSecondaryTrack->
SetParentID(fpTrack->GetTrackID());
94 fpSecondary->push_back( tempSecondaryTrack );
95 fN2ndariesAtRestDoIt++;
99 delete tempSecondaryTrack;
104 fpSecondary->push_back( tempSecondaryTrack );
122 if(fpVerbose) fpVerbose->DoItStarted();
127 size_t initialSize = mainList->
size();
131 for(
size_t i = 0 ; i < initialSize ; ++i)
140 exceptionDescription <<
"No track was pop back the main track list.";
160 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DOIT)
161 MemStat mem_first, mem_second, mem_diff;
167 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DOIT)
169 mem_diff = mem_intermediaire-mem_first;
170 G4cout <<
"\t\t >> || MEM || In DoIT with track "
176 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DOIT)
178 mem_diff = mem_second-mem_first;
179 G4cout <<
"\t >> || MEM || In DoIT with track "
181 <<
", diff is : " << mem_diff <<
G4endl;
186 fpTrackContainer->MergeSecondariesWithMainList();
187 fpTrackContainer->KillTracks();
188 fLeadingTracks.Reset();
225 for (
size_t i = 0; i < fpSecondary->size(); ++i)
227 delete (*fpSecondary)[i];
229 fpSecondary->clear();
244 if (!fpSecondary || fpSecondary->empty())
254 G4TrackVector::iterator secondaries_i = fpSecondary->begin();
256 for (; secondaries_i != fpSecondary->end(); ++secondaries_i)
258 G4Track* secondary = *secondaries_i;
259 fpTrackContainer->_PushTrack(secondary);
269 MemStat mem_first, mem_second, mem_diff;
280 mem_diff = mem_intermediaire-mem_first;
281 G4cout <<
"\t\t\t >> || MEM || After CleanProcessor " << track->
GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
284 if(track == 0)
return;
299 MemStat mem_first, mem_second, mem_diff;
307 if(fpVerbose) fpVerbose->PreStepVerbose(fpTrack);
313 exceptionDescription <<
"No process info found for particle :"
314 << fpTrack->GetDefinition()->GetParticleName();
316 "ITStepProcessor0012",
318 exceptionDescription);
327 if(fpProcessInfo->MAXofPostStepLoops == 0 &&
328 fpProcessInfo->MAXofAlongStepLoops == 0
329 && fpProcessInfo->MAXofAtRestLoops == 0)
332 exceptionDescription <<
"No process was found for particle :"
333 << fpTrack->GetDefinition()->GetParticleName();
335 "ITStepProcessorNoProcess",
337 exceptionDescription);
349 if(fpVerbose) fpVerbose->NewStep();
356 fpNavigator->SetNavigatorState(fpITrack->GetTrackingInfo()->GetNavigatorState());
366 mem_diff = mem_intermediaire-mem_first;
367 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After dealing with navigator with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
372 if(fpProcessInfo->MAXofAtRestLoops > 0 && fpProcessInfo->fpAtRestDoItVector
378 InvokeAtRestDoItProcs();
380 fpStep->GetPostStepPoint()->SetStepStatus(fpState->fStepStatus);
384 if(fpVerbose) fpVerbose->AtRestDoItInvoked();
396 exceptionDescription <<
" !!! TrackID : " << fpTrack->GetTrackID()
397 << G4endl<<
" !!! Track status : "<< fpTrack->GetTrackStatus() << G4endl
398 <<
" !!! Particle Name : "<< fpTrack -> GetDefinition() -> GetParticleName() << G4endl
399 <<
"No G4ITStepProcessor::fpITrack found" <<
G4endl;
402 "ITStepProcessor0013",
404 exceptionDescription);
408 if(fpITrack->GetTrackingInfo()->IsLeadingStep() ==
false)
414 fpStep->GetPostStepPoint()->SetProcessDefinedStep(fpTransportation);
415 FindTransportationStep();
420 mem_diff = mem_intermediaire-mem_first;
421 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After FindTransportationStep() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
425 fpTrack->SetStepLength(fpState->fPhysicalStep);
426 fpStep->SetStepLength(fpState->fPhysicalStep);
428 G4double GeomStepLength = fpState->fPhysicalStep;
431 fpStep->GetPostStepPoint()->SetStepStatus(fpState->fStepStatus);
434 InvokeAlongStepDoItProcs();
438 mem_diff = mem_intermediaire-mem_first;
439 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After InvokeAlongStepDoItProcs() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
444 if(fpVerbose) fpVerbose->AlongStepDoItAllDone();
451 fpState->fEndpointSafOrigin = fpPostStepPoint->GetPosition();
453 fpState->fEndpointSafety =
456 fpStep->GetPostStepPoint()->SetSafety(fpState->fEndpointSafety);
458 if(
GetIT(fpTrack)->GetTrackingInfo()->IsLeadingStep())
461 InvokePostStepDoItProcs();
465 mem_diff = mem_intermediaire-mem_first;
466 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After InvokePostStepDoItProcs() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
470 if(fpVerbose) fpVerbose->StepInfoForLeadingTrack();
476 InvokeTransportationProc();
477 fpStep->GetPostStepPoint()->SetProcessDefinedStep(fpTransportation);
481 mem_diff = mem_intermediaire-mem_first;
482 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After InvokeTransportationProc() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
488 if(fpVerbose) fpVerbose->PostStepDoItAllDone();
492 fpNavigator->ResetNavigatorState();
496 mem_diff = mem_intermediaire-mem_first;
497 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After fpNavigator->SetNavigatorState with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
505 fpTrack->AddTrackLength(fpStep->GetStepLength());
506 fpTrack->IncrementCurrentStepNumber();
514 if(fpVerbose) fpVerbose->PostStepVerbose(fpTrack);
549 mem_diff = mem_intermediaire-mem_first;
550 G4cout <<
"\t\t\t >> || MEM || End of DoStepping() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
564 fpStep->SetStepLength(0.);
565 fpTrack->SetStepLength(0.);
568 fpState->fSelectedAtRestDoItVector;
571 for(
size_t np = 0; np < fpProcessInfo->MAXofAtRestLoops; np++)
577 if(selectedAtRestDoItVector[fpProcessInfo->MAXofAtRestLoops - np - 1] !=
InActivated)
580 (
G4VITProcess*) (*fpProcessInfo->fpAtRestDoItVector)[np];
591 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess
593 fpParticleChange = fpCurrentProcess->AtRestDoIt(*fpTrack, *fpStep);
594 fpCurrentProcess->ResetProcessState();
597 fpStep->GetPostStepPoint()->SetProcessDefinedStep(fpCurrentProcess);
600 fpParticleChange->UpdateStepForAtRest(fpStep);
603 DealWithSecondaries(fN2ndariesAtRestDoIt);
607 fpTrack->SetTrackStatus(fpParticleChange->GetTrackStatus());
610 fpParticleChange->Clear();
614 fpStep->UpdateTrack();
633 MemStat mem_first, mem_second, mem_diff;
648 for(
size_t ci = 0; ci < fpProcessInfo->MAXofAlongStepLoops; ci++)
651 (
G4VITProcess*) (*fpProcessInfo->fpAlongStepDoItVector)[ci];
652 if(fpCurrentProcess == 0)
continue;
655 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess
657 fpParticleChange = fpCurrentProcess->AlongStepDoIt(*fpTrack, *fpStep);
661 mem_diff = mem_intermediaire-mem_first;
662 G4cout <<
"\t\t\t >> || MEM || After calling AlongStepDoIt for " << fpCurrentProcess->GetProcessName() <<
" and track "<< fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
666 fpCurrentProcess->ResetProcessState();
669 fpParticleChange->UpdateStepForAlongStep(fpStep);
673 if(fpVerbose) fpVerbose->AlongStepDoItOneByOne();
677 DealWithSecondaries(fN2ndariesAlongStepDoIt);
681 fpTrack->SetTrackStatus(fpParticleChange->GetTrackStatus());
684 fpParticleChange->Clear();
689 mem_diff = mem_intermediaire-mem_first;
690 G4cout <<
"\t\t\t >> || MEM || After looping on processes with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
693 fpStep->UpdateTrack();
697 if(fNewStatus ==
fAlive && fpTrack->GetKineticEnergy() <=
DBL_MIN)
700 if(fpProcessInfo->MAXofAtRestLoops>0) fNewStatus =
fStopButAlive;
702 fpTrack->SetTrackStatus( fNewStatus );
715 size_t _MAXofPostStepLoops = fpProcessInfo->MAXofPostStepLoops;
717 ->fSelectedPostStepDoItVector;
721 for(
size_t np = 0; np < _MAXofPostStepLoops; np++)
727 G4int Cond = selectedPostStepDoItVector[_MAXofPostStepLoops
747 for(
size_t np1 = np + 1; np1 < _MAXofPostStepLoops; np1++)
749 G4int Cond2 = selectedPostStepDoItVector[_MAXofPostStepLoops
765 fpCurrentProcess = (
G4VITProcess*) (*fpProcessInfo->fpPostStepDoItVector)[np];
767 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess
769 fpParticleChange = fpCurrentProcess->PostStepDoIt(*fpTrack, *fpStep);
771 fpCurrentProcess->ResetProcessState();
774 fpParticleChange->UpdateStepForPostStep(fpStep);
778 if(fpVerbose) fpVerbose->PostStepDoItOneByOne();
782 fpStep->UpdateTrack();
785 fpStep->GetPostStepPoint()->SetSafety(CalculateSafety());
788 DealWithSecondaries(fN2ndariesPostStepDoIt);
791 fpTrack->SetTrackStatus(fpParticleChange->GetTrackStatus());
794 fpParticleChange->Clear();
805 double physicalStep(0.);
807 fpTransportation = fpProcessInfo->fpTransportation;
813 exceptionDescription <<
"No G4ITStepProcessor::fpTrack found";
814 G4Exception(
"G4ITStepProcessor::FindTransportationStep",
815 "ITStepProcessor0013",
817 exceptionDescription);
824 exceptionDescription <<
"No G4ITStepProcessor::fITrack";
825 G4Exception(
"G4ITStepProcessor::FindTransportationStep",
826 "ITStepProcessor0014",
828 exceptionDescription);
831 if(!(fpITrack->GetTrack()))
834 exceptionDescription <<
"No G4ITStepProcessor::fITrack->GetTrack()";
835 G4Exception(
"G4ITStepProcessor::FindTransportationStep",
836 "ITStepProcessor0015",
838 exceptionDescription);
844 fpTransportation->SetProcessState(fpTrackingInfo->GetProcessState(fpTransportation
846 fpTransportation->ComputeStep(*fpTrack, *fpStep,
fTimeStep, physicalStep);
849 fpTransportation->ResetProcessState();
859 fpState->fPhysicalStep = physicalStep;
866 size_t _MAXofPostStepLoops = fpProcessInfo->MAXofPostStepLoops;
868 ->fSelectedPostStepDoItVector;
872 for(
size_t np = 0; np < _MAXofPostStepLoops; np++)
878 G4int Cond = selectedPostStepDoItVector[_MAXofPostStepLoops - np - 1];
895 for(
size_t np1 = np + 1; np1 < _MAXofPostStepLoops; np1++)
897 G4int Cond2 = selectedPostStepDoItVector[_MAXofPostStepLoops - np1 - 1];
916 G4bool tBelowCutEnergyAndSafety =
false;
925 ->GetMaterialCutsCouple());
930 tBelowCutEnergyAndSafety =
true;
936 fpPreStepPoint->GetMaterialCutsCouple());
937 tBelowCutEnergyAndSafety = (currentRange < CalculateSafety() );
941 if(tBelowCutEnergyAndSafety)
static G4ITReactionSet * Instance()
G4double GetKineticEnergy() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4int GetCoupleIndex(const G4MaterialCutsCouple *aCouple) const
void DoIt(double timeStep)
std::ostringstream G4ExceptionDescription
void Stepping(G4Track *, const double &)
void RemoveReactionSet(G4Track *track)
static G4int GetIndex(const G4String &name)
void SetCreatorProcess(const G4VProcess *aValue)
const G4double kCarTolerance
G4ParticleDefinition * GetDefinition() const
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
void DealWithSecondaries(G4int &)
void InvokeAtRestDoItProcs()
void InvokeTransportationProc()
void InvokePostStepDoItProcs()
G4bool IsGoodForTracking() const
G4double GetCharge() const
class std::vector< int, std::allocator< int > > G4SelectedPostStepDoItVector
void SetKineticEnergy(const G4double aValue)
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
void ApplyProductionCut(G4Track *)
void FindTransportationStep()
static G4ProductionCutsTable * GetProductionCutsTable()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void InvokeAlongStepDoItProcs()
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessManager * GetProcessManager() const
void SetParentID(const G4int aValue)
G4GLOB_DLL std::ostream G4cout
static G4LossTableManager * Instance()
G4ITTrackingManager * fpTrackingManager
G4bool GetApplyCutsFlag() const
void AppendStep(G4Track *track, G4Step *step)
class std::vector< int, std::allocator< int > > G4SelectedAtRestDoItVector
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4TrackStatus GetTrackStatus() const
void EndTracking(G4Track *)
G4IT * GetIT(const G4Track *track)
const G4DynamicParticle * GetDynamicParticle() const