201{
203 static const G4double expxl = -expxu;
204
208
209 static const G4int numMul = 1200;
210 static const G4int numMulAn = 400;
211 static const G4int numSec = 60;
212
215
218
219 static G4bool first =
true;
220 static G4double protmul[numMul], protnorm[numSec];
221 static G4double protmulAn[numMulAn],protnormAn[numSec];
222 static G4double neutmul[numMul], neutnorm[numSec];
223 static G4double neutmulAn[numMulAn],neutnormAn[numSec];
224
225
226
227
228 G4int i, counter, nt, npos, nneg, nzero;
229
230 if( first )
231 {
232 first = false;
233 for( i=0; i<numMul ; i++ ) protmul[i] = 0.0;
234 for( i=0; i<numSec ; i++ ) protnorm[i] = 0.0;
235 counter = -1;
236 for( npos=0; npos<(numSec/3); npos++ )
237 {
238 for( nneg=std::max(0,npos-2); nneg<=npos; nneg++ )
239 {
240 for( nzero=0; nzero<numSec/3; nzero++ )
241 {
242 if( ++counter < numMul )
243 {
244 nt = npos+nneg+nzero;
245 if( (nt>0) && (nt<=numSec) )
246 {
247 protmul[counter] =
pmltpc(npos,nneg,nzero,nt,protb,c);
248 protnorm[nt-1] += protmul[counter];
249 }
250 }
251 }
252 }
253 }
254 for( i=0; i<numMul; i++ )neutmul[i] = 0.0;
255 for( i=0; i<numSec; i++ )neutnorm[i] = 0.0;
256 counter = -1;
257 for( npos=0; npos<numSec/3; npos++ )
258 {
259 for( nneg=std::max(0,npos-1); nneg<=(npos+1); nneg++ )
260 {
261 for( nzero=0; nzero<numSec/3; nzero++ )
262 {
263 if( ++counter < numMul )
264 {
265 nt = npos+nneg+nzero;
266 if( (nt>0) && (nt<=numSec) )
267 {
268 neutmul[counter] =
pmltpc(npos,nneg,nzero,nt,neutb,c);
269 neutnorm[nt-1] += neutmul[counter];
270 }
271 }
272 }
273 }
274 }
275 for( i=0; i<numSec; i++ )
276 {
277 if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i];
278 if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i];
279 }
280
281 for( i=0; i<numMulAn ; i++ ) protmulAn[i] = 0.0;
282 for( i=0; i<numSec ; i++ ) protnormAn[i] = 0.0;
283 counter = -1;
284 for( npos=1; npos<(numSec/3); npos++ )
285 {
286 nneg = std::max(0,npos-2);
287 for( nzero=0; nzero<numSec/3; nzero++ )
288 {
289 if( ++counter < numMulAn )
290 {
291 nt = npos+nneg+nzero;
292 if( (nt>1) && (nt<=numSec) )
293 {
294 protmulAn[counter] =
pmltpc(npos,nneg,nzero,nt,protb,c);
295 protnormAn[nt-1] += protmulAn[counter];
296 }
297 }
298 }
299 }
300 for( i=0; i<numMulAn; i++ ) neutmulAn[i] = 0.0;
301 for( i=0; i<numSec; i++ ) neutnormAn[i] = 0.0;
302 counter = -1;
303 for( npos=0; npos<numSec/3; npos++ )
304 {
305 nneg = npos-1;
306 for( nzero=0; nzero<numSec/3; nzero++ )
307 {
308 if( ++counter < numMulAn )
309 {
310 nt = npos+nneg+nzero;
311 if( (nt>1) && (nt<=numSec) )
312 {
313 neutmulAn[counter] =
pmltpc(npos,nneg,nzero,nt,neutb,c);
314 neutnormAn[nt-1] += neutmulAn[counter];
315 }
316 }
317 }
318 }
319 for( i=0; i<numSec; i++ )
320 {
321 if( protnormAn[i] > 0.0 )protnormAn[i] = 1.0/protnormAn[i];
322 if( neutnormAn[i] > 0.0 )neutnormAn[i] = 1.0/neutnormAn[i];
323 }
324 }
325
326
327
328
329 pv[0] = incidentParticle;
330 pv[1] = targetParticle;
331 vecLen = 2;
332
333 if( !inElastic )
334 {
335 G4double cech[] = {0.50, 0.45, 0.40, 0.35, 0.30, 0.25, 0.06, 0.04, 0.005, 0.};
336
337 G4int iplab = std::min(9,
G4int( incidentTotalMomentum*2.5 ));
338 if(
G4UniformRand() < cech[iplab]/std::pow(atomicWeight,0.42) )
339 {
341
343 {
344 if(ran < 0.2)
345 {
348 }
349 else if (ran < 0.4)
350 {
353 }
354 else if (ran < 0.6)
355 {
358 }
359 else if (ran < 0.8)
360 {
363 }
364 else
365 {
368 }
369 }
370 else
371 {
374 }
375 }
376 return;
377 }
379 return;
380
381
382
383 npos = 0; nneg = 0; nzero = 0;
384 G4double anhl[] = {1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 0.97, 0.88,
385 0.85, 0.81, 0.75, 0.64, 0.64, 0.55, 0.55, 0.45, 0.47, 0.40,
386 0.39, 0.36, 0.33, 0.10, 0.01};
387 G4int iplab =
G4int( incidentTotalMomentum*10.);
388 if ( iplab > 9) iplab = 10 +
G4int( (incidentTotalMomentum -1.)*5. );
389 if ( iplab > 14) iplab = 15 +
G4int( incidentTotalMomentum -2. );
390 if ( iplab > 22) iplab = 23 +
G4int( (incidentTotalMomentum -10.)/10.);
391 iplab = std::min(24, iplab);
392
394
395
396 G4double aleab = std::log(availableEnergy);
397 G4double n = 3.62567+aleab*(0.665843+aleab*(0.336514
398 + aleab*(0.117712+0.0136912*aleab))) - 2.0;
399
400
401
403
404 for (nt=1; nt<=numSec; nt++) {
405 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
406 dum =
pi*nt/(2.0*
n*
n);
407 if (std::fabs(dum) < 1.0) {
408 if( test >= 1.0e-10 )anpn += dum*test;
409 } else {
410 anpn += dum*test;
411 }
412 }
413
416 if (targetCode == protonCode) {
417 counter = -1;
418 for (npos = 0; npos < numSec/3; npos++) {
419 for (nneg = std::max(0,npos-2); nneg <= npos; nneg++) {
420 for (nzero = 0; nzero < numSec/3; nzero++) {
421 if (++counter < numMul) {
422 nt = npos+nneg+nzero;
423 if ((nt > 0) && (nt <= numSec) ) {
424 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
425 dum = (
pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
426 if (std::fabs(dum) < 1.0) {
427 if( test >= 1.0e-10 )excs += dum*test;
428 } else {
429 excs += dum*test;
430 }
431
432 if (ran < excs) goto outOfLoop;
433 }
434 }
435 }
436 }
437 }
438
439 inElastic = false;
440 return;
441 } else {
442 counter = -1;
443 for( npos=0; npos<numSec/3; npos++ )
444 {
445 for( nneg=std::max(0,npos-1); nneg<=(npos+1); nneg++ )
446 {
447 for( nzero=0; nzero<numSec/3; nzero++ )
448 {
449 if( ++counter < numMul )
450 {
451 nt = npos+nneg+nzero;
452 if ( (nt>0) && (nt<=numSec) ) {
453 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
454 dum = (
pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
455 if (std::fabs(dum) < 1.0) {
456 if( test >= 1.0e-10 )excs += dum*test;
457 } else {
458 excs += dum*test;
459 }
460
461 if (ran < excs) goto outOfLoop;
462 }
463 }
464 }
465 }
466 }
467
468 inElastic = false;
469 return;
470 }
471
472 outOfLoop:
473
475
476 if( targetCode == protonCode)
477 {
478 if( npos == nneg)
479 {
480 }
481 else if (npos == (nneg+1))
482 {
483 if( ran < 0.50)
484 {
486 }
487 else if (ran < 0.75)
488 {
490 }
491 else
492 {
494 }
495 }
496 else
497 {
498 if (ran < 0.5)
499 {
502 }
503 else
504 {
507 }
508 }
509 }
510 else
511 {
512 if( npos == nneg)
513 {
514 if (ran < 0.5)
515 {
516 }
517 else if(ran < 0.75)
518 {
521 }
522 else
523 {
526 }
527 }
528 else if ( npos == (nneg+1))
529 {
530 if (ran < 0.5)
531 {
533 }
534 else
535 {
537 }
538 }
539 else
540 {
542 }
543 }
544
545 }
546 else
547 {
549 {
550
551 G4double aleab = std::log(availableEnergy);
552 G4double n = 3.62567+aleab*(0.665843+aleab*(0.336514
553 + aleab*(0.117712+0.0136912*aleab))) - 2.0;
554
555
556
558
559 for (nt=2; nt<=numSec; nt++) {
560 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
561 dum =
pi*nt/(2.0*
n*
n);
562 if (std::fabs(dum) < 1.0) {
563 if( test >= 1.0e-10 )anpn += dum*test;
564 } else {
565 anpn += dum*test;
566 }
567 }
568
571 if( targetCode == protonCode )
572 {
573 counter = -1;
574 for( npos=2; npos<numSec/3; npos++ )
575 {
576 nneg = npos-2;
577 for( nzero=0; nzero<numSec/3; nzero++ )
578 {
579 if( ++counter < numMulAn )
580 {
581 nt = npos+nneg+nzero;
582 if ( (nt>1) && (nt<=numSec) ) {
583 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
584 dum = (
pi/anpn)*nt*protmulAn[counter]*protnormAn[nt-1]/(2.0*n*n);
585 if (std::fabs(dum) < 1.0) {
586 if( test >= 1.0e-10 )excs += dum*test;
587 } else {
588 excs += dum*test;
589 }
590
591 if (ran < excs) goto outOfLoopAn;
592 }
593 }
594 }
595 }
596
597 inElastic = false;
598 return;
599 }
600 else
601 {
602 counter = -1;
603 for( npos=1; npos<numSec/3; npos++ )
604 {
605 nneg = npos-1;
606 for( nzero=0; nzero<numSec/3; nzero++ )
607 {
608 if (++counter < numMulAn) {
609 nt = npos+nneg+nzero;
610 if ( (nt>1) && (nt<=numSec) ) {
611 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
612 dum = (
pi/anpn)*nt*neutmulAn[counter]*neutnormAn[nt-1]/(2.0*n*n);
613 if (std::fabs(dum) < 1.0) {
614 if( test >= 1.0e-10 )excs += dum*test;
615 } else {
616 excs += dum*test;
617 }
618
619 if (ran < excs) goto outOfLoopAn;
620 }
621 }
622 }
623 }
624 inElastic = false;
625 return;
626 }
627 outOfLoopAn:
628 vecLen = 0;
629 }
630 }
631
632 nt = npos + nneg + nzero;
633 while ( nt > 0)
634 {
637 {
638 if( npos > 0 )
640 npos--;
641 }
642 }
643 else if ( ran < (
G4double)(npos+nneg)/nt)
644 {
645 if( nneg > 0 )
646 {
648 nneg--;
649 }
650 }
651 else
652 {
653 if( nzero > 0 )
654 {
656 nzero--;
657 }
658 }
659 nt = npos + nneg + nzero;
660 }
662 {
663 G4cout <<
"Particles produced: " ;
666 for (i=2; i < vecLen; i++)
667 {
669 }
671 }
672 return;
673 }
G4double pmltpc(G4int np, G4int nm, G4int nz, G4int n, G4double b, G4double c)
G4HEVector AntiSigmaMinus
G4double getTotalMomentum() const