79 #define PrepareState() G4ITTransportationState* __state = this->GetState<G4ITTransportationState>();
83 #define State(theXInfo) (__state->theXInfo)
90 using namespace G4MemStat;
98 fThreshold_Warning_Energy(100 *
MeV),
99 fThreshold_Important_Energy(250 *
MeV),
100 fThresholdTrials(10),
101 fUnimportant_Energy(1 *
MeV),
102 fSumEnergyKilled(0.0),
103 fMaxEnergyKilled(0.0),
104 fShortStepOptimisation(false),
105 fVerboseLevel(verbose)
220 G4cout <<
" G4ITTransportation: Statistics for looping particles "
222 G4cout <<
" Sum of energy of loopers killed: "
224 G4cout <<
" Max energy of loopers killed: "
260 G4double geometryStepLength(-1.0), newSafety(-1.0);
262 State(fParticleIsLooping) =
false;
263 State(fEndGlobalTimeComputed) =
false;
264 State(fGeometryLimitedStep) =
false;
312 G4bool fieldExertsForce =
false;
313 if ((particleCharge != 0.0))
334 if (!fieldExertsForce)
341 geometryStepLength = currentMinimumStep;
342 State(fGeometryLimitedStep) =
false;
368 State(fTransportEndPosition));
373 currentSafety = newSafety;
375 State(fGeometryLimitedStep) = (linearStepLength <= currentMinimumStep);
376 if (
State(fGeometryLimitedStep))
379 geometryStepLength = linearStepLength;
384 geometryStepLength = currentMinimumStep;
387 State(fEndPointDistance) = geometryStepLength;
391 State(fTransportEndPosition) = startPosition
392 + geometryStepLength * startMomentumDir;
396 State(fTransportEndMomentumDir) = startMomentumDir;
399 State(fParticleIsLooping) =
false;
400 State(fMomentumChanged) =
false;
401 State(fEndGlobalTimeComputed) =
true;
422 <<
"ITTransportation does not support external fields.";
424 <<
" If you are dealing with a tradiational MC simulation, ";
425 exceptionDescription <<
"please use G4Transportation.";
427 G4Exception(
"G4ITTransportation::AlongStepGetPhysicalInteractionLength",
583 if (currentMinimumStep == 0.0)
585 if (currentSafety == 0.0)
587 State(fGeometryLimitedStep) =
true;
597 if (currentSafety <
State(fEndPointDistance))
602 if (particleCharge != 0.0)
606 State(fTransportEndPosition));
607 currentSafety = endSafety;
620 State(fTransportEndPosition));
626 currentSafety +=
State(fEndPointDistance);
628 #ifdef G4DEBUG_TRANSPORT
630 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl;
631 G4cout <<
" Called Navigator->ComputeSafety at "
632 <<
State(fTransportEndPosition)
633 <<
" and it returned safety= " << endSafety <<
G4endl;
634 G4cout <<
" Adding endpoint distance " <<
State(fEndPointDistance)
635 <<
" to obtain pseudo-safety= " << currentSafety <<
G4endl;
645 return geometryStepLength;
650 const double timeStep,
651 double& oPhysicalStep)
661 State(fGeometryLimitedStep) =
false;
667 State(fEndGlobalTimeComputed) =
true;
671 if (!
State(fMomentumChanged))
675 oPhysicalStep = initialVelocity * timeStep;
679 State(fTransportEndPosition) = startPosition
680 + oPhysicalStep * startMomentumDir;
693 #if defined (DEBUG_MEM)
694 MemStat mem_first, mem_second, mem_diff;
697 #if defined (DEBUG_MEM)
709 if (!pdefOpticalPhoton) pdefOpticalPhoton =
736 if (
State(fEndGlobalTimeComputed) ==
false)
749 deltaTime = stepLength / finalVelocity;
751 else if (initialVelocity > 0.0)
753 deltaTime = stepLength / initialVelocity;
756 State(fCandidateEndGlobalTime) = startTime + deltaTime;
760 deltaTime =
State(fCandidateEndGlobalTime) - startTime;
783 if (
State(fParticleIsLooping))
806 <<
" G4ITTransportation is killing track that is looping or stuck "
808 <<
" MeV energy." <<
G4endl;
809 G4cout <<
" Number of trials = " <<
State(fNoLooperTrials)
810 <<
" No of calls to AlongStepDoIt = " << noCalls
814 State(fNoLooperTrials) = 0;
818 State(fNoLooperTrials)++;
822 G4cout <<
" G4ITTransportation::AlongStepDoIt(): Particle looping - "
823 <<
" Number of trials = " <<
State(fNoLooperTrials)
824 <<
" No of calls to = " << noCalls <<
G4endl;
831 State(fNoLooperTrials)=0;
842 #if defined (DEBUG_MEM)
844 mem_diff = mem_second-mem_first;
845 G4cout <<
"\t || MEM || End of G4ITTransportation::AlongStepDoIt, diff is: "
878 G4bool isLastStep =
false;
889 if (
State(fGeometryLimitedStep))
894 G4cout <<
"Step is limited by geometry "
902 if (
State(fCurrentTouchableHandle)->GetVolume() == 0)
905 exceptionDescription <<
"No current touchable found ";
906 G4Exception(
" G4ITTransportation::PostStepDoIt",
"G4ITTransportation001",
913 State(fCurrentTouchableHandle),
true);
917 if (
State(fCurrentTouchableHandle)->GetVolume() == 0)
925 G4cout <<
"G4ITTransportation will killed the track because "
926 "State(fCurrentTouchableHandle)->GetVolume() == 0"<<
G4endl;
932 retCurrentTouchable =
State(fCurrentTouchableHandle);
948 #ifdef G4DEBUG_TRANSPORT
953 if( ! (exiting || entering) )
955 G4cout <<
" Transport> : Proposed isLastStep= " << isLastStep
981 #ifdef G4DEBUG_TRANSPORT
983 G4cout <<
" Transport> Proposed isLastStep= " << isLastStep
984 <<
" Geometry did not limit step. Position : "
1011 pNewMaterialCutsCouple =
1015 if (pNewVol != 0 && pNewMaterialCutsCouple != 0
1016 && pNewMaterialCutsCouple->
GetMaterial() != pNewMaterial)
1053 GetIT(track)->GetTrackingInfo()->GetTrackStateManager());
1084 fieldMgrStore->ClearAllChordFindersState();
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4double fTransportEndKineticEnergy
G4double GetLocalTime() const
virtual void ComputeStep(const G4Track &, const G4Step &, const double timeStep, double &spaceStep)
G4double GetKineticEnergy() const
virtual void ConfigureForTrack(const G4Track *)
static G4ITTransportationManager * GetTransportationManager()
G4ITSafetyHelper * fpSafetyHelper
CLHEP::Hep3Vector G4ThreeVector
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
void ProposeGlobalTime(G4double t)
std::ostringstream G4ExceptionDescription
G4ThreeVector fTransportEndMomentumDir
G4LogicalVolume * GetLogicalVolume() const
virtual void LoadTrackState(G4TrackStateManager &manager)
static G4ParticleTable * GetParticleTable()
static constexpr double MeV
G4VSensitiveDetector * GetSensitiveDetector() const
static G4FieldManagerStore * GetInstance()
G4bool fInstantiateProcessState
G4double fSumEnergyKilled
G4StepPoint * GetPreStepPoint() const
virtual void NewTrackState()
G4bool DoesGlobalFieldExist()
G4double * theInteractionTimeLeft
G4double GetStepLength() const
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double, G4ForceCondition *pForceCond)
G4double fThreshold_Important_Energy
const G4ThreeVector & GetMomentumDirection() const
G4ReferenceCountedHandle< G4VTouchable > G4TouchableHandle
G4bool DoesFieldExist() const
G4double fEndPointDistance
G4ThreeVector fPreviousSftOrigin
void SetInstantiateProcessState(G4bool flag)
void SetSensitiveDetectorInTouchable(G4VSensitiveDetector *fSensitiveDetector)
const G4TouchableHandle & GetTouchableHandle() const
const G4ThreeVector & GetPolarization() const
void ProposeVelocity(G4double finalVelocity)
G4shared_ptr< G4ProcessState > fpState
G4bool enablePostStepDoIt
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *theNewVectorPointer)
const G4ParticleDefinition * GetParticleDefinition() const
G4TouchableHandle fCurrentTouchableHandle
G4bool fGeometryLimitedStep
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
virtual ~G4ITTransportation()
G4Material * GetMaterial() const
G4double GetVelocity() const
virtual void Initialize(const G4Track &)
G4double CalculateVelocityForOpticalPhoton() const
G4double CalculateVelocity() const
G4ThreeVector fTransportEndPosition
G4double fMaxEnergyKilled
void ProposeLocalTime(G4double t)
virtual void StartTracking(G4Track *)
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
G4VParticleChange * pParticleChange
void SetInstantiateProcessState(G4bool flag)
G4FieldManager * GetFieldManager() const
void ProposeLastStepInVolume(G4bool flag)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
#define fPreviousSftOrigin
virtual ~G4ITTransportationState()
G4ITTransportation(const G4String &aName="ITTransportation", G4int verbosityLevel=0)
G4double fThreshold_Warning_Energy
void ProposePosition(G4double x, G4double y, G4double z)
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)
G4double GetGlobalTime() const
G4double fCandidateEndGlobalTime
G4double GetCharge() const
const G4ThreeVector & GetPosition() const
const G4Field * GetDetectorField() const
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
void ProposeEnergy(G4double finalEnergy)
std::vector< G4ThreeVector > * GimmeTrajectoryVectorAndForgetIt() const
G4ITNavigator * GetNavigatorForTracking() const
void ProposeTrueStepLength(G4double truePathLength)
G4double GetVelocity() const
virtual void StartTracking(G4Track *)
G4ParticleChangeForTransport fParticleChange
G4ITTransportationState()
Process State.
static G4TransportationManager * GetTransportationManager()
static G4ProductionCutsTable * GetProductionCutsTable()
G4PropagatorInField * fFieldPropagator
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4ITSafetyHelper * GetSafetyHelper() const
G4double fUnimportant_Energy
virtual void SaveTrackState(G4TrackStateManager &manager)
G4ITNavigator * fLinearNavigator
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
void SetMaterialInTouchable(G4Material *fMaterial)
void SetProcessSubType(G4int)
G4GLOB_DLL std::ostream G4cout
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
G4ProductionCuts * GetProductionCuts() const
G4PropagatorInField * GetPropagatorInField() const
G4bool fEndGlobalTimeComputed
const G4Material * GetMaterial() const
void SetTouchableHandle(const G4TouchableHandle &fTouchable)
G4bool fParticleIsLooping
void SetMaterialCutsCoupleInTouchable(const G4MaterialCutsCouple *fMaterialCutsCouple)
G4TrackStatus GetTrackStatus() const
G4ThreeVector fTransportEndSpin
G4bool enableAlongStepDoIt
const G4ThreeVector & GetMomentumDirection() const
virtual void StartTracking(G4Track *aTrack)
virtual void ResetTrackState()
G4bool fShortStepOptimisation
void ProposeTrackStatus(G4TrackStatus status)
void ClearPropagatorState()
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &)
G4IT * GetIT(const G4Track *track)
const G4DynamicParticle * GetDynamicParticle() const
void SetMomentumChanged(G4bool b)
G4ITTransportation & operator=(const G4ITTransportation &)
G4TrackingInformation * GetTrackingInfo()
G4VPhysicalVolume * GetVolume() const
static constexpr double nanometer