342{
343 G4ping debug(
"debug_G4BinaryCascade");
344#ifdef debug_BIC_Propagate
345 G4cout <<
"G4BinaryCascade Propagate starting -------------------------------------------------------" <<
G4endl;
346#endif
347
351 theCurrentTime=0;
353
354 ClearAndDestroy(&theCapturedList);
355 ClearAndDestroy(&theSecondaryList);
356 theSecondaryList.clear();
357 ClearAndDestroy(&theFinalState);
358 std::vector<G4KineticTrack *>::iterator iter;
360
361 theCutOnP=90*MeV;
365
366
367 BuildTargetList();
368
369#ifdef debug_BIC_GetExcitationEnergy
370 G4cout <<
"ExcitationEnergy0 " << GetExcitationEnergy() <<
G4endl;
371#endif
372
374
375 G4bool success = BuildLateParticleCollisions(secondaries);
376 if (! success )
377 {
378 products=HighEnergyModelFSProducts(products, secondaries);
379 ClearAndDestroy(secondaries);
380 delete secondaries;
381
382#ifdef debug_G4BinaryCascade
383 G4cout <<
"G4BinaryCascade::Propagate: warning - high energy model failed energy conservation, returning unchanged high energy final state" <<
G4endl;
384#endif
385
386 return products;
387 }
388
389
391
392
393 FindCollisions(&theSecondaryList);
394
395
396 if(theCollisionMgr->
Entries() == 0 )
397 {
398
399 delete products;
400#ifdef debug_BIC_return
402#endif
403 return 0;
404 }
405
406
407
408
409
410 G4bool haveProducts =
false;
411 G4int collisionCount=0;
413 while(theCollisionMgr->
Entries() > 0 && currentZ)
414 {
415 if(Absorb()) {
416 haveProducts = true;
417 }
419 if(Capture()) {
420 haveProducts = true;
421 }
423
424
425
426 if(theCollisionMgr->
Entries() > 0)
427 {
430#ifdef debug_BIC_Propagate_Collisions
431 G4cout <<
" NextCollision * , Time, curtime = " << nextCollision <<
" "
434#endif
436 {
437
439 {
440 nextCollision = 0;
441 }
442 }
443
444 if( nextCollision )
445 {
446 if (ApplyCollision(nextCollision))
447 {
448
449 haveProducts = true;
450 collisionCount++;
452
453 } else {
454
456 }
457 }
458 }
459 }
460
461
462
463 if ( ! currentZ ){
464
465 products = FillVoidNucleusProducts(products);
466#ifdef debug_BIC_return
467 G4cout <<
"return @ Z=0 after collision loop "<<
G4endl;
468 PrintKTVector(&theSecondaryList,std::string(" theSecondaryList"));
469 G4cout <<
"theTargetList size: " << theTargetList.size() <<
G4endl;
470 PrintKTVector(&theTargetList,std::string(" theTargetList"));
471 PrintKTVector(&theCapturedList,std::string(" theCapturedList"));
472
473 G4cout <<
" ExcitE be4 Correct : " <<GetExcitationEnergy() <<
G4endl;
474 G4cout <<
" Mom Transfered to nucleus : " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
475 PrintKTVector(&theFinalState,std::string(" FinalState uncorrected"));
476 G4cout <<
"returned products: " << products->size() <<
G4endl;
477#endif
478
479 return products;
480 }
481
482
483 if(Absorb()) {
484 haveProducts = true;
485
486 }
487
488 if(Capture()) {
489 haveProducts = true;
490
491 }
492
493 if(!haveProducts)
494 {
495#ifdef debug_BIC_return
497#endif
498 return products;
499 }
500
501
502#ifdef debug_BIC_Propagate
503 G4cout <<
" Momentum transfer to Nucleus " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
505#endif
506
507 StepParticlesOut();
508
509
510 if ( theSecondaryList.size() > 0 )
511 {
512#ifdef debug_G4BinaryCascade
513 G4cerr <<
"G4BinaryCascade: Warning, have active particles at end" <<
G4endl;
514 PrintKTVector(&theSecondaryList, "active particles @ end added to theFinalState");
515#endif
516
517 for ( iter =theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
518 {
519 theFinalState.push_back(*iter);
520 }
521 theSecondaryList.clear();
522
523 }
524 while ( theCollisionMgr->
Entries() > 0 )
525 {
526#ifdef debug_G4BinaryCascade
527 G4cerr <<
" Warning: remove left over collision(s) " <<
G4endl;
528#endif
530 }
531
532#ifdef debug_BIC_Propagate_Excitation
533
534 PrintKTVector(&theSecondaryList,std::string(" theSecondaryList"));
535 G4cout <<
"theTargetList size: " << theTargetList.size() <<
G4endl;
536
537 PrintKTVector(&theCapturedList,std::string(" theCapturedList"));
538
539 G4cout <<
" ExcitE be4 Correct : " <<GetExcitationEnergy() <<
G4endl;
540 G4cout <<
" Mom Transfered to nucleus : " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
541 PrintKTVector(&theFinalState,std::string(" FinalState uncorrected"));
542#endif
543
544
545
546
547 G4double ExcitationEnergy=GetExcitationEnergy();
548
549#ifdef debug_BIC_Propagate_finals
550 PrintKTVector(&theFinalState,std::string(" FinalState be4 corr"));
551 G4cout <<
" Excitation Energy prefinal, #collisions:, out, captured "
552 << ExcitationEnergy << " "
553 << collisionCount << " "
554 << theFinalState.size() << " "
555 << theCapturedList.size()<<
G4endl;
556#endif
557
558 if (ExcitationEnergy < 0 )
559 {
560 G4int maxtry=5, ntry=0;
561 do {
562 CorrectFinalPandE();
563 ExcitationEnergy=GetExcitationEnergy();
564 } while ( ++ntry < maxtry && ExcitationEnergy < 0 );
565 }
566
567#ifdef debug_BIC_Propagate_finals
568 PrintKTVector(&theFinalState,std::string(" FinalState corrected"));
569 G4cout <<
" Excitation Energy final, #collisions:, out, captured "
570 << ExcitationEnergy << " "
571 << collisionCount << " "
572 << theFinalState.size() << " "
573 << theCapturedList.size()<<
G4endl;
574#endif
575
576
577 if ( ExcitationEnergy < 0. )
578 {
579
580 {
581
582
583
584
585
586
587
588
589
590
591 }
592 ClearAndDestroy(products);
593
594#ifdef debug_BIC_return
596#endif
597 return products;
598 }
599
601
602
604
605 products= ProductsAddFinalState(products, theFinalState);
606
607 products= ProductsAddPrecompound(products, precompoundProducts);
608
609
610
611
612 thePrimaryEscape = true;
613
614 #ifdef debug_BIC_return
616
617 #endif
618
619 return products;
620}
#define _CheckChargeAndBaryonNumber_(val)
CLHEP::HepLorentzVector G4LorentzVector
CLHEP::Hep3Vector G4ThreeVector
G4DLLIMPORT std::ostream G4cout
G4double GetCollisionTime(void)
void RemoveCollision(G4CollisionInitialState *collision)
G4CollisionInitialState * GetNextCollision()
virtual G4double GetMass()=0