MCPcopy Create free account
hub / github.com/Geant4/geant4 / Update

Method Update

source/track/src/G4FieldTrackUpdator.cc:52–85  ·  view source on GitHub ↗

---------------------------------------------------------------------

Source from the content-addressed store, hash-verified

50
51//---------------------------------------------------------------------
52void G4FieldTrackUpdator::Update(G4FieldTrack* ftrk, const G4Track* trk)
53{
54 const G4DynamicParticle* ptDynamicParticle = trk->GetDynamicParticle();
55
56 // The following properties must be updated 1) for each new track, and
57 ftrk->SetRestMass(ptDynamicParticle->GetMass());
58 // 2) Since ion can lose/gain electrons, this must be done at every step
59
60 ftrk->UpdateState(trk->GetPosition(), trk->GetGlobalTime(),
61 trk->GetMomentumDirection(), trk->GetKineticEnergy());
62
63#ifdef G4CHECK
64 if((trk->GetMomentum() - ftrk->GetMomentum()).mag2() >
65 1.e-16 * trk->GetMomentum().mag2())
66 {
67 G4cerr << "ERROR> G4FieldTrackUpdator sees *Disagreement* in momentum "
68 << G4endl;
69 G4cout << " FTupdator: Tracking Momentum= " << trk->GetMomentum()
70 << G4endl;
71 G4cout << " FTupdator: FldTrack Momentum= " << ftrk->GetMomentum()
72 << G4endl;
73 G4cout << " FTupdator: FldTrack-Tracking= "
74 << ftrk->GetMomentum() - trk->GetMomentum() << G4endl;
75 }
76#endif
77
78 ftrk->SetProperTimeOfFlight(trk->GetProperTime());
79
80 ftrk->SetChargeAndMoments(ptDynamicParticle->GetCharge(),
81 ptDynamicParticle->GetMagneticMoment());
82 ftrk->SetPDGSpin(ptDynamicParticle->GetParticleDefinition()->GetPDGSpin());
83 // The charge can change during tracking
84 ftrk->SetSpin(ptDynamicParticle->GetPolarization());
85}

Callers 7

SetImageMethod · 0.45
ModifiedMethod · 0.45
addInstanceMethod · 0.45
FinishViewMethod · 0.45
ExportScreenShotMethod · 0.45
ModifiedMethod · 0.45

Calls 14

GetMomentumDirectionMethod · 0.80
GetMagneticMomentMethod · 0.80
GetPDGSpinMethod · 0.80
GetMassMethod · 0.45
GetPositionMethod · 0.45
GetGlobalTimeMethod · 0.45
GetKineticEnergyMethod · 0.45
mag2Method · 0.45
GetMomentumMethod · 0.45
GetProperTimeMethod · 0.45
GetChargeMethod · 0.45
GetParticleDefinitionMethod · 0.45

Tested by

no test coverage detected