200{
202 static const G4double expxl = -expxu;
203
207
208 static const G4int numMul = 1200;
209 static const G4int numMulAn = 400;
210 static const G4int numSec = 60;
211
213
216
217 static G4bool first =
true;
218 static G4double protmul[numMul], protnorm[numSec];
219 static G4double protmulAn[numMulAn],protnormAn[numSec];
220 static G4double neutmul[numMul], neutnorm[numSec];
221 static G4double neutmulAn[numMulAn],neutnormAn[numSec];
222
223
224
225
226 G4int i, counter, nt, npos, nneg, nzero;
227
228 if( first )
229 {
230 first = false;
231 for( i=0; i<numMul ; i++ ) protmul[i] = 0.0;
232 for( i=0; i<numSec ; i++ ) protnorm[i] = 0.0;
233 counter = -1;
234 for( npos=0; npos<(numSec/3); npos++ )
235 {
236 for( nneg=std::max(0,npos-2); nneg<=(npos+1); nneg++ )
237 {
238 for( nzero=0; nzero<numSec/3; nzero++ )
239 {
240 if( ++counter < numMul )
241 {
242 nt = npos+nneg+nzero;
243 if( (nt>0) && (nt<=numSec) )
244 {
245 protmul[counter] =
pmltpc(npos,nneg,nzero,nt,protb,c);
246 protnorm[nt-1] += protmul[counter];
247 }
248 }
249 }
250 }
251 }
252 for( i=0; i<numMul; i++ )neutmul[i] = 0.0;
253 for( i=0; i<numSec; i++ )neutnorm[i] = 0.0;
254 counter = -1;
255 for( npos=0; npos<numSec/3; npos++ )
256 {
257 for( nneg=std::max(0,npos-1); nneg<=(npos+2); nneg++ )
258 {
259 for( nzero=0; nzero<numSec/3; nzero++ )
260 {
261 if( ++counter < numMul )
262 {
263 nt = npos+nneg+nzero;
264 if( (nt>0) && (nt<=numSec) )
265 {
266 neutmul[counter] =
pmltpc(npos,nneg,nzero,nt,neutb,c);
267 neutnorm[nt-1] += neutmul[counter];
268 }
269 }
270 }
271 }
272 }
273 for( i=0; i<numSec; i++ )
274 {
275 if( protnorm[i] > 0.0 )protnorm[i] = 1.0/protnorm[i];
276 if( neutnorm[i] > 0.0 )neutnorm[i] = 1.0/neutnorm[i];
277 }
278
279 for( i=0; i<numMulAn ; i++ ) protmulAn[i] = 0.0;
280 for( i=0; i<numSec ; i++ ) protnormAn[i] = 0.0;
281 counter = -1;
282 for( npos=1; npos<(numSec/3); npos++ )
283 {
284 nneg = std::max(0,npos-1);
285 for( nzero=0; nzero<numSec/3; nzero++ )
286 {
287 if( ++counter < numMulAn )
288 {
289 nt = npos+nneg+nzero;
290 if( (nt>1) && (nt<=numSec) )
291 {
292 protmulAn[counter] =
pmltpc(npos,nneg,nzero,nt,protb,c);
293 protnormAn[nt-1] += protmulAn[counter];
294 }
295 }
296 }
297 }
298 for( i=0; i<numMulAn; i++ ) neutmulAn[i] = 0.0;
299 for( i=0; i<numSec; i++ ) neutnormAn[i] = 0.0;
300 counter = -1;
301 for( npos=0; npos<numSec/3; npos++ )
302 {
303 nneg = npos;
304 for( nzero=0; nzero<numSec/3; nzero++ )
305 {
306 if( ++counter < numMulAn )
307 {
308 nt = npos+nneg+nzero;
309 if( (nt>1) && (nt<=numSec) )
310 {
311 neutmulAn[counter] =
pmltpc(npos,nneg,nzero,nt,neutb,c);
312 neutnormAn[nt-1] += neutmulAn[counter];
313 }
314 }
315 }
316 }
317 for( i=0; i<numSec; i++ )
318 {
319 if( protnormAn[i] > 0.0 )protnormAn[i] = 1.0/protnormAn[i];
320 if( neutnormAn[i] > 0.0 )neutnormAn[i] = 1.0/neutnormAn[i];
321 }
322 }
323
324
325
326
327 pv[0] = incidentParticle;
328 pv[1] = targetParticle;
329 vecLen = 2;
330
331 if( !inElastic )
332 {
333 G4double cech[] = {0.50, 0.45, 0.40, 0.35, 0.30, 0.25, 0.06, 0.04, 0.005, 0.};
334
335 G4int iplab = std::min(9,
G4int( incidentTotalMomentum*2.5));
336 if(
G4UniformRand() < cech[iplab]/std::pow(atomicWeight,0.42) )
337 {
339
340 if ( targetCode == protonCode)
341 {
342 if(ran < 0.2)
343 {
345 }
346 else if (ran < 0.4)
347 {
350 }
351 else if (ran < 0.6)
352 {
355 }
356 else if (ran < 0.8)
357 {
360 }
361 else
362 {
365 }
366 }
367 else
368 {
369 if (ran < 0.2)
370 {
372 }
373 else if (ran < 0.4)
374 {
377 }
378 else if (ran < 0.6)
379 {
382 }
383 else if (ran < 0.8)
384 {
387 }
388 else
389 {
392 }
393 }
394 }
395 return;
396 }
398 return;
399
400
401
402 npos = 0; nneg = 0; nzero = 0;
403 G4double anhl[] = {1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 0.97, 0.88,
404 0.85, 0.81, 0.75, 0.64, 0.64, 0.55, 0.55, 0.45, 0.47, 0.40,
405 0.39, 0.36, 0.33, 0.10, 0.01};
406 G4int iplab =
G4int( incidentTotalMomentum*10.);
407 if ( iplab > 9) iplab = 10 +
G4int( (incidentTotalMomentum -1.)*5. );
408 if ( iplab > 14) iplab = 15 +
G4int( incidentTotalMomentum -2. );
409 if ( iplab > 22) iplab = 23 +
G4int( (incidentTotalMomentum -10.)/10.);
410 iplab = std::min(24, iplab);
411
413 {
414
415
416
417 G4double aleab = std::log(availableEnergy);
418 G4double n = 3.62567+aleab*(0.665843+aleab*(0.336514
419 + aleab*(0.117712+0.0136912*aleab))) - 2.0;
420
421
422
424
425 for (nt=1; nt<=numSec; nt++) {
426 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
427 dum =
pi*nt/(2.0*
n*
n);
428 if (std::fabs(dum) < 1.0) {
429 if( test >= 1.0e-10 )anpn += dum*test;
430 } else {
431 anpn += dum*test;
432 }
433 }
434
437 if( targetCode == protonCode )
438 {
439 counter = -1;
440 for( npos=0; npos<numSec/3; npos++ )
441 {
442 for( nneg=std::max(0,npos-2); nneg<=(npos+1); nneg++ )
443 {
444 for( nzero=0; nzero<numSec/3; nzero++ )
445 {
446 if( ++counter < numMul )
447 {
448 nt = npos+nneg+nzero;
449 if ( (nt>0) && (nt<=numSec) ) {
450 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
451 dum = (
pi/anpn)*nt*protmul[counter]*protnorm[nt-1]/(2.0*n*n);
452 if (std::fabs(dum) < 1.0) {
453 if( test >= 1.0e-10 )excs += dum*test;
454 } else {
455 excs += dum*test;
456 }
457
458 if (ran < excs) goto outOfLoop;
459 }
460 }
461 }
462 }
463 }
464
465
466 inElastic = false;
467 return;
468 }
469 else
470 {
471 counter = -1;
472 for( npos=0; npos<numSec/3; npos++ )
473 {
474 for( nneg=std::max(0,npos-1); nneg<=(npos+2); nneg++ )
475 {
476 for( nzero=0; nzero<numSec/3; nzero++ )
477 {
478 if( ++counter < numMul )
479 {
480 nt = npos+nneg+nzero;
481 if ( (nt>0) && (nt<=numSec) ) {
482 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
483 dum = (
pi/anpn)*nt*neutmul[counter]*neutnorm[nt-1]/(2.0*n*n);
484 if (std::fabs(dum) < 1.0) {
485 if( test >= 1.0e-10 )excs += dum*test;
486 } else {
487 excs += dum*test;
488 }
489
490 if (ran < excs) goto outOfLoop;
491 }
492 }
493 }
494 }
495 }
496
497 inElastic = false;
498 return;
499 }
500
501 outOfLoop:
502
504
505 if( targetCode == protonCode)
506 {
507 if( npos == nneg)
508 {
509 if (ran < 0.40)
510 {
511 }
512 else if (ran < 0.8)
513 {
515 }
516 else
517 {
520 }
521 }
522 else if (npos == (nneg+1))
523 {
524 if( ran < 0.25)
525 {
527 }
528 else if (ran < 0.5)
529 {
532 }
533 else
534 {
536 }
537 }
538 else if (npos == (nneg-1))
539 {
541 }
542 else
543 {
546 }
547 }
548 else
549 {
550 if( npos == nneg)
551 {
552 if (ran < 0.4)
553 {
554 }
555 else if(ran < 0.8)
556 {
558 }
559 else
560 {
563 }
564 }
565 else if ( npos == (nneg-1))
566 {
567 if (ran < 0.5)
568 {
570 }
571 else if (ran < 0.75)
572 {
574 }
575 else
576 {
579 }
580 }
581 else if (npos == (nneg+1))
582 {
584 }
585 else
586 {
589 }
590 }
591
592 }
593 else
594 {
596 {
597
598 G4double aleab = std::log(availableEnergy);
599 G4double n = 3.62567+aleab*(0.665843+aleab*(0.336514
600 + aleab*(0.117712+0.0136912*aleab))) - 2.0;
601
602
603
605
606 for (nt=2; nt<=numSec; nt++) {
607 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
608 dum =
pi*nt/(2.0*
n*
n);
609 if (std::fabs(dum) < 1.0) {
610 if( test >= 1.0e-10 )anpn += dum*test;
611 } else {
612 anpn += dum*test;
613 }
614 }
615
618 if( targetCode == protonCode )
619 {
620 counter = -1;
621 for( npos=1; npos<numSec/3; npos++ )
622 {
623 nneg = npos-1;
624 for( nzero=0; nzero<numSec/3; nzero++ )
625 {
626 if( ++counter < numMulAn )
627 {
628 nt = npos+nneg+nzero;
629 if ( (nt>1) && (nt<=numSec) ) {
630 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
631 dum = (
pi/anpn)*nt*protmulAn[counter]*protnormAn[nt-1]/(2.0*n*n);
632 if (std::fabs(dum) < 1.0) {
633 if( test >= 1.0e-10 )excs += dum*test;
634 } else {
635 excs += dum*test;
636 }
637
638 if (ran < excs) goto outOfLoopAn;
639 }
640 }
641 }
642 }
643
644 inElastic = false;
645 return;
646 }
647 else
648 {
649 counter = -1;
650 for( npos=0; npos<numSec/3; npos++ )
651 {
652 nneg = npos;
653 for( nzero=0; nzero<numSec/3; nzero++ )
654 {
655 if( ++counter < numMulAn )
656 {
657 nt = npos+nneg+nzero;
658 if ( (nt>1) && (nt<=numSec) ) {
659 test = std::exp( std::min( expxu, std::max( expxl, -(pi/4.0)*(nt*nt)/(n*n) ) ) );
660 dum = (
pi/anpn)*nt*neutmulAn[counter]*neutnormAn[nt-1]/(2.0*n*n);
661 if (std::fabs(dum) < 1.0) {
662 if( test >= 1.0e-10 )excs += dum*test;
663 } else {
664 excs += dum*test;
665 }
666
667 if (ran < excs) goto outOfLoopAn;
668 }
669 }
670 }
671 }
672 inElastic = false;
673 return;
674 }
675 outOfLoopAn:
676 vecLen = 0;
677 }
678 }
679
680 nt = npos + nneg + nzero;
681 while ( nt > 0)
682 {
685 {
686 if( npos > 0 )
688 npos--;
689 }
690 }
691 else if ( ran < (
G4double)(npos+nneg)/nt)
692 {
693 if( nneg > 0 )
694 {
696 nneg--;
697 }
698 }
699 else
700 {
701 if( nzero > 0 )
702 {
704 nzero--;
705 }
706 }
707 nt = npos + nneg + nzero;
708 }
710 {
711 G4cout <<
"Particles produced: " ;
714 for (i=2; i < vecLen; i++)
715 {
717 }
719 }
720 return;
721 }
G4double pmltpc(G4int np, G4int nm, G4int nz, G4int n, G4double b, G4double c)
G4HEVector AntiSigmaMinus
G4double getTotalMomentum() const