85 fTransportEndPosition( 0.0, 0.0, 0.0 ),
86 fTransportEndMomentumDir( 0.0, 0.0, 0.0 ),
87 fTransportEndKineticEnergy( 0.0 ),
88 fTransportEndSpin( 0.0, 0.0, 0.0 ),
89 fMomentumChanged(true),
90 fEndGlobalTimeComputed(false),
91 fCandidateEndGlobalTime(0.0),
92 fParticleIsLooping( false ),
94 fFirstStepInVolume( true ),
95 fLastStepInVolume( false ),
96 fGeometryLimitedStep(true),
100 fEndPointDistance( -1.0 ),
102 fThreshold_Important_Energy( 1.0 *
MeV ),
103 fThresholdTrials( 10 ),
104 fNoLooperTrials( 0 ),
105 fSumEnergyKilled( 0.0 ), fMaxEnergyKilled( 0.0 ),
106 fShortStepOptimisation( false )
139 G4cout <<
" G4Transportation constructor> set fShortStepOptimisation to ";
153 G4cout <<
" G4Transportation: Statistics for looping particles " <<
G4endl;
154 G4cout <<
" Sum of energy of loopers killed: "
156 G4cout <<
" Max energy of loopers killed: "
175 G4double geometryStepLength= -1.0, newSafety= -1.0;
212 currentSafety = 0.0 ;
235 G4bool fieldExertsForce = false ;
238 G4bool fieldExists=
false;
251 fieldExists = (ptrField!=0) ;
256 if( (particleCharge != 0.0)
258 || (gravityOn && (restMass != 0.0) )
261 fieldExertsForce = fieldExists;
267 if( !fieldExertsForce )
274 geometryStepLength = currentMinimumStep ;
287 fPreviousSftOrigin = startPosition ;
291 currentSafety = newSafety ;
297 geometryStepLength = linearStepLength ;
302 geometryStepLength = currentMinimumStep ;
351 if( currentMinimumStep > 0 )
365 geometryStepLength =
std::min( lengthAlongCurve, currentMinimumStep );
369 fPreviousSftOrigin = startPosition ;
375 geometryStepLength = lengthAlongCurve= 0.0 ;
414 G4double absEdiff = std::fabs(startEnergy- endEnergy);
422 if( std::fabs(startEnergy- endEnergy) >
perThousand * endEnergy )
427 if( (no_large_ediff% warnModulo) == 0 )
430 G4cout <<
"WARNING - G4Transportation::AlongStepGetPIL() "
431 <<
" Energy change in Step is above 1^-3 relative value. " <<
G4endl
432 <<
" Relative change in 'tracking' step = "
433 << std::setw(15) << (endEnergy-startEnergy)/startEnergy <<
G4endl
434 <<
" Starting E= " << std::setw(12) << startEnergy /
MeV <<
" MeV " <<
G4endl
435 <<
" Ending E= " << std::setw(12) << endEnergy /
MeV <<
" MeV " <<
G4endl;
436 G4cout <<
" Energy has been corrected -- however, review"
437 <<
" field propagation parameters for accuracy." <<
G4endl;
438 if( (
verboseLevel > 2 ) || (no_warnings<4) || (no_large_ediff == warnModulo * moduloFactor) )
440 G4cout <<
" These include EpsilonStepMax(/Min) in G4FieldManager "
441 <<
" which determine fractional error per step for integrated quantities. " << G4endl
442 <<
" Note also the influence of the permitted number of integration steps."
445 G4cerr <<
"ERROR - G4Transportation::AlongStepGetPIL()" << G4endl
446 <<
" Bad 'endpoint'. Energy change detected"
447 <<
" and corrected. "
448 <<
" Has occurred already "
449 << no_large_ediff <<
" times." <<
G4endl;
450 if( no_large_ediff == warnModulo * moduloFactor )
452 warnModulo *= moduloFactor;
472 if( currentMinimumStep == 0.0 )
482 if( particleCharge != 0.0 )
486 currentSafety = endSafety ;
496 #ifdef G4DEBUG_TRANSPORT
498 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl ;
500 <<
" and it returned safety= " << endSafety <<
G4endl ;
502 <<
" to obtain pseudo-safety= " << currentSafety <<
G4endl ;
506 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl ;
507 G4cout <<
" Avoiding call to ComputeSafety : " <<
G4endl;
516 return geometryStepLength ;
528 const char *methodName=
"AlongStepDoIt";
558 if ( initialVelocity > 0.0 ) { deltaTime = stepLength/initialVelocity; }
611 G4cout <<
" G4Transportation::AlongStepDoIt(): Particle looping - "
615 <<
" No of calls to = " << noCallsASDI <<
G4endl;
678 LocateGlobalPointAndUpdateTouchableHandle( track.
GetPosition(),
742 if( pNewVol!=0 && pNewMaterialCutsCouple!=0 && pNewMaterialCutsCouple->
GetMaterial()!=pNewMaterial )
746 pNewMaterialCutsCouple =
G4double GetLocalTime() const
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)
G4double GetKineticEnergy() const
virtual void ConfigureForTrack(const G4Track *)
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
CLHEP::Hep3Vector G4ThreeVector
G4SafetyHelper * GetSafetyHelper() const
G4double fMaxEnergyKilled
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
void ProposeGlobalTime(G4double t)
G4bool fFieldExertedForce
G4LogicalVolume * GetLogicalVolume() const
G4bool DoesFieldChangeEnergy() const
static constexpr double MeV
G4VSensitiveDetector * GetSensitiveDetector() const
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
static G4FieldManagerStore * GetInstance()
void SetThresholds(G4double newEnWarn, G4double importantEnergy, G4int newMaxTrials)
static G4bool EnableUseMagneticMoment(G4bool useMoment=true)
G4StepPoint * GetPreStepPoint() const
G4bool IsLastStepInVolume()
G4bool EnteredDaughterVolume() const
virtual void LocateGlobalPointWithinVolume(const G4ThreeVector &position)
G4double GetStepLength() const
const G4ThreeVector & GetMomentumDirection() const
G4ReferenceCountedHandle< G4VTouchable > G4TouchableHandle
G4EquationOfMotion * GetCurrentEquationOfMotion()
#define fFieldExertedForce
void SetSensitiveDetectorInTouchable(G4VSensitiveDetector *fSensitiveDetector)
G4FieldManager * GetCurrentFieldManager()
G4ThreeVector fPreviousSftOrigin
const G4TouchableHandle & GetTouchableHandle() const
const G4ThreeVector & GetPolarization() const
static constexpr double perMillion
G4ParticleChangeForTransport fParticleChange
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4Navigator * GetNavigatorForTracking() const
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *theNewVectorPointer)
G4bool DoesGlobalFieldExist()
G4double ComputeStep(G4FieldTrack &pFieldTrack, G4double pCurrentProposedStepLength, G4double &pNewSafety, G4VPhysicalVolume *pPhysVol=0)
G4double fTransportEndKineticEnergy
G4double fEndPointDistance
G4Material * GetMaterial() const
G4double GetVelocity() const
G4double GetProperTime() const
virtual void Initialize(const G4Track &)
void SetVerboseLevel(G4int value)
G4ThreeVector GetSpin() const
G4ThreeVector GetPosition() const
void ProposeLocalTime(G4double t)
virtual void StartTracking(G4Track *)
G4double GetPDGSpin() const
G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)
G4ThreeVector fTransportEndSpin
G4double GetThresholdWarningEnergy() const
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
G4ParticleDefinition * GetDefinition() const
G4VParticleChange * pParticleChange
G4bool fGeometryLimitedStep
void ProposeLastStepInVolume(G4bool flag)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4ForceCondition *pForceCond)
#define fPreviousSftOrigin
G4double GetKineticEnergy() const
void ClearAllChordFindersState()
G4ThreeVector fTransportEndPosition
void ProposePosition(G4double x, G4double y, G4double z)
G4double GetMagneticMoment() const
static G4bool fUseMagneticMoment
static G4bool fUseMagneticMoment
G4double GetGlobalTime() const
static constexpr double kiloelectronvolt
G4double GetCharge() const
G4ThreeVector fTransportEndMomentumDir
G4bool fParticleIsLooping
const G4ThreeVector & GetPosition() const
const G4Field * GetDetectorField() const
void ProposeEnergy(G4double finalEnergy)
std::vector< G4ThreeVector > * GimmeTrajectoryVectorAndForgetIt() const
G4Transportation(G4int verbosityLevel=1)
void ProposeTrueStepLength(G4double truePathLength)
G4double fSumEnergyKilled
G4bool fEndGlobalTimeComputed
G4GLOB_DLL std::ostream G4cerr
G4double GetPDGMagneticMoment() const
G4TouchableHandle fCurrentTouchableHandle
static G4TransportationManager * GetTransportationManager()
G4double fCandidateEndGlobalTime
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true)
static G4ProductionCutsTable * GetProductionCutsTable()
void ProposeProperTime(G4double finalProperTime)
G4PropagatorInField * fFieldPropagator
void ProposeFirstStepInVolume(G4bool flag)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4bool ExitedMotherVolume() const
const G4ThreeVector & GetMomentumDir() const
void SetMaterialInTouchable(G4Material *fMaterial)
G4bool IsParticleLooping() const
void SetProcessSubType(G4int)
G4GLOB_DLL std::ostream G4cout
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
G4ProductionCuts * GetProductionCuts() const
G4double GetThresholdImportantEnergy() const
G4SafetyHelper * fpSafetyHelper
G4bool fShortStepOptimisation
G4PropagatorInField * GetPropagatorInField() const
void ReportLoopingTrack(const G4Track &track, const G4Step &stepInfo, G4int numTrials, G4long noCalls, const char *methodName) const
G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
const G4Material * GetMaterial() const
G4double GetTotalMomentum() const
G4Navigator * fLinearNavigator
void SetTouchableHandle(const G4TouchableHandle &fTouchable)
void StartTracking(G4Track *aTrack)
void SetMaterialCutsCoupleInTouchable(const G4MaterialCutsCouple *fMaterialCutsCouple)
G4TrackStatus GetTrackStatus() const
G4double fThreshold_Warning_Energy
G4int GetThresholdTrials() const
const G4ThreeVector & GetMomentumDirection() const
G4TransportationLogger * fpLogger
void ProposeTrackStatus(G4TrackStatus status)
void ClearPropagatorState()
G4double fThreshold_Important_Energy
G4double GetLabTimeOfFlight() const
const G4DynamicParticle * GetDynamicParticle() const
virtual void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double MassXc2)=0
G4bool fFirstStepInVolume
static constexpr double perThousand
void SetMomentumChanged(G4bool b)
G4bool IsGravityActive() const
void SetGeometricallyLimitedStep()
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4VPhysicalVolume * GetVolume() const
G4double GetTotalEnergy() const