54G4bool G4CoupledTransportation::fSignifyStepInAnyVolume=
false;
63 fPreviousMassSafety( 0.0 ),
64 fPreviousFullSafety( 0.0 ),
65 fMassGeometryLimitedStep( false ),
66 fFirstStepInMassVolume( true )
73 G4cout <<
" G4CoupledTransportation constructor: ----- " <<
G4endl;
75 G4cout <<
" Reports First/Last in "
76 << (fSignifyStepInAnyVolume ?
" any " :
" mass " )
122 fFirstStepInMassVolume =
fNewTrack || fMassGeometryLimitedStep ;
125#ifdef G4DEBUG_TRANSPORT
126 G4cout <<
" CoupledTransport::AlongStep GPIL: "
129 <<
" mass= " << fFirstStepInMassVolume <<
" ( geom= "
130 << fMassGeometryLimitedStep <<
" ) "
145#ifdef G4DEBUG_TRANSPORT
148 G4cout <<
"G4CoupledTransportation::AlongStepGPIL> called in volume "
160 startFullSafety= 0.0;
164 if( MagSqShift <
sqr(fPreviousFullSafety) )
166 G4double mag_shift= std::sqrt(MagSqShift);
167 startFullSafety = std::max( (fPreviousFullSafety - mag_shift), 0.0);
182 fMassGeometryLimitedStep = false ;
192 G4bool fieldExertsForce = false ;
194 const G4Field* ptrField=
nullptr;
197 G4bool eligibleEM = (particleCharge != 0.0)
201 if( (fieldMgr!=
nullptr) && (eligibleEM||eligibleGrav) )
213 if( ptrField !=
nullptr)
215 fieldExertsForce = eligibleEM
221 if( fieldExertsForce )
228 if( equationOfMotion )
230 equationOfMotion->SetChargeMomentumMass( chargeState,
234#ifdef G4DEBUG_TRANSPORT
237 G4cerr <<
" ERROR in G4CoupledTransportation> "
238 <<
"Cannot find valid Equation of motion: " <<
G4endl;
239 <<
" Unable to pass Charge, Momentum and Mass " <<
G4endl;
260 fMassGeometryLimitedStep = false ;
262 if( currentMinimumStep > 0 )
268 lengthAlongCurve = fPathFinder->
ComputeStep( aFieldTrack,
282 fMassGeometryLimitedStep = true ;
287#ifdef G4DEBUG_TRANSPORT
290 std::ostringstream message;
291 message <<
" ERROR in determining geometries limiting the step" <<
G4endl;
292 message <<
" Limiting: mass=" << fMassGeometryLimitedStep
294 message <<
"Incompatible conditions - by which geometries was it limited ?";
295 G4Exception(
"G4CoupledTransportation::AlongStepGetPhysicalInteractionLength()",
300 geometryStepLength = std::min( lengthAlongCurve, currentMinimumStep);
309 fPreviousMassSafety = newMassSafety ;
310 fPreviousFullSafety = newFullSafety ;
313#ifdef G4DEBUG_TRANSPORT
316 G4cout <<
"G4Transport:CompStep> "
317 <<
" called the pathfinder for a new step at " << startPosition
318 <<
" and obtained step = " << lengthAlongCurve <<
G4endl;
319 G4cout <<
" New safety (preStep) = " << newMassSafety <<
G4endl;
324 startFullSafety = newFullSafety ;
332 geometryStepLength = lengthAlongCurve= 0.0 ;
341 endTrackState= aFieldTrack;
345 if( !fieldExertsForce )
355#ifdef G4DEBUG_TRANSPORT
358 G4cout <<
" G4CT::CS End Position = "
360 G4cout <<
" G4CT::CS End Direction = "
389 G4double absEdiff = std::fabs(startEnergy- endEnergy);
390 if( (
verboseLevel > 1) && ( absEdiff > perThousand * endEnergy) )
407 safetyProposal= startFullSafety;
413 && ( particleCharge != 0.0 ) )
431 fPreviousMassSafety = endMassSafety ;
432 fPreviousFullSafety = endFullSafety;
441#ifdef G4DEBUG_TRANSPORT
443 G4cout <<
"***CoupledTransportation::AlongStepGPIL ** " <<
G4endl ;
445 <<
" give safety values: Mass= " << endMassSafety
446 <<
" All= " << endFullSafety <<
G4endl ;
448 <<
" to obtain pseudo-safety= " << safetyProposal <<
G4endl ;
454 G4cout <<
"***CoupledTransportation::AlongStepGPIL ** " <<
G4endl ;
455 G4cout <<
" Quick Safety estimate at endpoint "
457 <<
" gives safety endpoint value = "
459 <<
" using start-point value " << startFullSafety
465 proposedSafetyForStart= safetyProposal;
468 return geometryStepLength ;
480 <<
"**************************************************************"
482 G4cerr <<
"Endpoint has moved between value expected from TransportEndPosition "
483 <<
" and value from Track in PostStepDoIt. " <<
G4endl
484 <<
"Change of " << Quantity <<
" is " << moveVec.
mag() / mm
486 <<
" and its vector is " << (1.0/mm) * moveVec <<
" mm " <<
G4endl
487 <<
"Endpoint of ComputeStep was " << OldVector
488 <<
" and current position to locate is " << NewVector <<
G4endl;
504 if( fSignifyStepInAnyVolume )
516#ifdef G4DEBUG_TRANSPORT
521 "End of Step Position" );
522 G4cerr <<
" Problem in G4CoupledTransportation::PostStepDoIt " <<
G4endl;
530 G4cout <<
" Calling PathFinder::Locate() from "
531 <<
" G4CoupledTransportation::PostStepDoIt " <<
G4endl;
549#ifdef G4DEBUG_TRANSPORT
553 G4cout <<
"CHECK !!!!!!!!!!! fCurrentTouchableHandle->GetVolume() = "
572#ifdef G4DEBUG_TRANSPORT
575 G4cout <<
"G4CoupledTransportation::PostStepDoIt -- "
577 <<
" must be false " <<
G4endl;
596#ifdef G4DEBUG_NAVIGATION
597 G4cout <<
" CoupledTransport::AlongStep GPIL: "
599 <<
" mass= " << fMassGeometryLimitedStep <<
G4endl;
602 if( fSignifyStepInAnyVolume )
631 fPreviousMassSafety = 0.0 ;
632 fPreviousFullSafety = 0.0 ;
653 moduloFactor= 10, no_large_ediff= 0;
655 if( std::fabs(startEnergy- endEnergy) > perThousand * endEnergy )
658 if( (no_large_ediff% warnModulo) == 0 )
661 std::ostringstream message;
662 message <<
"Energy change in Step is above 1^-3 relative value. "
664 <<
" Relative change in 'tracking' step = "
665 << std::setw(15) << (endEnergy-startEnergy)/startEnergy
667 <<
" Starting E= " << std::setw(12) << startEnergy / MeV
669 <<
" Ending E= " << std::setw(12) << endEnergy / MeV
671 <<
"Energy has been corrected -- however, review"
672 <<
" field propagation parameters for accuracy." <<
G4endl;
674 || (no_large_ediff == warnModulo * moduloFactor) )
676 message <<
"These include EpsilonStepMax(/Min) in G4FieldManager,"
678 <<
"which determine fractional error per step for integrated quantities."
680 <<
"Note also the influence of the permitted number of integration steps."
683 message <<
"Bad 'endpoint'. Energy change detected and corrected."
685 <<
"Has occurred already " << no_large_ediff <<
" times.";
686 G4Exception(
"G4CoupledTransportation::AlongStepGetPIL()",
688 if( no_large_ediff == warnModulo * moduloFactor )
690 warnModulo *= moduloFactor;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)
void ReportMove(G4ThreeVector OldVector, G4ThreeVector NewVector, const G4String &Quantity)
void ReportInexactEnergy(G4double startEnergy, G4double endEnergy)
G4CoupledTransportation(G4int verbosityLevel=0)
void StartTracking(G4Track *aTrack)
G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
~G4CoupledTransportation()
const G4ThreeVector & GetMomentumDirection() const
G4double GetCharge() const
G4ParticleDefinition * GetDefinition() const
G4double GetMagneticMoment() const
G4double GetTotalMomentum() const
G4bool DoesFieldChangeEnergy() const
virtual void ConfigureForTrack(const G4Track *)
const G4Field * GetDetectorField() const
const G4ThreeVector & GetMomentumDir() const
G4double GetKineticEnergy() const
G4ThreeVector GetPosition() const
G4ThreeVector GetSpin() const
G4double GetLabTimeOfFlight() const
G4bool IsGravityActive() const
G4double GetPDGMagneticMoment() const
G4double GetPDGSpin() const
G4double ComputeSafety(const G4ThreeVector &globalPoint)
void ReLocate(const G4ThreeVector &position)
unsigned int GetNumberGeometriesLimitingStep() const
G4double ObtainSafety(G4int navId, G4ThreeVector &globalCenterPoint)
G4double ComputeStep(const G4FieldTrack &pFieldTrack, G4double pCurrentProposedStepLength, G4int navigatorId, G4int stepNo, G4double &pNewSafety, ELimited &limitedStep, G4FieldTrack &EndState, G4VPhysicalVolume *currentVolume)
void Locate(const G4ThreeVector &position, const G4ThreeVector &direction, G4bool relativeSearch=true)
G4double GetCurrentSafety() const
void PrepareNewTrack(const G4ThreeVector &position, const G4ThreeVector &direction, G4VPhysicalVolume *massStartVol=nullptr)
static G4PathFinder * GetInstance()
G4TouchableHandle CreateTouchableHandle(G4int navId) const
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
G4FieldManager * GetCurrentFieldManager()
G4bool IsParticleLooping() const
G4EquationOfMotion * GetCurrentEquationOfMotion()
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4TrackStatus GetTrackStatus() const
G4VPhysicalVolume * GetVolume() const
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
G4int GetCurrentStepNumber() const
const G4DynamicParticle * GetDynamicParticle() const
const G4TouchableHandle & GetTouchableHandle() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
const G4ThreeVector & GetPolarization() const
static constexpr G4int kMassNavigatorId
static G4TransportationManager * GetTransportationManager()
G4ThreeVector fPreviousSftOrigin
G4ThreeVector fTransportEndSpin
G4double fTransportEndKineticEnergy
void SetTouchableInformation(const G4TouchableHandle &touchable)
G4PropagatorInField * fFieldPropagator
G4ThreeVector fTransportEndPosition
G4bool fEndGlobalTimeComputed
G4ParticleChangeForTransport fParticleChange
G4double fEndPointDistance
G4TouchableHandle fCurrentTouchableHandle
void StartTracking(G4Track *aTrack)
static G4bool fUseGravity
G4bool fGeometryLimitedStep
static G4bool fUseMagneticMoment
G4bool fParticleIsLooping
G4ThreeVector fTransportEndMomentumDir
G4SafetyHelper * fpSafetyHelper
G4double fCandidateEndGlobalTime
G4bool fFirstStepInVolume
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLastStepInVolume(G4bool flag)
void ProposeFirstStepInVolume(G4bool flag)
void ProposeTrueStepLength(G4double truePathLength)
const G4String & GetName() const
void SetProcessSubType(G4int)