85{
87 G4int idx = fShellIdx;
88
89
90 if(idx < 0 || idx >= nShells) {
91 if(nShells> nprob) {
92 nprob = nShells;
93 prob.resize(nprob,0.0);
94 }
96 for(idx=0; idx<nShells; ++idx) {
99 prob[idx] = sum;
100 }
102 for(idx=0; idx<nShells; ++idx) {
103 if(sum <= prob[idx]) { break; }
104 }
105 }
108
109
110
111
112
115 static const G4int nmax = 100;
116 do {
118
122 G4double e = kinEnergyFinal + ePotEnergy + electron_mass_c2;
123 G4double p = sqrt((e + electron_mass_c2)*(e - electron_mass_c2));
124
128 totEnergy += ePotEnergy;
129 totMomentum = sqrt((totEnergy + electron_mass_c2)
130 *(totEnergy - electron_mass_c2));
131 }
132
133 G4double eTotEnergy = eKinEnergy + electron_mass_c2;
134 G4double eTotMomentum = sqrt(eKinEnergy*(eTotEnergy + electron_mass_c2));
136 G4double sintet = sqrt((1 - costet)*(1 + costet));
137
138 cost = 1.0;
139 if(n >= nmax) {
140
141
142
143
144
145
146
147
148
149
150
151 if(0.0 == bindingEnergy) { isOK = true; }
153 }
154
155 G4double x0 = p*(totMomentum + eTotMomentum*costet);
156
157
158
159
160
161
162 if(x0 > 0.0) {
163 G4double x1 = p*eTotMomentum*sintet;
164 G4double x2 = totEnergy*(eTotEnergy - e) - e*eTotEnergy
165 - totMomentum*eTotMomentum*costet + electron_mass_c2*electron_mass_c2;
167 if(std::abs(y) <= 1.0) {
168 cost = -(x2 + x1*sqrt(1. - y*y))/x0;
169 if(std::abs(cost) <= 1.0) { isOK = true; }
170 else { cost = 1.0; }
171 }
172
173
174
175
176
177
178
179
180
181 }
182
183
184 } while(!isOK);
185
186 G4double sint = sqrt((1 - cost)*(1 + cost));
188
191
193}
G4double G4Log(G4double x)
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
G4ThreeVector fLocalDirection
G4double bindingEnergy(G4int A, G4int Z)