79# define PrepareState() \
80 G4ITTransportationState* __state = this->GetState<G4ITTransportationState>()
84#define State(theXInfo) (__state->theXInfo)
99 fThreshold_Warning_Energy(100 * MeV),
100 fThreshold_Important_Energy(250 * MeV),
101 fThresholdTrials(10),
102 fUnimportant_Energy(1 * MeV),
103 fSumEnergyKilled(0.0),
104 fMaxEnergyKilled(0.0),
105 fShortStepOptimisation(false),
106 fVerboseLevel(verbose)
128 fInstantiateProcessState =
true;
174 fInstantiateProcessState = right.fInstantiateProcessState;
221 G4cout <<
" G4ITTransportation: Statistics for looping particles "
223 G4cout <<
" Sum of energy of loopers killed: "
225 G4cout <<
" Max energy of loopers killed: "
261 G4double geometryStepLength(-1.0), newSafety(-1.0);
263 State(fParticleIsLooping) =
false;
264 State(fEndGlobalTimeComputed) =
false;
265 State(fGeometryLimitedStep) =
false;
313 G4bool fieldExertsForce =
false;
314 if ((particleCharge != 0.0))
335 if (!fieldExertsForce)
342 geometryStepLength = currentMinimumStep;
343 State(fGeometryLimitedStep) =
false;
369 State(fTransportEndPosition));
374 currentSafety = newSafety;
376 State(fGeometryLimitedStep) = (linearStepLength <= currentMinimumStep);
377 if (
State(fGeometryLimitedStep))
380 geometryStepLength = linearStepLength;
385 geometryStepLength = currentMinimumStep;
388 State(fEndPointDistance) = geometryStepLength;
392 State(fTransportEndPosition) = startPosition
393 + geometryStepLength * startMomentumDir;
397 State(fTransportEndMomentumDir) = startMomentumDir;
400 State(fParticleIsLooping) =
false;
401 State(fMomentumChanged) =
false;
402 State(fEndGlobalTimeComputed) =
true;
403 State(theInteractionTimeLeft) =
State(fEndPointDistance)
405 State(fCandidateEndGlobalTime) =
State(theInteractionTimeLeft)
423 <<
"ITTransportation does not support external fields.";
425 <<
" If you are dealing with a tradiational MC simulation, ";
426 exceptionDescription <<
"please use G4Transportation.";
428 G4Exception(
"G4ITTransportation::AlongStepGetPhysicalInteractionLength",
584 if (currentMinimumStep == 0.0)
586 if (currentSafety == 0.0)
588 State(fGeometryLimitedStep) =
true;
598 if (currentSafety <
State(fEndPointDistance))
603 if (particleCharge != 0.0)
607 State(fTransportEndPosition));
608 currentSafety = endSafety;
621 State(fTransportEndPosition));
627 currentSafety +=
State(fEndPointDistance);
629#ifdef G4DEBUG_TRANSPORT
631 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl;
632 G4cout <<
" Called Navigator->ComputeSafety at "
633 <<
State(fTransportEndPosition)
634 <<
" and it returned safety= " << endSafety <<
G4endl;
635 G4cout <<
" Adding endpoint distance " <<
State(fEndPointDistance)
636 <<
" to obtain pseudo-safety= " << currentSafety <<
G4endl;
646 return geometryStepLength;
651 const double timeStep,
652 double& oPhysicalStep)
662 State(fGeometryLimitedStep) =
false;
668 State(fEndGlobalTimeComputed) =
true;
672 if (!
State(fMomentumChanged))
676 oPhysicalStep = initialVelocity * timeStep;
680 State(fTransportEndPosition) = startPosition
681 + oPhysicalStep * startMomentumDir;
694#if defined (DEBUG_MEM)
695 MemStat mem_first, mem_second, mem_diff;
698#if defined (DEBUG_MEM)
699 mem_first = MemoryUsage();
710 if (!pdefOpticalPhoton) pdefOpticalPhoton =
737 if (
State(fEndGlobalTimeComputed) ==
false)
750 deltaTime = stepLength / finalVelocity;
752 else if (initialVelocity > 0.0)
754 deltaTime = stepLength / initialVelocity;
757 State(fCandidateEndGlobalTime) = startTime + deltaTime;
761 deltaTime =
State(fCandidateEndGlobalTime) - startTime;
784 if (
State(fParticleIsLooping))
807 <<
" G4ITTransportation is killing track that is looping or stuck "
809 <<
" MeV energy." <<
G4endl;
810 G4cout <<
" Number of trials = " <<
State(fNoLooperTrials)
811 <<
" No of calls to AlongStepDoIt = " << noCalls
815 State(fNoLooperTrials) = 0;
819 State(fNoLooperTrials)++;
823 G4cout <<
" G4ITTransportation::AlongStepDoIt(): Particle looping - "
824 <<
" Number of trials = " <<
State(fNoLooperTrials)
825 <<
" No of calls to = " << noCalls <<
G4endl;
832 State(fNoLooperTrials)=0;
843#if defined (DEBUG_MEM)
844 mem_second = MemoryUsage();
845 mem_diff = mem_second-mem_first;
846 G4cout <<
"\t || MEM || End of G4ITTransportation::AlongStepDoIt, diff is: "
879 G4bool isLastStep =
false;
890 if (
State(fGeometryLimitedStep))
895 G4cout <<
"Step is limited by geometry "
903 if (
State(fCurrentTouchableHandle)->GetVolume() == 0)
906 exceptionDescription <<
"No current touchable found ";
907 G4Exception(
" G4ITTransportation::PostStepDoIt",
"G4ITTransportation001",
914 State(fCurrentTouchableHandle),
true);
918 if (
State(fCurrentTouchableHandle)->GetVolume() == 0)
926 G4cout <<
"G4ITTransportation will killed the track because "
927 "State(fCurrentTouchableHandle)->GetVolume() == 0"<<
G4endl;
933 retCurrentTouchable =
State(fCurrentTouchableHandle);
949#ifdef G4DEBUG_TRANSPORT
954 if( ! (exiting || entering) )
956 G4cout <<
" Transport> : Proposed isLastStep= " << isLastStep
959 <<
" Track position : " << track.
GetPosition() /nanometer <<
" [nm]"
982#ifdef G4DEBUG_TRANSPORT
984 G4cout <<
" Transport> Proposed isLastStep= " << isLastStep
985 <<
" Geometry did not limit step. Position : "
1010 pNewMaterialCutsCouple =
1014 if (pNewVol != 0 && pNewMaterialCutsCouple != 0
1015 && pNewMaterialCutsCouple->
GetMaterial() != pNewMaterial)
1043 if (fInstantiateProcessState)
1052 GetIT(track)->GetTrackingInfo()->GetTrackStateManager());
1083 fieldMgrStore->ClearAllChordFindersState();
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define fPreviousSftOrigin
G4IT * GetIT(const G4Track *track)
@ fLowEnergyTransportation
CLHEP::Hep3Vector G4ThreeVector
G4ReferenceCountedHandle< G4VTouchable > G4TouchableHandle
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetMomentumDirection() const
G4double GetCharge() const
static G4FieldManagerStore * GetInstance()
virtual void ConfigureForTrack(const G4Track *)
const G4Field * GetDetectorField() const
G4bool DoesFieldExist() const
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
static G4ITTransportationManager * GetTransportationManager()
G4ITNavigator * GetNavigatorForTracking() const
G4ITSafetyHelper * GetSafetyHelper() const
G4double fMaxEnergyKilled
G4ParticleChangeForTransport fParticleChange
G4double fUnimportant_Energy
G4double fThreshold_Important_Energy
G4double fSumEnergyKilled
virtual void ComputeStep(const G4Track &, const G4Step &, const double timeStep, double &spaceStep)
virtual void BuildPhysicsTable(const G4ParticleDefinition &)
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double, G4ForceCondition *pForceCond)
void SetInstantiateProcessState(G4bool flag)
G4PropagatorInField * fFieldPropagator
G4bool DoesGlobalFieldExist()
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)
virtual ~G4ITTransportation()
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
G4ITSafetyHelper * fpSafetyHelper
G4ITTransportation(const G4String &aName="ITTransportation", G4int verbosityLevel=0)
G4bool fShortStepOptimisation
G4double fThreshold_Warning_Energy
G4ITNavigator * fLinearNavigator
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &)
virtual void StartTracking(G4Track *aTrack)
G4TrackingInformation * GetTrackingInfo()
G4VSensitiveDetector * GetSensitiveDetector() const
G4Material * GetMaterial() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
const G4Material * GetMaterial() const
G4ProductionCuts * GetProductionCuts() const
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *vec)
void Initialize(const G4Track &) final
void SetMaterialInTouchable(G4Material *fMaterial)
void SetTouchableHandle(const G4TouchableHandle &fTouchable)
void SetMaterialCutsCoupleInTouchable(const G4MaterialCutsCouple *fMaterialCutsCouple)
void SetSensitiveDetectorInTouchable(G4VSensitiveDetector *fSensitiveDetector)
void SetMomentumChanged(G4bool b)
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
void ProposePosition(G4double x, G4double y, G4double z)
void ProposeLocalTime(G4double t)
void ProposeVelocity(G4double finalVelocity)
void ProposeEnergy(G4double finalEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
void ProposeGlobalTime(G4double t)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
static G4ProductionCutsTable * GetProductionCutsTable()
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
void ClearPropagatorState()
std::vector< G4ThreeVector > * GimmeTrajectoryVectorAndForgetIt() const
G4double GetVelocity() const
G4StepPoint * GetPreStepPoint() const
virtual void NewTrackState()
virtual void SaveTrackState(G4TrackStateManager &manager)
virtual void LoadTrackState(G4TrackStateManager &manager)
virtual void ResetTrackState()
G4TrackStatus GetTrackStatus() const
G4double GetVelocity() const
G4double CalculateVelocityForOpticalPhoton() const
const G4ParticleDefinition * GetParticleDefinition() const
G4VPhysicalVolume * GetVolume() const
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
G4double GetLocalTime() const
const G4DynamicParticle * GetDynamicParticle() const
const G4TouchableHandle & GetTouchableHandle() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
G4double CalculateVelocity() const
const G4ThreeVector & GetPolarization() const
G4double GetStepLength() const
static G4TransportationManager * GetTransportationManager()
G4PropagatorInField * GetPropagatorInField() const
G4FieldManager * GetFieldManager() const
virtual void StartTracking(G4Track *)
void SetInstantiateProcessState(G4bool flag)
G4shared_ptr< G4ProcessState > fpState
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLastStepInVolume(G4bool flag)
void ProposeTrueStepLength(G4double truePathLength)
G4LogicalVolume * GetLogicalVolume() const
G4bool enableAlongStepDoIt
void SetProcessSubType(G4int)
virtual void StartTracking(G4Track *)
G4bool enablePostStepDoIt
G4VParticleChange * pParticleChange
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4TouchableHandle fCurrentTouchableHandle
G4bool fParticleIsLooping
virtual ~G4ITTransportationState()
G4ThreeVector fPreviousSftOrigin
G4ThreeVector fTransportEndMomentumDir
G4ITTransportationState()
Process State.
G4double fEndPointDistance
G4double fCandidateEndGlobalTime
G4ThreeVector fTransportEndPosition
G4double fTransportEndKineticEnergy
G4bool fEndGlobalTimeComputed
G4bool fGeometryLimitedStep
G4ThreeVector fTransportEndSpin