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