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 | // $Id: G4RPGAntiSigmaMinusInelastic.cc,v 1.1 2007/07/18 21:04:20 dennis Exp $ |
---|
27 | // GEANT4 tag $Name: geant4-09-03-ref-09 $ |
---|
28 | // |
---|
29 | |
---|
30 | #include "G4RPGAntiSigmaMinusInelastic.hh" |
---|
31 | #include "Randomize.hh" |
---|
32 | |
---|
33 | G4HadFinalState* |
---|
34 | G4RPGAntiSigmaMinusInelastic::ApplyYourself( const G4HadProjectile &aTrack, |
---|
35 | G4Nucleus &targetNucleus ) |
---|
36 | { |
---|
37 | const G4HadProjectile *originalIncident = &aTrack; |
---|
38 | if (originalIncident->GetKineticEnergy()<= 0.1*MeV) |
---|
39 | { |
---|
40 | theParticleChange.SetStatusChange(isAlive); |
---|
41 | theParticleChange.SetEnergyChange(aTrack.GetKineticEnergy()); |
---|
42 | theParticleChange.SetMomentumChange(aTrack.Get4Momentum().vect().unit()); |
---|
43 | return &theParticleChange; |
---|
44 | } |
---|
45 | |
---|
46 | // Choose the target particle |
---|
47 | |
---|
48 | G4DynamicParticle *originalTarget = targetNucleus.ReturnTargetParticle(); |
---|
49 | |
---|
50 | if( verboseLevel > 1 ) |
---|
51 | { |
---|
52 | const G4Material *targetMaterial = aTrack.GetMaterial(); |
---|
53 | G4cout << "G4RPGAntiSigmaMinusInelastic::ApplyYourself called" << G4endl; |
---|
54 | G4cout << "kinetic energy = " << originalIncident->GetKineticEnergy()/MeV << "MeV, "; |
---|
55 | G4cout << "target material = " << targetMaterial->GetName() << ", "; |
---|
56 | G4cout << "target particle = " << originalTarget->GetDefinition()->GetParticleName() |
---|
57 | << G4endl; |
---|
58 | } |
---|
59 | |
---|
60 | // Fermi motion and evaporation |
---|
61 | // As of Geant3, the Fermi energy calculation had not been Done |
---|
62 | |
---|
63 | G4double ek = originalIncident->GetKineticEnergy()/MeV; |
---|
64 | G4double amas = originalIncident->GetDefinition()->GetPDGMass()/MeV; |
---|
65 | G4ReactionProduct modifiedOriginal; |
---|
66 | modifiedOriginal = *originalIncident; |
---|
67 | |
---|
68 | G4double tkin = targetNucleus.Cinema( ek ); |
---|
69 | ek += tkin; |
---|
70 | modifiedOriginal.SetKineticEnergy( ek*MeV ); |
---|
71 | G4double et = ek + amas; |
---|
72 | G4double p = std::sqrt( std::abs((et-amas)*(et+amas)) ); |
---|
73 | G4double pp = modifiedOriginal.GetMomentum().mag()/MeV; |
---|
74 | if( pp > 0.0 ) |
---|
75 | { |
---|
76 | G4ThreeVector momentum = modifiedOriginal.GetMomentum(); |
---|
77 | modifiedOriginal.SetMomentum( momentum * (p/pp) ); |
---|
78 | } |
---|
79 | // |
---|
80 | // calculate black track energies |
---|
81 | // |
---|
82 | tkin = targetNucleus.EvaporationEffects( ek ); |
---|
83 | ek -= tkin; |
---|
84 | modifiedOriginal.SetKineticEnergy( ek*MeV ); |
---|
85 | et = ek + amas; |
---|
86 | p = std::sqrt( std::abs((et-amas)*(et+amas)) ); |
---|
87 | pp = modifiedOriginal.GetMomentum().mag()/MeV; |
---|
88 | if( pp > 0.0 ) |
---|
89 | { |
---|
90 | G4ThreeVector momentum = modifiedOriginal.GetMomentum(); |
---|
91 | modifiedOriginal.SetMomentum( momentum * (p/pp) ); |
---|
92 | } |
---|
93 | G4ReactionProduct currentParticle = modifiedOriginal; |
---|
94 | G4ReactionProduct targetParticle; |
---|
95 | targetParticle = *originalTarget; |
---|
96 | currentParticle.SetSide( 1 ); // incident always goes in forward hemisphere |
---|
97 | targetParticle.SetSide( -1 ); // target always goes in backward hemisphere |
---|
98 | G4bool incidentHasChanged = false; |
---|
99 | G4bool targetHasChanged = false; |
---|
100 | G4bool quasiElastic = false; |
---|
101 | G4FastVector<G4ReactionProduct,GHADLISTSIZE> vec; // vec will contain the secondary particles |
---|
102 | G4int vecLen = 0; |
---|
103 | vec.Initialize( 0 ); |
---|
104 | |
---|
105 | const G4double cutOff = 0.1; |
---|
106 | const G4double anni = std::min( 1.3*currentParticle.GetTotalMomentum()/GeV, 0.4 ); |
---|
107 | if( (currentParticle.GetKineticEnergy()/MeV > cutOff) || (G4UniformRand() > anni) ) |
---|
108 | Cascade( vec, vecLen, |
---|
109 | originalIncident, currentParticle, targetParticle, |
---|
110 | incidentHasChanged, targetHasChanged, quasiElastic ); |
---|
111 | |
---|
112 | CalculateMomenta( vec, vecLen, |
---|
113 | originalIncident, originalTarget, modifiedOriginal, |
---|
114 | targetNucleus, currentParticle, targetParticle, |
---|
115 | incidentHasChanged, targetHasChanged, quasiElastic ); |
---|
116 | |
---|
117 | SetUpChange( vec, vecLen, |
---|
118 | currentParticle, targetParticle, |
---|
119 | incidentHasChanged ); |
---|
120 | |
---|
121 | delete originalTarget; |
---|
122 | return &theParticleChange; |
---|
123 | } |
---|
124 | |
---|
125 | |
---|
126 | void G4RPGAntiSigmaMinusInelastic::Cascade( |
---|
127 | G4FastVector<G4ReactionProduct,GHADLISTSIZE> &vec, |
---|
128 | G4int& vecLen, |
---|
129 | const G4HadProjectile *originalIncident, |
---|
130 | G4ReactionProduct ¤tParticle, |
---|
131 | G4ReactionProduct &targetParticle, |
---|
132 | G4bool &incidentHasChanged, |
---|
133 | G4bool &targetHasChanged, |
---|
134 | G4bool &quasiElastic ) |
---|
135 | { |
---|
136 | // Derived from H. Fesefeldt's original FORTRAN code CASASM |
---|
137 | // AntiSigmaMinus undergoes interaction with nucleon within a nucleus. Check if it is |
---|
138 | // energetically possible to produce pions/kaons. In not, assume nuclear excitation |
---|
139 | // occurs and input particle is degraded in energy. No other particles are produced. |
---|
140 | // If reaction is possible, find the correct number of pions/protons/neutrons |
---|
141 | // produced using an interpolation to multiplicity data. Replace some pions or |
---|
142 | // protons/neutrons by kaons or strange baryons according to the average |
---|
143 | // multiplicity per Inelastic reaction. |
---|
144 | |
---|
145 | const G4double mOriginal = originalIncident->GetDefinition()->GetPDGMass()/MeV; |
---|
146 | const G4double etOriginal = originalIncident->GetTotalEnergy()/MeV; |
---|
147 | const G4double pOriginal = originalIncident->GetTotalMomentum()/MeV; |
---|
148 | const G4double targetMass = targetParticle.GetMass()/MeV; |
---|
149 | G4double centerofmassEnergy = std::sqrt( mOriginal*mOriginal + |
---|
150 | targetMass*targetMass + |
---|
151 | 2.0*targetMass*etOriginal ); |
---|
152 | G4double availableEnergy = centerofmassEnergy-(targetMass+mOriginal); |
---|
153 | |
---|
154 | static G4bool first = true; |
---|
155 | const G4int numMul = 1200; |
---|
156 | const G4int numMulA = 400; |
---|
157 | const G4int numSec = 60; |
---|
158 | static G4double protmul[numMul], protnorm[numSec]; // proton constants |
---|
159 | static G4double neutmul[numMul], neutnorm[numSec]; // neutron constants |
---|
160 | static G4double protmulA[numMulA], protnormA[numSec]; // proton constants |
---|
161 | static G4double neutmulA[numMulA], neutnormA[numSec]; // neutron constants |
---|
162 | // np = number of pi+, nm = number of pi-, nz = number of pi0 |
---|
163 | G4int counter, nt=0, np=0, nm=0, nz=0; |
---|
164 | G4double test; |
---|
165 | const G4double c = 1.25; |
---|
166 | const G4double b[2] = { 0.7, 0.7 }; |
---|
167 | if( first ) // compute normalization constants, this will only be Done once |
---|
168 | { |
---|
169 | first = false; |
---|
170 | G4int i; |
---|
171 | for( i=0; i<numMul; ++i )protmul[i] = 0.0; |
---|
172 | for( i=0; i<numSec; ++i )protnorm[i] = 0.0; |
---|
173 | counter = -1; |
---|
174 | for( np=0; np<(numSec/3); ++np ) |
---|
175 | { |
---|
176 | for( nm=std::max(0,np-2); nm<=np; ++nm ) |
---|
177 | { |
---|
178 | for( nz=0; nz<numSec/3; ++nz ) |
---|
179 | { |
---|
180 | if( ++counter < numMul ) |
---|
181 | { |
---|
182 | nt = np+nm+nz; |
---|
183 | if( nt>0 && nt<=numSec ) |
---|
184 | { |
---|
185 | protmul[counter] = Pmltpc(np,nm,nz,nt,b[0],c); |
---|
186 | protnorm[nt-1] += protmul[counter]; |
---|
187 | } |
---|
188 | } |
---|
189 | } |
---|
190 | } |
---|
191 | } |
---|
192 | for( i=0; i<numMul; ++i )neutmul[i] = 0.0; |
---|
193 | for( i=0; i<numSec; ++i )neutnorm[i] = 0.0; |
---|
194 | counter = -1; |
---|
195 | for( np=0; np<numSec/3; ++np ) |
---|
196 | { |
---|
197 | for( nm=std::max(0,np-1); nm<=(np+1); ++nm ) |
---|
198 | { |
---|
199 | for( nz=0; nz<numSec/3; ++nz ) |
---|
200 | { |
---|
201 | if( ++counter < numMul ) |
---|
202 | { |
---|
203 | nt = np+nm+nz; |
---|
204 | if( nt>0 && nt<=numSec ) |
---|
205 | { |
---|
206 | neutmul[counter] = Pmltpc(np,nm,nz,nt,b[1],c); |
---|
207 | neutnorm[nt-1] += neutmul[counter]; |
---|
208 | } |
---|
209 | } |
---|
210 | } |
---|
211 | } |
---|
212 | } |
---|
213 | for( i=0; i<numSec; ++i ) |
---|
214 | { |
---|
215 | if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i]; |
---|
216 | if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i]; |
---|
217 | } |
---|
218 | // |
---|
219 | // do the same for annihilation channels |
---|
220 | // |
---|
221 | for( i=0; i<numMulA; ++i )protmulA[i] = 0.0; |
---|
222 | for( i=0; i<numSec; ++i )protnormA[i] = 0.0; |
---|
223 | counter = -1; |
---|
224 | for( np=2; np<(numSec/3); ++np ) |
---|
225 | { |
---|
226 | nm = np-2; |
---|
227 | for( nz=0; nz<numSec/3; ++nz ) |
---|
228 | { |
---|
229 | if( ++counter < numMulA ) |
---|
230 | { |
---|
231 | nt = np+nm+nz; |
---|
232 | if( nt>1 && nt<=numSec ) |
---|
233 | { |
---|
234 | protmulA[counter] = Pmltpc(np,nm,nz,nt,b[0],c); |
---|
235 | protnormA[nt-1] += protmulA[counter]; |
---|
236 | } |
---|
237 | } |
---|
238 | } |
---|
239 | } |
---|
240 | for( i=0; i<numMulA; ++i )neutmulA[i] = 0.0; |
---|
241 | for( i=0; i<numSec; ++i )neutnormA[i] = 0.0; |
---|
242 | counter = -1; |
---|
243 | for( np=1; np<numSec/3; ++np ) |
---|
244 | { |
---|
245 | nm = np-1; |
---|
246 | for( nz=0; nz<numSec/3; ++nz ) |
---|
247 | { |
---|
248 | if( ++counter < numMulA ) |
---|
249 | { |
---|
250 | nt = np+nm+nz; |
---|
251 | if( nt>1 && nt<=numSec ) |
---|
252 | { |
---|
253 | neutmulA[counter] = Pmltpc(np,nm,nz,nt,b[1],c); |
---|
254 | neutnormA[nt-1] += neutmulA[counter]; |
---|
255 | } |
---|
256 | } |
---|
257 | } |
---|
258 | } |
---|
259 | for( i=0; i<numSec; ++i ) |
---|
260 | { |
---|
261 | if( protnormA[i] > 0.0 )protnormA[i] = 1.0/protnormA[i]; |
---|
262 | if( neutnormA[i] > 0.0 )neutnormA[i] = 1.0/neutnormA[i]; |
---|
263 | } |
---|
264 | } // end of initialization |
---|
265 | const G4double expxu = 82.; // upper bound for arg. of exp |
---|
266 | const G4double expxl = -expxu; // lower bound for arg. of exp |
---|
267 | G4ParticleDefinition *aNeutron = G4Neutron::Neutron(); |
---|
268 | G4ParticleDefinition *aProton = G4Proton::Proton(); |
---|
269 | G4ParticleDefinition *aPiPlus = G4PionPlus::PionPlus(); |
---|
270 | G4ParticleDefinition *aKaonMinus = G4KaonMinus::KaonMinus(); |
---|
271 | G4ParticleDefinition *aKaonZL = G4KaonZeroLong::KaonZeroLong(); |
---|
272 | G4ParticleDefinition *aKaonPlus = G4KaonPlus::KaonPlus(); |
---|
273 | G4ParticleDefinition *anAntiLambda = G4AntiLambda::AntiLambda(); |
---|
274 | G4ParticleDefinition *anAntiSigmaZero = G4AntiSigmaZero::AntiSigmaZero(); |
---|
275 | const G4double anhl[] = {1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,0.97,0.88, |
---|
276 | 0.85,0.81,0.75,0.64,0.64,0.55,0.55,0.45,0.47,0.40, |
---|
277 | 0.39,0.36,0.33,0.10,0.01}; |
---|
278 | G4int iplab = G4int( pOriginal/GeV*10.0 ); |
---|
279 | if( iplab > 9 )iplab = G4int( (pOriginal/GeV- 1.0)*5.0 ) + 10; |
---|
280 | if( iplab > 14 )iplab = G4int( pOriginal/GeV- 2.0 ) + 15; |
---|
281 | if( iplab > 23 )iplab = G4int( (pOriginal/GeV-10.0)/10.0 ) + 23; |
---|
282 | if( iplab > 24 )iplab = 24; |
---|
283 | if( G4UniformRand() > anhl[iplab] ) |
---|
284 | { |
---|
285 | if( availableEnergy <= aPiPlus->GetPDGMass()/MeV ) |
---|
286 | { |
---|
287 | quasiElastic = true; |
---|
288 | return; |
---|
289 | } |
---|
290 | G4double n, anpn; |
---|
291 | GetNormalizationConstant( availableEnergy, n, anpn ); |
---|
292 | G4double ran = G4UniformRand(); |
---|
293 | G4double dum, excs = 0.0; |
---|
294 | if( targetParticle.GetDefinition() == aProton ) |
---|
295 | { |
---|
296 | counter = -1; |
---|
297 | for( np=0; np<numSec/3 && ran>=excs; ++np ) |
---|
298 | { |
---|
299 | for( nm=std::max(0,np-2); nm<=np && ran>=excs; ++nm ) |
---|
300 | { |
---|
301 | for( nz=0; nz<numSec/3 && ran>=excs; ++nz ) |
---|
302 | { |
---|
303 | if( ++counter < numMul ) |
---|
304 | { |
---|
305 | nt = np+nm+nz; |
---|
306 | if( nt>0 && nt<=numSec ) |
---|
307 | { |
---|
308 | test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) ); |
---|
309 | dum = (pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n); |
---|
310 | if( std::fabs(dum) < 1.0 ) |
---|
311 | { |
---|
312 | if( test >= 1.0e-10 )excs += dum*test; |
---|
313 | } |
---|
314 | else |
---|
315 | excs += dum*test; |
---|
316 | } |
---|
317 | } |
---|
318 | } |
---|
319 | } |
---|
320 | } |
---|
321 | if( ran >= excs ) // 3 previous loops continued to the end |
---|
322 | { |
---|
323 | quasiElastic = true; |
---|
324 | return; |
---|
325 | } |
---|
326 | np--; nm--; nz--; |
---|
327 | G4int ncht = std::min( 3, std::max( 1, np-nm+1 ) ); |
---|
328 | switch( ncht ) |
---|
329 | { |
---|
330 | case 1: |
---|
331 | break; |
---|
332 | case 2: |
---|
333 | if( G4UniformRand() < 0.5 ) |
---|
334 | { |
---|
335 | targetParticle.SetDefinitionAndUpdateE( aNeutron ); |
---|
336 | targetHasChanged = true; |
---|
337 | } |
---|
338 | else |
---|
339 | { |
---|
340 | if( G4UniformRand() < 0.5 ) |
---|
341 | currentParticle.SetDefinitionAndUpdateE( anAntiLambda ); |
---|
342 | else |
---|
343 | currentParticle.SetDefinitionAndUpdateE( anAntiSigmaZero ); |
---|
344 | incidentHasChanged = true; |
---|
345 | } |
---|
346 | break; |
---|
347 | case 3: |
---|
348 | if( G4UniformRand() < 0.5 ) |
---|
349 | currentParticle.SetDefinitionAndUpdateE( anAntiLambda ); |
---|
350 | else |
---|
351 | currentParticle.SetDefinitionAndUpdateE( anAntiSigmaZero ); |
---|
352 | incidentHasChanged = true; |
---|
353 | targetParticle.SetDefinitionAndUpdateE( aNeutron ); |
---|
354 | targetHasChanged = true; |
---|
355 | break; |
---|
356 | } |
---|
357 | } |
---|
358 | else // target must be a neutron |
---|
359 | { |
---|
360 | counter = -1; |
---|
361 | for( np=0; np<numSec/3 && ran>=excs; ++np ) |
---|
362 | { |
---|
363 | for( nm=std::max(0,np-1); nm<=(np+1) && ran>=excs; ++nm ) |
---|
364 | { |
---|
365 | for( nz=0; nz<numSec/3 && ran>=excs; ++nz ) |
---|
366 | { |
---|
367 | if( ++counter < numMul ) |
---|
368 | { |
---|
369 | nt = np+nm+nz; |
---|
370 | if( nt>0 && nt<=numSec ) |
---|
371 | { |
---|
372 | test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) ); |
---|
373 | dum = (pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n); |
---|
374 | if( std::fabs(dum) < 1.0 ) |
---|
375 | { |
---|
376 | if( test >= 1.0e-10 )excs += dum*test; |
---|
377 | } |
---|
378 | else |
---|
379 | excs += dum*test; |
---|
380 | } |
---|
381 | } |
---|
382 | } |
---|
383 | } |
---|
384 | } |
---|
385 | if( ran >= excs ) // 3 previous loops continued to the end |
---|
386 | { |
---|
387 | quasiElastic = true; |
---|
388 | return; |
---|
389 | } |
---|
390 | np--; nm--; nz--; |
---|
391 | G4int ncht = std::min( 3, std::max( 1, np-nm+2 ) ); |
---|
392 | switch( ncht ) |
---|
393 | { |
---|
394 | case 1: |
---|
395 | { |
---|
396 | targetParticle.SetDefinitionAndUpdateE( aProton ); |
---|
397 | targetHasChanged = true; |
---|
398 | } |
---|
399 | break; |
---|
400 | case 2: |
---|
401 | if( G4UniformRand() < 0.5 ) |
---|
402 | { |
---|
403 | if( G4UniformRand() < 0.5 ) |
---|
404 | { |
---|
405 | currentParticle.SetDefinitionAndUpdateE( anAntiLambda ); |
---|
406 | incidentHasChanged = true; |
---|
407 | targetParticle.SetDefinitionAndUpdateE( aProton ); |
---|
408 | targetHasChanged = true; |
---|
409 | } |
---|
410 | } |
---|
411 | else |
---|
412 | { |
---|
413 | if( G4UniformRand() < 0.5 ) |
---|
414 | { |
---|
415 | currentParticle.SetDefinitionAndUpdateE( anAntiSigmaZero ); |
---|
416 | incidentHasChanged = true; |
---|
417 | targetParticle.SetDefinitionAndUpdateE( aProton ); |
---|
418 | targetHasChanged = true; |
---|
419 | } |
---|
420 | } |
---|
421 | break; |
---|
422 | case 3: |
---|
423 | if( G4UniformRand() < 0.5 ) |
---|
424 | currentParticle.SetDefinitionAndUpdateE( anAntiLambda ); |
---|
425 | else |
---|
426 | currentParticle.SetDefinitionAndUpdateE( anAntiSigmaZero ); |
---|
427 | incidentHasChanged = true; |
---|
428 | break; |
---|
429 | } |
---|
430 | } |
---|
431 | } |
---|
432 | else // random number <= anhl[iplab] |
---|
433 | { |
---|
434 | if( centerofmassEnergy <= aPiPlus->GetPDGMass()/MeV+aKaonPlus->GetPDGMass()/MeV ) |
---|
435 | { |
---|
436 | quasiElastic = true; |
---|
437 | return; |
---|
438 | } |
---|
439 | G4double n, anpn; |
---|
440 | GetNormalizationConstant( -centerofmassEnergy, n, anpn ); |
---|
441 | G4double ran = G4UniformRand(); |
---|
442 | G4double dum, excs = 0.0; |
---|
443 | if( targetParticle.GetDefinition() == aProton ) |
---|
444 | { |
---|
445 | counter = -1; |
---|
446 | for( np=2; np<numSec/3 && ran>=excs; ++np ) |
---|
447 | { |
---|
448 | nm=np-2; |
---|
449 | for( nz=0; nz<numSec/3 && ran>=excs; ++nz ) |
---|
450 | { |
---|
451 | if( ++counter < numMulA ) |
---|
452 | { |
---|
453 | nt = np+nm+nz; |
---|
454 | if( nt>1 && nt<=numSec ) |
---|
455 | { |
---|
456 | test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) ); |
---|
457 | dum = (pi/anpn)*nt*protmulA[counter]*protnormA[nt-1]/(2.0*n*n); |
---|
458 | if( std::fabs(dum) < 1.0 ) |
---|
459 | { |
---|
460 | if( test >= 1.0e-10 )excs += dum*test; |
---|
461 | } |
---|
462 | else |
---|
463 | excs += dum*test; |
---|
464 | } |
---|
465 | } |
---|
466 | } |
---|
467 | } |
---|
468 | if( ran >= excs ) // 3 previous loops continued to the end |
---|
469 | { |
---|
470 | quasiElastic = true; |
---|
471 | return; |
---|
472 | } |
---|
473 | np--; nz--; |
---|
474 | } |
---|
475 | else // target must be a neutron |
---|
476 | { |
---|
477 | counter = -1; |
---|
478 | for( np=1; np<numSec/3 && ran>=excs; ++np ) |
---|
479 | { |
---|
480 | nm = np-1; |
---|
481 | for( nz=0; nz<numSec/3 && ran>=excs; ++nz ) |
---|
482 | { |
---|
483 | if( ++counter < numMulA ) |
---|
484 | { |
---|
485 | nt = np+nm+nz; |
---|
486 | if( nt>1 && nt<=numSec ) |
---|
487 | { |
---|
488 | test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) ); |
---|
489 | dum = (pi/anpn)*nt*neutmulA[counter]*neutnormA[nt-1]/(2.0*n*n); |
---|
490 | if( std::fabs(dum) < 1.0 ) |
---|
491 | { |
---|
492 | if( test >= 1.0e-10 )excs += dum*test; |
---|
493 | } |
---|
494 | else |
---|
495 | excs += dum*test; |
---|
496 | } |
---|
497 | } |
---|
498 | } |
---|
499 | } |
---|
500 | if( ran >= excs ) // 3 previous loops continued to the end |
---|
501 | { |
---|
502 | quasiElastic = true; |
---|
503 | return; |
---|
504 | } |
---|
505 | np--; nz--; |
---|
506 | } |
---|
507 | if( nz > 0 ) |
---|
508 | { |
---|
509 | if( nm > 0 ) |
---|
510 | { |
---|
511 | if( G4UniformRand() < 0.5 ) |
---|
512 | { |
---|
513 | vec.Initialize( 1 ); |
---|
514 | G4ReactionProduct *p = new G4ReactionProduct; |
---|
515 | p->SetDefinition( aKaonMinus ); |
---|
516 | (G4UniformRand() < 0.5) ? p->SetSide( -1 ) : p->SetSide( 1 ); |
---|
517 | vec.SetElement( vecLen++, p ); |
---|
518 | --nm; |
---|
519 | } |
---|
520 | else // random number >= 0.5 |
---|
521 | { |
---|
522 | vec.Initialize( 1 ); |
---|
523 | G4ReactionProduct *p = new G4ReactionProduct; |
---|
524 | p->SetDefinition( aKaonZL ); |
---|
525 | (G4UniformRand() < 0.5) ? p->SetSide( -1 ) : p->SetSide( 1 ); |
---|
526 | vec.SetElement( vecLen++, p ); |
---|
527 | --nz; |
---|
528 | } |
---|
529 | } |
---|
530 | else // nm == 0 |
---|
531 | { |
---|
532 | vec.Initialize( 1 ); |
---|
533 | G4ReactionProduct *p = new G4ReactionProduct; |
---|
534 | p->SetDefinition( aKaonZL ); |
---|
535 | (G4UniformRand() < 0.5) ? p->SetSide( -1 ) : p->SetSide( 1 ); |
---|
536 | vec.SetElement( vecLen++, p ); |
---|
537 | --nz; |
---|
538 | } |
---|
539 | } |
---|
540 | else // nz == 0 |
---|
541 | { |
---|
542 | if( nm > 0 ) |
---|
543 | { |
---|
544 | vec.Initialize( 1 ); |
---|
545 | G4ReactionProduct *p = new G4ReactionProduct; |
---|
546 | p->SetDefinition( aKaonMinus ); |
---|
547 | (G4UniformRand() < 0.5) ? p->SetSide( -1 ) : p->SetSide( 1 ); |
---|
548 | vec.SetElement( vecLen++, p ); |
---|
549 | --nm; |
---|
550 | } |
---|
551 | } |
---|
552 | currentParticle.SetMass( 0.0 ); |
---|
553 | targetParticle.SetMass( 0.0 ); |
---|
554 | } |
---|
555 | |
---|
556 | SetUpPions( np, nm, nz, vec, vecLen ); |
---|
557 | return; |
---|
558 | } |
---|
559 | |
---|
560 | /* end of file */ |
---|
561 | |
---|