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

#include <G4LEpp.hh>

+ Inheritance diagram for G4LEpp:

Public Member Functions

 G4LEpp ()
 
 ~G4LEpp () override
 
G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &targetNucleus) override
 
G4double SampleInvariantT (const G4ParticleDefinition *p, G4double plab, G4int Z, G4int A) override
 
- Public Member Functions inherited from G4HadronElastic
 G4HadronElastic (const G4String &name="hElasticLHEP")
 
 ~G4HadronElastic () override
 
G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &targetNucleus) override
 
G4double SampleInvariantT (const G4ParticleDefinition *p, G4double plab, G4int Z, G4int A) override
 
G4double GetSlopeCof (const G4int pdg)
 
void SetLowestEnergyLimit (G4double value)
 
G4double LowestEnergyLimit () const
 
G4double ComputeMomentumCMS (const G4ParticleDefinition *p, G4double plab, G4int Z, G4int A)
 
void ModelDescription (std::ostream &) const override
 
- Public Member Functions inherited from G4HadronicInteraction
 G4HadronicInteraction (const G4String &modelName="HadronicModel")
 
virtual ~G4HadronicInteraction ()
 
virtual G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)
 
virtual G4double SampleInvariantT (const G4ParticleDefinition *p, G4double plab, G4int Z, G4int A)
 
virtual G4bool IsApplicable (const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)
 
G4double GetMinEnergy () const
 
G4double GetMinEnergy (const G4Material *aMaterial, const G4Element *anElement) const
 
void SetMinEnergy (G4double anEnergy)
 
void SetMinEnergy (G4double anEnergy, const G4Element *anElement)
 
void SetMinEnergy (G4double anEnergy, const G4Material *aMaterial)
 
G4double GetMaxEnergy () const
 
G4double GetMaxEnergy (const G4Material *aMaterial, const G4Element *anElement) const
 
void SetMaxEnergy (const G4double anEnergy)
 
void SetMaxEnergy (G4double anEnergy, const G4Element *anElement)
 
void SetMaxEnergy (G4double anEnergy, const G4Material *aMaterial)
 
G4int GetVerboseLevel () const
 
void SetVerboseLevel (G4int value)
 
const G4StringGetModelName () const
 
void DeActivateFor (const G4Material *aMaterial)
 
void ActivateFor (const G4Material *aMaterial)
 
void DeActivateFor (const G4Element *anElement)
 
void ActivateFor (const G4Element *anElement)
 
G4bool IsBlocked (const G4Material *aMaterial) const
 
G4bool IsBlocked (const G4Element *anElement) const
 
void SetRecoilEnergyThreshold (G4double val)
 
G4double GetRecoilEnergyThreshold () const
 
virtual const std::pair< G4double, G4doubleGetFatalEnergyCheckLevels () const
 
virtual std::pair< G4double, G4doubleGetEnergyMomentumCheckLevels () const
 
void SetEnergyMomentumCheckLevels (G4double relativeLevel, G4double absoluteLevel)
 
virtual void ModelDescription (std::ostream &outFile) const
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual void InitialiseModel ()
 
 G4HadronicInteraction (const G4HadronicInteraction &right)=delete
 
const G4HadronicInteractionoperator= (const G4HadronicInteraction &right)=delete
 
G4bool operator== (const G4HadronicInteraction &right) const =delete
 
G4bool operator!= (const G4HadronicInteraction &right) const =delete
 

Additional Inherited Members

- Protected Member Functions inherited from G4HadronicInteraction
void SetModelName (const G4String &nam)
 
G4bool IsBlocked () const
 
void Block ()
 
- Protected Attributes inherited from G4HadronElastic
G4double pLocalTmax
 
- Protected Attributes inherited from G4HadronicInteraction
G4HadFinalState theParticleChange
 
G4int verboseLevel
 
G4double theMinEnergy
 
G4double theMaxEnergy
 
G4bool isBlocked
 

Detailed Description

Definition at line 41 of file G4LEpp.hh.

Constructor & Destructor Documentation

◆ G4LEpp()

G4LEpp::G4LEpp ( )
explicit

Definition at line 41 of file G4LEpp.cc.

41 :G4HadronElastic("G4LEpp")
42{
43 SetMinEnergy(0.);
44 SetMaxEnergy(5.*GeV);
45}
void SetMinEnergy(G4double anEnergy)
void SetMaxEnergy(const G4double anEnergy)

◆ ~G4LEpp()

G4LEpp::~G4LEpp ( )
override

Definition at line 47 of file G4LEpp.cc.

48{}

Member Function Documentation

◆ ApplyYourself()

G4HadFinalState * G4LEpp::ApplyYourself ( const G4HadProjectile aTrack,
G4Nucleus targetNucleus 
)
overridevirtual

Reimplemented from G4HadronElastic.

Definition at line 51 of file G4LEpp.cc.

52{
54 const G4HadProjectile* aParticle = &aTrack;
55
56 G4double P = aParticle->GetTotalMomentum();
57 G4double Px = aParticle->Get4Momentum().x();
58 G4double Py = aParticle->Get4Momentum().y();
59 G4double Pz = aParticle->Get4Momentum().z();
60 G4double E = aParticle->GetTotalEnergy();
61 G4ThreeVector theInitial = aParticle->Get4Momentum().vect().unit();
62
63 if (verboseLevel > 1) {
64 G4double ek = aParticle->GetKineticEnergy();
65 G4double E0 = aParticle->GetDefinition()->GetPDGMass();
66 G4double Q = aParticle->GetDefinition()->GetPDGCharge();
67 G4int A = targetNucleus.GetA_asInt();
68 G4int Z = targetNucleus.GetZ_asInt();
69 G4cout << "G4LEpp:ApplyYourself: incident particle: "
70 << aParticle->GetDefinition()->GetParticleName() << G4endl;
71 G4cout << "P = " << P/GeV << " GeV/c"
72 << ", Px = " << Px/GeV << " GeV/c"
73 << ", Py = " << Py/GeV << " GeV/c"
74 << ", Pz = " << Pz/GeV << " GeV/c" << G4endl;
75 G4cout << "E = " << E/GeV << " GeV"
76 << ", kinetic energy = " << ek/GeV << " GeV"
77 << ", mass = " << E0/GeV << " GeV"
78 << ", charge = " << Q << G4endl;
79 G4cout << "G4LEpp:ApplyYourself: material:" << G4endl;
80 G4cout << "A = " << A
81 << ", Z = " << Z
82 << ", atomic mass "
83 << G4Proton::Proton()->GetPDGMass()/GeV << "GeV"
84 << G4endl;
85 //
86 // GHEISHA ADD operation to get total energy, mass, charge
87 //
88 E += proton_mass_c2;
89 G4double E02 = E*E - P*P;
90 E0 = std::sqrt(std::fabs(E02));
91 if (E02 < 0)E0 *= -1;
92 Q += Z;
93 G4cout << "G4LEpp:ApplyYourself: total:" << G4endl;
94 G4cout << "E = " << E/GeV << " GeV"
95 << ", mass = " << E0/GeV << " GeV"
96 << ", charge = " << Q << G4endl;
97 }
98 G4double t = SampleInvariantT(aParticle->GetDefinition(), P, 0, 0);
99 G4double cost = 1.0 - 2*t/(P*P);
100 if(cost > 1.0) { cost = 1.0; }
101 if(cost <-1.0) { cost =-1.0; }
102 G4double sint = std::sqrt((1.0 - cost)*(1.0 + cost));
103 G4double phi = twopi*G4UniformRand();
104 // Get the target particle
105 G4DynamicParticle* targetParticle = targetNucleus.ReturnTargetParticle();
106
107 G4double E1 = aParticle->GetTotalEnergy();
108 G4double M1 = aParticle->GetDefinition()->GetPDGMass();
109 G4double E2 = targetParticle->GetTotalEnergy();
110 G4double M2 = targetParticle->GetDefinition()->GetPDGMass();
111 G4double totalEnergy = E1 + E2;
112 G4double pseudoMass = std::sqrt(totalEnergy*totalEnergy - P*P);
113
114 // Transform into centre of mass system
115
116 G4double px = (M2/pseudoMass)*Px;
117 G4double py = (M2/pseudoMass)*Py;
118 G4double pz = (M2/pseudoMass)*Pz;
119 G4double p = std::sqrt(px*px + py*py + pz*pz);
120
121 if (verboseLevel > 1) {
122 G4cout << " E1, M1 (GeV) " << E1/GeV << " " << M1/GeV << G4endl;
123 G4cout << " E2, M2 (GeV) " << E2/GeV << " " << M2/GeV << G4endl;
124 G4cout << " particle 1 momentum in CM " << px/GeV
125 << " " << py/GeV << " "
126 << pz/GeV << " " << p/GeV << G4endl;
127 }
128
129 // First scatter w.r.t. Z axis
130 G4double pxnew = p*sint*std::cos(phi);
131 G4double pynew = p*sint*std::sin(phi);
132 G4double pznew = p*cost;
133
134 // Rotate according to the direction of the incident particle
135 if (px*px + py*py > 0) {
136 G4double ph, cosp, sinp;
137 cost = pz/p;
138 sint = (std::sqrt((1-cost)*(1+cost)) + std::sqrt(px*px+py*py)/p)/2;
139 py < 0 ? ph = 3*halfpi : ph = halfpi;
140 if (std::fabs(px) > 0.000001*GeV) ph = std::atan2(py,px);
141 cosp = std::cos(ph);
142 sinp = std::sin(ph);
143 px = (cost*cosp*pxnew - sinp*pynew + sint*cosp*pznew);
144 py = (cost*sinp*pxnew + cosp*pynew + sint*sinp*pznew);
145 pz = (-sint*pxnew + cost*pznew);
146 }
147 else {
148 px = pxnew;
149 py = pynew;
150 pz = pznew;
151 }
152
153 if (verboseLevel > 1) {
154 G4cout << " AFTER SCATTER..." << G4endl;
155 G4cout << " particle 1 momentum in CM " << px/GeV << " " << py/GeV << " "
156 << pz/GeV << " " << p/GeV << G4endl;
157 }
158
159 // Transform to lab system
160
161 G4double E1pM2 = E1 + M2;
162 G4double betaCM = P/E1pM2;
163 G4double betaCMx = Px/E1pM2;
164 G4double betaCMy = Py/E1pM2;
165 G4double betaCMz = Pz/E1pM2;
166 G4double gammaCM = E1pM2/std::sqrt(E1pM2*E1pM2 - P*P);
167
168 if (verboseLevel > 1) {
169 G4cout << " betaCM " << betaCMx << " " << betaCMy << " "
170 << betaCMz << " " << betaCM << G4endl;
171 G4cout << " gammaCM " << gammaCM << G4endl;
172 }
173
174 // Now following GLOREN...
175
176 G4double BETA[5], PA[5], PB[5];
177 BETA[1] = -betaCMx;
178 BETA[2] = -betaCMy;
179 BETA[3] = -betaCMz;
180 BETA[4] = gammaCM;
181
182 //The incident particle...
183
184 PA[1] = px;
185 PA[2] = py;
186 PA[3] = pz;
187 PA[4] = std::sqrt(M1*M1 + p*p);
188
189 G4double BETPA = BETA[1]*PA[1] + BETA[2]*PA[2] + BETA[3]*PA[3];
190 G4double BPGAM = (BETPA * BETA[4]/(BETA[4] + 1.) - PA[4]) * BETA[4];
191
192 PB[1] = PA[1] + BPGAM * BETA[1];
193 PB[2] = PA[2] + BPGAM * BETA[2];
194 PB[3] = PA[3] + BPGAM * BETA[3];
195 PB[4] = (PA[4] - BETPA) * BETA[4];
196
198 newP->SetDefinition(aParticle->GetDefinition());
199 newP->SetMomentum(G4ThreeVector(PB[1], PB[2], PB[3]));
200
201 //The target particle...
202
203 PA[1] = -px;
204 PA[2] = -py;
205 PA[3] = -pz;
206 PA[4] = std::sqrt(M2*M2 + p*p);
207
208 BETPA = BETA[1]*PA[1] + BETA[2]*PA[2] + BETA[3]*PA[3];
209 BPGAM = (BETPA * BETA[4]/(BETA[4] + 1.) - PA[4]) * BETA[4];
210
211 PB[1] = PA[1] + BPGAM * BETA[1];
212 PB[2] = PA[2] + BPGAM * BETA[2];
213 PB[3] = PA[3] + BPGAM * BETA[3];
214 PB[4] = (PA[4] - BETPA) * BETA[4];
215
216 targetParticle->SetMomentum(G4ThreeVector(PB[1], PB[2], PB[3]));
217
218 if (verboseLevel > 1) {
219 G4cout << " particle 1 momentum in LAB "
220 << newP->GetMomentum()/GeV
221 << " " << newP->GetTotalMomentum()/GeV << G4endl;
222 G4cout << " particle 2 momentum in LAB "
223 << targetParticle->GetMomentum()/GeV
224 << " " << targetParticle->GetTotalMomentum()/GeV << G4endl;
225 G4cout << " TOTAL momentum in LAB "
226 << (newP->GetMomentum()+targetParticle->GetMomentum())/GeV
227 << " "
228 << (newP->GetMomentum()+targetParticle->GetMomentum()).mag()/GeV
229 << G4endl;
230 }
231
234 delete newP;
235
236 // Recoil particle
237 theParticleChange.AddSecondary(targetParticle);
238 return &theParticleChange;
239}
double A(double temperature)
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
#define G4UniformRand()
Definition: Randomize.hh:52
Hep3Vector unit() const
Hep3Vector vect() const
const G4ThreeVector & GetMomentumDirection() const
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4double GetTotalEnergy() const
void SetMomentum(const G4ThreeVector &momentum)
G4ThreeVector GetMomentum() const
G4double GetTotalMomentum() const
void AddSecondary(G4DynamicParticle *aP, G4int mod=-1)
void SetEnergyChange(G4double anEnergy)
void SetMomentumChange(const G4ThreeVector &aV)
G4double GetTotalMomentum() const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4LorentzVector & Get4Momentum() const
G4double GetTotalEnergy() const
G4double SampleInvariantT(const G4ParticleDefinition *p, G4double plab, G4int Z, G4int A) override
Definition: G4LEpp.cc:245
G4int GetA_asInt() const
Definition: G4Nucleus.hh:109
G4int GetZ_asInt() const
Definition: G4Nucleus.hh:115
G4DynamicParticle * ReturnTargetParticle() const
Definition: G4Nucleus.cc:241
G4double GetPDGCharge() const
const G4String & GetParticleName() const
static G4Proton * Proton()
Definition: G4Proton.cc:92

◆ SampleInvariantT()

G4double G4LEpp::SampleInvariantT ( const G4ParticleDefinition p,
G4double  plab,
G4int  Z,
G4int  A 
)
overridevirtual

Reimplemented from G4HadronElastic.

Definition at line 245 of file G4LEpp.cc.

247{
248 G4double nMass = p->GetPDGMass(); // 939.565346*MeV;
249 G4double ek = std::sqrt(plab*plab+nMass*nMass) - nMass;
250
251 // Find energy bin
252
253 G4int je1 = 0;
254 G4int je2 = NENERGY - 1;
255 ek /= GeV;
256
257 do
258 {
259 G4int midBin = (je1 + je2)/2;
260
261 if (ek < elab[midBin]) je2 = midBin;
262 else je1 = midBin;
263 }
264 while (je2 - je1 > 1); /* Loop checking, 10.08.2015, A.Ribon */
265
266 G4double delab = elab[je2] - elab[je1];
267
268 // Sample the angle
269
270 G4double sample = G4UniformRand();
271 G4int ke1 = 0;
272 G4int ke2 = NANGLE - 1;
273 G4double dsig, b, rc;
274
275 dsig = Sig[je2][0] - Sig[je1][0];
276 rc = dsig/delab;
277 b = Sig[je1][0] - rc*elab[je1];
278
279 G4double sigint1 = rc*ek + b;
280 G4double sigint2 = 0.;
281
282 do
283 {
284 G4int midBin = (ke1 + ke2)/2;
285 dsig = Sig[je2][midBin] - Sig[je1][midBin];
286 rc = dsig/delab;
287 b = Sig[je1][midBin] - rc*elab[je1];
288 G4double sigint = rc*ek + b;
289
290 if (sample < sigint)
291 {
292 ke2 = midBin;
293 sigint2 = sigint;
294 }
295 else
296 {
297 ke1 = midBin;
298 sigint1 = sigint;
299 }
300 }
301 while (ke2 - ke1 > 1); /* Loop checking, 10.08.2015, A.Ribon */
302
303 dsig = sigint2 - sigint1;
304 rc = 1./dsig;
305 b = ke1 - rc*sigint1;
306
307 G4double kint = rc*sample + b;
308 G4double theta = (0.5 + kint)*pi/180.;
309 G4double t = 0.5*plab*plab*(1 - std::cos(theta));
310
311 return t;
312}

Referenced by ApplyYourself().


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