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