Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AdjointeIonisationModel.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
28#include "G4AdjointCSManager.hh"
29
31#include "G4Integrator.hh"
32#include "G4TrackStatus.hh"
33#include "G4ParticleChange.hh"
34#include "G4AdjointElectron.hh"
35#include "G4Gamma.hh"
36#include "G4AdjointGamma.hh"
37
38
39////////////////////////////////////////////////////////////////////////////////
40//
42 G4VEmAdjointModel("Inv_eIon_model")
43
44{
45
46 UseMatrix =true;
48 ApplyCutInRange = true;
51 WithRapidSampling = false;
52
57}
58////////////////////////////////////////////////////////////////////////////////
59//
61{;}
62////////////////////////////////////////////////////////////////////////////////
63//
65 G4bool IsScatProjToProjCase,
66 G4ParticleChange* fParticleChange)
67{
68
69
70 const G4DynamicParticle* theAdjointPrimary =aTrack.GetDynamicParticle();
71
72 //Elastic inverse scattering
73 //---------------------------------------------------------
74 G4double adjointPrimKinEnergy = theAdjointPrimary->GetKineticEnergy();
75 G4double adjointPrimP =theAdjointPrimary->GetTotalMomentum();
76
77 if (adjointPrimKinEnergy>HighEnergyLimit*0.999){
78 return;
79 }
80
81 //Sample secondary energy
82 //-----------------------
83 G4double projectileKinEnergy;
84 if (!WithRapidSampling ) { //used by default
85 projectileKinEnergy = SampleAdjSecEnergyFromCSMatrix(adjointPrimKinEnergy, IsScatProjToProjCase);
86
87 CorrectPostStepWeight(fParticleChange,
88 aTrack.GetWeight(),
89 adjointPrimKinEnergy,
90 projectileKinEnergy,
91 IsScatProjToProjCase); //Caution !!!this weight correction should be always applied
92 }
93 else { //only for test at the moment
94
95 G4double Emin,Emax;
96 if (IsScatProjToProjCase) {
98 Emax=GetSecondAdjEnergyMaxForScatProjToProjCase(adjointPrimKinEnergy);
99 }
100 else {
101 Emin=GetSecondAdjEnergyMinForProdToProjCase(adjointPrimKinEnergy);
102 Emax=GetSecondAdjEnergyMaxForProdToProjCase(adjointPrimKinEnergy);
103 }
104 projectileKinEnergy = Emin*std::pow(Emax/Emin,G4UniformRand());
105
106
107
109 if ( !IsScatProjToProjCase) lastCS=lastAdjointCSForProdToProjCase;
110
111 G4double new_weight=aTrack.GetWeight();
112 G4double used_diffCS=lastCS*std::log(Emax/Emin)/projectileKinEnergy;
113 G4double needed_diffCS=adjointPrimKinEnergy/projectileKinEnergy;
114 if (!IsScatProjToProjCase) needed_diffCS *=DiffCrossSectionPerVolumePrimToSecond(currentMaterial,projectileKinEnergy,adjointPrimKinEnergy);
115 else needed_diffCS *=DiffCrossSectionPerVolumePrimToScatPrim(currentMaterial,projectileKinEnergy,adjointPrimKinEnergy);
116 new_weight*=needed_diffCS/used_diffCS;
117 fParticleChange->SetParentWeightByProcess(false);
118 fParticleChange->SetSecondaryWeightByProcess(false);
119 fParticleChange->ProposeParentWeight(new_weight);
120
121
122 }
123
124
125
126 //Kinematic:
127 //we consider a two body elastic scattering for the forward processes where the projectile knock on an e- at rest and gives
128 // him part of its energy
129 //----------------------------------------------------------------------------------------
130
132 G4double projectileTotalEnergy = projectileM0+projectileKinEnergy;
133 G4double projectileP2 = projectileTotalEnergy*projectileTotalEnergy - projectileM0*projectileM0;
134
135
136
137 //Companion
138 //-----------
140 if (IsScatProjToProjCase) {
142 }
143 G4double companionTotalEnergy =companionM0+ projectileKinEnergy-adjointPrimKinEnergy;
144 G4double companionP2 = companionTotalEnergy*companionTotalEnergy - companionM0*companionM0;
145
146
147 //Projectile momentum
148 //--------------------
149 G4double P_parallel = (adjointPrimP*adjointPrimP + projectileP2 - companionP2)/(2.*adjointPrimP);
150 G4double P_perp = std::sqrt( projectileP2 - P_parallel*P_parallel);
151 G4ThreeVector dir_parallel=theAdjointPrimary->GetMomentumDirection();
152 G4double phi =G4UniformRand()*2.*3.1415926;
153 G4ThreeVector projectileMomentum = G4ThreeVector(P_perp*std::cos(phi),P_perp*std::sin(phi),P_parallel);
154 projectileMomentum.rotateUz(dir_parallel);
155
156
157
158 if (!IsScatProjToProjCase ){ //kill the primary and add a secondary
159 fParticleChange->ProposeTrackStatus(fStopAndKill);
160 fParticleChange->AddSecondary(new G4DynamicParticle(theAdjEquivOfDirectPrimPartDef,projectileMomentum));
161 //G4cout<<"projectileMomentum "<<projectileMomentum<<G4endl;
162 }
163 else {
164 fParticleChange->ProposeEnergy(projectileKinEnergy);
165 fParticleChange->ProposeMomentumDirection(projectileMomentum.unit());
166 }
167
168
169
170
171}
172////////////////////////////////////////////////////////////////////////////////
173//
174//The implementation here is correct for energy loss process, for the photoelectric and compton scattering the method should be redefine
176 G4double kinEnergyProj,
177 G4double kinEnergyProd,
178 G4double Z,
179 G4double )
180{
181 G4double dSigmadEprod=0;
182 G4double Emax_proj = GetSecondAdjEnergyMaxForProdToProjCase(kinEnergyProd);
183 G4double Emin_proj = GetSecondAdjEnergyMinForProdToProjCase(kinEnergyProd);
184
185
186 if (kinEnergyProj>Emin_proj && kinEnergyProj<=Emax_proj){ //the produced particle should have a kinetic energy smaller than the projectile
187 dSigmadEprod=Z*DiffCrossSectionMoller(kinEnergyProj,kinEnergyProd);
188 }
189 return dSigmadEprod;
190
191
192
193}
194
195//////////////////////////////////////////////////////////////////////////////
196//
197G4double G4AdjointeIonisationModel::DiffCrossSectionMoller(G4double kinEnergyProj,G4double kinEnergyProd){
198
199 G4double energy = kinEnergyProj + electron_mass_c2;
200 G4double x = kinEnergyProd/kinEnergyProj;
201 G4double gam = energy/electron_mass_c2;
202 G4double gamma2 = gam*gam;
203 G4double beta2 = 1.0 - 1.0/gamma2;
204
205 G4double gg = (2.0*gam - 1.0)/gamma2;
206 G4double y = 1.0 - x;
207 G4double fac=twopi_mc2_rcl2/electron_mass_c2;
208 G4double dCS = fac*( 1.-gg + ((1.0 - gg*x)/(x*x))
209 + ((1.0 - gg*y)/(y*y)))/(beta2*(gam-1));
210 return dCS/kinEnergyProj;
211
212
213
214}
215
CLHEP::Hep3Vector G4ThreeVector
@ fStopAndKill
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
#define G4UniformRand()
Definition: Randomize.hh:52
Hep3Vector unit() const
Hep3Vector & rotateUz(const Hep3Vector &)
Definition: ThreeVector.cc:33
static G4AdjointElectron * AdjointElectron()
virtual G4double DiffCrossSectionPerAtomPrimToSecond(G4double kinEnergyProj, G4double kinEnergyProd, G4double Z, G4double A=0.)
virtual void SampleSecondaries(const G4Track &aTrack, G4bool IsScatProjToProjCase, G4ParticleChange *fParticleChange)
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
G4double GetTotalMomentum() const
static G4Electron * Electron()
Definition: G4Electron.cc:93
void AddSecondary(G4Track *aSecondary)
void ProposeEnergy(G4double finalEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4double GetWeight() const
const G4DynamicParticle * GetDynamicParticle() const
virtual G4double DiffCrossSectionPerVolumePrimToScatPrim(const G4Material *aMaterial, G4double kinEnergyProj, G4double kinEnergyScatProj)
G4double lastAdjointCSForProdToProjCase
G4double lastAdjointCSForScatProjToProjCase
virtual G4double GetSecondAdjEnergyMaxForProdToProjCase(G4double PrimAdjEnergy)
virtual void CorrectPostStepWeight(G4ParticleChange *fParticleChange, G4double old_weight, G4double adjointPrimKinEnergy, G4double projectileKinEnergy, G4bool IsScatProjToProjCase)
virtual G4double DiffCrossSectionPerVolumePrimToSecond(const G4Material *aMaterial, G4double kinEnergyProj, G4double kinEnergyProd)
G4ParticleDefinition * theDirectPrimaryPartDef
G4double SampleAdjSecEnergyFromCSMatrix(size_t MatrixIndex, G4double prim_energy, G4bool IsScatProjToProjCase)
virtual G4double GetSecondAdjEnergyMaxForScatProjToProjCase(G4double PrimAdjEnergy)
G4Material * currentMaterial
G4bool UseOnlyOneMatrixForAllElements
virtual G4double GetSecondAdjEnergyMinForProdToProjCase(G4double PrimAdjEnergy)
G4double currentTcutForDirectSecond
G4ParticleDefinition * theAdjEquivOfDirectSecondPartDef
virtual G4double GetSecondAdjEnergyMinForScatProjToProjCase(G4double PrimAdjEnergy, G4double Tcut=0)
G4ParticleDefinition * theAdjEquivOfDirectPrimPartDef
void ProposeTrackStatus(G4TrackStatus status)
void SetSecondaryWeightByProcess(G4bool)
void SetParentWeightByProcess(G4bool)
void ProposeParentWeight(G4double finalWeight)