68 fTransportEndPosition(0.0, 0.0, 0.0),
69 fTransportEndMomentumDir(0.0, 0.0, 0.0),
70 fTransportEndKineticEnergy(0.0),
71 fTransportEndSpin(0.0, 0.0, 0.0),
72 fMomentumChanged(false),
73 fEndGlobalTimeComputed(false),
74 fCandidateEndGlobalTime(0.0),
75 fParticleIsLooping( false ),
77 fPreviousMassSafety( 0.0 ),
78 fPreviousFullSafety( 0.0 ),
79 fMassGeometryLimitedStep( false ),
80 fAnyGeometryLimitedStep( false ),
81 fEndpointDistance( -1.0 ),
82 fThreshold_Warning_Energy( 100 *
MeV ),
83 fThreshold_Important_Energy( 250 *
MeV ),
84 fThresholdTrials( 10 ),
86 fSumEnergyKilled( 0.0 ), fMaxEnergyKilled( 0.0 ),
87 fVerboseLevel( verbosity )
102 G4cout <<
" G4CoupledTransportation constructor: ----- " <<
G4endl;
104 G4cout <<
" Navigator Id obtained in G4CoupledTransportation constructor "
128 G4cout <<
" G4CoupledTransportation: Statistics for looping particles " <<
G4endl;
177 #ifdef G4DEBUG_TRANSPORT
180 G4cout <<
"G4CoupledTransportation::AlongStepGPIL> called in volume "
191 G4double MagSqShift = OriginShift.mag2() ;
192 startMassSafety = 0.0;
193 startFullSafety= 0.0;
199 G4double mag_shift= std::sqrt(MagSqShift);
227 G4bool fieldExertsForce = false ;
246 if( (particleCharge != 0.0)
248 || (gravityOn && (restMass != 0.0))
251 fieldExertsForce =
true;
257 if( fieldExertsForce )
292 if( equationOfMotion )
320 if( currentMinimumStep > 0 )
350 G4cerr <<
" Error in determining geometries limiting the step" <<
G4endl;
353 G4Exception(
"G4CoupledTransportation::AlongStepGetPhysicalInteractionLength()",
355 "Incompatible conditions - was limited by a geometry?");
365 geometryStepLength =
std::min( lengthAlongCurve, currentMinimumStep);
373 fPreviousSftOrigin = startPosition ;
378 #ifdef G4DEBUG_TRANSPORT
381 G4cout <<
"G4Transport:CompStep> "
382 <<
" called the pathfinder for a new step at " << startPosition
383 <<
" and obtained step = " << lengthAlongCurve <<
G4endl;
384 G4cout <<
" New safety (preStep) = " << newMassSafety
385 <<
" versus precalculated = " << startMassSafety <<
G4endl;
390 startMassSafety = newMassSafety ;
391 startFullSafety = newFullSafety ;
399 geometryStepLength = lengthAlongCurve= 0.0 ;
408 endTrackState= aFieldTrack;
412 if( startMassSafety == 0.0 )
421 if( !fieldExertsForce )
431 #ifdef G4DEBUG_TRANSPORT
462 G4double absEdiff = std::fabs(startEnergy- endEnergy);
487 safetyProposal= startFullSafety;
493 && ( particleCharge != 0.0 ) )
523 #ifdef G4DEBUG_TRANSPORT
525 G4cout <<
"***Transportation::AlongStepGPIL ** " <<
G4endl ;
527 <<
" give safety values: Mass= " << endMassSafety
528 <<
" All= " << endFullSafety <<
G4endl ;
529 G4cout <<
" Adding endpoint distance " << fEndpointDistance
530 <<
" to obtain pseudo-safety= " << safetyProposal <<
G4endl ;
536 G4cout <<
"***Transportation::AlongStepGPIL ** " <<
G4endl ;
539 <<
" using start-point value " << startFullSafety
545 proposedSafetyForStart= safetyProposal;
548 return geometryStepLength ;
590 if( finalVelocity > 0.0 ) { finalInverseVel= 1.0 / finalVelocity; }
592 if( initialVelocity > 0.0 ) { initialInverseVel= 1.0 / initialVelocity; }
595 if (finalVelocity > 0.0)
598 G4double meanInverseVelocity = 0.5 * ( initialInverseVel + finalInverseVel );
599 deltaTime = stepLength * meanInverseVelocity ;
605 deltaTime = stepLength * initialInverseVel ;
658 G4cout <<
" G4CoupledTransportation is killing track that is looping or stuck " <<
G4endl
660 <<
" MeV energy." <<
G4endl;
675 G4cout <<
" ** G4CoupledTransportation::AlongStepDoIt(): Particle looping - " <<
G4endl
678 <<
" Total no of calls to this method (all tracks) = " << noCalls <<
G4endl;
721 <<
"**************************************************************" <<
G4endl;
722 G4cerr <<
"Endpoint has moved between value expected from TransportEndPosition "
723 <<
" and value from Track in PostStepDoIt. " << G4endl
724 <<
"Change of " << Quantity <<
" is " << moveVec.mag() /
mm <<
" mm long, "
725 <<
" and its vector is " << (1.0/
mm) * moveVec <<
" mm " << G4endl
726 <<
"Endpoint of ComputeStep was " << OldVector
727 <<
" and current position to locate is " << NewVector << G4endl;
746 #ifdef G4DEBUG_TRANSPORT
751 G4cerr <<
" Problem in G4CoupledTransportation::PostStepDoIt " <<
G4endl;
759 G4cout <<
" Calling PathFinder::Locate() from "
760 <<
" G4CoupledTransportation::PostStepDoIt " <<
G4endl;
779 #ifdef G4DEBUG_TRANSPORT
782 G4cout <<
"G4CoupledTransportation::PostStepDoIt --- fNavigatorId = "
788 G4cout <<
"CHECK !!!!!!!!!!! fCurrentTouchableHandle->GetVolume() = " << vol;
789 if( vol ) {
G4cout <<
"Name=" << vol->GetName(); }
809 #ifdef G4DEBUG_TRANSPORT
812 G4cout <<
"G4CoupledTransportation::PostStepDoIt -- "
814 <<
" must be false " <<
G4endl;
859 if( pNewMaterialCutsCouple!=0
860 && pNewMaterialCutsCouple->
GetMaterial()!=pNewMaterial )
864 pNewMaterialCutsCouple =
943 #ifdef G4DEBUG_TRANSPORT
966 static G4ThreadLocal G4int no_warnings= 0, warnModulo=1, moduloFactor= 10, no_large_ediff= 0;
968 if( std::fabs(startEnergy- endEnergy) >
perThousand * endEnergy )
971 if( (no_large_ediff% warnModulo) == 0 )
974 G4cout <<
"WARNING - G4CoupledTransportation::AlongStepGetPIL() "
975 <<
" Energy change in Step is above 1^-3 relative value. " <<
G4endl
976 <<
" Relative change in 'tracking' step = "
977 << std::setw(15) << (endEnergy-startEnergy)/startEnergy <<
G4endl
978 <<
" Starting E= " << std::setw(12) << startEnergy /
MeV <<
" MeV " <<
G4endl
979 <<
" Ending E= " << std::setw(12) << endEnergy /
MeV <<
" MeV " <<
G4endl;
980 G4cout <<
" Energy has been corrected -- however, review"
981 <<
" field propagation parameters for accuracy." <<
G4endl;
982 if( (
fVerboseLevel > 2 ) || (no_warnings<4) || (no_large_ediff == warnModulo * moduloFactor) )
984 G4cout <<
" These include EpsilonStepMax(/Min) in G4FieldManager "
985 <<
" which determine fractional error per step for integrated quantities. " << G4endl
986 <<
" Note also the influence of the permitted number of integration steps."
989 G4cerr <<
"ERROR - G4CoupledTransportation::AlongStepGetPIL()" << G4endl
990 <<
" Bad 'endpoint'. Energy change detected"
991 <<
" and corrected. "
992 <<
" Has occurred already "
993 << no_large_ediff <<
" times." <<
G4endl;
994 if( no_large_ediff == warnModulo * moduloFactor )
996 warnModulo *= moduloFactor;
void PrepareNewTrack(const G4ThreeVector &position, const G4ThreeVector &direction, G4VPhysicalVolume *massStartVol=0)
static G4PathFinder * GetInstance()
void SetMaterialInTouchable(G4Material *fMaterial)
G4double fPreviousFullSafety
void SetTouchableHandle(const G4TouchableHandle &fTouchable)
const G4ThreeVector & GetPolarization() const
G4bool fAnyGeometryLimitedStep
G4double ObtainSafety(G4int navId, G4ThreeVector &globalCenterPoint)
void Locate(const G4ThreeVector &position, const G4ThreeVector &direction, G4bool relativeSearch=true)
G4SafetyHelper * GetSafetyHelper() const
G4SafetyHelper * fpSafetyHelper
G4double GetLocalTime() const
void ReportMove(G4ThreeVector OldVector, G4ThreeVector NewVector, const G4String &Quantity)
void SetMaterialCutsCoupleInTouchable(const G4MaterialCutsCouple *fMaterialCutsCouple)
void StartTracking(G4Track *aTrack)
virtual void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double MassXc2)=0
G4double GetProperTime() const
CLHEP::Hep3Vector G4ThreeVector
G4double GetVelocity() const
G4double GetCurrentSafety() const
G4double GetKineticEnergy() const
G4TouchableHandle fCurrentTouchableHandle
const G4DynamicParticle * GetDynamicParticle() const
const G4MagIntegratorStepper * GetStepper() const
G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)
G4double fTransportEndKineticEnergy
void ClearAllChordFindersState()
G4bool fMassGeometryLimitedStep
G4Material * GetMaterial() const
G4bool DoesGlobalFieldExist()
void ReLocate(const G4ThreeVector &position)
const G4ThreeVector & GetPosition() const
~G4CoupledTransportation()
const G4ThreeVector & GetMomentumDir() const
G4TrackStatus GetTrackStatus() const
G4ThreeVector GetSpin() const
G4bool fGlobalFieldExists
G4Navigator * GetNavigatorForTracking() const
G4bool fEndGlobalTimeComputed
G4TouchableHandle CreateTouchableHandle(G4int navId) const
G4Navigator * fMassNavigator
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
G4ParticleDefinition * GetDefinition() const
static const double perThousand
G4double GetVelocity() const
G4ThreeVector fTransportEndMomentumDir
void ProposePosition(G4double x, G4double y, G4double z)
G4ReferenceCountedHandle< G4VTouchable > G4TouchableHandle
unsigned int GetNumberGeometriesLimitingStep() const
G4double fEndpointDistance
G4double fThreshold_Important_Energy
G4double GetTotalMomentum() const
G4double fPreviousMassSafety
static G4bool EnableUseMagneticMoment(G4bool useMoment=true)
G4StepPoint * GetPreStepPoint() const
virtual void Initialize(const G4Track &)
virtual void ConfigureForTrack(const G4Track *)
G4double GetKineticEnergy() const
G4EquationOfMotion * GetEquationOfMotion()
G4bool fParticleIsLooping
G4ThreeVector GetPosition() const
G4GLOB_DLL std::ostream G4cout
void ReportInexactEnergy(G4double startEnergy, G4double endEnergy)
G4int GetCurrentStepNumber() const
G4ThreeVector fPreviousSftOrigin
const G4String & GetName() const
G4double fMaxEnergyKilled
const G4ThreeVector & GetMomentumDirection() const
G4double GetCharge() const
void ProposeTrueStepLength(G4double truePathLength)
G4double fSumEnergyKilled
G4double ComputeStep(const G4FieldTrack &pFieldTrack, G4double pCurrentProposedStepLength, G4int navigatorId, G4int stepNo, G4double &pNewSafety, ELimited &limitedStep, G4FieldTrack &EndState, G4VPhysicalVolume *currentVolume)
void SetProcessSubType(G4int)
G4bool DoesFieldChangeEnergy() const
G4double ComputeSafety(const G4ThreeVector &globalPoint)
G4double GetGlobalTime() const
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
const G4TouchableHandle & GetTouchableHandle() const
G4ThreeVector fTransportEndSpin
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const
static const double perMillion
static G4ProductionCutsTable * GetProductionCutsTable()
G4int ActivateNavigator(G4Navigator *aNavigator)
const G4ThreeVector & GetMomentumDirection() const
G4LogicalVolume * GetLogicalVolume() const
void ProposeProperTime(G4double finalProperTime)
G4double GetPDGMass() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
static G4FieldManagerStore * GetInstance()
void SetSensitiveDetectorInTouchable(G4VSensitiveDetector *fSensitiveDetector)
#define fPreviousSftOrigin
G4bool IsParticleLooping() const
G4double GetLabTimeOfFlight() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4bool IsGravityActive() const
void ProposeGlobalTime(G4double t)
G4ChordFinder * GetChordFinder()
G4FieldManager * GetCurrentFieldManager()
static G4bool fUseMagneticMoment
void ProposeEnergy(G4double finalEnergy)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4VPhysicalVolume * GetVolume() const
G4double GetTotalEnergy() const
G4double fCandidateEndGlobalTime
G4double GetPDGSpin() const
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
void ClearPropagatorState()
void ProposeLastStepInVolume(G4bool flag)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
G4double GetPDGMagneticMoment() const
G4PathFinder * fPathFinder
void ProposeTrackStatus(G4TrackStatus status)
const G4Field * GetDetectorField() const
G4MagInt_Driver * GetIntegrationDriver()
void SetMomentumChanged(G4bool b)
G4PropagatorInField * GetPropagatorInField() const
G4ProductionCuts * GetProductionCuts() const
G4VSensitiveDetector * GetSensitiveDetector() const
G4double fThreshold_Warning_Energy
G4ThreeVector fTransportEndPosition
G4double GetMagneticMoment() const
G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4ForceCondition *pForceCond)
void ProposeLocalTime(G4double t)
G4PropagatorInField * fFieldPropagator
G4double GetStepLength() const
const G4Material * GetMaterial() const
G4GLOB_DLL std::ostream G4cerr
G4ParticleChangeForTransport fParticleChange
static G4bool fUseMagneticMoment
G4CoupledTransportation(G4int verbosityLevel=0)