Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AdjointhIonisationModel Class Reference

#include <G4AdjointhIonisationModel.hh>

+ Inheritance diagram for G4AdjointhIonisationModel:

Public Member Functions

 G4AdjointhIonisationModel (G4ParticleDefinition *pDef)
 
 ~G4AdjointhIonisationModel () override
 
void SampleSecondaries (const G4Track &aTrack, G4bool isScatProjToProj, G4ParticleChange *fParticleChange) override
 
void RapidSampleSecondaries (const G4Track &aTrack, G4bool isScatProjToProj, G4ParticleChange *fParticleChange)
 
G4double DiffCrossSectionPerAtomPrimToSecond (G4double kinEnergyProj, G4double kinEnergyProd, G4double Z, G4double A=0.) override
 
G4double AdjointCrossSection (const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool isScatProjToProj) override
 
G4double GetSecondAdjEnergyMaxForScatProjToProj (G4double primAdjEnergy) override
 
G4double GetSecondAdjEnergyMinForScatProjToProj (G4double primAdjEnergy, G4double tcut=0.) override
 
G4double GetSecondAdjEnergyMaxForProdToProj (G4double primAdjEnergy) override
 
G4double GetSecondAdjEnergyMinForProdToProj (G4double primAdjEnergy) override
 
 G4AdjointhIonisationModel (G4AdjointhIonisationModel &)=delete
 
G4AdjointhIonisationModeloperator= (const G4AdjointhIonisationModel &right)=delete
 
- Public Member Functions inherited from G4VEmAdjointModel
 G4VEmAdjointModel (const G4String &nam)
 
virtual ~G4VEmAdjointModel ()
 
virtual void SampleSecondaries (const G4Track &aTrack, G4bool isScatProjToProj, G4ParticleChange *fParticleChange)=0
 
virtual G4double AdjointCrossSection (const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool isScatProjToProj)
 
virtual G4double DiffCrossSectionPerAtomPrimToSecond (G4double kinEnergyProj, G4double kinEnergyProd, G4double Z, G4double A=0.)
 
virtual G4double DiffCrossSectionPerAtomPrimToScatPrim (G4double kinEnergyProj, G4double kinEnergyScatProj, G4double Z, G4double A=0.)
 
virtual G4double DiffCrossSectionPerVolumePrimToSecond (const G4Material *aMaterial, G4double kinEnergyProj, G4double kinEnergyProd)
 
virtual G4double DiffCrossSectionPerVolumePrimToScatPrim (const G4Material *aMaterial, G4double kinEnergyProj, G4double kinEnergyScatProj)
 
virtual G4double GetSecondAdjEnergyMaxForScatProjToProj (G4double primAdjEnergy)
 
virtual G4double GetSecondAdjEnergyMinForScatProjToProj (G4double primAdjEnergy, G4double tcut=0.)
 
virtual G4double GetSecondAdjEnergyMaxForProdToProj (G4double primAdjEnergy)
 
virtual G4double GetSecondAdjEnergyMinForProdToProj (G4double primAdjEnergy)
 
void DefineCurrentMaterial (const G4MaterialCutsCouple *couple)
 
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerAtomForSecond (G4double kinEnergyProd, G4double Z, G4double A=0., G4int nbin_pro_decade=10)
 
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerAtomForScatProj (G4double kinEnergyProd, G4double Z, G4double A=0., G4int nbin_pro_decade=10)
 
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerVolumeForSecond (G4Material *aMaterial, G4double kinEnergyProd, G4int nbin_pro_decade=10)
 
std::vector< std::vector< double > * > ComputeAdjointCrossSectionVectorPerVolumeForScatProj (G4Material *aMaterial, G4double kinEnergyProd, G4int nbin_pro_decade=10)
 
void SetCSMatrices (std::vector< G4AdjointCSMatrix * > *Vec1CSMatrix, std::vector< G4AdjointCSMatrix * > *Vec2CSMatrix)
 
G4ParticleDefinitionGetAdjointEquivalentOfDirectPrimaryParticleDefinition ()
 
G4ParticleDefinitionGetAdjointEquivalentOfDirectSecondaryParticleDefinition ()
 
G4double GetHighEnergyLimit ()
 
G4double GetLowEnergyLimit ()
 
void SetHighEnergyLimit (G4double aVal)
 
void SetLowEnergyLimit (G4double aVal)
 
void DefineDirectEMModel (G4VEmModel *aModel)
 
void SetAdjointEquivalentOfDirectPrimaryParticleDefinition (G4ParticleDefinition *aPart)
 
void SetAdjointEquivalentOfDirectSecondaryParticleDefinition (G4ParticleDefinition *aPart)
 
void SetSecondPartOfSameType (G4bool aBool)
 
G4bool GetSecondPartOfSameType ()
 
void SetUseMatrix (G4bool aBool)
 
void SetUseMatrixPerElement (G4bool aBool)
 
void SetUseOnlyOneMatrixForAllElements (G4bool aBool)
 
void SetApplyCutInRange (G4bool aBool)
 
G4bool GetUseMatrix ()
 
G4bool GetUseMatrixPerElement ()
 
G4bool GetUseOnlyOneMatrixForAllElements ()
 
G4bool GetApplyCutInRange ()
 
G4String GetName ()
 
virtual void SetCSBiasingFactor (G4double aVal)
 
void SetCorrectWeightForPostStepInModel (G4bool aBool)
 
void SetAdditionalWeightCorrectionFactorForPostStepOutsideModel (G4double factor)
 
 G4VEmAdjointModel (G4VEmAdjointModel &)=delete
 
G4VEmAdjointModeloperator= (const G4VEmAdjointModel &right)=delete
 

Additional Inherited Members

- Protected Member Functions inherited from G4VEmAdjointModel
G4double DiffCrossSectionFunction1 (G4double kinEnergyProj)
 
G4double DiffCrossSectionFunction2 (G4double kinEnergyProj)
 
G4double SampleAdjSecEnergyFromCSMatrix (std::size_t MatrixIndex, G4double prim_energy, G4bool isScatProjToProj)
 
G4double SampleAdjSecEnergyFromCSMatrix (G4double prim_energy, G4bool isScatProjToProj)
 
void SelectCSMatrix (G4bool isScatProjToProj)
 
virtual G4double SampleAdjSecEnergyFromDiffCrossSectionPerAtom (G4double prim_energy, G4bool isScatProjToProj)
 
virtual void CorrectPostStepWeight (G4ParticleChange *fParticleChange, G4double old_weight, G4double adjointPrimKinEnergy, G4double projectileKinEnergy, G4bool isScatProjToProj)
 
- Protected Attributes inherited from G4VEmAdjointModel
G4AdjointCSManagerfCSManager
 
G4VEmModelfDirectModel = nullptr
 
const G4String fName
 
G4MaterialfSelectedMaterial = nullptr
 
G4MaterialfCurrentMaterial = nullptr
 
G4MaterialCutsCouplefCurrentCouple = nullptr
 
G4ParticleDefinitionfAdjEquivDirectPrimPart = nullptr
 
G4ParticleDefinitionfAdjEquivDirectSecondPart = nullptr
 
G4ParticleDefinitionfDirectPrimaryPart = nullptr
 
std::vector< G4AdjointCSMatrix * > * fCSMatrixProdToProjBackScat = nullptr
 
std::vector< G4AdjointCSMatrix * > * fCSMatrixProjToProjBackScat = nullptr
 
std::vector< G4doublefElementCSScatProjToProj
 
std::vector< G4doublefElementCSProdToProj
 
G4double fKinEnergyProdForIntegration = 0.
 
G4double fKinEnergyScatProjForIntegration = 0.
 
G4double fLastCS = 0.
 
G4double fLastAdjointCSForScatProjToProj = 0.
 
G4double fLastAdjointCSForProdToProj = 0.
 
G4double fPreStepEnergy = 0.
 
G4double fTcutPrim = 0.
 
G4double fTcutSecond = 0.
 
G4double fHighEnergyLimit = 0.
 
G4double fLowEnergyLimit = 0.
 
G4double fCsBiasingFactor = 1.
 
G4double fOutsideWeightFactor = 1.
 
G4int fASelectedNucleus = 0
 
G4int fZSelectedNucleus = 0
 
std::size_t fCSMatrixUsed = 0
 
G4bool fSecondPartSameType = false
 
G4bool fInModelWeightCorr
 
G4bool fApplyCutInRange = true
 
G4bool fUseMatrix = false
 
G4bool fUseMatrixPerElement = false
 
G4bool fOneMatrixForAllElements = false
 

Detailed Description

Definition at line 47 of file G4AdjointhIonisationModel.hh.

Constructor & Destructor Documentation

◆ G4AdjointhIonisationModel() [1/2]

G4AdjointhIonisationModel::G4AdjointhIonisationModel ( G4ParticleDefinition pDef)
explicit

Definition at line 42 of file G4AdjointhIonisationModel.cc.

43 : G4VEmAdjointModel("Adjoint_hIonisation")
44{
45 fUseMatrix = true;
47 fApplyCutInRange = true;
49 fSecondPartSameType = false;
50
51 // The direct EM Model is taken as BetheBloch. It is only used for the
52 // computation of the differential cross section.
53 // The Bragg model could be used as an alternative as it offers the same
54 // differential cross section
55
57 fBraggDirectEMModel = new G4BraggModel(pDef);
59 fDirectPrimaryPart = pDef;
60
61 if(pDef == G4Proton::Proton())
62 {
64 }
65
66 DefineProjectileProperty();
67}
static G4AdjointElectron * AdjointElectron()
static G4AdjointProton * AdjointProton()
static G4Proton * Proton()
Definition: G4Proton.cc:92
G4ParticleDefinition * fAdjEquivDirectSecondPart
G4ParticleDefinition * fAdjEquivDirectPrimPart
G4VEmModel * fDirectModel
G4ParticleDefinition * fDirectPrimaryPart

◆ ~G4AdjointhIonisationModel()

G4AdjointhIonisationModel::~G4AdjointhIonisationModel ( )
override

Definition at line 70 of file G4AdjointhIonisationModel.cc.

70{}

◆ G4AdjointhIonisationModel() [2/2]

G4AdjointhIonisationModel::G4AdjointhIonisationModel ( G4AdjointhIonisationModel )
delete

Member Function Documentation

◆ AdjointCrossSection()

G4double G4AdjointhIonisationModel::AdjointCrossSection ( const G4MaterialCutsCouple aCouple,
G4double  primEnergy,
G4bool  isScatProjToProj 
)
overridevirtual

Reimplemented from G4VEmAdjointModel.

Definition at line 397 of file G4AdjointhIonisationModel.cc.

400{
401 if(fUseMatrix)
402 return G4VEmAdjointModel::AdjointCrossSection(aCouple, primEnergy,
403 isScatProjToProj);
404 DefineCurrentMaterial(aCouple);
405
406 G4double Cross =
407 fCurrentMaterial->GetElectronDensity() * twopi_mc2_rcl2 * fMass;
408
409 if(!isScatProjToProj)
410 {
411 G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProj(primEnergy);
412 G4double Emin_proj = GetSecondAdjEnergyMinForProdToProj(primEnergy);
413 if(Emax_proj > Emin_proj && primEnergy > fTcutSecond)
414 {
415 Cross *= (1. / Emin_proj - 1. / Emax_proj) / primEnergy;
416 }
417 else
418 Cross = 0.;
419 }
420 else
421 {
422 G4double Emax_proj = GetSecondAdjEnergyMaxForScatProjToProj(primEnergy);
423 G4double Emin_proj =
425 G4double diff1 = Emin_proj - primEnergy;
426 G4double diff2 = Emax_proj - primEnergy;
427 G4double t1 =
428 (1. / diff1 + 1. / Emin_proj - 1. / diff2 - 1. / Emax_proj) / primEnergy;
429 G4double t2 =
430 2. * std::log(Emax_proj / Emin_proj) / primEnergy / primEnergy;
431 Cross *= (t1 + t2);
432 }
433 fLastCS = Cross;
434 return Cross;
435}
double G4double
Definition: G4Types.hh:83
G4double GetSecondAdjEnergyMinForScatProjToProj(G4double primAdjEnergy, G4double tcut=0.) override
G4double GetSecondAdjEnergyMaxForScatProjToProj(G4double primAdjEnergy) override
G4double GetSecondAdjEnergyMinForProdToProj(G4double primAdjEnergy) override
G4double GetSecondAdjEnergyMaxForProdToProj(G4double primAdjEnergy) override
G4double GetElectronDensity() const
Definition: G4Material.hh:212
G4Material * fCurrentMaterial
void DefineCurrentMaterial(const G4MaterialCutsCouple *couple)
virtual G4double AdjointCrossSection(const G4MaterialCutsCouple *aCouple, G4double primEnergy, G4bool isScatProjToProj)

◆ DiffCrossSectionPerAtomPrimToSecond()

G4double G4AdjointhIonisationModel::DiffCrossSectionPerAtomPrimToSecond ( G4double  kinEnergyProj,
G4double  kinEnergyProd,
G4double  Z,
G4double  A = 0. 
)
overridevirtual

Reimplemented from G4VEmAdjointModel.

Definition at line 280 of file G4AdjointhIonisationModel.cc.

282{ // Probably here the Bragg Model should be also used for
283 // kinEnergyProj/nuc < 2 MeV
284
285 G4double dSigmadEprod = 0.;
286 G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProj(kinEnergyProd);
287 G4double Emin_proj = GetSecondAdjEnergyMinForProdToProj(kinEnergyProd);
288
289 // the produced particle should have a kinetic energy smaller than the
290 // projectile
291 if(kinEnergyProj > Emin_proj && kinEnergyProj <= Emax_proj)
292 {
293 G4double Tmax = kinEnergyProj;
294 G4double E1 = kinEnergyProd;
295 //1.0006 factor seems to give the best diff CS, important impact on proton correction factor
296 G4double E2 = kinEnergyProd *1.0006;
297 G4double sigma1, sigma2;
298 if(kinEnergyProj > 2. * MeV)
299 {
301 fDirectPrimaryPart, kinEnergyProj, Z, A, E1, 1.e20);
303 fDirectPrimaryPart, kinEnergyProj, Z, A, E2, 1.e20);
304 }
305 else
306 {
307 sigma1 = fBraggDirectEMModel->ComputeCrossSectionPerAtom(
308 fDirectPrimaryPart, kinEnergyProj, Z, A, E1, 1.e20);
309 sigma2 = fBraggDirectEMModel->ComputeCrossSectionPerAtom(
310 fDirectPrimaryPart, kinEnergyProj, Z, A, E2, 1.e20);
311 }
312
313 dSigmadEprod = (sigma1 - sigma2) / (E2 - E1);
314 if(dSigmadEprod > 1.)
315 {
316 G4cout << "sigma1 " << kinEnergyProj / MeV << '\t' << kinEnergyProd / MeV
317 << '\t' << sigma1 << G4endl;
318 G4cout << "sigma2 " << kinEnergyProj / MeV << '\t' << kinEnergyProd / MeV
319 << '\t' << sigma2 << G4endl;
320 G4cout << "dsigma " << kinEnergyProj / MeV << '\t' << kinEnergyProd / MeV
321 << '\t' << dSigmadEprod << G4endl;
322 }
323
324 // correction of differential cross section at high energy to correct for
325 // the suppression of particle at secondary at high energy used in the Bethe
326 // Bloch Model. This correction consists of multiplying by g the probability
327 // function used to test the rejection of a secondary. Source code taken
328 // from G4BetheBlochModel::SampleSecondaries
329 G4double deltaKinEnergy = kinEnergyProd;
330
331 // projectile formfactor - suppression of high energy
332 // delta-electron production at high energy
333 G4double x = fFormFact * deltaKinEnergy;
334 if(x > 1.e-6)
335 {
336 G4double totEnergy = kinEnergyProj + fMass;
337 G4double etot2 = totEnergy * totEnergy;
338 G4double beta2 = kinEnergyProj * (kinEnergyProj + 2.0 * fMass) / etot2;
339 G4double f = 1.0 - beta2 * deltaKinEnergy / Tmax;
340 G4double f1 = 0.0;
341 if(0.5 == fSpin)
342 {
343 f1 = 0.5 * deltaKinEnergy * deltaKinEnergy / etot2;
344 f += f1;
345 }
346 G4double x1 = 1.0 + x;
347 G4double gg = 1.0 / (x1 * x1);
348 if(0.5 == fSpin)
349 {
350 G4double x2 = 0.5 * electron_mass_c2 * deltaKinEnergy / (fMass * fMass);
351 gg *= (1.0 + fMagMoment2 * (x2 - f1 / f) / (1.0 + x2));
352 }
353 if(gg > 1.0)
354 {
355 G4cout << "### G4BetheBlochModel in Adjoint Sim WARNING: g= " << g
356 << G4endl;
357 gg = 1.;
358 }
359 dSigmadEprod *= gg;
360 }
361 }
362
363 return dSigmadEprod;
364}
const G4int Z[17]
const G4double A[17]
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A=0., G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
Definition: G4VEmModel.cc:284

Referenced by RapidSampleSecondaries().

◆ GetSecondAdjEnergyMaxForProdToProj()

G4double G4AdjointhIonisationModel::GetSecondAdjEnergyMaxForProdToProj ( G4double  primAdjEnergy)
overridevirtual

Reimplemented from G4VEmAdjointModel.

Definition at line 454 of file G4AdjointhIonisationModel.cc.

455{
456 return GetHighEnergyLimit();
457}
G4double GetHighEnergyLimit()

Referenced by AdjointCrossSection(), DiffCrossSectionPerAtomPrimToSecond(), and RapidSampleSecondaries().

◆ GetSecondAdjEnergyMaxForScatProjToProj()

G4double G4AdjointhIonisationModel::GetSecondAdjEnergyMaxForScatProjToProj ( G4double  primAdjEnergy)
overridevirtual

Reimplemented from G4VEmAdjointModel.

Definition at line 438 of file G4AdjointhIonisationModel.cc.

440{
441 G4double Tmax = primAdjEnergy * fOnePlusRatio2 /
442 (fOneMinusRatio2 - 2. * fMassRatio * primAdjEnergy / fMass);
443 return Tmax;
444}

Referenced by AdjointCrossSection(), and RapidSampleSecondaries().

◆ GetSecondAdjEnergyMinForProdToProj()

G4double G4AdjointhIonisationModel::GetSecondAdjEnergyMinForProdToProj ( G4double  primAdjEnergy)
overridevirtual

Reimplemented from G4VEmAdjointModel.

Definition at line 460 of file G4AdjointhIonisationModel.cc.

462{
463 G4double Tmin =
464 (2. * primAdjEnergy - 4. * fMass +
465 std::sqrt(4. * primAdjEnergy * primAdjEnergy + 16. * fMass * fMass +
466 8. * primAdjEnergy * fMass * (1. / fMassRatio + fMassRatio))) /
467 4.;
468 return Tmin;
469}

Referenced by AdjointCrossSection(), DiffCrossSectionPerAtomPrimToSecond(), and RapidSampleSecondaries().

◆ GetSecondAdjEnergyMinForScatProjToProj()

G4double G4AdjointhIonisationModel::GetSecondAdjEnergyMinForScatProjToProj ( G4double  primAdjEnergy,
G4double  tcut = 0. 
)
overridevirtual

Reimplemented from G4VEmAdjointModel.

Definition at line 447 of file G4AdjointhIonisationModel.cc.

449{
450 return primAdjEnergy + tcut;
451}

Referenced by AdjointCrossSection(), and RapidSampleSecondaries().

◆ operator=()

G4AdjointhIonisationModel & G4AdjointhIonisationModel::operator= ( const G4AdjointhIonisationModel right)
delete

◆ RapidSampleSecondaries()

void G4AdjointhIonisationModel::RapidSampleSecondaries ( const G4Track aTrack,
G4bool  isScatProjToProj,
G4ParticleChange fParticleChange 
)

Definition at line 143 of file G4AdjointhIonisationModel.cc.

146{
147 const G4DynamicParticle* theAdjointPrimary = aTrack.GetDynamicParticle();
149
150 G4double adjointPrimKinEnergy = theAdjointPrimary->GetKineticEnergy();
151 G4double adjointPrimP = theAdjointPrimary->GetTotalMomentum();
152
153 if(adjointPrimKinEnergy > GetHighEnergyLimit() * 0.999)
154 {
155 return;
156 }
157
158 G4double projectileKinEnergy = 0.;
159 G4double eEnergy = 0.;
160 G4double newCS =
161 fCurrentMaterial->GetElectronDensity() * twopi_mc2_rcl2 * fMass;
162 if(!isScatProjToProj)
163 { // 1/E^2 distribution
164
165 eEnergy = adjointPrimKinEnergy;
166 G4double Emax = GetSecondAdjEnergyMaxForProdToProj(adjointPrimKinEnergy);
167 G4double Emin = GetSecondAdjEnergyMinForProdToProj(adjointPrimKinEnergy);
168 if(Emin >= Emax)
169 return;
170 G4double a = 1. / Emax;
171 G4double b = 1. / Emin;
172 newCS = newCS * (b - a) / eEnergy;
173
174 projectileKinEnergy = 1. / (b - (b - a) * G4UniformRand());
175 }
176 else
177 {
178 G4double Emax =
179 GetSecondAdjEnergyMaxForScatProjToProj(adjointPrimKinEnergy);
180 G4double Emin =
182 if(Emin >= Emax)
183 return;
184 G4double diff1 = Emin - adjointPrimKinEnergy;
185 G4double diff2 = Emax - adjointPrimKinEnergy;
186
187 G4double t1 = adjointPrimKinEnergy * (1. / diff1 - 1. / diff2);
188 G4double t2 = adjointPrimKinEnergy * (1. / Emin - 1. / Emax);
189 G4double t3 = 2. * std::log(Emax / Emin);
190 G4double sum_t = t1 + t2 + t3;
191 newCS = newCS * sum_t / adjointPrimKinEnergy / adjointPrimKinEnergy;
192 G4double t = G4UniformRand() * sum_t;
193 if(t <= t1)
194 {
195 G4double q = G4UniformRand() * t1 / adjointPrimKinEnergy;
196 projectileKinEnergy = adjointPrimKinEnergy + 1. / (1. / diff1 - q);
197 }
198 else if(t <= t2)
199 {
200 G4double q = G4UniformRand() * t2 / adjointPrimKinEnergy;
201 projectileKinEnergy = 1. / (1. / Emin - q);
202 }
203 else
204 {
205 projectileKinEnergy = Emin * std::pow(Emax / Emin, G4UniformRand());
206 }
207 eEnergy = projectileKinEnergy - adjointPrimKinEnergy;
208 }
209
210 G4double diffCS_perAtom_Used = twopi_mc2_rcl2 * fMass * adjointPrimKinEnergy /
211 projectileKinEnergy / projectileKinEnergy /
212 eEnergy / eEnergy;
213
214 // Weight correction
215 // First w_corr is set to the ratio between adjoint total CS and fwd total CS
216 G4double w_corr =
218
219 w_corr *= newCS / fLastCS;
220 // Then another correction is needed due to the fact that a biaised
221 // differential CS has been used rather than the one consistent with the
222 // direct model. Here we consider the true diffCS as the one obtained by the
223 // numerical differentiation over Tcut of the direct CS
224
225 G4double diffCS =
226 DiffCrossSectionPerAtomPrimToSecond(projectileKinEnergy, eEnergy, 1, 1);
227 w_corr *= diffCS / diffCS_perAtom_Used;
228
229 if (isScatProjToProj && fTcutSecond>0.005) w_corr=1.;
230
231 G4double new_weight = aTrack.GetWeight() * w_corr;
232 fParticleChange->SetParentWeightByProcess(false);
233 fParticleChange->SetSecondaryWeightByProcess(false);
234 fParticleChange->ProposeParentWeight(new_weight);
235
236 // Kinematic:
237 // we consider a two body elastic scattering for the forward processes where
238 // the projectile knocks on an e- at rest and gives it part of its energy
240 G4double projectileTotalEnergy = projectileM0 + projectileKinEnergy;
241 G4double projectileP2 =
242 projectileTotalEnergy * projectileTotalEnergy - projectileM0 * projectileM0;
243
244 // Companion
246 if(isScatProjToProj)
247 {
248 companionM0 = fAdjEquivDirectSecondPart->GetPDGMass();
249 }
250 G4double companionTotalEnergy =
251 companionM0 + projectileKinEnergy - adjointPrimKinEnergy;
252 G4double companionP2 =
253 companionTotalEnergy * companionTotalEnergy - companionM0 * companionM0;
254
255 // Projectile momentum
256 G4double P_parallel =
257 (adjointPrimP * adjointPrimP + projectileP2 - companionP2) /
258 (2. * adjointPrimP);
259 G4double P_perp = std::sqrt(projectileP2 - P_parallel * P_parallel);
260 G4ThreeVector dir_parallel = theAdjointPrimary->GetMomentumDirection();
261 G4double phi = G4UniformRand() * twopi;
262 G4ThreeVector projectileMomentum =
263 G4ThreeVector(P_perp * std::cos(phi), P_perp * std::sin(phi), P_parallel);
264 projectileMomentum.rotateUz(dir_parallel);
265
266 if(!isScatProjToProj)
267 { // kill the primary and add a secondary
268 fParticleChange->ProposeTrackStatus(fStopAndKill);
269 fParticleChange->AddSecondary(
270 new G4DynamicParticle(fAdjEquivDirectPrimPart, projectileMomentum));
271 }
272 else
273 {
274 fParticleChange->ProposeEnergy(projectileKinEnergy);
275 fParticleChange->ProposeMomentumDirection(projectileMomentum.unit());
276 }
277}
CLHEP::Hep3Vector G4ThreeVector
@ fStopAndKill
#define G4UniformRand()
Definition: Randomize.hh:52
Hep3Vector unit() const
Hep3Vector & rotateUz(const Hep3Vector &)
Definition: ThreeVector.cc:33
G4double GetPostStepWeightCorrection()
static G4AdjointCSManager * GetAdjointCSManager()
G4double DiffCrossSectionPerAtomPrimToSecond(G4double kinEnergyProj, G4double kinEnergyProd, G4double Z, G4double A=0.) override
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
G4double GetTotalMomentum() const
void AddSecondary(G4Track *aSecondary)
void ProposeEnergy(G4double finalEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4double GetWeight() const
const G4DynamicParticle * GetDynamicParticle() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
void ProposeTrackStatus(G4TrackStatus status)
void SetSecondaryWeightByProcess(G4bool)
void SetParentWeightByProcess(G4bool)
void ProposeParentWeight(G4double finalWeight)

Referenced by SampleSecondaries().

◆ SampleSecondaries()

void G4AdjointhIonisationModel::SampleSecondaries ( const G4Track aTrack,
G4bool  isScatProjToProj,
G4ParticleChange fParticleChange 
)
overridevirtual

Implements G4VEmAdjointModel.

Definition at line 73 of file G4AdjointhIonisationModel.cc.

76{
77 if(!fUseMatrix)
78 return RapidSampleSecondaries(aTrack, isScatProjToProj, fParticleChange);
79
80 const G4DynamicParticle* theAdjointPrimary = aTrack.GetDynamicParticle();
81
82 // Elastic inverse scattering
83 G4double adjointPrimKinEnergy = theAdjointPrimary->GetKineticEnergy();
84 G4double adjointPrimP = theAdjointPrimary->GetTotalMomentum();
85
86 if(adjointPrimKinEnergy > GetHighEnergyLimit() * 0.999)
87 {
88 return;
89 }
90
91 // Sample secondary energy
92 G4double projectileKinEnergy =
93 SampleAdjSecEnergyFromCSMatrix(adjointPrimKinEnergy, isScatProjToProj);
94 CorrectPostStepWeight(fParticleChange, aTrack.GetWeight(),
95 adjointPrimKinEnergy, projectileKinEnergy,
96 isScatProjToProj);
97 // Caution!!! this weight correction should be always applied
98
99 // Kinematic:
100 // we consider a two body elastic scattering for the forward processes where
101 // the projectile knock on an e- at rest and gives it part of its energy
103 G4double projectileTotalEnergy = projectileM0 + projectileKinEnergy;
104 G4double projectileP2 =
105 projectileTotalEnergy * projectileTotalEnergy - projectileM0 * projectileM0;
106
107 // Companion
109 if(isScatProjToProj)
110 {
111 companionM0 = fAdjEquivDirectSecondPart->GetPDGMass();
112 }
113 G4double companionTotalEnergy =
114 companionM0 + projectileKinEnergy - adjointPrimKinEnergy;
115 G4double companionP2 =
116 companionTotalEnergy * companionTotalEnergy - companionM0 * companionM0;
117
118 // Projectile momentum
119 G4double P_parallel =
120 (adjointPrimP * adjointPrimP + projectileP2 - companionP2) /
121 (2. * adjointPrimP);
122 G4double P_perp = std::sqrt(projectileP2 - P_parallel * P_parallel);
123 G4ThreeVector dir_parallel = theAdjointPrimary->GetMomentumDirection();
124 G4double phi = G4UniformRand() * twopi;
125 G4ThreeVector projectileMomentum =
126 G4ThreeVector(P_perp * std::cos(phi), P_perp * std::sin(phi), P_parallel);
127 projectileMomentum.rotateUz(dir_parallel);
128
129 if(!isScatProjToProj)
130 { // kill the primary and add a secondary
131 fParticleChange->ProposeTrackStatus(fStopAndKill);
132 fParticleChange->AddSecondary(
133 new G4DynamicParticle(fAdjEquivDirectPrimPart, projectileMomentum));
134 }
135 else
136 {
137 fParticleChange->ProposeEnergy(projectileKinEnergy);
138 fParticleChange->ProposeMomentumDirection(projectileMomentum.unit());
139 }
140}
void RapidSampleSecondaries(const G4Track &aTrack, G4bool isScatProjToProj, G4ParticleChange *fParticleChange)
virtual void CorrectPostStepWeight(G4ParticleChange *fParticleChange, G4double old_weight, G4double adjointPrimKinEnergy, G4double projectileKinEnergy, G4bool isScatProjToProj)
G4double SampleAdjSecEnergyFromCSMatrix(std::size_t MatrixIndex, G4double prim_energy, G4bool isScatProjToProj)

The documentation for this class was generated from the following files: