399{
400 G4ping debug(
"debug_G4BinaryCascade");
401#ifdef debug_BIC_Propagate
402 G4cout <<
"G4BinaryCascade Propagate starting -------------------------------------------------------" <<
G4endl;
403#endif
404
408 theCurrentTime=0;
411
412 ClearAndDestroy(&theCapturedList);
413 ClearAndDestroy(&theSecondaryList);
414 theSecondaryList.clear();
415 ClearAndDestroy(&theFinalState);
416 std::vector<G4KineticTrack *>::iterator iter;
418
419 theCutOnP=90*MeV;
423
424
425 BuildTargetList();
426
427#ifdef debug_BIC_GetExcitationEnergy
428 G4cout <<
"ExcitationEnergy0 " << GetExcitationEnergy() <<
G4endl;
429#endif
430
432
433 G4bool success = BuildLateParticleCollisions(secondaries);
434 if (! success )
435 {
436 products=HighEnergyModelFSProducts(products, secondaries);
437 ClearAndDestroy(secondaries);
438 delete secondaries;
439
440#ifdef debug_G4BinaryCascade
441 G4cout <<
"G4BinaryCascade::Propagate: warning - high energy model failed energy conservation, returning unchanged high energy final state" <<
G4endl;
442#endif
443
444 return products;
445 }
446
447
450
451
452 FindCollisions(&theSecondaryList);
453
454
455 if(theCollisionMgr->
Entries() == 0 )
456 {
457
458 delete products;
459#ifdef debug_BIC_return
461#endif
462 return 0;
463 }
464
465
466
467
468
469 G4bool haveProducts =
false;
470 G4int collisionCount=0;
471 G4int collisionLoopMaxCount=1000000;
472 while(theCollisionMgr->
Entries() > 0 && currentZ && --collisionLoopMaxCount>0)
473 {
474 if(Absorb()) {
475 haveProducts = true;
476 }
477 if(Capture()) {
478 haveProducts = true;
479 }
480
481
482
483 if(theCollisionMgr->
Entries() > 0)
484 {
487#ifdef debug_BIC_Propagate_Collisions
488 G4cout <<
" NextCollision * , Time, curtime = " << nextCollision <<
" "
491#endif
493 {
494
496 {
497 nextCollision = 0;
498 }
499 }
500
501
502 if( nextCollision )
503 {
504 if (ApplyCollision(nextCollision))
505 {
506
507 haveProducts = true;
508 collisionCount++;
509
510
511
512 } else {
513
515 }
516 }
517 }
518 }
519
520
521
523 for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter)
524 {
526 }
527 if ( ! theTargetList.size() || ! nProtons ){
528
529 products = FillVoidNucleusProducts(products);
530#ifdef debug_BIC_return
531 G4cout <<
"return @ Z=0 after collision loop "<<
G4endl;
532 PrintKTVector(&theSecondaryList,std::string(" theSecondaryList"));
533 G4cout <<
"theTargetList size: " << theTargetList.size() <<
G4endl;
534 PrintKTVector(&theTargetList,std::string(" theTargetList"));
535 PrintKTVector(&theCapturedList,std::string(" theCapturedList"));
536
537 G4cout <<
" ExcitE be4 Correct : " <<GetExcitationEnergy() <<
G4endl;
538 G4cout <<
" Mom Transfered to nucleus : " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
539 PrintKTVector(&theFinalState,std::string(" FinalState uncorrected"));
540 G4cout <<
"returned products: " << products->size() <<
G4endl;
543#endif
544
545 return products;
546 }
547
548
549 if(Absorb()) {
550 haveProducts = true;
551
552 }
553
554 if(Capture()) {
555 haveProducts = true;
556
557 }
558
559 if(!haveProducts)
560 {
561#ifdef debug_BIC_return
563#endif
564 return products;
565 }
566
567
568#ifdef debug_BIC_Propagate
569 G4cout <<
" Momentum transfer to Nucleus " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
571#endif
572
573 StepParticlesOut();
575
576
577 if ( theSecondaryList.size() > 0 )
578 {
579#ifdef debug_G4BinaryCascade
580 G4cerr <<
"G4BinaryCascade: Warning, have active particles at end" <<
G4endl;
581 PrintKTVector(&theSecondaryList, "active particles @ end added to theFinalState");
582#endif
583
584 for ( iter =theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
585 {
586 theFinalState.push_back(*iter);
587 }
588 theSecondaryList.clear();
589
590 }
591 while ( theCollisionMgr->
Entries() > 0 )
592 {
593#ifdef debug_G4BinaryCascade
594 G4cerr <<
" Warning: remove left over collision(s) " <<
G4endl;
595#endif
597 }
598
599#ifdef debug_BIC_Propagate_Excitation
600
601 PrintKTVector(&theSecondaryList,std::string(" theSecondaryList"));
602 G4cout <<
"theTargetList size: " << theTargetList.size() <<
G4endl;
603
604 PrintKTVector(&theCapturedList,std::string(" theCapturedList"));
605
606 G4cout <<
" ExcitE be4 Correct : " <<GetExcitationEnergy() <<
G4endl;
607 G4cout <<
" Mom Transfered to nucleus : " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
608 PrintKTVector(&theFinalState,std::string(" FinalState uncorrected"));
609#endif
610
611
612
613
614 G4double ExcitationEnergy=GetExcitationEnergy();
615
616#ifdef debug_BIC_Propagate_finals
617 PrintKTVector(&theFinalState,std::string(" FinalState be4 corr"));
618 G4cout <<
" Excitation Energy prefinal, #collisions:, out, captured "
619 << ExcitationEnergy << " "
620 << collisionCount << " "
621 << theFinalState.size() << " "
622 << theCapturedList.size()<<
G4endl;
623#endif
624
625 if (ExcitationEnergy < 0 )
626 {
627 G4int maxtry=5, ntry=0;
628 do {
629 CorrectFinalPandE();
630 ExcitationEnergy=GetExcitationEnergy();
631 } while ( ++ntry < maxtry && ExcitationEnergy < 0 );
632 }
634
635#ifdef debug_BIC_Propagate_finals
636 PrintKTVector(&theFinalState,std::string(" FinalState corrected"));
637 G4cout <<
" Excitation Energy final, #collisions:, out, captured "
638 << ExcitationEnergy << " "
639 << collisionCount << " "
640 << theFinalState.size() << " "
641 << theCapturedList.size()<<
G4endl;
642#endif
643
644
645 if ( ExcitationEnergy < 0. )
646 {
647 #ifdef debug_G4BinaryCascade
648 G4cerr <<
"G4BinaryCascade-Warning: negative excitation energy ";
650 PrintKTVector(&theFinalState,std::string("FinalState"));
651 PrintKTVector(&theCapturedList,std::string("captured"));
652 G4cout <<
"negative ExE:Final 4Momentum .mag: " << GetFinal4Momentum()
653 <<
" "<< GetFinal4Momentum().
mag()<<
G4endl
654 << "negative ExE:FinalNucleusMom .mag: " << GetFinalNucleusMomentum()
655 <<
" "<< GetFinalNucleusMomentum().
mag()<<
G4endl;
656 #endif
657 #ifdef debug_BIC_return
658 G4cout <<
" negative Excitation E return empty products " << products <<
G4endl;
660 #endif
661
662 ClearAndDestroy(products);
663 return products;
664 }
665
667
668
671
672 products= ProductsAddFinalState(products, theFinalState);
673
674 products= ProductsAddPrecompound(products, precompoundProducts);
675
676
677
678
679 thePrimaryEscape = true;
680
681 #ifdef debug_BIC_return
683
684 #endif
685
686 return products;
687}
#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.