389{
390 G4ping debug(
"debug_G4BinaryCascade");
391#ifdef debug_BIC_Propagate
392 G4cout <<
"G4BinaryCascade Propagate starting -------------------------------------------------------" <<
G4endl;
393#endif
394
398 theCurrentTime=0;
401
402 ClearAndDestroy(&theCapturedList);
403 ClearAndDestroy(&theSecondaryList);
404 theSecondaryList.clear();
405 ClearAndDestroy(&theFinalState);
406 std::vector<G4KineticTrack *>::iterator iter;
408
409 theCutOnP=90*MeV;
413
414
415 BuildTargetList();
416
417#ifdef debug_BIC_GetExcitationEnergy
418 G4cout <<
"ExcitationEnergy0 " << GetExcitationEnergy() <<
G4endl;
419#endif
420
422
423 G4bool success = BuildLateParticleCollisions(secondaries);
424 if (! success )
425 {
426 products=HighEnergyModelFSProducts(products, secondaries);
427 ClearAndDestroy(secondaries);
428 delete secondaries;
429
430#ifdef debug_G4BinaryCascade
431 G4cout <<
"G4BinaryCascade::Propagate: warning - high energy model failed energy conservation, returning unchanged high energy final state" <<
G4endl;
432#endif
433
434 return products;
435 }
436
437
440
441
442 FindCollisions(&theSecondaryList);
443
444
445 if(theCollisionMgr->
Entries() == 0 )
446 {
447
448 delete products;
449#ifdef debug_BIC_return
451#endif
452 return 0;
453 }
454
455
456
457
458
459 G4bool haveProducts =
false;
460#ifdef debug_BIC_Propagate_Collisions
461 G4int collisionCount=0;
462#endif
463 G4int collisionLoopMaxCount=1000000;
464 while(theCollisionMgr->
Entries() > 0 && currentZ && --collisionLoopMaxCount>0)
465 {
466 if(Absorb()) {
467 haveProducts = true;
468 }
469 if(Capture()) {
470 haveProducts = true;
471 }
472
473
474
475 if(theCollisionMgr->
Entries() > 0)
476 {
479#ifdef debug_BIC_Propagate_Collisions
480 G4cout <<
" NextCollision * , Time, curtime = " << nextCollision <<
" "
483#endif
485 {
486
488 {
489 nextCollision = 0;
490 }
491 }
492
493
494 if( nextCollision )
495 {
496 if (ApplyCollision(nextCollision))
497 {
498
499 haveProducts = true;
500#ifdef debug_BIC_Propagate_Collisions
501 collisionCount++;
502#endif
503
504 } else {
505
507 }
508 }
509 }
510 }
511
512
513
515 for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter)
516 {
518 }
519 if ( ! theTargetList.size() || ! nProtons ){
520
521 products = FillVoidNucleusProducts(products);
522#ifdef debug_BIC_return
523 G4cout <<
"return @ Z=0 after collision loop "<<
G4endl;
524 PrintKTVector(&theSecondaryList,std::string(" theSecondaryList"));
525 G4cout <<
"theTargetList size: " << theTargetList.size() <<
G4endl;
526 PrintKTVector(&theTargetList,std::string(" theTargetList"));
527 PrintKTVector(&theCapturedList,std::string(" theCapturedList"));
528
529 G4cout <<
" ExcitE be4 Correct : " <<GetExcitationEnergy() <<
G4endl;
530 G4cout <<
" Mom Transfered to nucleus : " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
531 PrintKTVector(&theFinalState,std::string(" FinalState uncorrected"));
532 G4cout <<
"returned products: " << products->size() <<
G4endl;
535#endif
536
537 return products;
538 }
539
540
541 if(Absorb()) {
542 haveProducts = true;
543
544 }
545
546 if(Capture()) {
547 haveProducts = true;
548
549 }
550
551 if(!haveProducts)
552 {
553#ifdef debug_BIC_return
555#endif
556 return products;
557 }
558
559
560#ifdef debug_BIC_Propagate
561 G4cout <<
" Momentum transfer to Nucleus " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
563#endif
564
565 StepParticlesOut();
567
568
569 if ( theSecondaryList.size() > 0 )
570 {
571#ifdef debug_G4BinaryCascade
572 G4cerr <<
"G4BinaryCascade: Warning, have active particles at end" <<
G4endl;
573 PrintKTVector(&theSecondaryList, "active particles @ end added to theFinalState");
574#endif
575
576 for ( iter =theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
577 {
578 theFinalState.push_back(*iter);
579 }
580 theSecondaryList.clear();
581
582 }
583 while ( theCollisionMgr->
Entries() > 0 )
584 {
585#ifdef debug_G4BinaryCascade
586 G4cerr <<
" Warning: remove left over collision(s) " <<
G4endl;
587#endif
589 }
590
591#ifdef debug_BIC_Propagate_Excitation
592
593 PrintKTVector(&theSecondaryList,std::string(" theSecondaryList"));
594 G4cout <<
"theTargetList size: " << theTargetList.size() <<
G4endl;
595
596 PrintKTVector(&theCapturedList,std::string(" theCapturedList"));
597
598 G4cout <<
" ExcitE be4 Correct : " <<GetExcitationEnergy() <<
G4endl;
599 G4cout <<
" Mom Transfered to nucleus : " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
600 PrintKTVector(&theFinalState,std::string(" FinalState uncorrected"));
601#endif
602
603
604
605
606 G4double ExcitationEnergy=GetExcitationEnergy();
607
608#ifdef debug_BIC_Propagate_finals
609 PrintKTVector(&theFinalState,std::string(" FinalState be4 corr"));
610 G4cout <<
" Excitation Energy prefinal, #collisions:, out, captured "
611 << ExcitationEnergy << " "
612 << collisionCount << " "
613 << theFinalState.size() << " "
614 << theCapturedList.size()<<
G4endl;
615#endif
616
617 if (ExcitationEnergy < 0 )
618 {
619 G4int maxtry=5, ntry=0;
620 do {
621 CorrectFinalPandE();
622 ExcitationEnergy=GetExcitationEnergy();
623 } while ( ++ntry < maxtry && ExcitationEnergy < 0 );
624 }
626
627#ifdef debug_BIC_Propagate_finals
628 PrintKTVector(&theFinalState,std::string(" FinalState corrected"));
629 G4cout <<
" Excitation Energy final, #collisions:, out, captured "
630 << ExcitationEnergy << " "
631 << collisionCount << " "
632 << theFinalState.size() << " "
633 << theCapturedList.size()<<
G4endl;
634#endif
635
636
637 if ( ExcitationEnergy < 0. )
638 {
639 #ifdef debug_G4BinaryCascade
640 G4cerr <<
"G4BinaryCascade-Warning: negative excitation energy ";
642 PrintKTVector(&theFinalState,std::string("FinalState"));
643 PrintKTVector(&theCapturedList,std::string("captured"));
644 G4cout <<
"negative ExE:Final 4Momentum .mag: " << GetFinal4Momentum()
645 <<
" "<< GetFinal4Momentum().
mag()<<
G4endl
646 << "negative ExE:FinalNucleusMom .mag: " << GetFinalNucleusMomentum()
647 <<
" "<< GetFinalNucleusMomentum().
mag()<<
G4endl;
648 #endif
649 #ifdef debug_BIC_return
650 G4cout <<
" negative Excitation E return empty products " << products <<
G4endl;
652 #endif
653
654 ClearAndDestroy(products);
655 return products;
656 }
657
659
660
663
664 products= ProductsAddFinalState(products, theFinalState);
665
666 products= ProductsAddPrecompound(products, precompoundProducts);
667
668
669
670
671 thePrimaryEscape = true;
672
673 #ifdef debug_BIC_return
675
676 #endif
677
678 return products;
679}
#define _CheckChargeAndBaryonNumber_(val)
#define _DebugEpConservation(val)
CLHEP::HepLorentzVector G4LorentzVector
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
G4double GetCollisionTime(void)
void RemoveCollision(G4CollisionInitialState *collision)
G4CollisionInitialState * GetNextCollision()
static G4Proton * Proton()
virtual G4double GetMass()=0
ParticleList decay(Cluster *const c)
Carries out a cluster decay.