153 fParticleIsLooping = false ;
174 #ifdef G4DEBUG_TRANSPORT
175 if( fVerboseLevel > 1 )
177 G4cout <<
"G4CoupledTransportation::AlongStepGPIL> called in volume "
187 G4ThreeVector OriginShift = startPosition - fPreviousSftOrigin ;
189 startMassSafety = 0.0;
190 startFullSafety= 0.0;
194 if( MagSqShift <
sqr(fPreviousFullSafety) )
196 G4double mag_shift= std::sqrt(MagSqShift);
197 startMassSafety =
std::max( (fPreviousMassSafety - mag_shift), 0.0);
198 startFullSafety =
std::max( (fPreviousFullSafety - mag_shift), 0.0);
212 fMassGeometryLimitedStep = false ;
213 fAnyGeometryLimitedStep =
false;
224 G4bool fieldExertsForce = false ;
243 if( (particleCharge != 0.0)
244 || (fUseMagneticMoment && (magneticMoment != 0.0) )
245 || (gravityOn && (restMass != 0.0))
248 fieldExertsForce =
true;
254 if( fieldExertsForce )
286 if( equationOfMotion )
309 fMassGeometryLimitedStep = false ;
310 fAnyGeometryLimitedStep = false ;
311 if( currentMinimumStep > 0 )
317 lengthAlongCurve = fPathFinder->
ComputeStep( theFieldTrack,
333 fMassGeometryLimitedStep = true ;
339 if( fMassGeometryLimitedStep && !fAnyGeometryLimitedStep )
341 G4cerr <<
" Error in determining geometries limiting the step" <<
G4endl;
342 G4cerr <<
" Limiting: mass=" << fMassGeometryLimitedStep
343 <<
" any= " << fAnyGeometryLimitedStep <<
G4endl;
344 G4Exception(
"G4CoupledTransportation::AlongStepGetPhysicalInteractionLength()",
346 "Incompatible conditions - was limited by a geometry?");
356 geometryStepLength =
std::min( lengthAlongCurve, currentMinimumStep);
360 fMomentumChanged = true ;
361 fTransportEndMomentumDir = endTrackState.GetMomentumDir() ;
364 fPreviousSftOrigin = startPosition ;
365 fPreviousMassSafety = newMassSafety ;
366 fPreviousFullSafety = newFullSafety ;
369 #ifdef G4DEBUG_TRANSPORT
370 if( fVerboseLevel > 1 )
372 G4cout <<
"G4Transport:CompStep> "
373 <<
" called the pathfinder for a new step at " << startPosition
374 <<
" and obtained step = " << lengthAlongCurve <<
G4endl;
375 G4cout <<
" New safety (preStep) = " << newMassSafety
376 <<
" versus precalculated = " << startMassSafety <<
G4endl;
381 startMassSafety = newMassSafety ;
382 startFullSafety = newFullSafety ;
385 fTransportEndPosition = endTrackState.GetPosition() ;
386 fTransportEndKineticEnergy = endTrackState.GetKineticEnergy() ;
390 geometryStepLength = lengthAlongCurve= 0.0 ;
391 fMomentumChanged = false ;
397 fTransportEndPosition = startPosition;
400 if( startMassSafety == 0.0 )
402 fMassGeometryLimitedStep = true ;
403 fAnyGeometryLimitedStep =
true;
409 if( !fieldExertsForce )
411 fParticleIsLooping = false ;
412 fMomentumChanged = false ;
413 fEndGlobalTimeComputed = false ;
419 #ifdef G4DEBUG_TRANSPORT
420 if( fVerboseLevel > 1 )
422 G4cout <<
" G4CT::CS End Position = " << fTransportEndPosition <<
G4endl;
423 G4cout <<
" G4CT::CS End Direction = " << fTransportEndMomentumDir <<
G4endl;
431 fCandidateEndGlobalTime = endTrackState.GetLabTimeOfFlight();
432 fEndGlobalTimeComputed =
true;
442 fEndGlobalTimeComputed =
false;
447 G4double endEnergy= fTransportEndKineticEnergy;
450 G4double absEdiff = std::fabs(startEnergy- endEnergy);
457 if( (fVerboseLevel > 1) && ( absEdiff >
perThousand * endEnergy) )
469 endpointDistance = (fTransportEndPosition - startPosition).mag() ;
472 fTransportEndSpin = endTrackState.GetSpin();
475 safetyProposal= startFullSafety;
480 if( (startFullSafety < endpointDistance )
481 && ( particleCharge != 0.0 ) )
499 fPreviousMassSafety = endMassSafety ;
500 fPreviousFullSafety = endFullSafety;
501 fPreviousSftOrigin = fTransportEndPosition ;
505 safetyProposal = endFullSafety + endpointDistance;
511 #ifdef G4DEBUG_TRANSPORT
513 G4cout <<
"***Transportation::AlongStepGPIL ** " <<
G4endl ;
514 G4cout <<
" Revised Safety at endpoint " << fTransportEndPosition
515 <<
" give safety values: Mass= " << endMassSafety
516 <<
" All= " << endFullSafety <<
G4endl ;
517 G4cout <<
" Adding endpoint distance " << endpointDistance
518 <<
" to obtain pseudo-safety= " << safetyProposal <<
G4endl ;
524 G4cout <<
"***Transportation::AlongStepGPIL ** " <<
G4endl ;
525 G4cout <<
" Quick Safety estimate at endpoint " << fTransportEndPosition
526 <<
" gives safety endpoint value = " << startFullSafety - endpointDistance
527 <<
" using start-point value " << startFullSafety
528 <<
" and endpointDistance " << endpointDistance <<
G4endl;
533 proposedSafetyForStart= safetyProposal;
536 return geometryStepLength ;
const G4ThreeVector & GetPolarization() const
G4double ObtainSafety(G4int navId, G4ThreeVector &globalCenterPoint)
virtual void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double MassXc2)=0
G4double GetProperTime() const
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
G4double GetPDGMass() const
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)
const G4Field * GetDetectorField() const
G4MagInt_Driver * GetIntegrationDriver()
G4double GetMagneticMoment() const
G4GLOB_DLL std::ostream G4cerr