75 fTransportEndPosition(0.0, 0.0, 0.0),
76 fTransportEndMomentumDir(0.0, 0.0, 0.0),
77 fTransportEndKineticEnergy(0.0),
78 fTransportEndSpin(0.0, 0.0, 0.0),
79 fMomentumChanged(false),
80 fEndGlobalTimeComputed(false),
81 fCandidateEndGlobalTime(0.0),
82 fParticleIsLooping( false ),
85 fPreviousMassSafety( 0.0 ),
86 fPreviousFullSafety( 0.0 ),
87 fMassGeometryLimitedStep( false ),
88 fAnyGeometryLimitedStep( false ),
89 fEndpointDistance( -1.0 ),
91 fThreshold_Important_Energy( 1.0 *
MeV ),
92 fThresholdTrials( 10 ),
94 fSumEnergyKilled( 0.0 ), fMaxEnergyKilled( 0.0 ),
95 fFirstStepInMassVolume( true ),
96 fFirstStepInAnyVolume( true )
111 G4cout <<
" G4CoupledTransportation constructor: ----- " <<
G4endl;
113 G4cout <<
" Navigator Id obtained in G4CoupledTransportation constructor "
115 G4cout <<
" Reports First/Last in "
143 G4cout <<
" G4CoupledTransportation: Statistics for looping particles "
145 G4cout <<
" Sum of energy of loopers killed: "
147 G4cout <<
" Max energy of loopers killed: "
190 #ifdef G4DEBUG_TRANSPORT
191 G4cout <<
" CoupledTransport::AlongStep GPIL: "
209 #ifdef G4DEBUG_TRANSPORT
212 G4cout <<
"G4CoupledTransportation::AlongStepGPIL> called in volume "
224 startMassSafety = 0.0;
225 startFullSafety= 0.0;
231 G4double mag_shift= std::sqrt(MagSqShift);
259 G4bool fieldExertsForce = false ;
278 if( (particleCharge != 0.0)
280 || (gravityOn && (restMass != 0.0)) )
282 fieldExertsForce =
true;
288 if( fieldExertsForce )
298 if( equationOfMotion )
300 equationOfMotion->SetChargeMomentumMass( chargeState,
304 #ifdef G4DEBUG_TRANSPORT
307 G4cerr <<
" ERROR in G4CoupledTransportation> "
308 <<
"Cannot find valid Equation of motion: " <<
G4endl;
309 <<
" Unable to pass Charge, Momentum and Mass " <<
G4endl;
332 if( currentMinimumStep > 0 )
357 #ifdef G4DEBUG_TRANSPORT
361 message <<
" ERROR in determining geometries limiting the step" <<
G4endl;
364 message <<
"Incompatible conditions - by which geometries was it limited ?"<<
G4endl;
365 G4Exception(
"G4CoupledTransportation::AlongStepGetPhysicalInteractionLength()",
370 geometryStepLength =
std::min( lengthAlongCurve, currentMinimumStep);
378 fPreviousSftOrigin = startPosition ;
383 #ifdef G4DEBUG_TRANSPORT
386 G4cout <<
"G4Transport:CompStep> "
387 <<
" called the pathfinder for a new step at " << startPosition
388 <<
" and obtained step = " << lengthAlongCurve <<
G4endl;
389 G4cout <<
" New safety (preStep) = " << newMassSafety
390 <<
" versus precalculated = " << startMassSafety <<
G4endl;
395 startMassSafety = newMassSafety ;
396 startFullSafety = newFullSafety ;
404 geometryStepLength = lengthAlongCurve= 0.0 ;
413 endTrackState= aFieldTrack;
417 if( startMassSafety == 0.0 )
426 if( !fieldExertsForce )
435 #ifdef G4DEBUG_TRANSPORT
438 G4cout <<
" G4CT::CS End Position = "
440 G4cout <<
" G4CT::CS End Direction = "
468 G4double absEdiff = std::fabs(startEnergy- endEnergy);
494 safetyProposal= startFullSafety;
500 && ( particleCharge != 0.0 ) )
528 #ifdef G4DEBUG_TRANSPORT
530 G4cout <<
"***CoupledTransportation::AlongStepGPIL ** " <<
G4endl ;
532 <<
" give safety values: Mass= " << endMassSafety
533 <<
" All= " << endFullSafety <<
G4endl ;
534 G4cout <<
" Adding endpoint distance " << fEndpointDistance
535 <<
" to obtain pseudo-safety= " << safetyProposal <<
G4endl ;
541 G4cout <<
"***CoupledTransportation::AlongStepGPIL ** " <<
G4endl ;
544 <<
" using start-point value " << startFullSafety
550 proposedSafetyForStart= safetyProposal;
553 return geometryStepLength ;
563 const char *methodName=
"AlongStepDoIt";
597 if( finalVelocity > 0.0 ) { finalInverseVel= 1.0 / finalVelocity; }
599 if( initialVelocity > 0.0 ) { initialInverseVel= 1.0 / initialVelocity; }
602 if (finalVelocity > 0.0)
605 G4double meanInverseVelocity = 0.5 * ( initialInverseVel + finalInverseVel );
606 deltaTime = stepLength * meanInverseVelocity ;
612 deltaTime = stepLength * initialInverseVel ;
673 G4cout <<
" ** G4CoupledTransportation::AlongStepDoIt(): Particle looping - " <<
G4endl
678 <<
" Total no of calls to this method (all tracks) = "
679 << noCallsCT_ASDI <<
G4endl;
725 <<
"**************************************************************"
727 G4cerr <<
"Endpoint has moved between value expected from TransportEndPosition "
728 <<
" and value from Track in PostStepDoIt. " << G4endl
729 <<
"Change of " << Quantity <<
" is " << moveVec.
mag() /
mm <<
" mm long, "
730 <<
" and its vector is " << (1.0/
mm) * moveVec <<
" mm " << G4endl
731 <<
"Endpoint of ComputeStep was " << OldVector
732 <<
" and current position to locate is " << NewVector << G4endl;
760 #ifdef G4DEBUG_TRANSPORT
765 G4cerr <<
" Problem in G4CoupledTransportation::PostStepDoIt " <<
G4endl;
773 G4cout <<
" Calling PathFinder::Locate() from "
774 <<
" G4CoupledTransportation::PostStepDoIt " <<
G4endl;
793 #ifdef G4DEBUG_TRANSPORT
796 G4cout <<
"G4CoupledTransportation::PostStepDoIt --- fNavigatorId = "
802 G4cout <<
"CHECK !!!!!!!!!!! fCurrentTouchableHandle->GetVolume() = "
804 if( vol ) {
G4cout <<
"Name=" << vol->GetName(); }
821 #ifdef G4DEBUG_TRANSPORT
824 G4cout <<
"G4CoupledTransportation::PostStepDoIt -- "
826 <<
" must be false " <<
G4endl;
845 #ifdef G4DEBUG_NAVIGATION
846 G4cout <<
" CoupledTransport::AlongStep GPIL: "
879 if( pNewMaterialCutsCouple!=0
880 && pNewMaterialCutsCouple->
GetMaterial()!=pNewMaterial )
960 #ifdef G4DEBUG_TRANSPORT
988 moduloFactor= 10, no_large_ediff= 0;
990 if( std::fabs(startEnergy- endEnergy) >
perThousand * endEnergy )
993 if( (no_large_ediff% warnModulo) == 0 )
996 G4cout <<
"WARNING - G4CoupledTransportation::AlongStepGetPIL() "
997 <<
" Energy change in Step is above 1^-3 relative value. " <<
G4endl
998 <<
" Relative change in 'tracking' step = "
999 << std::setw(15) << (endEnergy-startEnergy)/startEnergy <<
G4endl
1000 <<
" Starting E= " << std::setw(12) << startEnergy /
MeV <<
" MeV " <<
G4endl
1001 <<
" Ending E= " << std::setw(12) << endEnergy /
MeV <<
" MeV " <<
G4endl;
1002 G4cout <<
" Energy has been corrected -- however, review"
1003 <<
" field propagation parameters for accuracy." <<
G4endl;
1004 if( (
verboseLevel > 2 ) || (no_warnings<4) || (no_large_ediff == warnModulo * moduloFactor) )
1006 G4cout <<
" These include EpsilonStepMax(/Min) in G4FieldManager "
1007 <<
" which determine fractional error per step for integrated quantities. " << G4endl
1008 <<
" Note also the influence of the permitted number of integration steps."
1011 G4cerr <<
"ERROR - G4CoupledTransportation::AlongStepGetPIL()" << G4endl
1012 <<
" Bad 'endpoint'. Energy change detected"
1013 <<
" and corrected. "
1014 <<
" Has occurred already "
1015 << no_large_ediff <<
" times." <<
G4endl;
1016 if( no_large_ediff == warnModulo * moduloFactor )
1018 warnModulo *= moduloFactor;
G4double GetLocalTime() const
G4Navigator * fMassNavigator
G4double GetKineticEnergy() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
virtual void ConfigureForTrack(const G4Track *)
CLHEP::Hep3Vector G4ThreeVector
G4SafetyHelper * GetSafetyHelper() const
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
G4double ObtainSafety(G4int navId, G4ThreeVector &globalCenterPoint)
void ProposeGlobalTime(G4double t)
void ReportInexactEnergy(G4double startEnergy, G4double endEnergy)
G4LogicalVolume * GetLogicalVolume() const
G4bool DoesFieldChangeEnergy() const
static constexpr double MeV
G4VSensitiveDetector * GetSensitiveDetector() const
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
static G4FieldManagerStore * GetInstance()
G4PathFinder * fPathFinder
void SetThresholds(G4double newEnWarn, G4double importantEnergy, G4int newMaxTrials)
G4StepPoint * GetPreStepPoint() const
static constexpr double mm
G4double fSumEnergyKilled
G4double GetThresholdImportantEnergy() const
G4double GetStepLength() const
G4double GetCurrentSafety() const
const G4ThreeVector & GetMomentumDirection() const
G4ReferenceCountedHandle< G4VTouchable > G4TouchableHandle
void ReportMove(G4ThreeVector OldVector, G4ThreeVector NewVector, const G4String &Quantity)
G4EquationOfMotion * GetCurrentEquationOfMotion()
void SetSensitiveDetectorInTouchable(G4VSensitiveDetector *fSensitiveDetector)
void message(RunManager *runmanager)
G4TransportationLogger * fpLogger
G4FieldManager * GetCurrentFieldManager()
G4ParticleChangeForTransport fParticleChange
const G4TouchableHandle & GetTouchableHandle() const
const G4ThreeVector & GetPolarization() const
G4bool fParticleIsLooping
static constexpr double perMillion
G4double fTransportEndKineticEnergy
void ReLocate(const G4ThreeVector &position)
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)
G4Navigator * GetNavigatorForTracking() const
G4PropagatorInField * fFieldPropagator
G4int GetCurrentStepNumber() const
G4double GetThresholdWarningEnergy() const
G4double fThreshold_Warning_Energy
G4bool DoesGlobalFieldExist()
G4double fCandidateEndGlobalTime
G4Material * GetMaterial() const
G4double GetVelocity() const
G4double GetProperTime() const
virtual void Initialize(const G4Track &)
G4ThreeVector fTransportEndMomentumDir
G4double ComputeStep(const G4FieldTrack &pFieldTrack, G4double pCurrentProposedStepLength, G4int navigatorId, G4int stepNo, G4double &pNewSafety, ELimited &limitedStep, G4FieldTrack &EndState, G4VPhysicalVolume *currentVolume)
void SetVerboseLevel(G4int value)
G4ThreeVector GetSpin() const
~G4CoupledTransportation()
G4ThreeVector GetPosition() const
void ProposeLocalTime(G4double t)
G4double GetPDGSpin() const
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
G4ParticleDefinition * GetDefinition() const
G4FieldManager * GetFieldManager() const
void ProposeLastStepInVolume(G4bool flag)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4double fPreviousMassSafety
#define fPreviousSftOrigin
G4double GetKineticEnergy() const
void ClearAllChordFindersState()
void ProposePosition(G4double x, G4double y, G4double z)
G4double GetMagneticMoment() const
static G4bool fUseMagneticMoment
static G4bool fUseMagneticMoment
G4TouchableHandle CreateTouchableHandle(G4int navId) const
G4double GetGlobalTime() const
static constexpr double kiloelectronvolt
G4double GetCharge() const
G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
void StartTracking(G4Track *aTrack)
const G4ThreeVector & GetPosition() const
const G4Field * GetDetectorField() const
void ProposeEnergy(G4double finalEnergy)
G4bool fAnyGeometryLimitedStep
void ProposeTrueStepLength(G4double truePathLength)
G4double GetVelocity() const
unsigned int GetNumberGeometriesLimitingStep() const
G4GLOB_DLL std::ostream G4cerr
G4double GetPDGMagneticMoment() const
static G4TransportationManager * GetTransportationManager()
void Locate(const G4ThreeVector &position, const G4ThreeVector &direction, G4bool relativeSearch=true)
static G4ProductionCutsTable * GetProductionCutsTable()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void ProposeProperTime(G4double finalProperTime)
G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4ForceCondition *pForceCond)
G4double fPreviousFullSafety
G4bool fGlobalFieldExists
static G4bool EnableUseMagneticMoment(G4bool useMoment=true)
static G4bool fSignifyStepInAnyVolume
void ProposeFirstStepInVolume(G4bool flag)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
void PrepareNewTrack(const G4ThreeVector &position, const G4ThreeVector &direction, G4VPhysicalVolume *massStartVol=0)
G4int ActivateNavigator(G4Navigator *aNavigator)
const G4ThreeVector & GetMomentumDir() const
void SetMaterialInTouchable(G4Material *fMaterial)
G4bool IsParticleLooping() const
G4TouchableHandle fCurrentTouchableHandle
void SetProcessSubType(G4int)
G4int GetThresholdTrials() const
G4double fThreshold_Important_Energy
G4GLOB_DLL std::ostream G4cout
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
G4ProductionCuts * GetProductionCuts() const
G4PropagatorInField * GetPropagatorInField() const
G4ChordFinder * GetChordFinder()
void ReportLoopingTrack(const G4Track &track, const G4Step &stepInfo, G4int numTrials, G4long noCalls, const char *methodName) const
const G4Material * GetMaterial() const
G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)
G4double GetTotalMomentum() const
void SetTouchableHandle(const G4TouchableHandle &fTouchable)
void SetMaterialCutsCoupleInTouchable(const G4MaterialCutsCouple *fMaterialCutsCouple)
G4bool fFirstStepInAnyVolume
G4bool fFirstStepInMassVolume
G4TrackStatus GetTrackStatus() const
G4bool fMassGeometryLimitedStep
G4CoupledTransportation(G4int verbosityLevel=0)
const G4ThreeVector & GetMomentumDirection() const
static G4PathFinder * GetInstance()
G4SafetyHelper * fpSafetyHelper
G4ThreeVector fTransportEndSpin
void ProposeTrackStatus(G4TrackStatus status)
void ClearPropagatorState()
G4double GetLabTimeOfFlight() const
const G4DynamicParticle * GetDynamicParticle() const
static constexpr double perThousand
void SetMomentumChanged(G4bool b)
G4ThreeVector fPreviousSftOrigin
G4double ComputeSafety(const G4ThreeVector &globalPoint)
G4bool fEndGlobalTimeComputed
const G4String & GetName() const
G4bool IsGravityActive() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4VPhysicalVolume * GetVolume() const
G4double fEndpointDistance
G4double GetTotalEnergy() const
G4ThreeVector fTransportEndPosition
G4double fMaxEnergyKilled