58 static const size_t SizeOfSelectedDoItVector=100;
68 fpTrackingManager = 0;
77 G4ITStepProcessor::G4ITStepProcessorState::G4ITStepProcessorState() :
81 fSelectedAtRestDoItVector (
G4VITProcess::GetMaxProcessIndex(),0),
82 fSelectedPostStepDoItVector (
G4VITProcess::GetMaxProcessIndex(),0)
85 fPreviousStepSize = -1.;
97 G4ITStepProcessor::G4ITStepProcessorState::G4ITStepProcessorState(
const G4ITStepProcessorState& ) :
101 fSelectedAtRestDoItVector (
G4VITProcess::GetMaxProcessIndex(),0),
102 fSelectedPostStepDoItVector (
G4VITProcess::GetMaxProcessIndex(),0)
105 fPreviousStepSize = -1.;
108 proposedSafety = -1.;
113 fTouchableHandle = 0;
117 G4ITStepProcessor::G4ITStepProcessorState& G4ITStepProcessor::G4ITStepProcessorState::operator=(
const G4ITStepProcessorState& rhs)
119 if(
this == &rhs)
return *
this;
121 fSelectedAtRestDoItVector.clear();
124 fSelectedPostStepDoItVector.clear();
129 fPreviousStepSize = -1.;
132 proposedSafety = -1.;
137 fTouchableHandle = 0;
142 G4ITStepProcessor::G4ITStepProcessorState::~G4ITStepProcessorState()
148 std::map<const G4ParticleDefinition*, ProcessGeneralInfo*> ::iterator it;
150 for(it = fProcessGeneralInfoMap.begin();it != fProcessGeneralInfoMap.end();it++)
159 fProcessGeneralInfoMap.clear();
166 fInitialized =
false;
176 if(fInitialized)
return;
180 ->GetNavigatorForTracking());
197 if(fpSecondary)
delete fpSecondary;
207 verboseLevel = rhs.verboseLevel ;
208 fStoreTrajectory = rhs.fStoreTrajectory ;
211 fpTrackingManager = 0;
213 fInitialized =
false;
215 kCarTolerance = rhs.kCarTolerance;
216 fInitialized =
false;
226 if (
this == &rhs)
return *
this;
236 G4cout<<
"G4ITStepProcessor::CloneProcesses: is called"<<
G4endl;
242 theParticleIterator->
reset();
244 while( (*theParticleIterator)() )
251 G4cerr <<
"ERROR - G4ITStepProcessor::GetProcessNumber()" << G4endl
252 <<
" ProcessManager is NULL for particle = "
255 G4Exception(
"G4ITStepProcessor::GetProcessNumber()",
"ITStepProcessor0001",
271 for(
int i = 0 ; i < processVector->
size() ; i++)
273 G4VProcess* base_process = (*processVector)[i];
288 G4cout<<
"G4ITStepProcessor::GetProcessNumber: is called track"<<
G4endl;
292 G4cerr <<
"ERROR - G4SteppingManager::GetProcessNumber()" << G4endl
293 <<
" ProcessManager is NULL for particle = "
296 G4Exception(
"G4SteppingManager::GetProcessNumber()",
"ITStepProcessor0002",
301 std::map<const G4ParticleDefinition*, ProcessGeneralInfo*>::iterator it = fProcessGeneralInfoMap.find(particle);
302 if(it != fProcessGeneralInfoMap.end())
304 G4Exception(
"G4SteppingManager::SetupGeneralProcessInfo()",
"ITStepProcessor0003",
310 fpProcessInfo =
new ProcessGeneralInfo();
317 G4cout <<
"G4ITStepProcessor::GetProcessNumber: #ofAtRest="
318 << fpProcessInfo->MAXofAtRestLoops <<
G4endl;
326 G4cout <<
"G4ITStepProcessor::GetProcessNumber:#ofAlongStp="
327 << fpProcessInfo->MAXofAlongStepLoops <<
G4endl;
335 G4cout <<
"G4ITStepProcessor::GetProcessNumber: #ofPostStep="
336 << fpProcessInfo->MAXofPostStepLoops <<
G4endl;
339 if (SizeOfSelectedDoItVector<fpProcessInfo->MAXofAtRestLoops ||
340 SizeOfSelectedDoItVector<fpProcessInfo->MAXofAlongStepLoops ||
341 SizeOfSelectedDoItVector<fpProcessInfo->MAXofPostStepLoops )
343 G4cerr <<
"ERROR - G4ITStepProcessor::GetProcessNumber()" << G4endl
344 <<
" SizeOfSelectedDoItVector= " << SizeOfSelectedDoItVector
345 <<
" ; is smaller then one of MAXofAtRestLoops= "
346 << fpProcessInfo->MAXofAtRestLoops << G4endl
347 <<
" or MAXofAlongStepLoops= " << fpProcessInfo->MAXofAlongStepLoops
348 <<
" or MAXofPostStepLoops= " << fpProcessInfo->MAXofPostStepLoops <<
G4endl;
349 G4Exception(
"G4ITStepProcessor::GetProcessNumber()",
351 "The array size is smaller than the actual No of processes.");
354 if(!fpProcessInfo->fpAtRestDoItVector &&
355 !fpProcessInfo->fpAlongStepDoItVector &&
356 !fpProcessInfo->fpPostStepDoItVector)
359 exceptionDescription <<
"No DoIt process found " ;
360 G4Exception(
"G4ITStepProcessor::DoStepping",
"ITStepProcessor0005",
365 if(fpProcessInfo->fpAlongStepGetPhysIntVector && fpProcessInfo->MAXofAlongStepLoops>0)
368 ((*fpProcessInfo->fpAlongStepGetPhysIntVector)[fpProcessInfo->MAXofAlongStepLoops-1]);
370 if(fpProcessInfo->fpTransportation == 0)
373 exceptionDescription <<
"No transportation process found " ;
374 G4Exception(
"G4ITStepProcessor::SetupGeneralProcessInfo",
"ITStepProcessor0006",
378 fProcessGeneralInfoMap[particle] = fpProcessInfo;
389 fpITrack =
GetIT(fpTrack) ;
401 G4ExceptionDescription exceptionDescription (
"No IT pointer was attached to the track you try to process.");
402 G4Exception(
"G4ITStepProcessor::SetTrack",
"ITStepProcessor0007",
417 std::map<const G4ParticleDefinition*, ProcessGeneralInfo*>::iterator it = fProcessGeneralInfoMap.find(particle);
419 if(it == fProcessGeneralInfoMap.end())
422 if(fpProcessInfo == 0)
425 G4Exception(
"G4ITStepProcessor::GetProcessNumber",
"ITStepProcessor0008",
432 fpProcessInfo = it->second;
453 fN2ndariesAtRestDoIt = 0;
454 fN2ndariesAlongStepDoIt = 0;
455 fN2ndariesPostStepDoIt = 0;
466 fAtRestDoItProcTriggered = 0;
469 unsigned int NofInactiveProc=0;
471 for(
size_t ri=0 ; ri < fpProcessInfo->MAXofAtRestLoops ; ri++ )
473 fpCurrentProcess = (
G4VITProcess*) (*fpProcessInfo->fpAtRestGetPhysIntVector)[ri];
474 if (fpCurrentProcess== 0)
476 (fpState->fSelectedAtRestDoItVector)[ri] =
InActivated;
483 lifeTime = fpCurrentProcess->
AtRestGPIL( *fpTrack, &fCondition );
488 (fpState->fSelectedAtRestDoItVector)[ri] =
Forced;
492 (fpState->fSelectedAtRestDoItVector)[ri] =
InActivated;
493 if(lifeTime < shortestLifeTime )
495 shortestLifeTime = lifeTime;
496 fAtRestDoItProcTriggered =
G4int(ri);
497 (fpState->fSelectedAtRestDoItVector)[fAtRestDoItProcTriggered] =
NotForced;
502 fTimeStep = shortestLifeTime ;
506 if(NofInactiveProc==fpProcessInfo->MAXofAtRestLoops)
508 G4cerr <<
"ERROR - G4ITStepProcessor::InvokeAtRestDoItProcs()" <<
G4endl
509 <<
" No AtRestDoIt process is active!" <<
G4endl;
534 &direction,
false, false );
557 fpCurrentVolume = fpState->fTouchableHandle->GetVolume();
585 if( fpCurrentVolume==0 )
590 G4cerr <<
"ERROR - G4ITStepProcessor::SetInitialStep()" <<
G4endl
591 <<
" Primary particle starting at - "
593 <<
" - is outside of the world volume." <<
G4endl;
594 G4Exception(
"G4ITStepProcessor::SetInitialStep()",
"ITStepProcessor0011",
599 G4cout <<
"WARNING - G4ITStepProcessor::SetInitialStep()" <<
G4endl
600 <<
" Initial track position is outside world! - "
629 fpState =
new G4ITStepProcessorState();
728 fpState->fPhysicalStep =
DBL_MAX;
731 double proposedTimeStep =
DBL_MAX;
732 G4VProcess* processWithPostStepGivenByTimeStep(0);
735 fPostStepDoItProcTriggered = fpProcessInfo->MAXofPostStepLoops;
736 fPostStepAtTimeDoItProcTriggered = fpProcessInfo->MAXofPostStepLoops;
742 for(
size_t np=0; np < fpProcessInfo->MAXofPostStepLoops; np++)
744 fpCurrentProcess = (
G4VITProcess*) (*fpProcessInfo->fpPostStepGetPhysIntVector)[np];
745 if (fpCurrentProcess== 0)
747 (fpState->fSelectedPostStepDoItVector)[np] =
InActivated;
755 fPhysIntLength = fpCurrentProcess->
756 PostStepGPIL( *fpTrack,
757 fpState->fPreviousStepSize,
772 G4Exception(
"G4ITStepProcessor::DefinePhysicalStepLength()",
"ITStepProcessor0008",
777 (fpState->fSelectedPostStepDoItVector)[np] =
Forced;
785 (fpState->fSelectedPostStepDoItVector)[np] =
InActivated;
791 for(
size_t nrest=np+1; nrest < fpProcessInfo->MAXofPostStepLoops; nrest++)
793 (fpState->fSelectedPostStepDoItVector)[nrest] =
InActivated;
799 if(fPhysIntLength < fpState->fPhysicalStep )
806 fPhysIntLength *= -1;
807 if(fPhysIntLength < proposedTimeStep)
809 proposedTimeStep = fPhysIntLength;
810 fPostStepAtTimeDoItProcTriggered = np;
811 processWithPostStepGivenByTimeStep = fpCurrentProcess;
816 fpState->fPhysicalStep = fPhysIntLength;
818 fPostStepDoItProcTriggered =
G4int(np);
827 fpState->proposedSafety =
DBL_MAX;
828 G4double safetyProposedToAndByProcess = fpState->proposedSafety;
830 for(
size_t kp=0; kp < fpProcessInfo->MAXofAlongStepLoops; kp++)
832 fpCurrentProcess = (
G4VITProcess*) (*fpProcessInfo->fpAlongStepGetPhysIntVector)[kp];
833 if (fpCurrentProcess== 0)
continue;
837 fPhysIntLength = fpCurrentProcess-> AlongStepGPIL( *fpTrack,
838 fpState->fPreviousStepSize,
839 fpState->fPhysicalStep,
840 safetyProposedToAndByProcess,
843 if(fPhysIntLength < fpState->fPhysicalStep)
845 fpState->fPhysicalStep = fPhysIntLength;
858 if(kp == fpProcessInfo->MAXofAlongStepLoops-1)
862 if(! fpTransportation)
865 exceptionDescription <<
"No transportation process found " ;
866 G4Exception(
"G4ITStepProcessor::DoDefinePhysicalStepLength",
"ITStepProcessor0009",
881 if(kp == fpProcessInfo->MAXofAlongStepLoops-1)
885 if(! fpTransportation)
888 exceptionDescription <<
"No transportation process found " ;
889 G4Exception(
"G4ITStepProcessor::DoDefinePhysicalStepLength",
"ITStepProcessor0010",
897 if(proposedTimeStep < fTimeStep)
899 if(fPostStepAtTimeDoItProcTriggered<fpProcessInfo->MAXofPostStepLoops)
901 if ((fpState->fSelectedPostStepDoItVector)[fPostStepAtTimeDoItProcTriggered] ==
904 (fpState->fSelectedPostStepDoItVector)[fPostStepAtTimeDoItProcTriggered] =
NotForced;
910 fTimeStep = proposedTimeStep;
912 fpTransportation->
ComputeStep(*fpTrack,*fpStep,fTimeStep,fpState->fPhysicalStep);
918 if (fPostStepDoItProcTriggered<fpProcessInfo->MAXofPostStepLoops)
920 if ((fpState->fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] ==
923 (fpState->fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] =
934 if (safetyProposedToAndByProcess < fpState->proposedSafety)
936 fpState->proposedSafety = safetyProposedToAndByProcess;
939 safetyProposedToAndByProcess = fpState->proposedSafety;
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4ParticleDefinition * GetDefinition() const
G4int GetParentID() const
virtual G4VPhysicalVolume * ResetHierarchyAndLocate(const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
static void DeleteInstance()
void SetVertexMomentumDirection(const G4ThreeVector &aValue)
void SetProcessDefinedStep(const G4VProcess *aValue)
std::ostringstream G4ExceptionDescription
static const size_t & GetMaxProcessIndex()
void DeleteSecondaryVector()
void SetNavigator(G4ITNavigator *value)
const G4ThreeVector & GetPosition() const
G4double GetSurfaceTolerance() const
G4TrackStatus GetTrackStatus() const
void SetNextTouchableHandle(const G4TouchableHandle &apValue)
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4int GetPDGEncoding() const
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *theNewVectorPointer)
G4ProcessManager * GetProcessManager() const
virtual void StartTracking(G4Track *)
const G4String & GetParticleName() const
G4VProcess * SetProcessActivation(G4VProcess *aProcess, G4bool fActive)
G4VPhysicalVolume * GetNextVolume() const
void DefinePhysicalStepLength(G4Track *)
G4double AtRestGPIL(const G4Track &track, G4ForceCondition *condition)
G4StepPoint * GetPreStepPoint() const
G4ITNavigatorState_Lock * GetNavigatorState()
G4IT * GetIT(const G4Track *track)
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4double GetKineticEnergy() const
static G4ITTransportationManager * GetTransportationManager()
G4GLOB_DLL std::ostream G4cout
void reset(G4bool ifSkipIon=true)
G4int GetCurrentStepNumber() const
G4TrackVector * NewSecondaryVector()
G4VPhysicalVolume * GetPhysicalVolume() const
void ActiveOnlyITProcess()
virtual void ComputeStep(const G4Track &, const G4Step &, const double timeStep, double &spaceStep)
virtual G4int GetRegularStructureId() const =0
void ResetTotalEnergyDeposit()
void SetVertexKineticEnergy(const G4double aValue)
const G4TouchableHandle & GetNextTouchableHandle() const
G4double GetInteractionTimeLeft()
void SetProcessState(G4ProcessState_Lock *aProcInfo)
const G4TouchableHandle & GetTouchableHandle() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual void Initialize()
G4TrackingInformation * GetTrackingInfo()
const G4ThreeVector & GetMomentumDirection() const
G4LogicalVolume * GetLogicalVolume() const
G4TrackVector * GetfSecondary()
static G4ParticleTable * GetParticleTable()
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
void SetVertexPosition(const G4ThreeVector &aValue)
G4StepPoint * GetPostStepPoint() const
G4ITStepProcessor & operator=(const G4ITStepProcessor &other)
G4VPhysicalVolume * GetVolume() const
void SetNavigatorState(G4ITNavigatorState_Lock *)
void DoDefinePhysicalStepLength()
virtual ~G4ITStepProcessor()
void InitializeStep(G4Track *aValue)
G4TouchableHistory * CreateTouchableHistory() const
void SetupGeneralProcessInfo(G4ParticleDefinition *, G4ProcessManager *)
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4bool ProposesTimeStep() const
size_t GetProcessID() const
G4PTblDicIterator * GetIterator() const
void SetStep(const G4Step *aValue)
#define theParticleIterator
G4double GetStepLength() const
static G4GeometryTolerance * GetInstance()
G4ProcessVector * GetProcessList() const
void ForceReInitialization()
G4GLOB_DLL std::ostream G4cerr
void SetLogicalVolumeAtVertex(const G4LogicalVolume *)
void CopyPostToPreStepPoint()
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const