58static const size_t SizeOfSelectedDoItVector=100;
68 fpTrackingManager = 0;
77G4ITStepProcessor::G4ITStepProcessorState::G4ITStepProcessorState() :
79 fSelectedAtRestDoItVector (gMaxNProcesses,0),
80 fSelectedPostStepDoItVector (gMaxNProcesses,0)
83 fPreviousStepSize = -1.;
95G4ITStepProcessor::G4ITStepProcessorState::G4ITStepProcessorState(
const G4ITStepProcessorState& ) :
97 fSelectedAtRestDoItVector (gMaxNProcesses,0),
98 fSelectedPostStepDoItVector (gMaxNProcesses,0)
101 fPreviousStepSize = -1.;
104 proposedSafety = -1.;
109 fTouchableHandle = 0;
113G4ITStepProcessor::G4ITStepProcessorState& G4ITStepProcessor::G4ITStepProcessorState::operator=(
const G4ITStepProcessorState& rhs)
115 if(
this == &rhs)
return *
this;
117 fSelectedAtRestDoItVector.clear();
118 fSelectedAtRestDoItVector.resize(gMaxNProcesses,0);
119 fSelectedPostStepDoItVector.clear();
120 fSelectedPostStepDoItVector.resize(gMaxNProcesses,0);
123 fPreviousStepSize = -1.;
126 proposedSafety = -1.;
131 fTouchableHandle = 0;
136G4ITStepProcessor::G4ITStepProcessorState::~G4ITStepProcessorState()
142 std::map<const G4ParticleDefinition*, ProcessGeneralInfo*> ::iterator it;
144 for(it = fProcessGeneralInfoMap.begin();it != fProcessGeneralInfoMap.end();it++)
153 fProcessGeneralInfoMap.clear();
160 fInitialized =
false;
170 if(fInitialized)
return;
174 ->GetNavigatorForTracking());
191 if(fpSecondary)
delete fpSecondary;
201 verboseLevel = rhs.verboseLevel ;
202 fStoreTrajectory = rhs.fStoreTrajectory ;
205 fpTrackingManager = 0;
207 fInitialized =
false;
209 kCarTolerance = rhs.kCarTolerance;
210 fInitialized =
false;
220 if (
this == &rhs)
return *
this;
230 G4cout<<
"G4ITStepProcessor::CloneProcesses: is called"<<
G4endl;
236 theParticleIterator->
reset();
238 while( (*theParticleIterator)() )
245 G4cerr <<
"ERROR - G4ITStepProcessor::GetProcessNumber()" <<
G4endl
246 <<
" ProcessManager is NULL for particle = "
249 G4Exception(
"G4ITStepProcessor::GetProcessNumber()",
"ITStepProcessor0001",
265 for(
int i = 0 ; i < processVector->
size() ; i++)
267 G4VProcess* base_process = (*processVector)[i];
282 G4cout<<
"G4ITStepProcessor::GetProcessNumber: is called track"<<
G4endl;
286 G4cerr <<
"ERROR - G4SteppingManager::GetProcessNumber()" <<
G4endl
287 <<
" ProcessManager is NULL for particle = "
290 G4Exception(
"G4SteppingManager::GetProcessNumber()",
"ITStepProcessor0002",
295 std::map<const G4ParticleDefinition*, ProcessGeneralInfo*>::iterator it = fProcessGeneralInfoMap.find(particle);
296 if(it != fProcessGeneralInfoMap.end())
298 G4Exception(
"G4SteppingManager::SetupGeneralProcessInfo()",
"ITStepProcessor0003",
304 fpProcessInfo =
new ProcessGeneralInfo();
311 G4cout <<
"G4ITStepProcessor::GetProcessNumber: #ofAtRest="
312 << fpProcessInfo->MAXofAtRestLoops <<
G4endl;
320 G4cout <<
"G4ITStepProcessor::GetProcessNumber:#ofAlongStp="
321 << fpProcessInfo->MAXofAlongStepLoops <<
G4endl;
329 G4cout <<
"G4ITStepProcessor::GetProcessNumber: #ofPostStep="
330 << fpProcessInfo->MAXofPostStepLoops <<
G4endl;
333 if (SizeOfSelectedDoItVector<fpProcessInfo->MAXofAtRestLoops ||
334 SizeOfSelectedDoItVector<fpProcessInfo->MAXofAlongStepLoops ||
335 SizeOfSelectedDoItVector<fpProcessInfo->MAXofPostStepLoops )
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()",
345 "The array size is smaller than the actual No of processes.");
348 if(!fpProcessInfo->fpAtRestDoItVector &&
349 !fpProcessInfo->fpAlongStepDoItVector &&
350 !fpProcessInfo->fpPostStepDoItVector)
353 exceptionDescription <<
"No DoIt process found " ;
354 G4Exception(
"G4ITStepProcessor::DoStepping",
"ITStepProcessor0005",
359 if(fpProcessInfo->fpAlongStepGetPhysIntVector && fpProcessInfo->MAXofAlongStepLoops>0)
362 ((*fpProcessInfo->fpAlongStepGetPhysIntVector)[fpProcessInfo->MAXofAlongStepLoops-1]);
364 if(fpProcessInfo->fpTransportation == 0)
367 exceptionDescription <<
"No transportation process found " ;
368 G4Exception(
"G4ITStepProcessor::SetupGeneralProcessInfo",
"ITStepProcessor0006",
372 fProcessGeneralInfoMap[particle] = fpProcessInfo;
383 fpITrack =
GetIT(fpTrack) ;
395 G4ExceptionDescription exceptionDescription (
"No IT pointer was attached to the track you try to process.");
396 G4Exception(
"G4ITStepProcessor::SetTrack",
"ITStepProcessor0007",
411 std::map<const G4ParticleDefinition*, ProcessGeneralInfo*>::iterator it = fProcessGeneralInfoMap.find(particle);
413 if(it == fProcessGeneralInfoMap.end())
416 if(fpProcessInfo == 0)
419 G4Exception(
"G4ITStepProcessor::GetProcessNumber",
"ITStepProcessor0008",
426 fpProcessInfo = it->second;
447 fN2ndariesAtRestDoIt = 0;
448 fN2ndariesAlongStepDoIt = 0;
449 fN2ndariesPostStepDoIt = 0;
460 fAtRestDoItProcTriggered = 0;
463 unsigned int NofInactiveProc=0;
465 for(
size_t ri=0 ; ri < fpProcessInfo->MAXofAtRestLoops ; ri++ )
467 fpCurrentProcess = (
G4VITProcess*) (*fpProcessInfo->fpAtRestGetPhysIntVector)[ri];
468 if (fpCurrentProcess== 0)
470 (fpState->fSelectedAtRestDoItVector)[ri] =
InActivated;
477 lifeTime = fpCurrentProcess->
AtRestGPIL( *fpTrack, &fCondition );
482 (fpState->fSelectedAtRestDoItVector)[ri] =
Forced;
486 (fpState->fSelectedAtRestDoItVector)[ri] =
InActivated;
487 if(lifeTime < shortestLifeTime )
489 shortestLifeTime = lifeTime;
490 fAtRestDoItProcTriggered =
G4int(ri);
491 (fpState->fSelectedAtRestDoItVector)[fAtRestDoItProcTriggered] =
NotForced;
496 fTimeStep = shortestLifeTime ;
500 if(NofInactiveProc==fpProcessInfo->MAXofAtRestLoops)
502 G4cerr <<
"ERROR - G4ITStepProcessor::InvokeAtRestDoItProcs()" <<
G4endl
503 <<
" No AtRestDoIt process is active!" <<
G4endl;
528 &direction,
false,
false );
551 fpCurrentVolume = fpState->fTouchableHandle->GetVolume();
579 if( fpCurrentVolume==0 )
584 G4cerr <<
"ERROR - G4ITStepProcessor::SetInitialStep()" <<
G4endl
585 <<
" Primary particle starting at - "
587 <<
" - is outside of the world volume." <<
G4endl;
588 G4Exception(
"G4ITStepProcessor::SetInitialStep()",
"ITStepProcessor0011",
593 G4cout <<
"WARNING - G4ITStepProcessor::SetInitialStep()" <<
G4endl
594 <<
" Initial track position is outside world! - "
623 fpState =
new G4ITStepProcessorState();
722 fpState->fPhysicalStep =
DBL_MAX;
725 double proposedTimeStep =
DBL_MAX;
726 G4VProcess* processWithPostStepGivenByTimeStep(0);
729 fPostStepDoItProcTriggered = fpProcessInfo->MAXofPostStepLoops;
730 fPostStepAtTimeDoItProcTriggered = fpProcessInfo->MAXofPostStepLoops;
736 for(
size_t np=0; np < fpProcessInfo->MAXofPostStepLoops; np++)
738 fpCurrentProcess = (
G4VITProcess*) (*fpProcessInfo->fpPostStepGetPhysIntVector)[np];
739 if (fpCurrentProcess== 0)
741 (fpState->fSelectedPostStepDoItVector)[np] =
InActivated;
749 fPhysIntLength = fpCurrentProcess->
750 PostStepGPIL( *fpTrack,
751 fpState->fPreviousStepSize,
766 G4Exception(
"G4ITStepProcessor::DefinePhysicalStepLength()",
"ITStepProcessor0008",
771 (fpState->fSelectedPostStepDoItVector)[np] =
Forced;
779 (fpState->fSelectedPostStepDoItVector)[np] =
InActivated;
785 for(
size_t nrest=np+1; nrest < fpProcessInfo->MAXofPostStepLoops; nrest++)
787 (fpState->fSelectedPostStepDoItVector)[nrest] =
InActivated;
793 if(fPhysIntLength < fpState->fPhysicalStep )
800 fPhysIntLength *= -1;
801 if(fPhysIntLength < proposedTimeStep)
803 proposedTimeStep = fPhysIntLength;
804 fPostStepAtTimeDoItProcTriggered = np;
805 processWithPostStepGivenByTimeStep = fpCurrentProcess;
810 fpState->fPhysicalStep = fPhysIntLength;
812 fPostStepDoItProcTriggered =
G4int(np);
821 fpState->proposedSafety =
DBL_MAX;
822 G4double safetyProposedToAndByProcess = fpState->proposedSafety;
824 for(
size_t kp=0; kp < fpProcessInfo->MAXofAlongStepLoops; kp++)
826 fpCurrentProcess = (
G4VITProcess*) (*fpProcessInfo->fpAlongStepGetPhysIntVector)[kp];
827 if (fpCurrentProcess== 0)
continue;
831 fPhysIntLength = fpCurrentProcess-> AlongStepGPIL( *fpTrack,
832 fpState->fPreviousStepSize,
833 fpState->fPhysicalStep,
834 safetyProposedToAndByProcess,
837 if(fPhysIntLength < fpState->fPhysicalStep)
839 fpState->fPhysicalStep = fPhysIntLength;
852 if(kp == fpProcessInfo->MAXofAlongStepLoops-1)
856 if(! fpTransportation)
859 exceptionDescription <<
"No transportation process found " ;
860 G4Exception(
"G4ITStepProcessor::DoDefinePhysicalStepLength",
"ITStepProcessor0009",
875 if(kp == fpProcessInfo->MAXofAlongStepLoops-1)
879 if(! fpTransportation)
882 exceptionDescription <<
"No transportation process found " ;
883 G4Exception(
"G4ITStepProcessor::DoDefinePhysicalStepLength",
"ITStepProcessor0010",
891 if(proposedTimeStep < fTimeStep)
893 if(fPostStepAtTimeDoItProcTriggered<fpProcessInfo->MAXofPostStepLoops)
895 if ((fpState->fSelectedPostStepDoItVector)[fPostStepAtTimeDoItProcTriggered] ==
898 (fpState->fSelectedPostStepDoItVector)[fPostStepAtTimeDoItProcTriggered] =
NotForced;
904 fTimeStep = proposedTimeStep;
906 fpTransportation->
ComputeStep(*fpTrack,*fpStep,fTimeStep,fpState->fPhysicalStep);
912 if (fPostStepDoItProcTriggered<fpProcessInfo->MAXofPostStepLoops)
914 if ((fpState->fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] ==
917 (fpState->fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] =
928 if (safetyProposedToAndByProcess < fpState->proposedSafety)
930 fpState->proposedSafety = safetyProposedToAndByProcess;
933 safetyProposedToAndByProcess = fpState->proposedSafety;
G4IT * GetIT(const G4Track *track)
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
void SetNavigatorState(G4ITNavigatorState_Lock *)
G4ITNavigatorState_Lock * GetNavigatorState()
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
G4TouchableHistory * CreateTouchableHistory() const
virtual G4VPhysicalVolume * ResetHierarchyAndLocate(const G4ThreeVector &point, const G4ThreeVector &direction, const G4TouchableHistory &h)
virtual ~G4ITStepProcessor()
void ForceReInitialization()
void ActiveOnlyITProcess()
void SetNavigator(G4ITNavigator *value)
G4ITStepProcessor & operator=(const G4ITStepProcessor &other)
void DoDefinePhysicalStepLength()
void DefinePhysicalStepLength(G4Track *)
void SetupGeneralProcessInfo(G4ParticleDefinition *, G4ProcessManager *)
virtual void Initialize()
virtual void StartTracking(G4Track *)
static void DeleteInstance()
static G4ITTransportationManager * GetTransportationManager()
virtual void ComputeStep(const G4Track &, const G4Step &, const double timeStep, double &spaceStep)
G4TrackingInformation * GetTrackingInfo()
G4ProcessManager * GetProcessManager() const
G4int GetPDGEncoding() const
const G4String & GetParticleName() const
G4PTblDicIterator * GetIterator()
static G4ParticleTable * GetParticleTable()
G4VProcess * SetProcessActivation(G4VProcess *aProcess, G4bool fActive)
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessVector * GetProcessList() const
G4ProcessVector * GetPostStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4ProcessVector * GetAtRestProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
void SetProcessDefinedStep(const G4VProcess *aValue)
G4VPhysicalVolume * GetPhysicalVolume() const
void DeleteSecondaryVector()
void InitializeStep(G4Track *aValue)
void ResetTotalEnergyDeposit()
G4TrackVector * GetfSecondary()
void CopyPostToPreStepPoint()
G4StepPoint * GetPreStepPoint() const
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *theNewVectorPointer)
G4TrackVector * NewSecondaryVector()
G4StepPoint * GetPostStepPoint() const
G4TrackStatus GetTrackStatus() const
void SetTrackStatus(const G4TrackStatus aTrackStatus)
void SetStep(const G4Step *aValue)
G4VPhysicalVolume * GetVolume() const
void SetVertexPosition(const G4ThreeVector &aValue)
const G4TouchableHandle & GetNextTouchableHandle() const
void SetVertexMomentumDirection(const G4ThreeVector &aValue)
G4VPhysicalVolume * GetNextVolume() const
void SetNextTouchableHandle(const G4TouchableHandle &apValue)
const G4ThreeVector & GetPosition() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4int GetCurrentStepNumber() const
G4ParticleDefinition * GetDefinition() const
const G4TouchableHandle & GetTouchableHandle() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
G4double GetStepLength() const
void SetVertexKineticEnergy(const G4double aValue)
G4int GetParentID() const
void SetLogicalVolumeAtVertex(const G4LogicalVolume *)
G4bool ProposesTimeStep() const
size_t GetProcessID() const
void SetProcessState(G4ProcessState_Lock *aProcInfo)
G4double GetInteractionTimeLeft()
static const size_t & GetMaxProcessIndex()
G4LogicalVolume * GetLogicalVolume() const
virtual G4int GetRegularStructureId() const =0
G4double AtRestGPIL(const G4Track &track, G4ForceCondition *condition)
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription