79 fEndPointDistance( -1.0 ),
80 fShortStepOptimisation( false )
116 if ( !pNullTouchableHandle)
127 G4cout <<
" G4Transportation constructor> set fShortStepOptimisation to ";
150 outStr <<
" G4Transportation: Statistics for looping particles " <<
G4endl;
153 outStr <<
" Sum of energy of looping tracks killed: "
156 <<
" Sum of energy of non-electrons : "
164 outStr <<
" Max energy of non-electron looper killed: "
171 outStr <<
" Sum of energy of loopers 'saved': "
173 outStr <<
" Sum of energy of unstable loopers 'saved': "
179 outStr <<
" No looping tracks found or killed. " <<
G4endl;
248 if(eligibleEM || eligibleGrav)
254 fieldMgr->ConfigureForTrack(&track);
260 if(
const G4Field* ptrField = fieldMgr->GetDetectorField())
262 eligibleEM || (eligibleGrav && ptrField->IsGravityActive());
266 G4double geometryStepLength = currentMinimumStep;
268 if(currentMinimumStep == 0.0)
287 startPosition, startMomentumDir, currentMinimumStep, currentSafety);
289 if(linearStepLength <= currentMinimumStep)
291 geometryStepLength = linearStepLength;
307 startPosition + geometryStepLength * startMomentumDir;
315 const auto particlePDGSpin = pParticleDef->
GetPDGSpin();
316 const auto particlePDGMagM = pParticleDef->GetPDGMagneticMoment();
323 G4ChargeState(particleCharge, magneticMoment, particlePDGSpin),
328 startMomentumDir, kineticEnergy, particleMass,
329 particleCharge, particleSpin, particlePDGMagM,
336 aFieldTrack, currentMinimumStep, currentSafety, track.
GetVolume(),
339 if(lengthAlongCurve < geometryStepLength)
340 geometryStepLength = lengthAlongCurve;
384#if defined(G4VERBOSE) || defined(G4DEBUG_TRANSPORT)
392 G4double startEnergy = kineticEnergy;
398 if(std::fabs(startEnergy - endEnergy) > perThousand * endEnergy)
403 if((no_large_ediff % warnModulo) == 0)
406 std::ostringstream message;
407 message <<
"Energy change in Step is above 1^-3 relative value. "
408 <<
G4endl <<
" Relative change in 'tracking' step = "
409 << std::setw(15) << (endEnergy - startEnergy) / startEnergy
410 <<
G4endl <<
" Starting E= " << std::setw(12)
411 << startEnergy / MeV <<
" MeV " <<
G4endl
412 <<
" Ending E= " << std::setw(12) << endEnergy / MeV
414 <<
"Energy has been corrected -- however, review"
415 <<
" field propagation parameters for accuracy." <<
G4endl;
417 (no_large_ediff == warnModulo * moduloFactor))
419 message <<
"These include EpsilonStepMax(/Min) in G4FieldManager "
421 <<
"which determine fractional error per step for "
422 "integrated quantities. "
424 <<
"Note also the influence of the permitted number of "
428 message <<
"Bad 'endpoint'. Energy change detected and corrected."
429 <<
G4endl <<
"Has occurred already " << no_large_ediff
431 G4Exception(
"G4Transportation::AlongStepGetPIL()",
"EnergyChange",
433 if(no_large_ediff == warnModulo * moduloFactor)
435 warnModulo *= moduloFactor;
449 if(particleCharge != 0.0)
453 currentSafety = endSafety;
463#ifdef G4DEBUG_TRANSPORT
465 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl;
467 <<
" and it returned safety= " << endSafety <<
G4endl;
469 <<
" to obtain pseudo-safety= " << currentSafety <<
G4endl;
473 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl;
474 G4cout <<
" Avoiding call to ComputeSafety : " <<
G4endl;
488 return geometryStepLength;
499#if defined(G4VERBOSE) || defined(G4DEBUG_TRANSPORT)
503 #define noCallsASDI 0
538 if ( initialVelocity > 0.0 ) { deltaTime = stepLength/initialVelocity; }
573 if( (candidateForEnd && stable) || (unstableAndKillable && unstableForEnd) )
578 G4int particlePDG= particleType->GetPDGEncoding();
579 const G4int electronPDG= 11;
590 if( particleType->GetPDGEncoding() != electronPDG )
622 <<
" Particle is looping but is saved ..." <<
G4endl
686 if ( pNewVol!=0 && pNewMaterialCutsCouple!=0
687 && pNewMaterialCutsCouple->
GetMaterial()!=pNewMaterial )
691 pNewMaterialCutsCouple =
731 LocateGlobalPointAndUpdateTouchableHandle( track.
GetPosition(),
879 G4int maxTrials = 10;
893 G4int maxTrials = 30;
905 const char* message=
"Logger object missing from G4Transportation object";
928 G4long oldPrec= outStr.precision(6);
930 outStr <<
G4endl << indent << GetProcessName() <<
": ";
932 outStr <<
" Parameters for looping particles: " <<
G4endl
933 <<
" warning-E = " << fThreshold_Warning_Energy / CLHEP::MeV <<
" MeV " <<
G4endl
934 <<
" important E = " << fThreshold_Important_Energy / CLHEP::MeV <<
" MeV " <<
G4endl
935 <<
" thresholdTrials " << fThresholdTrials <<
G4endl;
936 outStr.precision(oldPrec);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define fPreviousSftOrigin
#define fFieldExertedForce
CLHEP::Hep3Vector G4ThreeVector
G4ReferenceCountedHandle< G4VTouchable > G4TouchableHandle
G4GLOB_DLL std::ostream G4cout
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 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 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
void SetStepStatus(const G4StepStatus aValue)
G4StepPoint * GetPreStepPoint() const
G4StepPoint * GetPostStepPoint() 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
static G4TransportationParameters * Instance()
void SetThresholdImportantEnergy(G4double newEnImp)
G4ThreeVector fPreviousSftOrigin
static void SetSilenceLooperWarnings(G4bool val)
G4double fSumEnerSqKilled
G4double fThreshold_Important_Energy
G4double fSumEnergyKilled
G4int fMaxEnergyKilledPDG
G4Transportation(G4int verbosityLevel=1, const G4String &aName="Transportation")
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
void SetTouchableInformation(const G4TouchableHandle &touchable)
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)
static G4bool fUseGravity
G4double fMaxEnergyKilled
G4bool fGeometryLimitedStep
G4Navigator * fLinearNavigator
G4TransportationLogger * fpLogger
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