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

#include <G4LElastic.hh>

+ Inheritance diagram for G4LElastic:

Public Member Functions

 G4LElastic (const G4String &name="G4LElastic")
 
 ~G4LElastic ()
 
G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)
 
virtual void ModelDescription (std::ostream &outFile) const
 
virtual const std::pair< G4double, G4doubleGetFatalEnergyCheckLevels () const
 
- Public Member Functions inherited from G4HadronicInteraction
 G4HadronicInteraction (const G4String &modelName="HadronicModel")
 
virtual ~G4HadronicInteraction ()
 
virtual G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &targetNucleus)=0
 
virtual G4double SampleInvariantT (const G4ParticleDefinition *p, G4double plab, G4int Z, G4int A)
 
virtual G4bool IsApplicable (const G4HadProjectile &, G4Nucleus &)
 
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)
 
const G4HadronicInteractionGetMyPointer () const
 
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
 
G4bool operator== (const G4HadronicInteraction &right) const
 
G4bool operator!= (const G4HadronicInteraction &right) 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
 

Additional Inherited Members

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

Detailed Description

Definition at line 61 of file G4LElastic.hh.

Constructor & Destructor Documentation

◆ G4LElastic()

G4LElastic::G4LElastic ( const G4String name = "G4LElastic")

Definition at line 47 of file G4LElastic.cc.

49{
50 SetMinEnergy(0.0);
52}
void SetMinEnergy(G4double anEnergy)
void SetMaxEnergy(const G4double anEnergy)
#define DBL_MAX
Definition: templates.hh:83

◆ ~G4LElastic()

G4LElastic::~G4LElastic ( )
inline

Definition at line 67 of file G4LElastic.hh.

67{};

Member Function Documentation

◆ ApplyYourself()

G4HadFinalState * G4LElastic::ApplyYourself ( const G4HadProjectile aTrack,
G4Nucleus targetNucleus 
)
virtual

Implements G4HadronicInteraction.

Definition at line 68 of file G4LElastic.cc.

69{
70 if(getenv("debug_LElastic")) verboseLevel = 5;
72 const G4HadProjectile* aParticle = &aTrack;
73 G4double atno2 = targetNucleus.GetA_asInt();
74 G4double zTarget = targetNucleus.GetZ_asInt();
77
78 // Elastic scattering off Hydrogen
79
80 G4DynamicParticle* aSecondary = 0;
81 if (atno2 < 1.5) {
82 const G4ParticleDefinition* aParticleType = aParticle->GetDefinition();
83 if (aParticleType == G4PionPlus::PionPlus())
84 aSecondary = LightMedia.PionPlusExchange(aParticle, targetNucleus);
85 else if (aParticleType == G4PionMinus::PionMinus())
86 aSecondary = LightMedia.PionMinusExchange(aParticle, targetNucleus);
87 else if (aParticleType == G4KaonPlus::KaonPlus())
88 aSecondary = LightMedia.KaonPlusExchange(aParticle, targetNucleus);
89 else if (aParticleType == G4KaonZeroShort::KaonZeroShort())
90 aSecondary = LightMedia.KaonZeroShortExchange(aParticle,targetNucleus);
91 else if (aParticleType == G4KaonZeroLong::KaonZeroLong())
92 aSecondary = LightMedia.KaonZeroLongExchange(aParticle, targetNucleus);
93 else if (aParticleType == G4KaonMinus::KaonMinus())
94 aSecondary = LightMedia.KaonMinusExchange(aParticle, targetNucleus);
95 else if (aParticleType == G4Proton::Proton())
96 aSecondary = LightMedia.ProtonExchange(aParticle, targetNucleus);
97 else if (aParticleType == G4AntiProton::AntiProton())
98 aSecondary = LightMedia.AntiProtonExchange(aParticle, targetNucleus);
99 else if (aParticleType == G4Neutron::Neutron())
100 aSecondary = LightMedia.NeutronExchange(aParticle, targetNucleus);
101 else if (aParticleType == G4AntiNeutron::AntiNeutron())
102 aSecondary = LightMedia.AntiNeutronExchange(aParticle, targetNucleus);
103 else if (aParticleType == G4Lambda::Lambda())
104 aSecondary = LightMedia.LambdaExchange(aParticle, targetNucleus);
105 else if (aParticleType == G4AntiLambda::AntiLambda())
106 aSecondary = LightMedia.AntiLambdaExchange(aParticle, targetNucleus);
107 else if (aParticleType == G4SigmaPlus::SigmaPlus())
108 aSecondary = LightMedia.SigmaPlusExchange(aParticle, targetNucleus);
109 else if (aParticleType == G4SigmaMinus::SigmaMinus())
110 aSecondary = LightMedia.SigmaMinusExchange(aParticle, targetNucleus);
111 else if (aParticleType == G4AntiSigmaPlus::AntiSigmaPlus())
112 aSecondary = LightMedia.AntiSigmaPlusExchange(aParticle,targetNucleus);
113 else if (aParticleType == G4AntiSigmaMinus::AntiSigmaMinus())
114 aSecondary= LightMedia.AntiSigmaMinusExchange(aParticle,targetNucleus);
115 else if (aParticleType == G4XiZero::XiZero())
116 aSecondary = LightMedia.XiZeroExchange(aParticle, targetNucleus);
117 else if (aParticleType == G4XiMinus::XiMinus())
118 aSecondary = LightMedia.XiMinusExchange(aParticle, targetNucleus);
119 else if (aParticleType == G4AntiXiZero::AntiXiZero())
120 aSecondary = LightMedia.AntiXiZeroExchange(aParticle, targetNucleus);
121 else if (aParticleType == G4AntiXiMinus::AntiXiMinus())
122 aSecondary = LightMedia.AntiXiMinusExchange(aParticle, targetNucleus);
123 else if (aParticleType == G4OmegaMinus::OmegaMinus())
124 aSecondary = LightMedia.OmegaMinusExchange(aParticle, targetNucleus);
125 else if (aParticleType == G4AntiOmegaMinus::AntiOmegaMinus())
126 aSecondary= LightMedia.AntiOmegaMinusExchange(aParticle,targetNucleus);
127 else if (aParticleType == G4KaonPlus::KaonPlus())
128 aSecondary = LightMedia.KaonPlusExchange(aParticle, targetNucleus);
129 }
130
131 // Has a charge or strangeness exchange occurred?
132 if (aSecondary) {
133 aSecondary->SetMomentum(aParticle->Get4Momentum().vect());
136 }
137 // G4cout << "Entering elastic scattering 1"<<G4endl;
138
139 G4double p = aParticle->GetTotalMomentum()/GeV;
140 if (verboseLevel > 1)
141 G4cout << "G4LElastic::DoIt: Incident particle p=" << p << " GeV" << G4endl;
142
143 if (p < 0.01) return &theParticleChange;
144
145 // G4cout << "Entering elastic scattering 2"<<G4endl;
146// Compute the direction of elastic scattering.
147// It is planned to replace this code with a method based on
148// parameterized functions and a Monte Carlo method to invert the CDF.
149
150 G4double ran = G4UniformRand();
151 G4double aa, bb, cc, dd, rr;
152 if (atno2 <= 62.) {
153 aa = std::pow(atno2, 1.63);
154 bb = 14.5*std::pow(atno2, 0.66);
155 cc = 1.4*std::pow(atno2, 0.33);
156 dd = 10.;
157 }
158 else {
159 aa = std::pow(atno2, 1.33);
160 bb = 60.*std::pow(atno2, 0.33);
161 cc = 0.4*std::pow(atno2, 0.40);
162 dd = 10.;
163 }
164 aa = aa/bb;
165 cc = cc/dd;
166 rr = (aa + cc)*ran;
167 if (verboseLevel > 1) {
168 G4cout << "DoIt: aa,bb,cc,dd,rr" << G4endl;
169 G4cout << aa << " " << bb << " " << cc << " " << dd << " " << rr << G4endl;
170 }
171 G4double t1 = -std::log(ran)/bb;
172 G4double t2 = -std::log(ran)/dd;
173 if (verboseLevel > 1) {
174 G4cout << "t1,Fctcos " << t1 << " " << Fctcos(t1, aa, bb, cc, dd, rr) <<
175 G4endl;
176 G4cout << "t2,Fctcos " << t2 << " " << Fctcos(t2, aa, bb, cc, dd, rr) <<
177 G4endl;
178 }
179 G4double eps = 0.001;
180 G4int ind1 = 10;
181 G4double t;
182 G4int ier1;
183 ier1 = Rtmi(&t, t1, t2, eps, ind1,
184 aa, bb, cc, dd, rr);
185 if (verboseLevel > 1) {
186 G4cout << "From Rtmi, ier1=" << ier1 << G4endl;
187 G4cout << "t, Fctcos " << t << " " << Fctcos(t, aa, bb, cc, dd, rr) <<
188 G4endl;
189 }
190 if (ier1 != 0) t = 0.25*(3.*t1 + t2);
191 if (verboseLevel > 1) {
192 G4cout << "t, Fctcos " << t << " " << Fctcos(t, aa, bb, cc, dd, rr) <<
193 G4endl;
194 }
195 G4double phi = G4UniformRand()*twopi;
196 rr = 0.5*t/(p*p);
197 if (rr > 1.) rr = 0.;
198 if (verboseLevel > 1)
199 G4cout << "rr=" << rr << G4endl;
200 G4double cost = 1. - rr;
201 G4double sint = std::sqrt(std::max(rr*(2. - rr), 0.));
202 if (sint == 0.) return &theParticleChange;
203 // G4cout << "Entering elastic scattering 3"<<G4endl;
204 if (verboseLevel > 1)
205 G4cout << "cos(t)=" << cost << " std::sin(t)=" << sint << G4endl;
206
207 // Scattered particle referred to axis of incident particle
208 G4double mass1 = aParticle->GetDefinition()->GetPDGMass();
209 G4int Z=static_cast<G4int>(zTarget+.5);
210 G4int A=static_cast<G4int>(atno2);
211 if(G4UniformRand()<atno2-A) A++;
212 //G4cout << " ion info "<<atno2 << " "<<A<<" "<<Z<<" "<<zTarget<<G4endl;
213 G4double mass2 =
215
216 // non relativistic approximation
217 G4double a = 1 + mass2/mass1;
218 G4double b = -2.*p*cost;
219 G4double c = p*p*(1 - mass2/mass1);
220 G4double p1 = (-b+std::sqrt(std::max(0.0,b*b-4.*a*c)))/(2.*a);
221 G4double px = p1*sint*std::sin(phi);
222 G4double py = p1*sint*std::cos(phi);
223 G4double pz = p1*cost;
224
225// relativistic calculation
226 G4double etot = std::sqrt(mass1*mass1+p*p)+mass2;
227 a = etot*etot-p*p*cost*cost;
228 b = 2*p*p*(mass1*cost*cost-etot);
229 c = p*p*p*p*sint*sint;
230
231 G4double de = (-b-std::sqrt(std::max(0.0,b*b-4.*a*c)))/(2.*a);
232 G4double e1 = std::sqrt(p*p+mass1*mass1)-de;
233 G4double p12=e1*e1-mass1*mass1;
234 p1 = std::sqrt(std::max(1.*eV*eV,p12));
235 px = p1*sint*std::sin(phi);
236 py = p1*sint*std::cos(phi);
237 pz = p1*cost;
238
239 if (verboseLevel > 1)
240 {
241 G4cout << "Relevant test "<<p<<" "<<p1<<" "<<cost<<" "<<de<<G4endl;
242 G4cout << "p1/p = "<<p1/p<<" "<<mass1<<" "<<mass2<<" "<<a<<" "<<b<<" "<<c<<G4endl;
243 G4cout << "rest = "<< b*b<<" "<<4.*a*c<<" "<<G4endl;
244 G4cout << "make p1 = "<< p12<<" "<<e1*e1<<" "<<mass1*mass1<<" "<<G4endl;
245 }
246// Incident particle
247 G4double pxinc = p*aParticle->Get4Momentum().vect().unit().x();
248 G4double pyinc = p*aParticle->Get4Momentum().vect().unit().y();
249 G4double pzinc = p*aParticle->Get4Momentum().vect().unit().z();
250 if (verboseLevel > 1) {
251 G4cout << "NOM SCAT " << px << " " << py << " " << pz << G4endl;
252 G4cout << "INCIDENT " << pxinc << " " << pyinc << " " << pzinc << G4endl;
253 }
254
255// Transform scattered particle to reflect direction of incident particle
256 G4double pxnew, pynew, pznew;
257 Defs1(p, px, py, pz, pxinc, pyinc, pzinc, &pxnew, &pynew, &pznew);
258// Normalize:
259 G4double pxre=pxinc-pxnew;
260 G4double pyre=pyinc-pynew;
261 G4double pzre=pzinc-pznew;
262 G4ThreeVector it0(pxnew*GeV, pynew*GeV, pznew*GeV);
263 if(p1>0)
264 {
265 pxnew = pxnew/p1;
266 pynew = pynew/p1;
267 pznew = pznew/p1;
268 }
269 else
270 {
271 //G4double pphi = 2*pi*G4UniformRand();
272 //G4double ccth = 2*G4UniformRand()-1;
273 pxnew = 0;//std::sin(std::acos(ccth))*std::sin(pphi);
274 pynew = 0;//std::sin(std::acos(ccth))*std::cos(phi);
275 pznew = 1;//ccth;
276 }
277 if (verboseLevel > 1) {
278 G4cout << "DoIt: returning new momentum vector" << G4endl;
279 G4cout << "DoIt: "<<pxinc << " " << pyinc << " " << pzinc <<" "<<p<< G4endl;
280 G4cout << "DoIt: "<<pxnew << " " << pynew << " " << pznew <<" "<<p<< G4endl;
281 }
282
283 if (aSecondary) {
284 aSecondary->SetMomentumDirection(pxnew, pynew, pznew);
285 } else {
286 try
287 {
288 theParticleChange.SetMomentumChange(pxnew, pynew, pznew);
289 theParticleChange.SetEnergyChange(std::sqrt(mass1*mass1+it0.mag2())-mass1);
290 }
292 {
293 std::cerr << "GHADException originating from components of G4LElastic"<<std::cout;
294 throw;
295 }
297 G4ThreeVector it(pxre*GeV, pyre*GeV, pzre*GeV);
298 G4DynamicParticle * aSec =
299 new G4DynamicParticle(theDef, it.unit(), it.mag2()/(2.*mass2));
301 // G4cout << "Final check ###### "<<p<<" "<<it.mag()<<" "<<p1<<G4endl;
302 }
303 return &theParticleChange;
304}
@ stopAndKill
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
#define G4UniformRand()
Definition: Randomize.hh:53
double z() const
Hep3Vector unit() const
double x() const
double y() const
Hep3Vector vect() const
static G4AntiLambda * AntiLambda()
static G4AntiNeutron * AntiNeutron()
static G4AntiOmegaMinus * AntiOmegaMinus()
static G4AntiProton * AntiProton()
Definition: G4AntiProton.cc:93
static G4AntiSigmaMinus * AntiSigmaMinus()
static G4AntiSigmaPlus * AntiSigmaPlus()
static G4AntiXiMinus * AntiXiMinus()
static G4AntiXiZero * AntiXiZero()
void SetMomentumDirection(const G4ThreeVector &aDirection)
void SetMomentum(const G4ThreeVector &momentum)
void SetStatusChange(G4HadFinalStateStatus aS)
void AddSecondary(G4DynamicParticle *aP)
void SetEnergyChange(G4double anEnergy)
void SetMomentumChange(const G4ThreeVector &aV)
G4double GetTotalMomentum() const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4LorentzVector & Get4Momentum() const
static G4KaonMinus * KaonMinus()
Definition: G4KaonMinus.cc:113
static G4KaonPlus * KaonPlus()
Definition: G4KaonPlus.cc:113
static G4KaonZeroLong * KaonZeroLong()
static G4KaonZeroShort * KaonZeroShort()
static G4Lambda * Lambda()
Definition: G4Lambda.cc:108
G4DynamicParticle * PionMinusExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
Definition: G4LightMedia.cc:70
G4DynamicParticle * KaonPlusExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
Definition: G4LightMedia.cc:78
G4DynamicParticle * KaonZeroLongExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * NeutronExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * PionPlusExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
Definition: G4LightMedia.cc:40
G4DynamicParticle * AntiLambdaExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * AntiOmegaMinusExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * XiZeroExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * KaonMinusExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * SigmaPlusExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * AntiNeutronExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * ProtonExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * OmegaMinusExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * AntiXiMinusExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * AntiXiZeroExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * XiMinusExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * SigmaMinusExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * KaonZeroShortExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * LambdaExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * AntiSigmaPlusExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * AntiSigmaMinusExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
G4DynamicParticle * AntiProtonExchange(const G4HadProjectile *incidentParticle, const G4Nucleus &aNucleus)
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
G4int GetA_asInt() const
Definition: G4Nucleus.hh:109
G4int GetZ_asInt() const
Definition: G4Nucleus.hh:115
static G4OmegaMinus * OmegaMinus()
G4ParticleDefinition * FindIon(G4int atomicNumber, G4int atomicMass, G4double excitationEnergy)
static G4ParticleTable * GetParticleTable()
static G4PionMinus * PionMinus()
Definition: G4PionMinus.cc:98
static G4PionPlus * PionPlus()
Definition: G4PionPlus.cc:98
static G4Proton * Proton()
Definition: G4Proton.cc:93
static G4SigmaMinus * SigmaMinus()
static G4SigmaPlus * SigmaPlus()
Definition: G4SigmaPlus.cc:108
static G4XiMinus * XiMinus()
Definition: G4XiMinus.cc:106
static G4XiZero * XiZero()
Definition: G4XiZero.cc:106

Referenced by G4NeutronHPorLElasticModel::ApplyYourself().

◆ GetFatalEnergyCheckLevels()

const std::pair< G4double, G4double > G4LElastic::GetFatalEnergyCheckLevels ( ) const
virtual

Reimplemented from G4HadronicInteraction.

Definition at line 476 of file G4LElastic.cc.

477{
478 return std::pair<G4double, G4double>(5*perCent,250*GeV); // max energy non-conservation is mass of heavy nucleus
479}

◆ ModelDescription()

void G4LElastic::ModelDescription ( std::ostream &  outFile) const
virtual

Reimplemented from G4HadronicInteraction.

Definition at line 55 of file G4LElastic.cc.

56{
57 outFile << "G4LElastic is one of the Low Energy Parameterized (LEP)\n"
58 << "models used to implement elastic hadron scattering from nuclei.\n"
59 << "It is a re-engineered version of the GHEISHA code of\n"
60 << "H. Fesefeldt. It performs simplified two-body elastic\n"
61 << "scattering for all long-lived hadronic projectiles by using\n"
62 << "a two-exponential parameterization in momentum transfer.\n"
63 << "It is valid for incident hadrons of all energies.\n";
64}

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