157 fParticleIsLooping = false ;
178 #ifdef G4DEBUG_TRANSPORT
179 if( fVerboseLevel > 1 )
181 G4cout <<
"G4CoupledTransportation::AlongStepGPIL> called in volume "
193 startMassSafety = 0.0;
194 startFullSafety= 0.0;
198 if( MagSqShift <
sqr(fPreviousFullSafety) )
200 G4double mag_shift= std::sqrt(MagSqShift);
201 startMassSafety =
std::max( (fPreviousMassSafety - mag_shift), 0.0);
202 startFullSafety =
std::max( (fPreviousFullSafety - mag_shift), 0.0);
216 fMassGeometryLimitedStep = false ;
217 fAnyGeometryLimitedStep =
false;
228 G4bool fieldExertsForce = false ;
247 if( (particleCharge != 0.0)
248 || (fUseMagneticMoment && (magneticMoment != 0.0) )
249 || (gravityOn && (restMass != 0.0))
252 fieldExertsForce =
true;
258 if( fieldExertsForce )
293 if( equationOfMotion )
299 G4cerr <<
" ERROR > Cannot find valid Equation of motion - Unable to pass Charge, Momentum and Mass " <<
G4endl;
321 fMassGeometryLimitedStep = false ;
322 fAnyGeometryLimitedStep = false ;
323 if( currentMinimumStep > 0 )
329 lengthAlongCurve = fPathFinder->
ComputeStep( aFieldTrack,
345 fMassGeometryLimitedStep = true ;
351 if( fMassGeometryLimitedStep && !fAnyGeometryLimitedStep )
353 G4cerr <<
" Error in determining geometries limiting the step" <<
G4endl;
354 G4cerr <<
" Limiting: mass=" << fMassGeometryLimitedStep
355 <<
" any= " << fAnyGeometryLimitedStep <<
G4endl;
356 G4Exception(
"G4CoupledTransportation::AlongStepGetPhysicalInteractionLength()",
358 "Incompatible conditions - was limited by a geometry?");
368 geometryStepLength =
std::min( lengthAlongCurve, currentMinimumStep);
372 fMomentumChanged = true ;
373 fTransportEndMomentumDir = endTrackState.GetMomentumDir() ;
376 fPreviousSftOrigin = startPosition ;
377 fPreviousMassSafety = newMassSafety ;
378 fPreviousFullSafety = newFullSafety ;
381 #ifdef G4DEBUG_TRANSPORT
382 if( fVerboseLevel > 1 )
384 G4cout <<
"G4Transport:CompStep> "
385 <<
" called the pathfinder for a new step at " << startPosition
386 <<
" and obtained step = " << lengthAlongCurve <<
G4endl;
387 G4cout <<
" New safety (preStep) = " << newMassSafety
388 <<
" versus precalculated = " << startMassSafety <<
G4endl;
393 startMassSafety = newMassSafety ;
394 startFullSafety = newFullSafety ;
397 fTransportEndPosition = endTrackState.GetPosition() ;
398 fTransportEndKineticEnergy = endTrackState.GetKineticEnergy() ;
402 geometryStepLength = lengthAlongCurve= 0.0 ;
403 fMomentumChanged = false ;
409 fTransportEndPosition = startPosition;
411 endTrackState= aFieldTrack;
415 if( startMassSafety == 0.0 )
417 fMassGeometryLimitedStep = true ;
418 fAnyGeometryLimitedStep =
true;
424 if( !fieldExertsForce )
426 fParticleIsLooping = false ;
427 fMomentumChanged = false ;
428 fEndGlobalTimeComputed = false ;
434 #ifdef G4DEBUG_TRANSPORT
435 if( fVerboseLevel > 1 )
437 G4cout <<
" G4CT::CS End Position = " << fTransportEndPosition <<
G4endl;
438 G4cout <<
" G4CT::CS End Direction = " << fTransportEndMomentumDir <<
G4endl;
446 fCandidateEndGlobalTime = endTrackState.GetLabTimeOfFlight();
447 fEndGlobalTimeComputed =
true;
457 fEndGlobalTimeComputed =
false;
462 G4double endEnergy= fTransportEndKineticEnergy;
465 G4double absEdiff = std::fabs(startEnergy- endEnergy);
472 if( (fVerboseLevel > 1) && ( absEdiff >
perThousand * endEnergy) )
484 fEndpointDistance = (fTransportEndPosition - startPosition).mag() ;
487 fTransportEndSpin = endTrackState.GetSpin();
490 safetyProposal= startFullSafety;
495 if( (startFullSafety < fEndpointDistance )
496 && ( particleCharge != 0.0 ) )
514 fPreviousMassSafety = endMassSafety ;
515 fPreviousFullSafety = endFullSafety;
516 fPreviousSftOrigin = fTransportEndPosition ;
520 safetyProposal = endFullSafety + fEndpointDistance;
526 #ifdef G4DEBUG_TRANSPORT
528 G4cout <<
"***Transportation::AlongStepGPIL ** " <<
G4endl ;
529 G4cout <<
" Revised Safety at endpoint " << fTransportEndPosition
530 <<
" give safety values: Mass= " << endMassSafety
531 <<
" All= " << endFullSafety <<
G4endl ;
532 G4cout <<
" Adding endpoint distance " << fEndpointDistance
533 <<
" to obtain pseudo-safety= " << safetyProposal <<
G4endl ;
539 G4cout <<
"***Transportation::AlongStepGPIL ** " <<
G4endl ;
540 G4cout <<
" Quick Safety estimate at endpoint " << fTransportEndPosition
541 <<
" gives safety endpoint value = " << startFullSafety - fEndpointDistance
542 <<
" using start-point value " << startFullSafety
543 <<
" and endpointDistance " << fEndpointDistance <<
G4endl;
548 proposedSafetyForStart= safetyProposal;
551 return geometryStepLength ;
static constexpr double perMillion
const G4ThreeVector & GetPolarization() const
G4double ObtainSafety(G4int navId, G4ThreeVector &globalCenterPoint)
virtual void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double MassXc2)=0
CLHEP::Hep3Vector G4ThreeVector
G4double GetCurrentSafety() const
const G4DynamicParticle * GetDynamicParticle() const
const G4MagIntegratorStepper * GetStepper() const
const G4ThreeVector & GetPosition() const
G4ParticleDefinition * GetDefinition() const
unsigned int GetNumberGeometriesLimitingStep() const
G4double GetTotalMomentum() const
virtual void ConfigureForTrack(const G4Track *)
G4double GetKineticEnergy() const
G4EquationOfMotion * GetEquationOfMotion()
G4GLOB_DLL std::ostream G4cout
void ReportInexactEnergy(G4double startEnergy, G4double endEnergy)
G4int GetCurrentStepNumber() const
const G4String & GetName() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetCharge() const
void ProposeTrueStepLength(G4double truePathLength)
G4double ComputeStep(const G4FieldTrack &pFieldTrack, G4double pCurrentProposedStepLength, G4int navigatorId, G4int stepNo, G4double &pNewSafety, ELimited &limitedStep, G4FieldTrack &EndState, G4VPhysicalVolume *currentVolume)
G4bool DoesFieldChangeEnergy() const
G4double ComputeSafety(const G4ThreeVector &globalPoint)
G4double GetGlobalTime() const
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const G4ThreeVector & GetMomentumDirection() const
#define fPreviousSftOrigin
G4bool IsParticleLooping() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4bool IsGravityActive() const
G4ChordFinder * GetChordFinder()
G4FieldManager * GetCurrentFieldManager()
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4VPhysicalVolume * GetVolume() const
G4double GetPDGSpin() const
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
static constexpr double perThousand
G4double GetPDGMagneticMoment() const
const G4Field * GetDetectorField() const
G4MagInt_Driver * GetIntegrationDriver()
G4double GetMagneticMoment() const
G4GLOB_DLL std::ostream G4cerr