85 fTransportEndPosition( 0.0, 0.0, 0.0 ),
86 fTransportEndMomentumDir( 0.0, 0.0, 0.0 ),
87 fTransportEndKineticEnergy( 0.0 ),
88 fTransportEndSpin( 0.0, 0.0, 0.0 ),
89 fMomentumChanged(true),
90 fEndGlobalTimeComputed(false),
91 fCandidateEndGlobalTime(0.0),
92 fParticleIsLooping( false ),
94 fFirstStepInVolume( true ),
95 fLastStepInVolume( false ),
96 fGeometryLimitedStep(true),
101 fEndPointDistance( -1.0 ),
102 fThreshold_Warning_Energy( 100 *
MeV ),
103 fThreshold_Important_Energy( 250 *
MeV ),
104 fThresholdTrials( 10 ),
105 fNoLooperTrials( 0 ),
106 fSumEnergyKilled( 0.0 ), fMaxEnergyKilled( 0.0 ),
107 fShortStepOptimisation( false ),
108 fVerboseLevel( verbosity )
137 G4cout <<
" G4Transportation constructor> set fShortStepOptimisation to ";
150 G4cout <<
" G4Transportation: Statistics for looping particles " <<
G4endl;
168 G4GPILSelection* selection )
170 G4double geometryStepLength= -1.0, newSafety= -1.0;
182 *selection = CandidateForSelection ;
208 currentSafety = 0.0 ;
231 G4bool fieldExertsForce = false ;
234 G4bool fieldExists=
false;
247 fieldExists = (ptrField!=0) ;
252 if( (particleCharge != 0.0)
254 || (gravityOn && (restMass != 0.0) )
257 fieldExertsForce = fieldExists;
265 if( !fieldExertsForce )
272 geometryStepLength = currentMinimumStep ;
285 fPreviousSftOrigin = startPosition ;
289 currentSafety = newSafety ;
295 geometryStepLength = linearStepLength ;
300 geometryStepLength = currentMinimumStep ;
332 ->GetEquationOfMotion();
340 track.GetGlobalTime(),
342 track.GetMomentumDirection(),
343 track.GetKineticEnergy(),
346 track.GetPolarization(),
352 if( currentMinimumStep > 0 )
359 track.GetVolume() ) ;
366 geometryStepLength =
std::min( lengthAlongCurve, currentMinimumStep );
370 fPreviousSftOrigin = startPosition ;
376 geometryStepLength = lengthAlongCurve= 0.0 ;
411 G4double startEnergy= track.GetKineticEnergy();
415 G4double absEdiff = std::fabs(startEnergy- endEnergy);
423 if( std::fabs(startEnergy- endEnergy) >
perThousand * endEnergy )
428 if( (no_large_ediff% warnModulo) == 0 )
431 G4cout <<
"WARNING - G4Transportation::AlongStepGetPIL() " 432 <<
" Energy change in Step is above 1^-3 relative value. " <<
G4endl 433 <<
" Relative change in 'tracking' step = " 434 << std::setw(15) << (endEnergy-startEnergy)/startEnergy <<
G4endl 435 <<
" Starting E= " << std::setw(12) << startEnergy /
MeV <<
" MeV " <<
G4endl 436 <<
" Ending E= " << std::setw(12) << endEnergy /
MeV <<
" MeV " <<
G4endl;
437 G4cout <<
" Energy has been corrected -- however, review" 438 <<
" field propagation parameters for accuracy." <<
G4endl;
439 if( (
fVerboseLevel > 2 ) || (no_warnings<4) || (no_large_ediff == warnModulo * moduloFactor) )
441 G4cout <<
" These include EpsilonStepMax(/Min) in G4FieldManager " 442 <<
" which determine fractional error per step for integrated quantities. " << G4endl
443 <<
" Note also the influence of the permitted number of integration steps." 446 G4cerr <<
"ERROR - G4Transportation::AlongStepGetPIL()" << G4endl
447 <<
" Bad 'endpoint'. Energy change detected" 448 <<
" and corrected. " 449 <<
" Has occurred already " 450 << no_large_ediff <<
" times." <<
G4endl;
451 if( no_large_ediff == warnModulo * moduloFactor )
453 warnModulo *= moduloFactor;
473 if( currentMinimumStep == 0.0 )
483 if( particleCharge != 0.0 )
487 currentSafety = endSafety ;
497 #ifdef G4DEBUG_TRANSPORT 499 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl ;
501 <<
" and it returned safety= " << endSafety <<
G4endl ;
503 <<
" to obtain pseudo-safety= " << currentSafety <<
G4endl ;
507 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl ;
508 G4cout <<
" Avoiding call to ComputeSafety : " <<
G4endl;
517 return geometryStepLength ;
526 const G4Step& stepData )
548 G4double startTime = track.GetGlobalTime() ;
554 G4double initialVelocity = stepData.GetPreStepPoint()->GetVelocity();
555 G4double stepLength = track.GetStepLength();
558 if ( initialVelocity > 0.0 ) { deltaTime = stepLength/initialVelocity; }
572 G4double restMass = track.GetDynamicParticle()->GetMass() ;
573 G4double deltaProperTime = deltaTime*( restMass/track.GetTotalEnergy() ) ;
575 fParticleChange.ProposeProperTime(track.GetProperTime() + deltaProperTime) ;
601 G4cout <<
" G4Transportation is killing track that is looping or stuck " 603 <<
" This track has " << track.GetKineticEnergy() /
MeV 604 <<
" MeV energy." <<
G4endl;
606 <<
" No of calls to AlongStepDoIt = " << noCalls
618 G4cout <<
" G4Transportation::AlongStepDoIt(): Particle looping - " 620 <<
" No of calls to = " << noCalls
651 G4ForceCondition* pForceCond )
654 *pForceCond = Forced ;
684 LocateGlobalPointAndUpdateTouchableHandle( track.GetPosition(),
685 track.GetMomentumDirection(),
717 retCurrentTouchable = track.GetTouchableHandle() ;
748 if( pNewVol!=0 && pNewMaterialCutsCouple!=0 && pNewMaterialCutsCouple->
GetMaterial()!=pNewMaterial )
752 pNewMaterialCutsCouple =
757 fParticleChange.SetMaterialCutsCoupleInTouchable( pNewMaterialCutsCouple );
G4bool EnteredDaughterVolume() const
G4double GetMagneticMoment() const
G4bool ExitedMotherVolume() const
G4bool fParticleIsLooping
G4bool fShortStepOptimisation
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)
G4bool fFirstStepInVolume
G4PropagatorInField * fFieldPropagator
const G4Material * GetMaterial() const
virtual void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double MassXc2)=0
G4bool IsParticleLooping() const
CLHEP::Hep3Vector G4ThreeVector
G4double fTransportEndKineticEnergy
void StartTracking(G4Track *aTrack)
G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)
void ClearAllChordFindersState()
G4bool fFieldExertedForce
G4bool fEndGlobalTimeComputed
G4Material * GetMaterial() const
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
G4bool DoesFieldChangeEnergy() const
G4ProductionCuts * GetProductionCuts() const
G4double GetTotalMomentum() const
static const double perThousand
G4ThreeVector fTransportEndPosition
G4SafetyHelper * fpSafetyHelper
#define fFieldExertedForce
G4ReferenceCountedHandle< G4VTouchable > G4TouchableHandle
virtual void StartTracking(G4Track *)
virtual void ConfigureForTrack(const G4Track *)
void SetGeometricallyLimitedStep()
G4GLOB_DLL std::ostream G4cout
G4double fEndPointDistance
G4double fThreshold_Important_Energy
G4bool IsGravityActive() const
G4double GetPDGMagneticMoment() const
G4SafetyHelper * GetSafetyHelper() const
G4bool DoesGlobalFieldExist()
void SetProcessSubType(G4int)
G4double GetPDGSpin() const
G4Navigator * GetNavigatorForTracking() const
const G4MagIntegratorStepper * GetStepper() const
G4ThreeVector fPreviousSftOrigin
G4bool IsLastStepInVolume()
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
G4TouchableHandle fCurrentTouchableHandle
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4Transportation(G4int verbosityLevel=1)
static G4TransportationManager * GetTransportationManager()
G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4ForceCondition *pForceCond)
G4double fMaxEnergyKilled
static const double perMillion
G4double ComputeStep(G4FieldTrack &pFieldTrack, G4double pCurrentProposedStepLength, G4double &pNewSafety, G4VPhysicalVolume *pPhysVol=0)
static G4ProductionCutsTable * GetProductionCutsTable()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
G4double GetCharge() const
G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
static G4FieldManagerStore * GetInstance()
#define fPreviousSftOrigin
std::vector< G4ThreeVector > * GimmeTrajectoryVectorAndForgetIt() const
G4double fThreshold_Warning_Energy
const G4ThreeVector & GetMomentumDirection() const
G4ChordFinder * GetChordFinder()
G4double GetLabTimeOfFlight() const
G4FieldManager * GetCurrentFieldManager()
const G4ThreeVector & GetMomentumDir() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
static G4bool fUseMagneticMoment
G4VParticleChange * pParticleChange
G4ThreeVector GetSpin() const
G4VSensitiveDetector * GetSensitiveDetector() const
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
void ClearPropagatorState()
G4ParticleDefinition * GetDefinition() const
G4ThreeVector fTransportEndSpin
G4double GetKineticEnergy() const
G4Navigator * fLinearNavigator
G4ThreeVector GetPosition() const
G4PropagatorInField * GetPropagatorInField() const
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=true)
G4LogicalVolume * GetLogicalVolume() const
G4MagInt_Driver * GetIntegrationDriver()
G4bool fGeometryLimitedStep
G4double fCandidateEndGlobalTime
G4ParticleChangeForTransport fParticleChange
virtual void LocateGlobalPointWithinVolume(const G4ThreeVector &position)
const G4Field * GetDetectorField() const
G4ThreeVector fTransportEndMomentumDir
G4GLOB_DLL std::ostream G4cerr
static G4bool fUseMagneticMoment
static G4bool EnableUseMagneticMoment(G4bool useMoment=true)
G4double fSumEnergyKilled