74 fEndPointDistance( -1.0 ),
75 fShortStepOptimisation( false )
107 if ( !pNullTouchableHandle)
118 G4cout <<
" G4Transportation constructor> set fShortStepOptimisation to ";
141 outStr <<
" G4Transportation: Statistics for looping particles " <<
G4endl;
144 outStr <<
" Sum of energy of looping tracks killed: "
147 <<
" Sum of energy of non-electrons : "
155 outStr <<
" Max energy of non-electron looper killed: "
162 outStr <<
" Sum of energy of loopers 'saved': "
164 outStr <<
" Sum of energy of unstable loopers 'saved': "
170 outStr <<
" No looping tracks found or killed. " <<
G4endl;
239 if(eligibleEM || eligibleGrav)
245 fieldMgr->ConfigureForTrack(&track);
251 if(
const G4Field* ptrField = fieldMgr->GetDetectorField())
253 eligibleEM || (eligibleGrav && ptrField->IsGravityActive());
257 G4double geometryStepLength = currentMinimumStep;
259 if(currentMinimumStep == 0.0)
279 startPosition, startMomentumDir, currentMinimumStep, currentSafety);
281 if(linearStepLength <= currentMinimumStep)
283 geometryStepLength = linearStepLength;
299 startPosition + geometryStepLength * startMomentumDir;
307 const auto particlePDGSpin = pParticleDef->
GetPDGSpin();
308 const auto particlePDGMagM = pParticleDef->GetPDGMagneticMoment();
315 G4ChargeState(particleCharge, magneticMoment, particlePDGSpin),
320 startMomentumDir, kineticEnergy, particleMass,
321 particleCharge, particleSpin, particlePDGMagM,
328 aFieldTrack, currentMinimumStep, currentSafety, track.
GetVolume(),
331 if(lengthAlongCurve < geometryStepLength)
332 geometryStepLength = lengthAlongCurve;
374#if defined(G4VERBOSE) || defined(G4DEBUG_TRANSPORT)
382 G4double startEnergy = kineticEnergy;
386 G4double absEdiff = std::fabs(startEnergy - endEnergy);
394 if(std::fabs(startEnergy - endEnergy) >
perThousand * endEnergy)
399 if((no_large_ediff % warnModulo) == 0)
402 std::ostringstream message;
403 message <<
"Energy change in Step is above 1^-3 relative value. "
404 <<
G4endl <<
" Relative change in 'tracking' step = "
405 << std::setw(15) << (endEnergy - startEnergy) / startEnergy
406 <<
G4endl <<
" Starting E= " << std::setw(12)
407 << startEnergy /
MeV <<
" MeV " <<
G4endl
408 <<
" Ending E= " << std::setw(12) << endEnergy /
MeV
410 <<
"Energy has been corrected -- however, review"
411 <<
" field propagation parameters for accuracy." <<
G4endl;
413 (no_large_ediff == warnModulo * moduloFactor))
415 message <<
"These include EpsilonStepMax(/Min) in G4FieldManager "
417 <<
"which determine fractional error per step for "
418 "integrated quantities. "
420 <<
"Note also the influence of the permitted number of "
424 message <<
"Bad 'endpoint'. Energy change detected and corrected."
425 <<
G4endl <<
"Has occurred already " << no_large_ediff
427 G4Exception(
"G4Transportation::AlongStepGetPIL()",
"EnergyChange",
429 if(no_large_ediff == warnModulo * moduloFactor)
431 warnModulo *= moduloFactor;
445 if(particleCharge != 0.0)
449 currentSafety = endSafety;
459#ifdef G4DEBUG_TRANSPORT
461 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl;
463 <<
" and it returned safety= " << endSafety <<
G4endl;
465 <<
" to obtain pseudo-safety= " << currentSafety <<
G4endl;
469 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl;
470 G4cout <<
" Avoiding call to ComputeSafety : " <<
G4endl;
484 return geometryStepLength;
495#if defined(G4VERBOSE) || defined(G4DEBUG_TRANSPORT)
499 #define noCallsASDI 0
529 if ( initialVelocity > 0.0 ) { deltaTime = stepLength/initialVelocity; }
564 if( (candidateForEnd && stable) || (unstableAndKillable && unstableForEnd) )
569 G4int particlePDG= particleType->GetPDGEncoding();
570 const G4int electronPDG= 11;
581 if( particleType->GetPDGEncoding() != electronPDG )
613 <<
" Particle is looping but is saved ..." <<
G4endl
678 LocateGlobalPointAndUpdateTouchableHandle( track.
GetPosition(),
739 if ( pNewVol!=0 && pNewMaterialCutsCouple!=0
740 && pNewMaterialCutsCouple->
GetMaterial()!=pNewMaterial )
744 pNewMaterialCutsCouple =
866 G4int maxTrials = 10;
880 G4int maxTrials = 30;
892 const char* message=
"Logger object missing from G4Transportation object";
915 G4int oldPrec= outStr.precision(6);
917 outStr <<
G4endl << indent << GetProcessName() <<
": ";
919 outStr <<
" Parameters for looping particles: " <<
G4endl
920 <<
" warning-E = " << fThreshold_Warning_Energy /
CLHEP::MeV <<
" MeV " <<
G4endl
921 <<
" important E = " << fThreshold_Important_Energy /
CLHEP::MeV <<
" MeV " <<
G4endl
922 <<
" thresholdTrials " << fThresholdTrials <<
G4endl;
923 outStr.precision(oldPrec);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define fPreviousSftOrigin
#define fFieldExertedForce
static constexpr double perMillion
static constexpr double MeV
static constexpr double perThousand
CLHEP::Hep3Vector G4ThreeVector
G4ReferenceCountedHandle< G4VTouchable > G4TouchableHandle
G4GLOB_DLL std::ostream G4cout
static G4bool fUseGravity
static G4bool fUseMagneticMoment
G4double GetCharge() const
const G4ParticleDefinition * GetParticleDefinition() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4double GetMagneticMoment() const
G4double GetTotalMomentum() const
const G4ThreeVector & GetPolarization() const
virtual void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double MassXc2)=0
static G4FieldManagerStore * GetInstance()
void ClearAllChordFindersState()
G4bool DoesFieldChangeEnergy() const
const G4ThreeVector & GetMomentumDir() const
G4double GetKineticEnergy() const
G4ThreeVector GetPosition() const
G4ThreeVector GetSpin() const
G4double GetLabTimeOfFlight() const
G4VSensitiveDetector * GetSensitiveDetector() const
G4Material * GetMaterial() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
const G4Material * GetMaterial() const
G4ProductionCuts * GetProductionCuts() const
void SetGeometricallyLimitedStep()
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true)
virtual void LocateGlobalPointWithinVolume(const G4ThreeVector &position)
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
G4bool EnteredDaughterVolume() const
G4bool ExitedMotherVolume() const
void SetPointerToVectorOfAuxiliaryPoints(std::vector< G4ThreeVector > *vec)
void SetMaterialInTouchable(G4Material *fMaterial)
void SetTouchableHandle(const G4TouchableHandle &fTouchable)
void SetMaterialCutsCoupleInTouchable(const G4MaterialCutsCouple *fMaterialCutsCouple)
virtual void Initialize(const G4Track &)
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 ProposeProperTime(G4double finalProperTime)
void ProposeEnergy(G4double finalEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
void ProposeGlobalTime(G4double t)
G4bool GetPDGStable() const
G4double GetPDGSpin() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
static G4ProductionCutsTable * GetProductionCutsTable()
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
G4FieldManager * GetCurrentFieldManager()
G4bool IsLastStepInVolume()
G4bool IsParticleLooping() const
G4EquationOfMotion * GetCurrentEquationOfMotion()
void ClearPropagatorState()
std::vector< G4ThreeVector > * GimmeTrajectoryVectorAndForgetIt() const
G4double ComputeStep(G4FieldTrack &pFieldTrack, G4double pCurrentProposedStepLength, G4double &pNewSafety, G4VPhysicalVolume *pPhysVol=nullptr, G4bool canRelaxDeltaChord=false)
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
G4double GetVelocity() const
G4StepPoint * GetPreStepPoint() const
G4TrackStatus GetTrackStatus() const
G4VPhysicalVolume * GetVolume() const
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
G4double GetProperTime() const
G4double GetLocalTime() const
const G4DynamicParticle * GetDynamicParticle() const
const G4TouchableHandle & GetTouchableHandle() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetStepLength() const
G4double GetTotalEnergy() const
void ReportLoopingTrack(const G4Track &track, const G4Step &stepInfo, G4int numTrials, G4long noCalls, const char *methodName) const
void ReportLooperThresholds(const char *className)
static G4TransportationManager * GetTransportationManager()
G4PropagatorInField * GetPropagatorInField() const
G4SafetyHelper * GetSafetyHelper() const
G4Navigator * GetNavigatorForTracking() const
void SetThresholdImportantEnergy(G4double newEnImp)
G4ThreeVector fPreviousSftOrigin
static void SetSilenceLooperWarnings(G4bool val)
G4double fSumEnerSqKilled
G4double fThreshold_Important_Energy
G4double fSumEnergyKilled
G4int fMaxEnergyKilledPDG
G4double fMaxEnergyKilled_NonElectron
G4ThreeVector fTransportEndSpin
G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
static G4bool EnableGravity(G4bool useGravity=true)
G4double fTransportEndKineticEnergy
void PushThresholdsToLogger()
void PrintStatistics(std::ostream &outStr) const
void SetHighLooperThresholds()
unsigned long fNumLoopersKilled_NonElectron
G4bool fShortStepOptimisation
static G4bool fSilenceLooperWarnings
void SetLowLooperThresholds()
G4PropagatorInField * fFieldPropagator
G4ThreeVector fTransportEndPosition
G4bool fEndGlobalTimeComputed
G4double fThreshold_Warning_Energy
G4int fMaxEnergyKilled_NonElecPDG
G4double fSumEnerSqKilled_NonElectron
G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)
void SetThresholdTrials(G4int newMaxTrials)
G4ParticleChangeForTransport fParticleChange
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)
G4double fEndPointDistance
G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4ForceCondition *pForceCond)
G4double fSumEnergyUnstableSaved
static G4bool EnableMagneticMoment(G4bool useMoment=true)
void ReportLooperThresholds()
G4TouchableHandle fCurrentTouchableHandle
G4int fAbandonUnstableTrials
void StartTracking(G4Track *aTrack)
G4Transportation(G4int verbosityLevel=1)
static G4bool fUseGravity
G4double fMaxEnergyKilled
G4bool fGeometryLimitedStep
G4Navigator * fLinearNavigator
G4TransportationLogger * fpLogger
G4bool DoesAnyFieldExist()
static G4bool fUseMagneticMoment
G4bool fParticleIsLooping
void SetThresholdWarningEnergy(G4double newEnWarn)
G4double fSumEnergyKilled_NonElectron
static G4bool GetSilenceLooperWarnings()
void ReportMissingLogger(const char *methodName)
G4ThreeVector fTransportEndMomentumDir
unsigned long fNumLoopersKilled
G4SafetyHelper * fpSafetyHelper
G4double fCandidateEndGlobalTime
G4bool fFieldExertedForce
virtual void ProcessDescription(std::ostream &outFile) const
G4bool fFirstStepInVolume
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLastStepInVolume(G4bool flag)
void ProposeFirstStepInVolume(G4bool flag)
void ProposeTrueStepLength(G4double truePathLength)
G4LogicalVolume * GetLogicalVolume() const
void SetVerboseLevel(G4int value)
void SetProcessSubType(G4int)
virtual void StartTracking(G4Track *)
G4VParticleChange * pParticleChange
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
static constexpr double keV
static constexpr double MeV
T max(const T t1, const T t2)
brief Return the largest of the two arguments