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

#include <G4DeltaAngle.hh>

+ Inheritance diagram for G4DeltaAngle:

Public Member Functions

 G4DeltaAngle (const G4String &name="")
 
 ~G4DeltaAngle () override
 
G4ThreeVectorSampleDirection (const G4DynamicParticle *dp, G4double kinEnergyFinal, G4int Z, const G4Material *mat=nullptr) final
 
G4ThreeVectorSampleDirectionForShell (const G4DynamicParticle *dp, G4double kinEnergyFinal, G4int Z, G4int shellIdx, const G4Material *mat=nullptr) final
 
G4DeltaAngleoperator= (const G4DeltaAngle &right)=delete
 
 G4DeltaAngle (const G4DeltaAngle &)=delete
 
- Public Member Functions inherited from G4VEmAngularDistribution
 G4VEmAngularDistribution (const G4String &name)
 
virtual ~G4VEmAngularDistribution ()
 
virtual void SamplePairDirections (const G4DynamicParticle *dp, G4double elecKinEnergy, G4double posiKinEnergy, G4ThreeVector &dirElectron, G4ThreeVector &dirPositron, G4int Z=0, const G4Material *mat=nullptr)
 
virtual void PrintGeneratorInformation () const
 
const G4StringGetName () const
 
G4VEmAngularDistributionoperator= (const G4VEmAngularDistribution &right)=delete
 
 G4VEmAngularDistribution (const G4VEmAngularDistribution &)=delete
 

Additional Inherited Members

- Protected Attributes inherited from G4VEmAngularDistribution
G4ThreeVector fLocalDirection
 
G4bool fPolarisation
 

Detailed Description

Definition at line 55 of file G4DeltaAngle.hh.

Constructor & Destructor Documentation

◆ G4DeltaAngle() [1/2]

G4DeltaAngle::G4DeltaAngle ( const G4String & name = "")
explicit

Definition at line 60 of file G4DeltaAngle.cc.

61 : G4VEmAngularDistribution("deltaVI")
62{
63 fElectron = G4Electron::Electron();
64 nprob = 26;
65 fShellIdx = -1;
66 prob.resize(nprob,0.0);
67}
static G4Electron * Electron()
Definition G4Electron.cc:91
G4VEmAngularDistribution(const G4String &name)

◆ ~G4DeltaAngle()

G4DeltaAngle::~G4DeltaAngle ( )
overridedefault

◆ G4DeltaAngle() [2/2]

G4DeltaAngle::G4DeltaAngle ( const G4DeltaAngle & )
delete

Member Function Documentation

◆ operator=()

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

◆ SampleDirection()

G4ThreeVector & G4DeltaAngle::SampleDirection ( const G4DynamicParticle * dp,
G4double kinEnergyFinal,
G4int Z,
const G4Material * mat = nullptr )
finalvirtual

Implements G4VEmAngularDistribution.

Definition at line 81 of file G4DeltaAngle.cc.

84{
86 G4int idx = fShellIdx;
87
88 // if idx is not properly defined sample shell index
89 if(idx < 0 || idx >= nShells) {
90 if(nShells> nprob) {
91 nprob = nShells;
92 prob.resize(nprob,0.0);
93 }
94 G4double sum = 0.0;
95 for(idx=0; idx<nShells; ++idx) {
98 prob[idx] = sum;
99 }
100 sum *= G4UniformRand();
101 for(idx=0; idx<nShells; ++idx) {
102 if(sum <= prob[idx]) { break; }
103 }
104 }
106 G4double cost;
107 /*
108 G4cout << "E(keV)= " << kinEnergyFinal/keV
109 << " Ebind(keV)= " << bindingEnergy
110 << " idx= " << idx << " nShells= " << nShells << G4endl;
111 */
112 G4int n = 0;
113 G4bool isOK = false;
114 static const G4int nmax = 100;
115 do {
116 ++n;
117 // the atomic electron
119 G4double eKinEnergy = bindingEnergy*x;
120 G4double ePotEnergy = bindingEnergy*(1.0 + x);
121 G4double e = kinEnergyFinal + ePotEnergy + electron_mass_c2;
122 G4double p = sqrt((e + electron_mass_c2)*(e - electron_mass_c2));
123
124 G4double totEnergy = dp->GetTotalEnergy();
125 G4double totMomentum = dp->GetTotalMomentum();
126 if(dp->GetParticleDefinition() == fElectron) {
127 totEnergy += ePotEnergy;
128 totMomentum = sqrt((totEnergy + electron_mass_c2)
129 *(totEnergy - electron_mass_c2));
130 }
131
132 G4double eTotEnergy = eKinEnergy + electron_mass_c2;
133 G4double eTotMomentum = sqrt(eKinEnergy*(eTotEnergy + electron_mass_c2));
134 G4double costet = 2*G4UniformRand() - 1;
135 G4double sintet = sqrt((1 - costet)*(1 + costet));
136
137 cost = 1.0;
138 if(n >= nmax) {
139 /*
140 G4ExceptionDescription ed;
141 ed << "### G4DeltaAngle Warning: " << n
142 << " iterations - stop the loop with cost= 1.0 "
143 << " for " << dp->GetDefinition()->GetParticleName() << "\n"
144 << " Ekin(MeV)= " << dp->GetKineticEnergy()/MeV
145 << " Efinal(MeV)= " << kinEnergyFinal/MeV
146 << " Ebinding(MeV)= " << bindingEnergy/MeV;
147 G4Exception("G4DeltaAngle::SampleDirection","em0044",
148 JustWarning, ed,"");
149 */
150 if(0.0 == bindingEnergy) { isOK = true; }
151 bindingEnergy = 0.0;
152 }
153
154 G4double x0 = p*(totMomentum + eTotMomentum*costet);
155 /*
156 G4cout << " x0= " << x0 << " p= " << p
157 << " ptot= " << totMomentum << " pe= " << eTotMomentum
158 << " e= " << e << " totMom= " << totMomentum
159 << G4endl;
160 */
161 if(x0 > 0.0) {
162 G4double x1 = p*eTotMomentum*sintet;
163 G4double x2 = totEnergy*(eTotEnergy - e) - e*eTotEnergy
164 - totMomentum*eTotMomentum*costet + electron_mass_c2*electron_mass_c2;
165 G4double y = -x2/x0;
166 if(std::abs(y) <= 1.0) {
167 cost = -(x2 + x1*sqrt(1. - y*y))/x0;
168 if(std::abs(cost) <= 1.0) { isOK = true; }
169 else { cost = 1.0; }
170 }
171
172 /*
173 G4cout << " Ekin(MeV)= " << dp->GetKineticEnergy()
174 << " e1(keV)= " << eKinEnergy/keV
175 << " e2(keV)= " << (e - electron_mass_c2)/keV
176 << " 1-cost= " << 1-cost
177 << " x0= " << x0 << " x1= " << x1 << " x2= " << x2
178 << G4endl;
179 */
180 }
181
182 // Loop checking, 03-Aug-2015, Vladimir Ivanchenko
183 } while(!isOK);
184
185 G4double sint = sqrt((1 - cost)*(1 + cost));
186 G4double phi = twopi*G4UniformRand();
187
188 fLocalDirection.set(sint*cos(phi), sint*sin(phi), cost);
190
191 return fLocalDirection;
192}
G4double G4Log(G4double x)
Definition G4Log.hh:227
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
#define G4UniformRand()
Definition Randomize.hh:52
void set(double x, double y, double z)
Hep3Vector & rotateUz(const Hep3Vector &)
static G4int GetNumberOfElectrons(G4int Z, G4int SubshellNb)
static G4double GetBindingEnergy(G4int Z, G4int SubshellNb)
static G4int GetNumberOfShells(G4int Z)
const G4ThreeVector & GetMomentumDirection() const
const G4ParticleDefinition * GetParticleDefinition() const
G4double GetTotalEnergy() const
G4double GetTotalMomentum() const
G4double bindingEnergy(G4int A, G4int Z)

Referenced by SampleDirectionForShell().

◆ SampleDirectionForShell()

G4ThreeVector & G4DeltaAngle::SampleDirectionForShell ( const G4DynamicParticle * dp,
G4double kinEnergyFinal,
G4int Z,
G4int shellIdx,
const G4Material * mat = nullptr )
finalvirtual

Reimplemented from G4VEmAngularDistribution.

Definition at line 72 of file G4DeltaAngle.cc.

75{
76 fShellIdx = idx;
77 return SampleDirection(dp, kinEnergyFinal,Z, mat);
78}
G4ThreeVector & SampleDirection(const G4DynamicParticle *dp, G4double kinEnergyFinal, G4int Z, const G4Material *mat=nullptr) final

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