60 using namespace G4MemStat;
69 for(
G4int DSecLoop = 0; DSecLoop < fpParticleChange->GetNumberOfSecondaries();
72 tempSecondaryTrack = fpParticleChange->GetSecondary(DSecLoop);
76 ApplyProductionCut(tempSecondaryTrack);
80 tempSecondaryTrack->
SetParentID(fpTrack->GetTrackID());
93 fpSecondary->push_back( tempSecondaryTrack );
94 fN2ndariesAtRestDoIt++;
98 delete tempSecondaryTrack;
103 fpSecondary->push_back( tempSecondaryTrack );
121 if(fpVerbose) fpVerbose->DoItStarted();
126 size_t initialSize = mainList->
size();
130 for(
size_t i = 0 ; i < initialSize ; ++i)
139 exceptionDescription <<
"No track was pop back the main track list.";
153 fpTrackingManager->EndTracking(track);
159 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DOIT)
160 MemStat mem_first, mem_second, mem_diff;
164 Stepping(track, timeStep);
166 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DOIT)
168 mem_diff = mem_intermediaire-mem_first;
169 G4cout <<
"\t\t >> || MEM || In DoIT with track "
175 #if defined (DEBUG_MEM) && defined (DEBUG_MEM_DOIT)
177 mem_diff = mem_second-mem_first;
178 G4cout <<
"\t >> || MEM || In DoIT with track "
180 <<
", diff is : " << mem_diff <<
G4endl;
185 fpTrackContainer->MergeSecondariesWithMainList();
186 fpTrackContainer->KillTracks();
187 fLeadingTracks.Reset();
216 fpTrackingManager->EndTracking(fpTrack);
224 for (
size_t i = 0; i < fpSecondary->size(); ++i)
226 delete (*fpSecondary)[i];
228 fpSecondary->clear();
231 fpTrackingManager->EndTracking(fpTrack);
243 if (!fpSecondary || fpSecondary->empty())
253 G4TrackVector::iterator secondaries_i = fpSecondary->begin();
255 for (; secondaries_i != fpSecondary->end(); ++secondaries_i)
257 G4Track* secondary = *secondaries_i;
258 fpTrackContainer->_PushTrack(secondary);
268 MemStat mem_first, mem_second, mem_diff;
279 mem_diff = mem_intermediaire-mem_first;
280 G4cout <<
"\t\t\t >> || MEM || After CleanProcessor " << track->
GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
283 if(track == 0)
return;
284 fTimeStep = timeStep;
298 MemStat mem_first, mem_second, mem_diff;
306 if(fpVerbose) fpVerbose->PreStepVerbose(fpTrack);
312 exceptionDescription <<
"No process info found for particle :"
313 << fpTrack->GetDefinition()->GetParticleName();
315 "ITStepProcessor0012",
317 exceptionDescription);
326 if(fpProcessInfo->MAXofPostStepLoops == 0 &&
327 fpProcessInfo->MAXofAlongStepLoops == 0
328 && fpProcessInfo->MAXofAtRestLoops == 0)
331 exceptionDescription <<
"No process was found for particle :"
332 << fpTrack->GetDefinition()->GetParticleName();
334 "ITStepProcessorNoProcess",
336 exceptionDescription);
348 if(fpVerbose) fpVerbose->NewStep();
355 fpNavigator->SetNavigatorState(fpITrack->GetTrackingInfo()->GetNavigatorState());
365 mem_diff = mem_intermediaire-mem_first;
366 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After dealing with navigator with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
371 if(fpProcessInfo->MAXofAtRestLoops > 0 && fpProcessInfo->fpAtRestDoItVector
377 InvokeAtRestDoItProcs();
379 fpStep->GetPostStepPoint()->SetStepStatus(fpState->fStepStatus);
383 if(fpVerbose) fpVerbose->AtRestDoItInvoked();
395 exceptionDescription <<
" !!! TrackID : " << fpTrack->GetTrackID()
396 << G4endl<<
" !!! Track status : "<< fpTrack->GetTrackStatus() << G4endl
397 <<
" !!! Particle Name : "<< fpTrack -> GetDefinition() -> GetParticleName() << G4endl
398 <<
"No G4ITStepProcessor::fpITrack found" <<
G4endl;
401 "ITStepProcessor0013",
403 exceptionDescription);
407 if(fpITrack->GetTrackingInfo()->IsLeadingStep() ==
false)
413 fpStep->GetPostStepPoint()->SetProcessDefinedStep(fpTransportation);
414 FindTransportationStep();
419 mem_diff = mem_intermediaire-mem_first;
420 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After FindTransportationStep() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
424 fpTrack->SetStepLength(fpState->fPhysicalStep);
425 fpStep->SetStepLength(fpState->fPhysicalStep);
427 G4double GeomStepLength = fpState->fPhysicalStep;
430 fpStep->GetPostStepPoint()->SetStepStatus(fpState->fStepStatus);
433 InvokeAlongStepDoItProcs();
437 mem_diff = mem_intermediaire-mem_first;
438 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After InvokeAlongStepDoItProcs() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
443 if(fpVerbose) fpVerbose->AlongStepDoItAllDone();
450 fpState->fEndpointSafOrigin = fpPostStepPoint->GetPosition();
452 fpState->fEndpointSafety =
455 fpStep->GetPostStepPoint()->SetSafety(fpState->fEndpointSafety);
457 if(
GetIT(fpTrack)->GetTrackingInfo()->IsLeadingStep())
460 InvokePostStepDoItProcs();
464 mem_diff = mem_intermediaire-mem_first;
465 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After InvokePostStepDoItProcs() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
469 if(fpVerbose) fpVerbose->StepInfoForLeadingTrack();
475 InvokeTransportationProc();
476 fpStep->GetPostStepPoint()->SetProcessDefinedStep(fpTransportation);
480 mem_diff = mem_intermediaire-mem_first;
481 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After InvokeTransportationProc() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
487 if(fpVerbose) fpVerbose->PostStepDoItAllDone();
491 fpNavigator->ResetNavigatorState();
495 mem_diff = mem_intermediaire-mem_first;
496 G4cout <<
"\t\t\t >> || MEM || G4ITStepProcessor::DoStepping || After fpNavigator->SetNavigatorState with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
504 fpTrack->AddTrackLength(fpStep->GetStepLength());
505 fpTrack->IncrementCurrentStepNumber();
513 if(fpVerbose) fpVerbose->PostStepVerbose(fpTrack);
543 fpTrackingManager->AppendStep(fpTrack, fpStep);
548 mem_diff = mem_intermediaire-mem_first;
549 G4cout <<
"\t\t\t >> || MEM || End of DoStepping() with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
563 fpStep->SetStepLength(0.);
564 fpTrack->SetStepLength(0.);
567 fpState->fSelectedAtRestDoItVector;
570 for(
size_t np = 0; np < fpProcessInfo->MAXofAtRestLoops; np++)
576 if(selectedAtRestDoItVector[fpProcessInfo->MAXofAtRestLoops - np - 1] !=
InActivated)
579 (
G4VITProcess*) (*fpProcessInfo->fpAtRestDoItVector)[np];
590 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess
592 fpParticleChange = fpCurrentProcess->AtRestDoIt(*fpTrack, *fpStep);
593 fpCurrentProcess->ResetProcessState();
596 fpStep->GetPostStepPoint()->SetProcessDefinedStep(fpCurrentProcess);
599 fpParticleChange->UpdateStepForAtRest(fpStep);
602 DealWithSecondaries(fN2ndariesAtRestDoIt);
606 fpTrack->SetTrackStatus(fpParticleChange->GetTrackStatus());
609 fpParticleChange->Clear();
613 fpStep->UpdateTrack();
632 MemStat mem_first, mem_second, mem_diff;
647 for(
size_t ci = 0; ci < fpProcessInfo->MAXofAlongStepLoops; ci++)
650 (
G4VITProcess*) (*fpProcessInfo->fpAlongStepDoItVector)[ci];
651 if(fpCurrentProcess == 0)
continue;
654 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess
656 fpParticleChange = fpCurrentProcess->AlongStepDoIt(*fpTrack, *fpStep);
660 mem_diff = mem_intermediaire-mem_first;
661 G4cout <<
"\t\t\t >> || MEM || After calling AlongStepDoIt for " << fpCurrentProcess->GetProcessName() <<
" and track "<< fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
665 fpCurrentProcess->ResetProcessState();
668 fpParticleChange->UpdateStepForAlongStep(fpStep);
672 if(fpVerbose) fpVerbose->AlongStepDoItOneByOne();
676 DealWithSecondaries(fN2ndariesAlongStepDoIt);
680 fpTrack->SetTrackStatus(fpParticleChange->GetTrackStatus());
683 fpParticleChange->Clear();
688 mem_diff = mem_intermediaire-mem_first;
689 G4cout <<
"\t\t\t >> || MEM || After looping on processes with " << fpTrack->GetTrackID() <<
", diff is : " << mem_diff <<
G4endl;
692 fpStep->UpdateTrack();
696 if(fNewStatus ==
fAlive && fpTrack->GetKineticEnergy() <=
DBL_MIN)
699 if(fpProcessInfo->MAXofAtRestLoops>0) fNewStatus =
fStopButAlive;
701 fpTrack->SetTrackStatus( fNewStatus );
714 size_t _MAXofPostStepLoops = fpProcessInfo->MAXofPostStepLoops;
716 ->fSelectedPostStepDoItVector;
720 for(
size_t np = 0; np < _MAXofPostStepLoops; np++)
726 G4int Cond = selectedPostStepDoItVector[_MAXofPostStepLoops
746 for(
size_t np1 = np + 1; np1 < _MAXofPostStepLoops; np1++)
748 G4int Cond2 = selectedPostStepDoItVector[_MAXofPostStepLoops
764 fpCurrentProcess = (
G4VITProcess*) (*fpProcessInfo->fpPostStepDoItVector)[np];
766 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess
768 fpParticleChange = fpCurrentProcess->PostStepDoIt(*fpTrack, *fpStep);
770 fpCurrentProcess->ResetProcessState();
773 fpParticleChange->UpdateStepForPostStep(fpStep);
777 if(fpVerbose) fpVerbose->PostStepDoItOneByOne();
781 fpStep->UpdateTrack();
784 fpStep->GetPostStepPoint()->SetSafety(CalculateSafety());
787 DealWithSecondaries(fN2ndariesPostStepDoIt);
790 fpTrack->SetTrackStatus(fpParticleChange->GetTrackStatus());
793 fpParticleChange->Clear();
804 double physicalStep(0.);
806 fpTransportation = fpProcessInfo->fpTransportation;
812 exceptionDescription <<
"No G4ITStepProcessor::fpTrack found";
813 G4Exception(
"G4ITStepProcessor::FindTransportationStep",
814 "ITStepProcessor0013",
816 exceptionDescription);
823 exceptionDescription <<
"No G4ITStepProcessor::fITrack";
824 G4Exception(
"G4ITStepProcessor::FindTransportationStep",
825 "ITStepProcessor0014",
827 exceptionDescription);
830 if(!(fpITrack->GetTrack()))
833 exceptionDescription <<
"No G4ITStepProcessor::fITrack->GetTrack()";
834 G4Exception(
"G4ITStepProcessor::FindTransportationStep",
835 "ITStepProcessor0015",
837 exceptionDescription);
843 fpTransportation->SetProcessState(fpTrackingInfo->GetProcessState(fpTransportation
845 fpTransportation->ComputeStep(*fpTrack, *fpStep, fTimeStep, physicalStep);
848 fpTransportation->ResetProcessState();
858 fpState->fPhysicalStep = physicalStep;
865 size_t _MAXofPostStepLoops = fpProcessInfo->MAXofPostStepLoops;
867 ->fSelectedPostStepDoItVector;
871 for(
size_t np = 0; np < _MAXofPostStepLoops; np++)
877 G4int Cond = selectedPostStepDoItVector[_MAXofPostStepLoops - np - 1];
894 for(
size_t np1 = np + 1; np1 < _MAXofPostStepLoops; np1++)
896 G4int Cond2 = selectedPostStepDoItVector[_MAXofPostStepLoops - np1 - 1];
915 G4bool tBelowCutEnergyAndSafety =
false;
924 ->GetMaterialCutsCouple());
929 tBelowCutEnergyAndSafety =
true;
935 fpPreStepPoint->GetMaterialCutsCouple());
936 tBelowCutEnergyAndSafety = (currentRange < CalculateSafety() );
940 if(tBelowCutEnergyAndSafety)