56 fFastTrack = &fastTrack;
59 const G4Track& currentTrack = *(fFastTrack->GetPrimaryTrack());
79 theWeightChange = currentTrack.
GetWeight();
102 if (localCoordinates)
103 globalPosition = fFastTrack->GetInverseAffineTransformation()->TransformPoint(
position);
105 thePositionChange = globalPosition;
123 if (localCoordinates)
124 globalMomentum = fFastTrack->GetInverseAffineTransformation()->TransformAxis(momentum);
126 SetMomentumChange(globalMomentum.
unit());
144 if (localCoordinates)
145 globalDirection = fFastTrack->GetInverseAffineTransformation()->TransformAxis(direction);
147 SetMomentumChange(globalDirection.
unit());
166 if (localCoordinates)
168 fFastTrack->GetInverseAffineTransformation()->TransformAxis(globalPolarization);
170 thePolarizationChange = globalPolarization;
214 if (localCoordinates) {
216 globalDynamics->SetMomentumDirection(
217 fFastTrack->GetInverseAffineTransformation()->TransformAxis(
218 globalDynamics->GetMomentumDirection()));
221 globalPolarization = fFastTrack->GetInverseAffineTransformation()->TransformAxis(
222 globalDynamics->GetPolarization());
223 globalDynamics->SetPolarization(globalPolarization.
x(), globalPolarization.
y(),
224 globalPolarization.
z());
227 globalPosition = fFastTrack->GetInverseAffineTransformation()->TransformPoint(globalPosition);
233 auto secondary =
new G4Track(globalDynamics, time, globalPosition);
251 tellWhatIsWrong <<
"G4FastStep can be initialised only through G4FastTrack." <<
G4endl;
287 pPostStepPoint->
SetWeight(theWeightChange);
318 pPostStepPoint->
SetWeight(theWeightChange);
335 G4cout <<
" Position - x (mm) : " <<
G4BestUnit(thePositionChange.x(),
"Length")
337 G4cout <<
" Position - y (mm) : " <<
G4BestUnit(thePositionChange.y(),
"Length")
339 G4cout <<
" Position - z (mm) : " <<
G4BestUnit(thePositionChange.z(),
"Length")
344 G4cout <<
" Momentum Direct - x : " << std::setw(20) << theMomentumChange.x() <<
G4endl;
345 G4cout <<
" Momentum Direct - y : " << std::setw(20) << theMomentumChange.y() <<
G4endl;
346 G4cout <<
" Momentum Direct - z : " << std::setw(20) << theMomentumChange.z() <<
G4endl;
350 G4cout <<
" Polarization - x : " << std::setw(20) << thePolarizationChange.x()
352 G4cout <<
" Polarization - y : " << std::setw(20) << thePolarizationChange.y()
354 G4cout <<
" Polarization - z : " << std::setw(20) << thePolarizationChange.z()
380 G4bool exitWithError =
false;
387 ed <<
"The energy becomes larger than the initial value, difference = " << accuracy <<
" MeV"
392 exitWithError =
true;
396 G4bool itsOKforMomentum =
true;
397 if (theEnergyChange > 0.) {
398 accuracy = std::abs(theMomentumChange.mag2() - 1.0);
401 ed <<
"The Momentum Change is not a unit vector, difference = " << accuracy <<
G4endl;
403 itsOK = itsOKforMomentum =
false;
405 exitWithError =
true;
413 ed <<
"The global time is getting backward, difference = " << accuracy <<
" ns" <<
G4endl;
421 ed <<
"The proper time is getting backward, difference = " << accuracy <<
" ns" <<
G4endl;
435 ed <<
"An inaccuracy in G4FastStep is beyond tolerance." <<
G4endl;
440 if (!itsOKforMomentum) {
441 G4double vmag = theMomentumChange.mag();
442 theMomentumChange = (1. / vmag) * theMomentumChange;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
void SetPolarization(const G4ThreeVector &)
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
G4double GetProperTime() const
const G4ThreeVector & GetPolarization() const
void SetPrimaryTrackFinalKineticEnergyAndDirection(G4double, const G4ThreeVector &, G4bool localCoordinates=true)
void SetPrimaryTrackFinalPosition(const G4ThreeVector &, G4bool localCoordinates=true)
G4bool CheckIt(const G4Track &) override
void SetPrimaryTrackFinalPolarization(const G4ThreeVector &, G4bool localCoordinates=true)
G4Step * UpdateStepForPostStep(G4Step *Step) override
void ProposePrimaryTrackFinalKineticEnergyAndDirection(G4double, const G4ThreeVector &, G4bool localCoordinates=true)
void DumpInfo() const override
void SetPrimaryTrackFinalMomentum(const G4ThreeVector &, G4bool localCoordinates=true)
void ProposePrimaryTrackFinalPosition(const G4ThreeVector &, G4bool localCoordinates=true)
G4Step * UpdateStepForAtRest(G4Step *Step) override
void ProposePrimaryTrackFinalPolarization(const G4ThreeVector &, G4bool localCoordinates=true)
void ProposePrimaryTrackFinalKineticEnergy(G4double)
void ProposePrimaryTrackFinalMomentumDirection(const G4ThreeVector &, G4bool localCoordinates=true)
G4Track * CreateSecondaryTrack(const G4DynamicParticle &, G4ThreeVector, G4ThreeVector, G4double, G4bool localCoordinates=true)
void Initialize(const G4FastTrack &)
void SetKineticEnergy(const G4double aValue)
void SetWeight(G4double aValue)
void SetProperTime(const G4double aValue)
void SetGlobalTime(const G4double aValue)
void SetPosition(const G4ThreeVector &aValue)
void AddLocalTime(const G4double aValue)
void SetMomentumDirection(const G4ThreeVector &aValue)
void SetPolarization(const G4ThreeVector &aValue)
G4Track * GetTrack() const
G4StepPoint * GetPostStepPoint() const
G4double GetWeight() const
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
G4double GetProperTime() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetKineticEnergy() const
virtual G4bool CheckIt(const G4Track &)
void ProposeTrackStatus(G4TrackStatus status)
G4SteppingControl theSteppingControlFlag
virtual void Initialize(const G4Track &)
G4double GetAccuracyForException() const
void AddSecondary(G4Track *aSecondary)
G4double GetAccuracyForWarning() const
virtual void DumpInfo() const
G4Step * UpdateStepInfo(G4Step *Step)