59static constexpr G4double kLowestKinEnergy = 10 * CLHEP::eV;
60static constexpr G4double kGeomMin = 0.05 * CLHEP::nm;
61static constexpr G4double kMinDisplacement2 = kGeomMin * kGeomMin;
76 fSubStepDynamicParticle =
78 fSubStepTrack =
new G4Track(fSubStepDynamicParticle, 0, zero);
80 fSubStepTrack->
SetStep(fSubStep);
100 G4Exception(
"G4TransportationWithMsc::AddMscModel",
"em0051",
102 "not allowed unless type == MultipleScattering");
105 fModelManager->
AddEmModel(order, mscModel,
nullptr, region);
114 if(
nullptr == fFirstParticle)
116 fFirstParticle = ∂
122 if(fFirstParticle == &part)
139 for(
G4int i = 0; i < numberOfModels; ++i)
143 msc->SetPolarAngleLimit(theParameters->MscThetaLimit());
145 std::min(msc->HighEnergyLimit(), theParameters->MaxKinEnergy());
146 msc->SetHighEnergyLimit(emax);
147 msc->SetUseBaseMaterials(baseMat);
160 if(fFirstParticle == &part)
166 const auto masterProcess =
171 for(
G4int i = 0; i < numberOfModels; ++i)
175 static_cast<G4VMscModel*
>(masterProcess->fModelManager->GetModel(i));
177 msc->InitialiseLocal(fFirstParticle, msc0);
188 G4cout <<
" (multipleSteps: 1)";
205 for(
G4int i = 0; i < numberOfModels; ++i)
209 msc->SetIonisation(ionisation, currParticle);
224 const G4double physStepLimit = currentMinimumStep;
234 if(physStepLimit > kGeomMin)
238 if(pdgMass > CLHEP::GeV)
240 ekinForSelection *= proton_mass_c2 / pdgMass;
243 if(ekinForSelection >= kLowestKinEnergy)
246 fModelManager->
SelectModel(ekinForSelection, couple->GetIndex()));
247 if(mscModel ==
nullptr)
249 G4Exception(
"G4TransportationWithMsc::AlongStepGPIL",
"em0052",
252 if(!mscModel->
IsActive(ekinForSelection))
261 if(mscModel !=
nullptr)
266 const G4Track* currentTrackPtr = &track;
268 G4double currentSafety = proposedSafety;
271 G4double stepLimitLeft = physStepLimit;
272 G4double totalGeometryStepLength = 0, totalTruePathLength = 0;
273 G4bool firstStep =
true, continueStepping = fMultipleSteps;
277 G4double gPathLength = stepLimitLeft;
280 G4bool mscLimitsStep = (tPathLength < stepLimitLeft);
281 if(!fMultipleSteps && mscLimitsStep)
297 *currentTrackPtr, previousStepSize, gPathLength, currentSafety,
298 &transportSelection);
299 if(geometryStepLength < gPathLength)
303 continueStepping =
false;
309 continueStepping =
false;
314 proposedSafety = currentSafety;
316 totalGeometryStepLength += geometryStepLength;
320 mscModel->
GetRange(particleDefinition, currentEnergy, couple);
325 tPathLength = std::min(tPathLength, stepLimitLeft);
327 totalTruePathLength += tPathLength;
332 continueStepping =
false;
334 else if(tPathLength >= range)
337 continueStepping =
false;
341 stepLimitLeft -= tPathLength;
345 if(tPathLength < range && tPathLength > kGeomMin)
347 static constexpr G4double minSafety = 1.20 * CLHEP::nm;
348 static constexpr G4double sFact = 0.99;
362 if(r2 > kMinDisplacement2)
364 G4bool positionChanged =
true;
370 if(postSafety > 0.0 && dispR <= postSafety)
379 if(dispR < postSafety)
385 else if(postSafety > kGeomMin)
393 positionChanged =
false;
416 currentEnergy = mscModel->
GetEnergy(particleDefinition,
417 range - tPathLength, couple);
420 currentTrackPtr = fSubStepTrack;
430 subPreStepPoint.
SetSafety(currentSafety);
434 }
while(continueStepping);
440 if(currentEnergy != ekin)
449 (void) mscModel->
GetRange(particleDefinition, ekin, couple);
454 return totalGeometryStepLength;
461 track, previousStepSize, currentMinimumStep, proposedSafety, selection);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
@ NotCandidateForSelection
G4GLOB_DLL std::ostream G4cout
void SetMomentumDirection(const G4ThreeVector &aDirection)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetKineticEnergy(G4double aEnergy)
static G4Electron * Definition()
static G4Electron * Electron()
void PrepareModels(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p)
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fm, const G4Region *r)
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4int verb)
G4VEmModel * SelectModel(G4double energy, std::size_t index)
void DumpModelList(std::ostream &out, G4int verb)
G4int NumberOfModels() const
G4VEmModel * GetModel(G4int idx, G4bool ver=false) const
G4bool IsPrintLocked() const
static G4EmParameters * Instance()
G4bool GetBaseMaterialFlag()
static G4LossTableManager * Instance()
G4VEnergyLossProcess * GetEnergyLossProcess(const G4ParticleDefinition *)
G4LossTableBuilder * GetTableBuilder()
void BuildPhysicsTable(const G4ParticleDefinition *aParticle)
G4EmConfigurator * EmConfigurator()
virtual void LocateGlobalPointWithinVolume(const G4ThreeVector &position)
const G4ThreeVector * GetMomentumDirection() const
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4double GetPDGMass() const
const G4String & GetParticleName() const
G4double ComputeSafety(const G4ThreeVector &pGlobalPoint, G4double maxRadius=DBL_MAX)
void ReLocateWithinVolume(const G4ThreeVector &pGlobalPoint)
void SetSafety(const G4double aValue)
void SetStepStatus(const G4StepStatus aValue)
void SetMaterialCutsCouple(const G4MaterialCutsCouple *)
void SetPosition(const G4ThreeVector &aValue)
G4StepPoint * GetPreStepPoint() const
void SetPosition(const G4ThreeVector &aValue)
void SetStep(const G4Step *aValue)
const G4ParticleDefinition * GetParticleDefinition() const
G4double GetKineticEnergy() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
void AddMscModel(G4VMscModel *mscModel, G4int order=0, const G4Region *region=nullptr)
void BuildPhysicsTable(const G4ParticleDefinition &part) override
~G4TransportationWithMsc() override
void StartTracking(G4Track *track) override
G4TransportationWithMsc(ScatteringType type, G4int verbosity=0)
G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection) override
void PreparePhysicsTable(const G4ParticleDefinition &part) override
G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double ¤tSafety, G4GPILSelection *selection)
G4double fTransportEndKineticEnergy
G4ThreeVector fTransportEndPosition
G4ParticleChangeForTransport fParticleChange
G4double fEndPointDistance
void StartTracking(G4Track *aTrack)
G4Navigator * fLinearNavigator
G4ThreeVector fTransportEndMomentumDir
G4SafetyHelper * fpSafetyHelper
void SetCrossSectionTable(G4PhysicsTable *, G4bool isLocal)
void SetMasterThread(G4bool val)
void SetCurrentCouple(const G4MaterialCutsCouple *)
void SetParticleChange(G4VParticleChange *, G4VEmFluctuationModel *f=nullptr)
G4bool IsActive(G4double kinEnergy) const
virtual void StartTracking(G4Track *)
virtual G4double ComputeTruePathLengthLimit(const G4Track &track, G4double &stepLimit)=0
virtual G4double ComputeTrueStepLength(G4double geomPathLength)=0
G4double GetEnergy(const G4ParticleDefinition *part, G4double range, const G4MaterialCutsCouple *couple)
G4double GetRange(const G4ParticleDefinition *part, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
virtual G4ThreeVector & SampleScattering(const G4ThreeVector &, G4double safety)=0
void ProposeTrueStepLength(G4double truePathLength)
void SetVerboseLevel(G4int value)
const G4VProcess * GetMasterProcess() const
const G4String & GetProcessName() const