Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ITStepProcessor Class Reference

#include <G4ITStepProcessor.hh>

Public Member Functions

 G4ITStepProcessor ()
 
virtual ~G4ITStepProcessor ()
 
void SetPreviousStepTime (G4double)
 
G4TrackGetTrack ()
 
G4StepGetStep ()
 
const G4StepGetStep () const
 
void SetStep (G4Step *val)
 
G4TrackVectorGetSecondaries ()
 
void SetTrackingManager (G4ITTrackingManager *trackMan)
 
G4ITTrackingManagerGetTrackingManager ()
 
virtual void Initialize ()
 
void ForceReInitialization ()
 
void DefinePhysicalStepLength (G4Track *)
 
void Stepping (G4Track *, const double &)
 
void CalculateStep (G4Track *, const double &)
 
void CalculateStep (G4Track *)
 
void DoIt (G4Track *, double)
 
void FindTransportationStep ()
 
void UpdateTrack (G4Track *)
 
double GetInteractionTime ()
 
const G4TrackGetTrack () const
 
void CleanProcessor ()
 

Protected Member Functions

void SetupGeneralProcessInfo (G4ParticleDefinition *, G4ProcessManager *)
 
void ClearProcessInfo ()
 
void SetTrack (G4Track *)
 
void GetProcessInfo ()
 
void SetupMembers ()
 
void ResetSecondaries ()
 
void InitDefineStep ()
 
void SetInitialStep ()
 
void GetAtRestIL ()
 
void DoDefinePhysicalStepLength ()
 
void DoStepping ()
 
void CalculateStep ()
 
void DoCalculateStep ()
 
void CloneProcesses ()
 
void ActiveOnlyITProcess ()
 
void ActiveOnlyITProcess (G4ProcessManager *)
 
void DealWithSecondaries (G4int &)
 
void InvokeAtRestDoItProcs ()
 
void InvokeAlongStepDoItProcs ()
 
void InvokePostStepDoItProcs ()
 
void InvokePSDIP (size_t)
 
void InvokeTransportationProc ()
 
void SetNavigator (G4ITNavigator *value)
 
G4double CalculateSafety ()
 
void ApplyProductionCut (G4Track *)
 
 G4ITStepProcessor (const G4ITStepProcessor &other)
 
G4ITStepProcessoroperator= (const G4ITStepProcessor &other)
 

Detailed Description

Its role is the same as G4StepManager :

  • Find the minimum physical length and corresponding time step
  • Step one track BUT on a given time step.

Definition at line 83 of file G4ITStepProcessor.hh.

Constructor & Destructor Documentation

◆ G4ITStepProcessor() [1/2]

G4ITStepProcessor::G4ITStepProcessor ( )

Definition at line 63 of file G4ITStepProcessor.cc.

64{
65 verboseLevel = 0 ;
66 // fpUserSteppingAction = 0 ;
67 fStoreTrajectory = 0;
68 fpTrackingManager = 0;
69 fpNavigator = 0;
70 kCarTolerance = -1.;
71 fInitialized = false;
72 fPreviousTimeStep = DBL_MAX;
75}
#define DBL_MAX
Definition: templates.hh:83

◆ ~G4ITStepProcessor()

G4ITStepProcessor::~G4ITStepProcessor ( )
virtual

Definition at line 183 of file G4ITStepProcessor.cc.

184{
185 if(fpStep)
186 {
187 fpStep->DeleteSecondaryVector();
188 delete fpStep;
189 }
190
191 if(fpSecondary) delete fpSecondary;
194
195 // if(fpUserSteppingAction) delete fpUserSteppingAction;
196}
void DeleteSecondaryVector()

◆ G4ITStepProcessor() [2/2]

G4ITStepProcessor::G4ITStepProcessor ( const G4ITStepProcessor other)
protected

Definition at line 199 of file G4ITStepProcessor.cc.

200{
201 verboseLevel = rhs.verboseLevel ;
202 fStoreTrajectory = rhs.fStoreTrajectory ;
203
204 // fpUserSteppingAction = 0 ;
205 fpTrackingManager = 0;
206 fpNavigator = 0;
207 fInitialized = false;
208
209 kCarTolerance = rhs.kCarTolerance;
210 fInitialized = false;
211 fPreviousTimeStep = DBL_MAX;
212
215}

Member Function Documentation

◆ ActiveOnlyITProcess() [1/2]

void G4ITStepProcessor::ActiveOnlyITProcess ( )
protected

Definition at line 226 of file G4ITStepProcessor.cc.

227{
228 // Method not used for the time being
229#ifdef debug
230 G4cout<<"G4ITStepProcessor::CloneProcesses: is called"<<G4endl;
231#endif
232
234 G4ParticleTable::G4PTblDicIterator* theParticleIterator = theParticleTable->GetIterator();
235
236 theParticleIterator->reset();
237 // TODO : Ne faire la boucle que sur les IT **** !!!
238 while( (*theParticleIterator)() )
239 {
240 G4ParticleDefinition* particle = theParticleIterator->value();
241 G4ProcessManager* pm= particle->GetProcessManager();
242
243 if(!pm)
244 {
245 G4cerr << "ERROR - G4ITStepProcessor::GetProcessNumber()" << G4endl
246 << " ProcessManager is NULL for particle = "
247 << particle->GetParticleName() << ", PDG_code = "
248 << particle->GetPDGEncoding() << G4endl;
249 G4Exception("G4ITStepProcessor::GetProcessNumber()", "ITStepProcessor0001",
250 FatalException, "Process Manager is not found.");
251 return;
252 }
253
255 }
256}
@ FatalException
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
G4PTblDicIterator * GetIterator()
static G4ParticleTable * GetParticleTable()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Referenced by ActiveOnlyITProcess().

◆ ActiveOnlyITProcess() [2/2]

void G4ITStepProcessor::ActiveOnlyITProcess ( G4ProcessManager processManager)
protected

Definition at line 259 of file G4ITStepProcessor.cc.

260{
261 // Method not used for the time being
262 G4ProcessVector* processVector = processManager->GetProcessList();
263
264 G4VITProcess* itProcess = 0 ;
265 for(int i = 0 ; i < processVector->size() ; i++)
266 {
267 G4VProcess* base_process = (*processVector)[i];
268 itProcess = dynamic_cast<G4VITProcess*>(base_process);
269
270 if(!itProcess)
271 {
272 processManager->SetProcessActivation(base_process, false);
273 }
274 }
275}
G4VProcess * SetProcessActivation(G4VProcess *aProcess, G4bool fActive)
G4ProcessVector * GetProcessList() const
G4int size() const

◆ ApplyProductionCut()

void G4ITStepProcessor::ApplyProductionCut ( G4Track aSecondary)
protected

Definition at line 570 of file G4ITStepProcessor2.cc.

571{
572 G4bool tBelowCutEnergyAndSafety = false;
573 G4int tPtclIdx
575 if (tPtclIdx<0)
576 {
577 return;
578 }
579 G4ProductionCutsTable* tCutsTbl
581 G4int tCoupleIdx
582 = tCutsTbl->GetCoupleIndex(fpPreStepPoint->GetMaterialCutsCouple());
583 G4double tProdThreshold
584 = (*(tCutsTbl->GetEnergyCutsVector(tPtclIdx)))[tCoupleIdx];
585 if( aSecondary->GetKineticEnergy()<tProdThreshold )
586 {
587 tBelowCutEnergyAndSafety = true;
588 if(std::abs(aSecondary->GetDynamicParticle()->GetCharge()) > DBL_MIN)
589 {
590 G4double currentRange
592 aSecondary->GetKineticEnergy(),
593 fpPreStepPoint->GetMaterialCutsCouple());
594 tBelowCutEnergyAndSafety = (currentRange < CalculateSafety() );
595 }
596 }
597
598 if( tBelowCutEnergyAndSafety )
599 {
600 if( !(aSecondary->IsGoodForTracking()) )
601 {
602 // Add kinetic energy to the total energy deposit
603 fpStep->AddTotalEnergyDeposit(
604 aSecondary->GetKineticEnergy() );
605 aSecondary->SetKineticEnergy(0.0);
606 }
607 }
608}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
G4double GetCharge() const
static G4LossTableManager * Instance()
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
static G4ProductionCutsTable * GetProductionCutsTable()
G4int GetCoupleIndex(const G4MaterialCutsCouple *aCouple) const
static G4int GetIndex(const G4String &name)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
void AddTotalEnergyDeposit(G4double value)
G4ParticleDefinition * GetDefinition() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetKineticEnergy() const
void SetKineticEnergy(const G4double aValue)
G4bool IsGoodForTracking() const
#define DBL_MIN
Definition: templates.hh:75

Referenced by DealWithSecondaries().

◆ CalculateSafety()

G4double G4ITStepProcessor::CalculateSafety ( )
inlineprotected

Definition at line 314 of file G4ITStepProcessor.hh.

315{
316 return std::max( fpState->endpointSafety -
317 (fpState->endpointSafOrigin - fpPostStepPoint->GetPosition()).mag(),
318 kCarTolerance );
319}
const G4ThreeVector & GetPosition() const

Referenced by ApplyProductionCut(), and InvokePSDIP().

◆ CalculateStep() [1/3]

void G4ITStepProcessor::CalculateStep ( )
protected

◆ CalculateStep() [2/3]

void G4ITStepProcessor::CalculateStep ( G4Track )

◆ CalculateStep() [3/3]

void G4ITStepProcessor::CalculateStep ( G4Track ,
const double &   
)

◆ CleanProcessor()

void G4ITStepProcessor::CleanProcessor ( )
inline

Definition at line 326 of file G4ITStepProcessor.hh.

327{
328 fTimeStep = DBL_MAX ;
329 fPhysIntLength = DBL_MAX;
330
331 fpState = 0;
332 fpTrack = 0;
333 fpTrackingInfo = 0 ;
334 fpITrack = 0;
335 fpStep = 0;
336 fpPreStepPoint = 0;
337 fpPostStepPoint = 0;
338
339 fpParticleChange = 0;
340
341 fpCurrentVolume = 0;
342// fpSensitive = 0;
343
344 fpSecondary = 0 ;
345
346 fpTransportation = 0;
347
348 fpCurrentProcess= 0;
349 fpProcessInfo = 0;
350
351 fAtRestDoItProcTriggered = INT_MAX;
352 fPostStepDoItProcTriggered = INT_MAX;
353 fPostStepAtTimeDoItProcTriggered = INT_MAX;
354 fGPILSelection = NotCandidateForSelection ;
355 fCondition = NotForced;
356}
@ NotForced
@ NotCandidateForSelection
#define INT_MAX
Definition: templates.hh:111

Referenced by G4ITStepProcessor(), Initialize(), and Stepping().

◆ ClearProcessInfo()

void G4ITStepProcessor::ClearProcessInfo ( )
protected

Definition at line 140 of file G4ITStepProcessor.cc.

141{
142 std::map<const G4ParticleDefinition*, ProcessGeneralInfo*> ::iterator it;
143
144 for(it = fProcessGeneralInfoMap.begin();it != fProcessGeneralInfoMap.end();it++)
145 {
146 if(it->second)
147 {
148 delete it->second;
149 it->second = 0;
150 }
151 }
152
153 fProcessGeneralInfoMap.clear();
154}

Referenced by ForceReInitialization(), and ~G4ITStepProcessor().

◆ CloneProcesses()

void G4ITStepProcessor::CloneProcesses ( )
protected

◆ DealWithSecondaries()

void G4ITStepProcessor::DealWithSecondaries ( G4int counter)
protected

Definition at line 50 of file G4ITStepProcessor2.cc.

51{
52 // Now Store the secondaries from ParticleChange to SecondaryList
53 G4Track* tempSecondaryTrack;
54
55 for(G4int DSecLoop=0 ;
56 DSecLoop<fpParticleChange->GetNumberOfSecondaries() ;
57 DSecLoop++)
58 {
59 tempSecondaryTrack = fpParticleChange->GetSecondary(DSecLoop);
60
61 if(tempSecondaryTrack->GetDefinition()->GetApplyCutsFlag())
62 {
63 ApplyProductionCut(tempSecondaryTrack);
64 }
65
66 // Set parentID
67 tempSecondaryTrack->SetParentID( fpTrack->GetTrackID() );
68
69 // Set the process pointer which created this track
70 tempSecondaryTrack->SetCreatorProcess( fpCurrentProcess );
71
72 // If this 2ndry particle has 'zero' kinetic energy, make sure
73 // it invokes a rest process at the beginning of the tracking
74 if(tempSecondaryTrack->GetKineticEnergy() <= DBL_MIN)
75 {
76 G4ProcessManager* pm = tempSecondaryTrack->GetDefinition()->GetProcessManager();
77 if (pm->GetAtRestProcessVector()->entries()>0){
78 tempSecondaryTrack->SetTrackStatus( fStopButAlive );
79 fpSecondary->push_back( tempSecondaryTrack );
80 fN2ndariesAtRestDoIt++;
81 } else {
82 delete tempSecondaryTrack;
83 }
84 }
85 else
86 {
87 fpSecondary->push_back( tempSecondaryTrack );
88 counter++;
89 }
90 } //end of loop on secondary
91}
@ fStopButAlive
void ApplyProductionCut(G4Track *)
G4bool GetApplyCutsFlag() const
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4int entries() const
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4int GetTrackID() const
void SetParentID(const G4int aValue)
void SetCreatorProcess(const G4VProcess *aValue)
G4int GetNumberOfSecondaries() const
G4Track * GetSecondary(G4int anIndex) const

Referenced by InvokeAlongStepDoItProcs(), InvokeAtRestDoItProcs(), and InvokePSDIP().

◆ DefinePhysicalStepLength()

void G4ITStepProcessor::DefinePhysicalStepLength ( G4Track track)

Definition at line 508 of file G4ITStepProcessor.cc.

509{
510 SetTrack(track);
512}
void SetTrack(G4Track *)

◆ DoCalculateStep()

void G4ITStepProcessor::DoCalculateStep ( )
protected

◆ DoDefinePhysicalStepLength()

void G4ITStepProcessor::DoDefinePhysicalStepLength ( )
protected

Definition at line 698 of file G4ITStepProcessor.cc.

699{
700
702
703 G4TrackStatus trackStatus = fpTrack -> GetTrackStatus() ;
704
705 if(trackStatus == fStopAndKill)
706 {
707 return ;
708 }
709
710 if(trackStatus == fStopButAlive)
711 {
712 fpITrack->GetTrackingInfo()->SetNavigatorState(fpNavigator->GetNavigatorState());
713 fpNavigator->SetNavigatorState(0);
714 return GetAtRestIL() ;
715 }
716
717
718 // Find minimum Step length and corresponding time
719 // demanded by active disc./cont. processes
720
721 // ReSet the counter etc.
722 fpState->fPhysicalStep = DBL_MAX; // Initialize by a huge number
723 fPhysIntLength = DBL_MAX; // Initialize by a huge number
724
725 double proposedTimeStep = DBL_MAX;
726 G4VProcess* processWithPostStepGivenByTimeStep(0);
727
728 // GPIL for PostStep
729 fPostStepDoItProcTriggered = fpProcessInfo->MAXofPostStepLoops;
730 fPostStepAtTimeDoItProcTriggered = fpProcessInfo->MAXofPostStepLoops;
731
732 // G4cout << "fpProcessInfo->MAXofPostStepLoops : " << fpProcessInfo->MAXofPostStepLoops
733 // << " mol : " << fpITrack -> GetName() << " id : " << fpTrack->GetTrackID()
734 // << G4endl;
735
736 for(size_t np=0; np < fpProcessInfo->MAXofPostStepLoops; np++)
737 {
738 fpCurrentProcess = (G4VITProcess*) (*fpProcessInfo->fpPostStepGetPhysIntVector)[np];
739 if (fpCurrentProcess== 0)
740 {
741 (fpState->fSelectedPostStepDoItVector)[np] = InActivated;
742 continue;
743 } // NULL means the process is inactivated by a user on fly.
744
745 fCondition=NotForced;
746 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
747
748 // G4cout << "Is going to call : " << fpCurrentProcess -> GetProcessName() << G4endl;
749 fPhysIntLength = fpCurrentProcess->
750 PostStepGPIL( *fpTrack,
751 fpState->fPreviousStepSize,
752 &fCondition );
753 fpCurrentProcess->SetProcessState(0);
754
755 switch (fCondition)
756 {
757 case ExclusivelyForced: // Will need special treatment
758 (fpState->fSelectedPostStepDoItVector)[np] = ExclusivelyForced;
759 fpState->fStepStatus = fExclusivelyForcedProc;
760 fpStep->GetPostStepPoint()
761 ->SetProcessDefinedStep(fpCurrentProcess);
762 break;
763
764 case Conditionally:
765 // (fpState->fSelectedPostStepDoItVector)[np] = Conditionally;
766 G4Exception("G4ITStepProcessor::DefinePhysicalStepLength()", "ITStepProcessor0008",
767 FatalException, "This feature is no more supported");
768 break;
769
770 case Forced:
771 (fpState->fSelectedPostStepDoItVector)[np] = Forced;
772 break;
773
774 case StronglyForced:
775 (fpState->fSelectedPostStepDoItVector)[np] = StronglyForced;
776 break;
777
778 default:
779 (fpState->fSelectedPostStepDoItVector)[np] = InActivated;
780 break;
781 }
782
783 if (fCondition==ExclusivelyForced)
784 {
785 for(size_t nrest=np+1; nrest < fpProcessInfo->MAXofPostStepLoops; nrest++)
786 {
787 (fpState->fSelectedPostStepDoItVector)[nrest] = InActivated;
788 }
789 return; // Please note the 'return' at here !!!
790 }
791 else
792 {
793 if(fPhysIntLength < fpState->fPhysicalStep )
794 {
795 // To avoid checking whether the process is actually
796 // proposing a time step, the returned time steps are
797 // negative (just for tagging)
798 if(fpCurrentProcess->ProposesTimeStep())
799 {
800 fPhysIntLength *= -1;
801 if(fPhysIntLength < proposedTimeStep)
802 {
803 proposedTimeStep = fPhysIntLength;
804 fPostStepAtTimeDoItProcTriggered = np;
805 processWithPostStepGivenByTimeStep = fpCurrentProcess;
806 }
807 }
808 else
809 {
810 fpState->fPhysicalStep = fPhysIntLength;
811 fpState->fStepStatus = fPostStepDoItProc;
812 fPostStepDoItProcTriggered = G4int(np);
813 fpStep->GetPostStepPoint()
814 ->SetProcessDefinedStep(fpCurrentProcess);
815 }
816 }
817 }
818 }
819
820 // GPIL for AlongStep
821 fpState->proposedSafety = DBL_MAX;
822 G4double safetyProposedToAndByProcess = fpState->proposedSafety;
823
824 for(size_t kp=0; kp < fpProcessInfo->MAXofAlongStepLoops; kp++)
825 {
826 fpCurrentProcess = (G4VITProcess*) (*fpProcessInfo->fpAlongStepGetPhysIntVector)[kp];
827 if (fpCurrentProcess== 0) continue;
828 // NULL means the process is inactivated by a user on fly.
829
830 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
831 fPhysIntLength = fpCurrentProcess-> AlongStepGPIL( *fpTrack,
832 fpState->fPreviousStepSize,
833 fpState->fPhysicalStep,
834 safetyProposedToAndByProcess,
835 &fGPILSelection );
836
837 if(fPhysIntLength < fpState->fPhysicalStep)
838 {
839 fpState->fPhysicalStep = fPhysIntLength;
840 // Should save PS and TS in IT
841
842 // Check if the process wants to be the GPIL winner. For example,
843 // multi-scattering proposes Step limit, but won't be the winner.
844 if(fGPILSelection==CandidateForSelection)
845 {
846 fpState->fStepStatus = fAlongStepDoItProc;
847 fpStep->GetPostStepPoint()
848 ->SetProcessDefinedStep(fpCurrentProcess);
849 }
850
851 // Transportation is assumed to be the last process in the vector
852 if(kp == fpProcessInfo->MAXofAlongStepLoops-1)
853 {
854 fpTransportation = dynamic_cast<G4ITTransportation*>(fpCurrentProcess);
855
856 if(! fpTransportation)
857 {
858 G4ExceptionDescription exceptionDescription ;
859 exceptionDescription << "No transportation process found " ;
860 G4Exception("G4ITStepProcessor::DoDefinePhysicalStepLength","ITStepProcessor0009",
861 FatalErrorInArgument,exceptionDescription);
862 }
863
864 fTimeStep = fpTransportation->GetInteractionTimeLeft();
865
866
867 if (fpTrack->GetNextVolume() != 0)
868 fpState->fStepStatus = fGeomBoundary;
869 else
870 fpState->fStepStatus = fWorldBoundary;
871 }
872 }
873 else
874 {
875 if(kp == fpProcessInfo->MAXofAlongStepLoops-1)
876 {
877 fpTransportation = dynamic_cast<G4ITTransportation*>(fpCurrentProcess);
878
879 if(! fpTransportation)
880 {
881 G4ExceptionDescription exceptionDescription ;
882 exceptionDescription << "No transportation process found " ;
883 G4Exception("G4ITStepProcessor::DoDefinePhysicalStepLength","ITStepProcessor0010",
884 FatalErrorInArgument,exceptionDescription);
885 }
886
887 fTimeStep = fpTransportation->GetInteractionTimeLeft();
888 }
889 }
890
891 if(proposedTimeStep < fTimeStep)
892 {
893 if(fPostStepAtTimeDoItProcTriggered<fpProcessInfo->MAXofPostStepLoops)
894 {
895 if ((fpState->fSelectedPostStepDoItVector)[fPostStepAtTimeDoItProcTriggered] ==
897 {
898 (fpState->fSelectedPostStepDoItVector)[fPostStepAtTimeDoItProcTriggered] = NotForced;
899 // (fpState->fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] = InActivated;
900
901 fpState->fStepStatus = fPostStepDoItProc;
902 fpStep->GetPostStepPoint()->SetProcessDefinedStep(processWithPostStepGivenByTimeStep);
903
904 fTimeStep = proposedTimeStep;
905
906 fpTransportation->ComputeStep(*fpTrack,*fpStep,fTimeStep,fpState->fPhysicalStep);
907 }
908 }
909 }
910 else
911 {
912 if (fPostStepDoItProcTriggered<fpProcessInfo->MAXofPostStepLoops)
913 {
914 if ((fpState->fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] ==
916 {
917 (fpState->fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] =
918 NotForced;
919 }
920 }
921 }
922
923 fpCurrentProcess->SetProcessState(0);
924
925 // Make sure to check the safety, even if Step is not limited
926 // by this process. J. Apostolakis, June 20, 1998
927 //
928 if (safetyProposedToAndByProcess < fpState->proposedSafety)
929 // proposedSafety keeps the smallest value:
930 fpState->proposedSafety = safetyProposedToAndByProcess;
931 else
932 // safetyProposedToAndByProcess always proposes a valid safety:
933 safetyProposedToAndByProcess = fpState->proposedSafety;
934
935 }
936
937 fpITrack->GetTrackingInfo()->SetNavigatorState(fpNavigator->GetNavigatorState());
938 fpNavigator->SetNavigatorState(0);
939}
@ FatalErrorInArgument
@ InActivated
@ StronglyForced
@ Conditionally
@ ExclusivelyForced
@ Forced
@ CandidateForSelection
@ fGeomBoundary
Definition: G4StepStatus.hh:54
@ fWorldBoundary
Definition: G4StepStatus.hh:52
@ fPostStepDoItProc
Definition: G4StepStatus.hh:60
@ fAlongStepDoItProc
Definition: G4StepStatus.hh:58
@ fExclusivelyForcedProc
Definition: G4StepStatus.hh:64
G4TrackStatus
@ fStopAndKill
void SetNavigatorState(G4ITNavigatorState_Lock *)
G4ITNavigatorState_Lock * GetNavigatorState()
virtual void ComputeStep(const G4Track &, const G4Step &, const double timeStep, double &spaceStep)
G4TrackingInformation * GetTrackingInfo()
Definition: G4IT.hh:134
void SetProcessDefinedStep(const G4VProcess *aValue)
G4StepPoint * GetPostStepPoint() const
G4VPhysicalVolume * GetNextVolume() const
G4ProcessState_Lock * GetProcessState(size_t index)
void SetNavigatorState(G4ITNavigatorState_Lock *)
G4bool ProposesTimeStep() const
size_t GetProcessID() const
Definition: G4VITProcess.hh:80
void SetProcessState(G4ProcessState_Lock *aProcInfo)
Definition: G4VITProcess.hh:90
G4double GetInteractionTimeLeft()
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

Referenced by DefinePhysicalStepLength().

◆ DoIt()

void G4ITStepProcessor::DoIt ( G4Track ,
double   
)

◆ DoStepping()

void G4ITStepProcessor::DoStepping ( )
protected

Definition at line 108 of file G4ITStepProcessor2.cc.

109{
110 SetupMembers() ;
111
112 if(!fpProcessInfo)
113 {
114 G4ExceptionDescription exceptionDescription ;
115 exceptionDescription << "No process info found for particle :"
116 << fpTrack->GetDefinition()->GetParticleName();
117 G4Exception("G4ITStepProcessor::DoStepping","ITStepProcessor0012",
118 FatalErrorInArgument,exceptionDescription);
119 return ;
120 }
121 else if(fpTrack->GetTrackStatus() == fStopAndKill )
122 {
123 fpState->fStepStatus = fUndefined;
124 return ;
125 }
126
127 if(fpProcessInfo->MAXofPostStepLoops == 0
128 && fpProcessInfo->MAXofAlongStepLoops == 0
129 && fpProcessInfo->MAXofAtRestLoops == 0)
130 {
131 fpTrack -> SetTrackStatus(fStopAndKill) ;
132 fpState->fStepStatus = fUndefined;
133 return ;
134 }
135 //---------------------------------
136 // AtRestStep, AlongStep and PostStep Processes
137 //---------------------------------
138 else
139 {
140 fpNavigator->SetNavigatorState(fpITrack->GetTrackingInfo()->GetNavigatorState());
141 fpNavigator->ResetHierarchyAndLocate( fpTrack->GetPosition(),
142 fpTrack->GetMomentumDirection(),
143 *((G4TouchableHistory*)fpTrack->GetTouchableHandle()()) );
144 fpNavigator->SetNavigatorState(fpITrack->GetTrackingInfo()->GetNavigatorState());
145 // We reset the navigator state before checking for AtRest
146 // in case a AtRest processe would use a navigator info
147
148 if( fpTrack->GetTrackStatus() == fStopButAlive )
149 {
150 if( fpProcessInfo->MAXofAtRestLoops>0 &&
151 fpProcessInfo->fpAtRestDoItVector != 0) // second condition to make coverity happy
152 {
153 //-----------------
154 // AtRestStepDoIt
155 //-----------------
157 fpState->fStepStatus = fAtRestDoItProc;
158 fpStep->GetPostStepPoint()->SetStepStatus( fpState->fStepStatus );
159
160 }
161 // Make sure the track is killed
162 fpTrack->SetTrackStatus( fStopAndKill );
163 }
164 else // if(fTimeStep > 0.) // Bye, because PostStepIL can return 0 => time =0
165 {
166 if(fpITrack == 0)
167 {
168 G4ExceptionDescription exceptionDescription ;
169 exceptionDescription
170 << " !!! TrackID : "<< fpTrack->GetTrackID() << G4endl
171 << " !!! Track status : "<< fpTrack->GetTrackStatus() << G4endl
172 << " !!! Particle Name : "<< fpTrack -> GetDefinition() -> GetParticleName() << G4endl
173 << "No G4ITStepProcessor::fpITrack found" << G4endl;
174
175 G4Exception("G4ITStepProcessor::DoStepping","ITStepProcessor0013",
176 FatalErrorInArgument,exceptionDescription);
177 return ; // to make coverity happy
178 }
179
180 if(fpITrack->GetTrackingInfo()->IsLeadingStep() == false)
181 {
182 // In case the track has NOT the minimum step length
183 // Given the final step time, the transportation
184 // will compute the final position of the particle
185
186 fpState->fStepStatus = fPostStepDoItProc;
187 fpStep->GetPostStepPoint()
188 ->SetProcessDefinedStep(fpTransportation);
190 }
191
192
193 // Store the Step length (geometrical length) to G4Step and G4Track
194 fpTrack->SetStepLength( fpState->fPhysicalStep );
195 fpStep->SetStepLength( fpState->fPhysicalStep );
196
197 G4double GeomStepLength = fpState->fPhysicalStep;
198
199 // Store StepStatus to PostStepPoint
200 fpStep->GetPostStepPoint()->SetStepStatus( fpState->fStepStatus );
201
202 // Invoke AlongStepDoIt
204
205 // Update track by taking into account all changes by AlongStepDoIt
206 // fpStep->UpdateTrack(); // done in InvokeAlongStepDoItProcs
207
208 // Update safety after invocation of all AlongStepDoIts
209 fpState->endpointSafOrigin= fpPostStepPoint->GetPosition();
210
211 fpState->endpointSafety= std::max( fpState->proposedSafety - GeomStepLength, kCarTolerance);
212
213 fpStep->GetPostStepPoint()->SetSafety( fpState->endpointSafety );
214
215 if(GetIT(fpTrack)->GetTrackingInfo()->IsLeadingStep())
216 {
217 // Invoke PostStepDoIt including G4ITTransportation::PSDI
219 }
220 else
221 {
222 // Only invoke transportation
224 }
225 }
226
227 fpITrack->GetTrackingInfo()->SetNavigatorState(fpNavigator->GetNavigatorState());
228 fpNavigator->SetNavigatorState(0);
229 }
230 //-------
231 // Finale
232 //-------
233
234 // Update 'TrackLength' and remeber the Step length of the current Step
235 fpTrack->AddTrackLength(fpStep->GetStepLength());
237
238 // Send G4Step information to Hit/Dig if the volume is sensitive
239/***
240 fpCurrentVolume = fpStep->GetPreStepPoint()->GetPhysicalVolume();
241 StepControlFlag = fpStep->GetControlFlag();
242
243 if( fpCurrentVolume != 0 && StepControlFlag != AvoidHitInvocation)
244 {
245 fpSensitive = fpStep->GetPreStepPoint()->
246 GetSensitiveDetector();
247 if( fpSensitive != 0 )
248 {
249 fpSensitive->Hit(fpStep);
250 }
251 }
252
253 User intervention process.
254 if( fpUserSteppingAction != 0 )
255 {
256 fpUserSteppingAction->UserSteppingAction(fpStep);
257 }
258 G4UserSteppingAction* regionalAction
259 = fpStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetRegion()
260 ->GetRegionalSteppingAction();
261 if( regionalAction ) regionalAction->UserSteppingAction(fpStep);
262***/
263 fpTrackingManager->AppendStep(fpTrack,fpStep);
264 // Stepping process finish. Return the value of the StepStatus.
265
266 // return fpState->fStepStatus;
267}
G4IT * GetIT(const G4Track *track)
Definition: G4IT.cc:48
@ fUndefined
Definition: G4StepStatus.hh:66
@ fAtRestDoItProc
Definition: G4StepStatus.hh:56
virtual G4VPhysicalVolume * ResetHierarchyAndLocate(const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
virtual void AppendStep(G4Track *track, G4Step *step)
void SetSafety(const G4double aValue)
void SetStepStatus(const G4StepStatus aValue)
void SetStepLength(G4double value)
G4double GetStepLength() const
G4TrackStatus GetTrackStatus() const
void SetStepLength(G4double value)
const G4ThreeVector & GetPosition() const
void AddTrackLength(const G4double aValue)
const G4TouchableHandle & GetTouchableHandle() const
const G4ThreeVector & GetMomentumDirection() const
void IncrementCurrentStepNumber()
G4ITNavigatorState_Lock * GetNavigatorState() const

Referenced by Stepping().

◆ FindTransportationStep()

void G4ITStepProcessor::FindTransportationStep ( )

Definition at line 464 of file G4ITStepProcessor2.cc.

465{
466 double physicalStep(0.) ;
467
468 fpTransportation = fpProcessInfo->fpTransportation;
469 // dynamic_cast<G4ITTransportation*>((fpProcessInfo->fpAlongStepGetPhysIntVector)[MAXofAlongStepLoops-1]);
470
471 if(!fpTrack)
472 {
473 G4ExceptionDescription exceptionDescription ;
474 exceptionDescription
475 << "No G4ITStepProcessor::fpTrack found";
476 G4Exception("G4ITStepProcessor::FindTransportationStep","ITStepProcessor0013",
477 FatalErrorInArgument,exceptionDescription);
478 return;
479
480 }
481 if(!fpITrack)
482 {
483 G4ExceptionDescription exceptionDescription ;
484 exceptionDescription
485 << "No G4ITStepProcessor::fITrack" ;
486 G4Exception("G4ITStepProcessor::FindTransportationStep","ITStepProcessor0014",
487 FatalErrorInArgument,exceptionDescription);
488 return;
489 }
490 if(!(fpITrack->GetTrack()))
491 {
492 G4ExceptionDescription exceptionDescription ;
493 exceptionDescription
494 << "No G4ITStepProcessor::fITrack->GetTrack()" ;
495 G4Exception("G4ITStepProcessor::FindTransportationStep","ITStepProcessor0015",
496 FatalErrorInArgument,exceptionDescription);
497 return;
498 }
499
500 if(fpTransportation)
501 {
502 fpTransportation->SetProcessState(fpTrackingInfo->GetProcessState(fpTransportation->GetProcessID()));
503 fpTransportation->ComputeStep(*fpTrack, *fpStep, fTimeStep, physicalStep) ;
504 fpTransportation->SetProcessState(0);
505 }
506
507 if(physicalStep >= DBL_MAX)
508 {
509 fpTrack -> SetTrackStatus(fStopAndKill) ;
510 return ;
511 }
512
513 fpState->fPhysicalStep = physicalStep ;
514}
G4Track * GetTrack()
Definition: G4IT.hh:207

Referenced by DoStepping().

◆ ForceReInitialization()

void G4ITStepProcessor::ForceReInitialization ( )

Definition at line 158 of file G4ITStepProcessor.cc.

159{
160 fInitialized = false;
162 Initialize();
163}
virtual void Initialize()

◆ GetAtRestIL()

void G4ITStepProcessor::GetAtRestIL ( )
protected

Definition at line 453 of file G4ITStepProcessor.cc.

454{
455 // Select the rest process which has the shortest time before
456 // it is invoked. In rest processes, GPIL()
457 // returns the time before a process occurs.
458 G4double lifeTime (DBL_MAX), shortestLifeTime (DBL_MAX);
459
460 fAtRestDoItProcTriggered = 0;
461 shortestLifeTime = DBL_MAX;
462
463 unsigned int NofInactiveProc=0;
464
465 for( size_t ri=0 ; ri < fpProcessInfo->MAXofAtRestLoops ; ri++ )
466 {
467 fpCurrentProcess = (G4VITProcess*) (*fpProcessInfo->fpAtRestGetPhysIntVector)[ri];
468 if (fpCurrentProcess== 0)
469 {
470 (fpState->fSelectedAtRestDoItVector)[ri] = InActivated;
471 NofInactiveProc++;
472 continue;
473 } // NULL means the process is inactivated by a user on fly.
474
475 fCondition=NotForced;
476 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
477 lifeTime = fpCurrentProcess->AtRestGPIL( *fpTrack, &fCondition );
478 fpCurrentProcess->SetProcessState(0);
479
480 if(fCondition==Forced)
481 {
482 (fpState->fSelectedAtRestDoItVector)[ri] = Forced;
483 }
484 else
485 {
486 (fpState->fSelectedAtRestDoItVector)[ri] = InActivated;
487 if(lifeTime < shortestLifeTime )
488 {
489 shortestLifeTime = lifeTime;
490 fAtRestDoItProcTriggered = G4int(ri);
491 (fpState->fSelectedAtRestDoItVector)[fAtRestDoItProcTriggered] = NotForced;
492 }
493 }
494 }
495
496 fTimeStep = shortestLifeTime ;
497
498 // at least one process is necessary to destroy the particle
499 // exit with warning
500 if(NofInactiveProc==fpProcessInfo->MAXofAtRestLoops)
501 {
502 G4cerr << "ERROR - G4ITStepProcessor::InvokeAtRestDoItProcs()" << G4endl
503 << " No AtRestDoIt process is active!" << G4endl;
504 }
505}
G4double AtRestGPIL(const G4Track &track, G4ForceCondition *condition)
Definition: G4VProcess.hh:461

Referenced by DoDefinePhysicalStepLength().

◆ GetInteractionTime()

double G4ITStepProcessor::GetInteractionTime ( )
inline

Definition at line 359 of file G4ITStepProcessor.hh.

360{
361 return fTimeStep ;
362}

◆ GetProcessInfo()

void G4ITStepProcessor::GetProcessInfo ( )
protected

Definition at line 408 of file G4ITStepProcessor.cc.

409{
410 G4ParticleDefinition* particle = fpTrack->GetDefinition();
411 std::map<const G4ParticleDefinition*, ProcessGeneralInfo*>::iterator it = fProcessGeneralInfoMap.find(particle);
412
413 if(it == fProcessGeneralInfoMap.end())
414 {
416 if(fpProcessInfo == 0)
417 {
418 G4ExceptionDescription exceptionDescription ("...");
419 G4Exception("G4ITStepProcessor::GetProcessNumber","ITStepProcessor0008",
420 FatalErrorInArgument,exceptionDescription);
421 return;
422 }
423 }
424 else
425 {
426 fpProcessInfo = it->second;
427 }
428}
void SetupGeneralProcessInfo(G4ParticleDefinition *, G4ProcessManager *)

Referenced by SetupMembers().

◆ GetSecondaries()

G4TrackVector * G4ITStepProcessor::GetSecondaries ( )
inline

Definition at line 97 of file G4ITStepProcessor.hh.

97{return fpSecondary;}

◆ GetStep() [1/2]

G4Step * G4ITStepProcessor::GetStep ( )
inline

Definition at line 93 of file G4ITStepProcessor.hh.

93{return fpStep;}

Referenced by SetTrack().

◆ GetStep() [2/2]

const G4Step * G4ITStepProcessor::GetStep ( ) const
inline

Definition at line 94 of file G4ITStepProcessor.hh.

94{return fpStep;}

◆ GetTrack() [1/2]

G4Track * G4ITStepProcessor::GetTrack ( )
inline

Definition at line 92 of file G4ITStepProcessor.hh.

92{return fpTrack;}

◆ GetTrack() [2/2]

const G4Track * G4ITStepProcessor::GetTrack ( ) const
inline

Definition at line 309 of file G4ITStepProcessor.hh.

310{
311 return fpTrack;
312}

◆ GetTrackingManager()

G4ITTrackingManager * G4ITStepProcessor::GetTrackingManager ( )
inline

Definition at line 99 of file G4ITStepProcessor.hh.

99{return fpTrackingManager;}

◆ InitDefineStep()

void G4ITStepProcessor::InitDefineStep ( )
protected

Definition at line 611 of file G4ITStepProcessor.cc.

612{
613
614 if(!fpStep)
615 {
616
617 // Create new Step and give it to the track
618 fpStep = new G4Step();
619 fpTrack->SetStep(fpStep);
620 fpSecondary = fpStep->NewSecondaryVector();
621
622 // Create new state and set it in the trackingInfo
623 fpState = new G4ITStepProcessorState();
625
626 SetupMembers();
627 fpNavigator->NewNavigatorState();
628
630 }
631 else
632 {
633 SetupMembers();
634
635 fpState->fPreviousStepSize = fpTrack->GetStepLength();
636/***
637 // Send G4Step information to Hit/Dig if the volume is sensitive
638 fpCurrentVolume = fpStep->GetPreStepPoint()->GetPhysicalVolume();
639 StepControlFlag = fpStep->GetControlFlag();
640 if( fpCurrentVolume != 0 && StepControlFlag != AvoidHitInvocation)
641 {
642 fpSensitive = fpStep->GetPreStepPoint()->
643 GetSensitiveDetector();
644
645 // if( fSensitive != 0 ) {
646 // fSensitive->Hit(fStep);
647 // }
648 }
649***/
650 // Store last PostStepPoint to PreStepPoint, and swap current and next
651 // volume information of G4Track. Reset total energy deposit in one Step.
652 fpStep->CopyPostToPreStepPoint();
653 fpStep->ResetTotalEnergyDeposit();
654
655 //JA Set the volume before it is used (in DefineStepLength() for User Limit)
656 fpCurrentVolume = fpStep->GetPreStepPoint()->GetPhysicalVolume();
657/*
658 G4cout << G4endl;
659 G4cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!" << G4endl;
660 G4cout << "PreStepPoint Volume : " << fpCurrentVolume->GetName() << G4endl;
661 G4cout << "Track Touchable : " << fpTrack->GetTouchableHandle()->GetVolume()->GetName() << G4endl;
662 G4cout << "Track NextTouchable : " << fpTrack->GetNextTouchableHandle()->GetVolume()->GetName() << G4endl;
663*/
664 // Reset the step's auxiliary points vector pointer
666
667 // Switch next touchable in track to current one
668 fpTrack->SetTouchableHandle(fpTrack->GetNextTouchableHandle());
669 fpState->fTouchableHandle = fpTrack->GetTouchableHandle();
670 fpTrack->SetNextTouchableHandle( fpState->fTouchableHandle );
671 G4VPhysicalVolume* oldTopVolume= fpTrack->GetTouchableHandle()->GetVolume();
672 fpNavigator->SetNavigatorState(fpITrack->GetTrackingInfo()->GetNavigatorState());
673
674 G4VPhysicalVolume* newTopVolume=
675 fpNavigator->ResetHierarchyAndLocate( fpTrack->GetPosition(),
676 fpTrack->GetMomentumDirection(),
677 *((G4TouchableHistory*)fpTrack->GetTouchableHandle()()) );
678
679 // G4cout << "New Top Volume : " << newTopVolume->GetName() << G4endl;
680
681 if(newTopVolume != oldTopVolume || oldTopVolume->GetRegularStructureId() == 1 )
682 {
683 fpState->fTouchableHandle = fpNavigator->CreateTouchableHistory();
684 fpTrack->SetTouchableHandle( fpState->fTouchableHandle );
685 fpTrack->SetNextTouchableHandle( fpState->fTouchableHandle );
686 }
687
688 fpNavigator->SetNavigatorState(fpITrack->GetTrackingInfo()->GetNavigatorState());
689 }
690}
G4TouchableHistory * CreateTouchableHistory() const
void NewNavigatorState()
G4VPhysicalVolume * GetPhysicalVolume() const
Definition: G4Step.hh:78
void ResetTotalEnergyDeposit()
void CopyPostToPreStepPoint()
G4StepPoint * GetPreStepPoint() const
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *theNewVectorPointer)
Definition: G4Step.hh:237
G4TrackVector * NewSecondaryVector()
void SetStep(const G4Step *aValue)
const G4TouchableHandle & GetNextTouchableHandle() const
void SetNextTouchableHandle(const G4TouchableHandle &apValue)
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4double GetStepLength() const
void SetStepProcessorState(G4ITStepProcessorState_Lock *)
virtual G4int GetRegularStructureId() const =0
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
Definition: G4VTouchable.cc:44

Referenced by DoDefinePhysicalStepLength().

◆ Initialize()

void G4ITStepProcessor::Initialize ( )
virtual

Definition at line 167 of file G4ITStepProcessor.cc.

168{
170 if(fInitialized) return;
171 // ActiveOnlyITProcess();
172
174 ->GetNavigatorForTracking());
175
176 fPhysIntLength = DBL_MAX;
178
179 fInitialized = true;
180}
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
void SetNavigator(G4ITNavigator *value)
static G4ITTransportationManager * GetTransportationManager()

Referenced by ForceReInitialization().

◆ InvokeAlongStepDoItProcs()

void G4ITStepProcessor::InvokeAlongStepDoItProcs ( )
protected

Definition at line 325 of file G4ITStepProcessor2.cc.

326{
327
328 // If the current Step is defined by a 'ExclusivelyForced'
329 // PostStepDoIt, then don't invoke any AlongStepDoIt
330 if(fpState->fStepStatus == fExclusivelyForcedProc)
331 {
332 return; // Take note 'return' at here !!!
333 }
334
335 // Invoke the all active continuous processes
336 for( size_t ci=0 ; ci<fpProcessInfo->MAXofAlongStepLoops ; ci++ )
337 {
338 fpCurrentProcess = (G4VITProcess*) (*fpProcessInfo->fpAlongStepDoItVector)[ci];
339 if (fpCurrentProcess== 0) continue;
340 // NULL means the process is inactivated by a user on fly.
341
342 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
343 fpParticleChange
344 = fpCurrentProcess->AlongStepDoIt( *fpTrack, *fpStep );
345 fpCurrentProcess->SetProcessState(0);
346 // Update the PostStepPoint of Step according to ParticleChange
347
348 fpParticleChange->UpdateStepForAlongStep(fpStep);
349
350 // Now Store the secondaries from ParticleChange to SecondaryList
351 DealWithSecondaries(fN2ndariesAlongStepDoIt) ;
352
353 // Set the track status according to what the process defined
354 // if kinetic energy >0, otherwise set fStopButAlive
355 fpTrack->SetTrackStatus( fpParticleChange->GetTrackStatus() );
356
357 // clear ParticleChange
358 fpParticleChange->Clear();
359 }
360
361 fpStep->UpdateTrack();
362
363 G4TrackStatus fNewStatus = fpTrack->GetTrackStatus();
364
365 if ( fNewStatus == fAlive && fpTrack->GetKineticEnergy() <= DBL_MIN )
366 {
367 // G4cout << "G4ITStepProcessor::InvokeAlongStepDoItProcs : Track will be killed" << G4endl;
368 if(fpProcessInfo->MAXofAtRestLoops>0) fNewStatus = fStopButAlive;
369 else fNewStatus = fStopAndKill;
370 fpTrack->SetTrackStatus( fNewStatus );
371 }
372
373}
@ fAlive
void DealWithSecondaries(G4int &)
void UpdateTrack()
virtual G4Step * UpdateStepForAlongStep(G4Step *Step)
G4TrackStatus GetTrackStatus() const
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)=0

Referenced by DoStepping().

◆ InvokeAtRestDoItProcs()

void G4ITStepProcessor::InvokeAtRestDoItProcs ( )
protected

Definition at line 275 of file G4ITStepProcessor2.cc.

276{
277 fpStep->SetStepLength( 0. ); //the particle has stopped
278 fpTrack->SetStepLength( 0. );
279
280 G4SelectedAtRestDoItVector& selectedAtRestDoItVector = fpState->fSelectedAtRestDoItVector;
281
282 // invoke selected process
283 for(size_t np=0; np < fpProcessInfo->MAXofAtRestLoops; np++)
284 {
285 //
286 // Note: DoItVector has inverse order against GetPhysIntVector
287 // and SelectedAtRestDoItVector.
288 //
289 if( selectedAtRestDoItVector[fpProcessInfo->MAXofAtRestLoops-np-1] != InActivated)
290 {
291 fpCurrentProcess = (G4VITProcess*) (*fpProcessInfo->fpAtRestDoItVector)[np];
292
293 fpCurrentProcess->SetProcessState(
294 fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
295 fpParticleChange
296 = fpCurrentProcess->AtRestDoIt( *fpTrack, *fpStep);
297 fpCurrentProcess->SetProcessState(0);
298
299 // Set the current process as a process which defined this Step length
300 fpStep->GetPostStepPoint()
301 ->SetProcessDefinedStep(fpCurrentProcess);
302
303 // Update Step
304 fpParticleChange->UpdateStepForAtRest(fpStep);
305
306 // Now Store the secondaries from ParticleChange to SecondaryList
307 DealWithSecondaries(fN2ndariesAtRestDoIt) ;
308
309 // clear ParticleChange
310 fpParticleChange->Clear();
311
312 } //if(fSelectedAtRestDoItVector[np] != InActivated){
313 } //for(size_t np=0; np < MAXofAtRestLoops; np++){
314 fpStep->UpdateTrack();
315
316 fpTrack->SetTrackStatus( fStopAndKill );
317}
class std::vector< int, std::allocator< int > > G4SelectedAtRestDoItVector
virtual G4Step * UpdateStepForAtRest(G4Step *Step)
virtual G4VParticleChange * AtRestDoIt(const G4Track &track, const G4Step &stepData)=0

Referenced by DoStepping().

◆ InvokePostStepDoItProcs()

void G4ITStepProcessor::InvokePostStepDoItProcs ( )
protected

Definition at line 383 of file G4ITStepProcessor2.cc.

384{
385
386 G4SelectedPostStepDoItVector& selectedPostStepDoItVector = fpState->fSelectedPostStepDoItVector;
387 G4StepStatus& stepStatus = fpState->fStepStatus;
388
389 // Invoke the specified discrete processes
390 for(size_t np=0; np < fpProcessInfo->MAXofPostStepLoops; np++)
391 {
392 //
393 // Note: DoItVector has inverse order against GetPhysIntVector
394 // and SelectedPostStepDoItVector.
395 //
396 G4int Cond = selectedPostStepDoItVector[fpProcessInfo->MAXofPostStepLoops-np-1];
397 if(Cond != InActivated)
398 {
399 if( ((Cond == NotForced) && (stepStatus == fPostStepDoItProc)) ||
400 ((Cond == Forced) && (stepStatus != fExclusivelyForcedProc)) ||
401 // ((Cond == Conditionally) && (stepStatus == fAlongStepDoItProc)) ||
402 ((Cond == ExclusivelyForced) && (stepStatus == fExclusivelyForcedProc)) ||
403 ((Cond == StronglyForced) )
404 )
405 {
406
407 InvokePSDIP(np);
408 }
409 } //if(*fSelectedPostStepDoItVector(np)........
410
411 // Exit from PostStepLoop if the track has been killed,
412 // but extra treatment for processes with Strongly Forced flag
413 if(fpTrack->GetTrackStatus() == fStopAndKill)
414 {
415 for(size_t np1=np+1; np1 < fpProcessInfo->MAXofPostStepLoops; np1++)
416 {
417 G4int Cond2 = selectedPostStepDoItVector[fpProcessInfo->MAXofPostStepLoops-np1-1];
418 if (Cond2 == StronglyForced)
419 {
420 InvokePSDIP(np1);
421 }
422 }
423 break;
424 }
425 } //for(size_t np=0; np < MAXofPostStepLoops; np++){
426}
class std::vector< int, std::allocator< int > > G4SelectedPostStepDoItVector
G4StepStatus
Definition: G4StepStatus.hh:51

Referenced by DoStepping().

◆ InvokePSDIP()

void G4ITStepProcessor::InvokePSDIP ( size_t  np)
protected

Definition at line 430 of file G4ITStepProcessor2.cc.

431{
432 fpCurrentProcess = (G4VITProcess*) (*fpProcessInfo->fpPostStepDoItVector)[np];
433
434 fpCurrentProcess->SetProcessState(fpTrackingInfo->GetProcessState(fpCurrentProcess->GetProcessID()));
435 fpParticleChange
436 = fpCurrentProcess->PostStepDoIt( *fpTrack, *fpStep);
437 fpCurrentProcess->SetProcessState(0);
438
439 // Update PostStepPoint of Step according to ParticleChange
440 fpParticleChange->UpdateStepForPostStep(fpStep);
441
442 // Update G4Track according to ParticleChange after each PostStepDoIt
443 fpStep->UpdateTrack();
444
445 // Update safety after each invocation of PostStepDoIts
447
448 // Now Store the secondaries from ParticleChange to SecondaryList
449 DealWithSecondaries(fN2ndariesPostStepDoIt) ;
450
451 // Set the track status according to what the process defined
452 fpTrack->SetTrackStatus( fpParticleChange->GetTrackStatus() );
453
454 // clear ParticleChange
455 fpParticleChange->Clear();
456}
virtual G4Step * UpdateStepForPostStep(G4Step *Step)
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)=0

Referenced by InvokePostStepDoItProcs(), and InvokeTransportationProc().

◆ InvokeTransportationProc()

void G4ITStepProcessor::InvokeTransportationProc ( )
protected

Definition at line 518 of file G4ITStepProcessor2.cc.

519{
520 size_t _MAXofPostStepLoops = fpProcessInfo->MAXofPostStepLoops;
521 G4SelectedPostStepDoItVector& selectedPostStepDoItVector = fpState->fSelectedPostStepDoItVector;
522 G4StepStatus& stepStatus = fpState->fStepStatus;
523
524 // Invoke the specified discrete processes
525 for(size_t np=0; np < _MAXofPostStepLoops; np++)
526 {
527 //
528 // Note: DoItVector has inverse order against GetPhysIntVector
529 // and SelectedPostStepDoItVector.
530 //
531 G4int Cond = selectedPostStepDoItVector[_MAXofPostStepLoops-np-1];
532 if(Cond != InActivated)
533 {
534 if(
535 ((Cond == Forced) && (stepStatus != fExclusivelyForcedProc)) ||
536 // ((Cond == Conditionally) && (stepStatus == fAlongStepDoItProc)) ||
537 ((Cond == ExclusivelyForced) && (stepStatus == fExclusivelyForcedProc)) ||
538 ((Cond == StronglyForced) )
539 )
540 {
541
542 InvokePSDIP(np);
543 }
544 } //if(*fSelectedPostStepDoItVector(np)........
545
546 // Exit from PostStepLoop if the track has been killed,
547 // but extra treatment for processes with Strongly Forced flag
548 if(fpTrack->GetTrackStatus() == fStopAndKill)
549 {
550 for(size_t np1=np+1; np1 < _MAXofPostStepLoops; np1++)
551 {
552 G4int Cond2 = selectedPostStepDoItVector[_MAXofPostStepLoops-np1-1];
553 if (Cond2 == StronglyForced)
554 {
555 InvokePSDIP(np1);
556 }
557 }
558 break;
559 }
560 }
561}

Referenced by DoStepping().

◆ operator=()

G4ITStepProcessor & G4ITStepProcessor::operator= ( const G4ITStepProcessor other)
protected

Definition at line 218 of file G4ITStepProcessor.cc.

219{
220 if (this == &rhs) return *this; // handle self assignment
221 //assignment operator
222 return *this;
223}

◆ ResetSecondaries()

void G4ITStepProcessor::ResetSecondaries ( )
protected

Definition at line 444 of file G4ITStepProcessor.cc.

445{
446 // Reset the secondary particles
447 fN2ndariesAtRestDoIt = 0;
448 fN2ndariesAlongStepDoIt = 0;
449 fN2ndariesPostStepDoIt = 0;
450}

Referenced by G4ITStepProcessor(), and SetupMembers().

◆ SetInitialStep()

void G4ITStepProcessor::SetInitialStep ( )
protected

Definition at line 516 of file G4ITStepProcessor.cc.

517{
518 // DEBUG
519 // G4cout << "SetInitialStep for : " << fpITrack-> GetName() << G4endl;
520 //________________________________________________________
521 // Initialize geometry
522
523
524 if ( ! fpTrack->GetTouchableHandle())
525 {
526 G4ThreeVector direction= fpTrack->GetMomentumDirection();
527 fpNavigator->LocateGlobalPointAndSetup( fpTrack->GetPosition(),
528 &direction, false, false );
529 fpState->fTouchableHandle = fpNavigator->CreateTouchableHistory();
530
531 fpTrack->SetTouchableHandle( fpState->fTouchableHandle );
532 fpTrack->SetNextTouchableHandle( fpState->fTouchableHandle );
533 }
534 else
535 {
536 fpState->fTouchableHandle = fpTrack->GetTouchableHandle();
537 fpTrack->SetNextTouchableHandle( fpState->fTouchableHandle );
538 G4VPhysicalVolume* oldTopVolume= fpTrack->GetTouchableHandle()->GetVolume();
539 G4VPhysicalVolume* newTopVolume=
540 fpNavigator->ResetHierarchyAndLocate( fpTrack->GetPosition(),
541 fpTrack->GetMomentumDirection(),
542 *((G4TouchableHistory*)fpTrack->GetTouchableHandle()()) );
543 if(newTopVolume != oldTopVolume || oldTopVolume->GetRegularStructureId() == 1 )
544 {
545 fpState->fTouchableHandle = fpNavigator->CreateTouchableHistory();
546 fpTrack->SetTouchableHandle( fpState->fTouchableHandle );
547 fpTrack->SetNextTouchableHandle( fpState->fTouchableHandle );
548 }
549 }
550
551 fpCurrentVolume = fpState->fTouchableHandle->GetVolume();
552
553 //________________________________________________________
554 // If the primary track has 'Suspend' or 'PostponeToNextEvent' state,
555 // set the track state to 'Alive'.
556 if( (fpTrack->GetTrackStatus()==fSuspend) ||
558 {
559 fpTrack->SetTrackStatus(fAlive);
560 }
561
562 // If the primary track has 'zero' kinetic energy, set the track
563 // state to 'StopButAlive'.
564 if(fpTrack->GetKineticEnergy() <= 0.0)
565 {
566 fpTrack->SetTrackStatus( fStopButAlive );
567 }
568 //________________________________________________________
569 // Set vertex information of G4Track at here
570 if ( fpTrack->GetCurrentStepNumber() == 0 )
571 {
572 fpTrack->SetVertexPosition( fpTrack->GetPosition() );
574 fpTrack->SetVertexKineticEnergy( fpTrack->GetKineticEnergy() );
575 fpTrack->SetLogicalVolumeAtVertex( fpTrack->GetVolume()->GetLogicalVolume() );
576 }
577 //________________________________________________________
578 // If track is already outside the world boundary, kill it
579 if( fpCurrentVolume==0 )
580 {
581 // If the track is a primary, stop processing
582 if(fpTrack->GetParentID()==0)
583 {
584 G4cerr << "ERROR - G4ITStepProcessor::SetInitialStep()" << G4endl
585 << " Primary particle starting at - "
586 << fpTrack->GetPosition()
587 << " - is outside of the world volume." << G4endl;
588 G4Exception("G4ITStepProcessor::SetInitialStep()", "ITStepProcessor0011",
589 FatalException, "Primary vertex outside of the world!");
590 }
591
592 fpTrack->SetTrackStatus( fStopAndKill );
593 G4cout << "WARNING - G4ITStepProcessor::SetInitialStep()" << G4endl
594 << " Initial track position is outside world! - "
595 << fpTrack->GetPosition() << G4endl;
596 }
597 else{
598 // Initial set up for attribues of 'Step'
599 fpStep->InitializeStep( fpTrack );
600 }
601
602
603 if( fpTrack->GetTrackStatus() == fStopAndKill ) return ;
604
605 fpTrackingManager->StartTracking(fpTrack);
606
607 fpState->fStepStatus = fUndefined;
608}
@ fSuspend
@ fPostponeToNextEvent
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
virtual void StartTracking(G4Track *)
void InitializeStep(G4Track *aValue)
G4VPhysicalVolume * GetVolume() const
void SetVertexPosition(const G4ThreeVector &aValue)
void SetVertexMomentumDirection(const G4ThreeVector &aValue)
G4int GetCurrentStepNumber() const
void SetVertexKineticEnergy(const G4double aValue)
G4int GetParentID() const
void SetLogicalVolumeAtVertex(const G4LogicalVolume *)
G4LogicalVolume * GetLogicalVolume() const

Referenced by InitDefineStep().

◆ SetNavigator()

void G4ITStepProcessor::SetNavigator ( G4ITNavigator value)
inlineprotected

Definition at line 321 of file G4ITStepProcessor.hh.

322{
323 fpNavigator = value;
324}

Referenced by Initialize().

◆ SetPreviousStepTime()

void G4ITStepProcessor::SetPreviousStepTime ( G4double  previousTimeStep)
inline

Definition at line 304 of file G4ITStepProcessor.hh.

305{
306 fPreviousTimeStep = previousTimeStep;
307}

◆ SetStep()

void G4ITStepProcessor::SetStep ( G4Step val)
inline

Definition at line 95 of file G4ITStepProcessor.hh.

95{fpStep = val;}

◆ SetTrack()

void G4ITStepProcessor::SetTrack ( G4Track track)
protected

Definition at line 378 of file G4ITStepProcessor.cc.

379{
380 fpTrack = track ;
381 if(fpTrack)
382 {
383 fpITrack = GetIT(fpTrack) ;
384 fpStep = const_cast<G4Step*>(fpTrack -> GetStep());
385
386 if(fpITrack)
387 {
388 fpTrackingInfo = fpITrack->GetTrackingInfo() ;
389 }
390 else
391 {
392 fpTrackingInfo = 0;
393 G4cerr << "Track ID : " << fpTrack->GetTrackID() << G4endl;
394
395 G4ExceptionDescription exceptionDescription ("No IT pointer was attached to the track you try to process.");
396 G4Exception("G4ITStepProcessor::SetTrack","ITStepProcessor0007",
397 FatalErrorInArgument,exceptionDescription);
398 }
399 }
400 else
401 {
402 fpITrack = 0;
403 fpStep = 0 ;
404 }
405}

Referenced by DefinePhysicalStepLength(), and Stepping().

◆ SetTrackingManager()

void G4ITStepProcessor::SetTrackingManager ( G4ITTrackingManager trackMan)
inline

Definition at line 98 of file G4ITStepProcessor.hh.

98{fpTrackingManager = trackMan;}

◆ SetupGeneralProcessInfo()

void G4ITStepProcessor::SetupGeneralProcessInfo ( G4ParticleDefinition particle,
G4ProcessManager pm 
)
protected

Definition at line 277 of file G4ITStepProcessor.cc.

279{
280
281#ifdef debug
282 G4cout<<"G4ITStepProcessor::GetProcessNumber: is called track"<<G4endl;
283#endif
284 if(!pm)
285 {
286 G4cerr << "ERROR - G4SteppingManager::GetProcessNumber()" << G4endl
287 << " ProcessManager is NULL for particle = "
288 << particle->GetParticleName() << ", PDG_code = "
289 << particle->GetPDGEncoding() << G4endl;
290 G4Exception("G4SteppingManager::GetProcessNumber()", "ITStepProcessor0002",
291 FatalException, "Process Manager is not found.");
292 return;
293 }
294
295 std::map<const G4ParticleDefinition*, ProcessGeneralInfo*>::iterator it = fProcessGeneralInfoMap.find(particle);
296 if(it != fProcessGeneralInfoMap.end())
297 {
298 G4Exception("G4SteppingManager::SetupGeneralProcessInfo()", "ITStepProcessor0003",
299 FatalException, "Process info already registered.");
300 return;
301 }
302
303 // here used as temporary
304 fpProcessInfo = new ProcessGeneralInfo();
305
306 // AtRestDoits
307 fpProcessInfo->MAXofAtRestLoops = pm->GetAtRestProcessVector()->entries();
308 fpProcessInfo->fpAtRestDoItVector = pm->GetAtRestProcessVector(typeDoIt);
309 fpProcessInfo->fpAtRestGetPhysIntVector = pm->GetAtRestProcessVector(typeGPIL);
310#ifdef debug
311 G4cout << "G4ITStepProcessor::GetProcessNumber: #ofAtRest="
312 << fpProcessInfo->MAXofAtRestLoops << G4endl;
313#endif
314
315 // AlongStepDoits
316 fpProcessInfo->MAXofAlongStepLoops = pm->GetAlongStepProcessVector()->entries();
317 fpProcessInfo->fpAlongStepDoItVector = pm->GetAlongStepProcessVector(typeDoIt);
318 fpProcessInfo->fpAlongStepGetPhysIntVector = pm->GetAlongStepProcessVector(typeGPIL);
319#ifdef debug
320 G4cout << "G4ITStepProcessor::GetProcessNumber:#ofAlongStp="
321 << fpProcessInfo->MAXofAlongStepLoops << G4endl;
322#endif
323
324 // PostStepDoits
325 fpProcessInfo->MAXofPostStepLoops = pm->GetPostStepProcessVector()->entries();
326 fpProcessInfo->fpPostStepDoItVector = pm->GetPostStepProcessVector(typeDoIt);
327 fpProcessInfo->fpPostStepGetPhysIntVector = pm->GetPostStepProcessVector(typeGPIL);
328#ifdef debug
329 G4cout << "G4ITStepProcessor::GetProcessNumber: #ofPostStep="
330 << fpProcessInfo->MAXofPostStepLoops << G4endl;
331#endif
332
333 if (SizeOfSelectedDoItVector<fpProcessInfo->MAXofAtRestLoops ||
334 SizeOfSelectedDoItVector<fpProcessInfo->MAXofAlongStepLoops ||
335 SizeOfSelectedDoItVector<fpProcessInfo->MAXofPostStepLoops )
336 {
337 G4cerr << "ERROR - G4ITStepProcessor::GetProcessNumber()" << G4endl
338 << " SizeOfSelectedDoItVector= " << SizeOfSelectedDoItVector
339 << " ; is smaller then one of MAXofAtRestLoops= "
340 << fpProcessInfo->MAXofAtRestLoops << G4endl
341 << " or MAXofAlongStepLoops= " << fpProcessInfo->MAXofAlongStepLoops
342 << " or MAXofPostStepLoops= " << fpProcessInfo->MAXofPostStepLoops << G4endl;
343 G4Exception("G4ITStepProcessor::GetProcessNumber()",
344 "ITStepProcessor0004", FatalException,
345 "The array size is smaller than the actual No of processes.");
346 }
347
348 if(!fpProcessInfo->fpAtRestDoItVector &&
349 !fpProcessInfo->fpAlongStepDoItVector &&
350 !fpProcessInfo->fpPostStepDoItVector)
351 {
352 G4ExceptionDescription exceptionDescription ;
353 exceptionDescription << "No DoIt process found " ;
354 G4Exception("G4ITStepProcessor::DoStepping","ITStepProcessor0005",
355 FatalErrorInArgument,exceptionDescription);
356 return ;
357 }
358
359 if(fpProcessInfo->fpAlongStepGetPhysIntVector && fpProcessInfo->MAXofAlongStepLoops>0)
360 {
361 fpProcessInfo->fpTransportation = dynamic_cast<G4ITTransportation*>
362 ((*fpProcessInfo->fpAlongStepGetPhysIntVector)[fpProcessInfo->MAXofAlongStepLoops-1]);
363
364 if(fpProcessInfo->fpTransportation == 0)
365 {
366 G4ExceptionDescription exceptionDescription ;
367 exceptionDescription << "No transportation process found " ;
368 G4Exception("G4ITStepProcessor::SetupGeneralProcessInfo","ITStepProcessor0006",
369 FatalErrorInArgument,exceptionDescription);
370 }
371 }
372 fProcessGeneralInfoMap[particle] = fpProcessInfo;
373 // fpProcessInfo = 0;
374}
@ typeGPIL
@ typeDoIt
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const

Referenced by GetProcessInfo().

◆ SetupMembers()

void G4ITStepProcessor::SetupMembers ( )
protected

Definition at line 431 of file G4ITStepProcessor.cc.

432{
433 fpSecondary = fpStep->GetfSecondary();
434 fpPreStepPoint = fpStep->GetPreStepPoint();
435 fpPostStepPoint = fpStep->GetPostStepPoint();
436
437 fpState = (G4ITStepProcessorState*) fpITrack->GetTrackingInfo()->GetStepProcessorState();
438
441}
G4TrackVector * GetfSecondary()
G4ITStepProcessorState_Lock * GetStepProcessorState()

Referenced by DoStepping(), and InitDefineStep().

◆ Stepping()

void G4ITStepProcessor::Stepping ( G4Track track,
const double &  timeStep 
)

Definition at line 95 of file G4ITStepProcessor2.cc.

96{
98 if(track == 0) return ; // maybe put an exception here
99 fTimeStep = timeStep ;
100 SetTrack(track);
101 DoStepping();
102}

◆ UpdateTrack()

void G4ITStepProcessor::UpdateTrack ( G4Track )

The documentation for this class was generated from the following files: