93 firstParticle(nullptr),
94 currParticle(nullptr),
97 latDisplacement(true),
99 fNewPosition(0.,0.,0.),
100 fNewDirection(0.,0.,1.)
107 lowestKinEnergy = 10*CLHEP::eV;
109 physStepLimit = gPathLength = tPathLength = 0.0;
110 fIonisation =
nullptr;
112 geomMin = 0.05*CLHEP::nm;
113 minDisplacement2 = geomMin*geomMin;
116 safetyHelper =
nullptr;
117 fPositionChanged =
false;
120 currentModel =
nullptr;
123 mscModels.reserve(2);
148 modelManager->
AddEmModel(order, p, fm, region);
156 for(
auto & msc : mscModels) {
if(msc == p) {
return; } }
157 mscModels.push_back(p);
164 return (index < mscModels.size()) ? mscModels[index] :
nullptr;
173 G4cout <<
"### G4VMultipleScattering::PrepearPhysicsTable() for "
180 if(!firstParticle) { firstParticle = ∂ }
183 latDisplacement =
false;
186 if(pname !=
"deuteron" && pname !=
"triton" &&
187 pname !=
"alpha+" && pname !=
"helium" &&
188 pname !=
"alpha" && pname !=
"He3" &&
189 pname !=
"hydrogen") {
193 if(&part == theGenericIon) { isIon =
true; }
195 if(theGenericIon && firstParticle != theGenericIon) {
198 size_t n = v->
size();
199 for(
size_t j=0; j<n; ++j) {
200 if((*v)[j] ==
this) {
201 firstParticle = theGenericIon;
211 currParticle =
nullptr;
214 G4cout <<
"### G4VMultipleScattering::PrepearPhysicsTable() for "
218 <<
" isIon: " << isIon <<
" isMaster: " << master
222 if(firstParticle == &part) {
251 for(
G4int i=0; i<numberOfModels; ++i) {
253 if(!msc) {
continue; }
281 G4cout <<
"### G4VMultipleScattering::BuildPhysicsTable() for "
283 <<
" and particle " << num <<
" isIon: " << isIon
284 <<
" IsMaster: " << master <<
G4endl;
289 if(firstParticle == &part) {
309 for(
G4int i=0; i<numberOfModels; ++i) {
311 if(!msc) {
continue; }
323 num ==
"e+" || num ==
"mu+" ||
324 num ==
"mu-" || num ==
"proton"||
325 num ==
"pi+" || num ==
"pi-" ||
326 num ==
"kaon+" || num ==
"kaon-" ||
327 num ==
"alpha" || num ==
"anti_proton" ||
328 num ==
"GenericIon" || num ==
"alpha+" ||
335 G4cout <<
"### G4VMultipleScattering::BuildPhysicsTable() done for "
337 <<
" and particle " << num
344void G4VMultipleScattering::StreamInfo(std::ostream& outFile,
373 for(
G4int i=0; i<numberOfModels; ++i) {
384 if(mscmod) { mscmod->
SetIonisation(fIonisation, currParticle); }
400 physStepLimit = gPathLength = tPathLength = currentMinimalStep;
415 if(1 < numberOfModels) {
422 if(currentModel->
IsActive(ekin) && tPathLength > geomMin
423 && ekin >= lowestKinEnergy) {
427 if (tPathLength < physStepLimit) {
430 }
else { isActive =
false; }
463 fPositionChanged =
false;
469 tPathLength = geomLength;
489 tPathLength = std::min(tPathLength, physStepLimit);
492 if(tPathLength < range && tPathLength > geomMin) {
494 static const G4double minSafety = 1.20*CLHEP::nm;
503 if(r2 > minDisplacement2) {
505 fPositionChanged =
true;
512 if(postSafety > 0.0 && dispR <= postSafety) {
513 fNewPosition += displacement;
519 if(dispR < postSafety) {
520 fNewPosition += displacement;
523 }
else if(postSafety > geomMin) {
524 fNewPosition += displacement*(postSafety/dispR);
528 fPositionChanged =
false;
531 if(fPositionChanged) {
596 if(part != firstParticle) {
return yes; }
599 if(masterProcess && masterProcess !=
this) {
return yes; }
602 static const G4String ss[4] = {
"1",
"2",
"3",
"4"};
603 for(
G4int i=0; i<nmod; ++i) {
608 G4int j = std::min(i,3);
615 G4cout <<
"Physics table are stored for "
618 <<
" with a name <" << name <<
"> " <<
G4endl;
621 G4cout <<
"Fail to store Physics Table for "
624 <<
" in the directory <" << directory
646 for(
G4int i=0; i<numberOfModels; ++i) {
657 StreamInfo(outFile, *firstParticle,
true);
G4double condition(const G4ErrorSymMatrix &m)
@ NotCandidateForSelection
G4GLOB_DLL std::ostream G4cout
static G4Electron * Electron()
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *, const G4Region *)
void DumpModelList(std::ostream &out, G4int verb)
G4int NumberOfModels() const
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4double minSubRange, G4int verb)
G4VEmModel * GetModel(G4int idx, G4bool ver=false)
static G4EmParameters * Instance()
G4double MscMuHadRangeFactor() const
G4double MscThetaLimit() const
G4MscStepLimitType MscMuHadStepLimitType() const
G4int WorkerVerbose() const
G4MscStepLimitType MscStepLimitType() const
G4double MaxKinEnergy() const
G4bool LateralDisplacement() const
G4bool MuHadLateralDisplacement() const
G4double MscRangeFactor() const
static G4GenericIon * GenericIon()
static G4LossTableManager * Instance()
G4VEnergyLossProcess * GetEnergyLossProcess(const G4ParticleDefinition *)
void PreparePhysicsTable(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p, G4bool theMaster)
void BuildPhysicsTable(const G4ParticleDefinition *aParticle)
void DeRegister(G4VEnergyLossProcess *p)
void Register(G4VEnergyLossProcess *p)
virtual void Initialize(const G4Track &)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
void ProposePosition(const G4ThreeVector &finalPosition)
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleType() const
G4double GetPDGMass() const
const G4String & GetParticleName() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4bool StorePhysicsTable(const G4String &filename, G4bool ascii=false)
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
G4double ComputeSafety(const G4ThreeVector &pGlobalPoint, G4double maxRadius=DBL_MAX)
void ReLocateWithinVolume(const G4ThreeVector &pGlobalPoint)
const G4ThreeVector & GetPosition() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetStepLength() const
G4StepPoint * GetPostStepPoint() const
const G4ParticleDefinition * GetParticleDefinition() const
G4double GetKineticEnergy() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
static G4TransportationManager * GetTransportationManager()
G4SafetyHelper * GetSafetyHelper() const
void SetCrossSectionTable(G4PhysicsTable *, G4bool isLocal)
void SetPolarAngleLimit(G4double)
void SetHighEnergyLimit(G4double)
void SetMasterThread(G4bool val)
void SetParticleChange(G4VParticleChange *, G4VEmFluctuationModel *f=nullptr)
G4double HighEnergyLimit() const
G4bool IsActive(G4double kinEnergy) const
G4PhysicsTable * GetCrossSectionTable()
virtual void StartTracking(G4Track *)
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel)
virtual G4double ComputeTruePathLengthLimit(const G4Track &track, G4double &stepLimit)=0
void SetIonisation(G4VEnergyLossProcess *, const G4ParticleDefinition *part)
virtual G4double ComputeTrueStepLength(G4double geomPathLength)=0
G4double GetRange(const G4ParticleDefinition *part, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
virtual G4ThreeVector & SampleScattering(const G4ThreeVector &, G4double safety)=0
void SetIonisation(G4VEnergyLossProcess *)
G4double GetMeanFreePath(const G4Track &track, G4double, G4ForceCondition *condition) override
G4ParticleChangeForMSC fParticleChange
void AddEmModel(G4int order, G4VEmModel *, const G4Region *region=nullptr)
void StartTracking(G4Track *) override
G4VEmModel * GetModelByIndex(G4int idx=0, G4bool ver=false) const
void PreparePhysicsTable(const G4ParticleDefinition &) override
void BuildPhysicsTable(const G4ParticleDefinition &) override
G4double ContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimalStep, G4double ¤tSafety)
G4VMultipleScattering(const G4String &name="msc", G4ProcessType type=fElectromagnetic)
void SetEmModel(G4VMscModel *, size_t index=0)
virtual void ProcessDescription(std::ostream &outFile) const override
G4bool RetrievePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii) override
virtual void InitialiseProcess(const G4ParticleDefinition *)=0
G4double AlongStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4double currentMinimalStep, G4double ¤tSafety, G4GPILSelection *selection) override
G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4ForceCondition *condition) override
G4VParticleChange * AlongStepDoIt(const G4Track &, const G4Step &) override
G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &) override
G4bool StorePhysicsTable(const G4ParticleDefinition *, const G4String &directory, G4bool ascii=false) override
G4VEmModel * SelectModel(G4double kinEnergy, size_t idx)
virtual ~G4VMultipleScattering()
G4double GetContinuousStepLimit(const G4Track &track, G4double previousStepSize, G4double currentMinimalStep, G4double ¤tSafety) override
G4VMscModel * EmModel(size_t index=0) const
void ProposeTrueStepLength(G4double truePathLength)
void SetVerboseLevel(G4int value)
const G4VProcess * GetMasterProcess() const
void SetProcessSubType(G4int)
G4VParticleChange * pParticleChange
G4int GetProcessSubType() const
const G4String & GetPhysicsTableFileName(const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
const G4String & GetProcessName() const