93 #if defined(debug_G4BinaryCascade)
94 #define _CheckChargeAndBaryonNumber_(val) CheckChargeAndBaryonNumber(val)
96 #define _CheckChargeAndBaryonNumber_(val)
111 theImR.push_back(theDecay);
114 theImR.push_back(aAb);
117 theImR.push_back(aSc);
123 theCutOnPAbsorb= 0*
MeV;
137 thePrimaryEscape =
true;
146 projectileA=projectileZ=0;
147 currentInitialEnergy=initial_nuclear_mass=0.;
161 ClearAndDestroy(&theTargetList);
162 ClearAndDestroy(&theSecondaryList);
163 ClearAndDestroy(&theCapturedList);
164 delete thePropagator;
165 delete theCollisionMgr;
167 delete theLateParticle;
169 delete theH1Scatterer;
174 outFile <<
"G4BinaryCascade is an intra-nuclear cascade model in which\n"
175 <<
"an incident hadron collides with a nucleon, forming two\n"
176 <<
"final-state particles, one or both of which may be resonances.\n"
177 <<
"The resonances then decay hadronically and the decay products\n"
178 <<
"are then propagated through the nuclear potential along curved\n"
179 <<
"trajectories until they re-interact or leave the nucleus.\n"
180 <<
"This model is valid for incident pions up to 1.5 GeV and\n"
181 <<
"nucleons up to 10 GeV.\n";
185 outFile <<
"G4BinaryCascade propagtes secondaries produced by a high\n"
186 <<
"energy model through the wounded nucleus.\n"
187 <<
"Secondaries are followed after the formation time and if\n"
188 <<
"within the nucleus are propagated through the nuclear\n"
189 <<
"potential along curved trajectories until they interact\n"
190 <<
"with a nucleon, decay, or leave the nucleus.\n"
191 <<
"An interaction of a secondary with a nucleon produces two\n"
192 <<
"final-state particles, one or both of which may be resonances.\n"
193 <<
"Resonances decay hadronically and the decay products\n"
194 <<
"are in turn propagated through the nuclear potential along curved\n"
195 <<
"trajectories until they re-interact or leave the nucleus.\n"
196 <<
"This model is valid for pions up to 1.5 GeV and\n"
197 <<
"nucleons up to about 3.5 GeV.\n";
212 static G4int eventcounter=0;
223 if(getenv(
"BCDEBUG") )
G4cerr <<
" ######### Binary Cascade Reaction number starts ######### "<<eventcounter<<
G4endl;
228 if(initial4Momentum.
e()-initial4Momentum.
m()<theBCminP &&
242 if(!getenv(
"I_Am_G4BinaryCascade_Developer") )
249 G4cerr <<
"You are using G4BinaryCascade for projectiles other than nucleons or pions."<<
G4endl;
250 G4cerr <<
"If you want to continue, please switch on the developer environment: "<<
G4endl;
251 G4cerr <<
"setenv I_Am_G4BinaryCascade_Developer 1 "<<G4endl<<
G4endl;
252 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade - used for unvalid particle type - Fatal");
257 thePrimaryType = definition;
258 thePrimaryEscape =
false;
262 G4int interactionCounter = 0;
270 ClearAndDestroy(products);
284 initialPosition=GetSpherePoint(1.1*radius, initial4Momentum);
285 kt =
new G4KineticTrack(definition, 0., initialPosition, initial4Momentum);
289 secondaries->push_back(kt);
296 }
while(! products );
298 if(++interactionCounter>99)
break;
299 }
while(products->size() == 0);
301 if(products->size()>0)
307 G4ReactionProductVector::iterator iter;
309 for(iter = products->begin(); iter != products->end(); ++iter)
313 (*iter)->GetTotalEnergy(),
314 (*iter)->GetMomentum());
322 if(getenv(
"BCDEBUG") )
G4cerr <<
" ######### Binary Cascade Reaction number void ######### "<<eventcounter<<
G4endl;
328 ClearAndDestroy(products);
334 if(getenv(
"BCDEBUG") )
G4cerr <<
" ######### Binary Cascade Reaction number ends ######### "<<eventcounter<<
G4endl;
344 #ifdef debug_BIC_Propagate
345 G4cout <<
"G4BinaryCascade Propagate starting -------------------------------------------------------" <<
G4endl;
354 ClearAndDestroy(&theCapturedList);
355 ClearAndDestroy(&theSecondaryList);
356 theSecondaryList.clear();
357 ClearAndDestroy(&theFinalState);
358 std::vector<G4KineticTrack *>::iterator iter;
369 #ifdef debug_BIC_GetExcitationEnergy
370 G4cout <<
"ExcitationEnergy0 " << GetExcitationEnergy() <<
G4endl;
375 G4bool success = BuildLateParticleCollisions(secondaries);
378 products=HighEnergyModelFSProducts(products, secondaries);
379 ClearAndDestroy(secondaries);
382 #ifdef debug_G4BinaryCascade
383 G4cout <<
"G4BinaryCascade::Propagate: warning - high energy model failed energy conservation, returning unchanged high energy final state" <<
G4endl;
393 FindCollisions(&theSecondaryList);
396 if(theCollisionMgr->
Entries() == 0 )
400 #ifdef debug_BIC_return
410 G4bool haveProducts =
false;
411 G4int collisionCount=0;
413 while(theCollisionMgr->
Entries() > 0 && currentZ)
426 if(theCollisionMgr->
Entries() > 0)
430 #ifdef debug_BIC_Propagate_Collisions
431 G4cout <<
" NextCollision * , Time, curtime = " << nextCollision <<
" "
446 if (ApplyCollision(nextCollision))
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"));
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;
495 #ifdef debug_BIC_return
502 #ifdef debug_BIC_Propagate
503 G4cout <<
" Momentum transfer to Nucleus " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
510 if ( theSecondaryList.size() > 0 )
512 #ifdef debug_G4BinaryCascade
513 G4cerr <<
"G4BinaryCascade: Warning, have active particles at end" <<
G4endl;
514 PrintKTVector(&theSecondaryList,
"active particles @ end added to theFinalState");
517 for ( iter =theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
519 theFinalState.push_back(*iter);
521 theSecondaryList.clear();
524 while ( theCollisionMgr->
Entries() > 0 )
526 #ifdef debug_G4BinaryCascade
527 G4cerr <<
" Warning: remove left over collision(s) " <<
G4endl;
532 #ifdef debug_BIC_Propagate_Excitation
534 PrintKTVector(&theSecondaryList,std::string(
" theSecondaryList"));
535 G4cout <<
"theTargetList size: " << theTargetList.size() <<
G4endl;
537 PrintKTVector(&theCapturedList,std::string(
" theCapturedList"));
539 G4cout <<
" ExcitE be4 Correct : " <<GetExcitationEnergy() <<
G4endl;
540 G4cout <<
" Mom Transfered to nucleus : " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
541 PrintKTVector(&theFinalState,std::string(
" FinalState uncorrected"));
547 G4double ExcitationEnergy=GetExcitationEnergy();
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;
558 if (ExcitationEnergy < 0 )
560 G4int maxtry=5, ntry=0;
563 ExcitationEnergy=GetExcitationEnergy();
564 }
while ( ++ntry < maxtry && ExcitationEnergy < 0 );
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;
577 if ( ExcitationEnergy < 0. )
592 ClearAndDestroy(products);
594 #ifdef debug_BIC_return
605 products= ProductsAddFinalState(products, theFinalState);
607 products= ProductsAddPrecompound(products, precompoundProducts);
612 thePrimaryEscape =
true;
614 #ifdef debug_BIC_return
623 G4double G4BinaryCascade::GetExcitationEnergy()
628 #if defined(debug_G4BinaryCascade) || defined(debug_BIC_GetExcitationEnergy)
629 G4int finalA = theTargetList.size()+theCapturedList.size();
630 G4int finalZ = GetTotalCharge(theTargetList)+GetTotalCharge(theCapturedList);
631 if ( (currentA - finalA) != 0 || (currentZ - finalZ) != 0 )
633 G4cerr <<
"G4BIC:GetExcitationEnergy(): Nucleon counting error current/final{A,Z} "
634 << currentA <<
" " << finalA <<
" "<< currentZ <<
" " << finalZ <<
G4endl;
645 else if (currentZ==0 )
648 else {nucleusMass = GetFinalNucleusMomentum().
mag()
653 #ifdef debug_G4BinaryCascade
654 G4cout <<
"G4BinaryCascade::GetExcitationEnergy(): Warning - invalid nucleus (A,Z)=("
655 << currentA <<
"," << currentZ <<
")" <<
G4endl;
660 #ifdef debug_BIC_GetExcitationEnergy
662 debug.push_back(
"====> current A, Z");
663 debug.push_back(currentZ);
664 debug.push_back(currentA);
665 debug.push_back(
"====> final A, Z");
666 debug.push_back(finalZ);
667 debug.push_back(finalA);
668 debug.push_back(nucleusMass);
669 debug.push_back(GetFinalNucleusMomentum().mag());
675 excitationE = GetFinalNucleusMomentum().
mag() - nucleusMass;
681 #ifdef debug_BIC_GetExcitationEnergy
683 if ( excitationE < 0 )
685 G4cout <<
"negative ExE final Ion mass " <<nucleusMass<<
G4endl;
687 if(finalZ>.5)
G4cout <<
" Final nuclmom/mass " << Nucl_mom <<
" " << Nucl_mom.
mag()
688 <<
" (A,Z)=("<< finalA <<
","<<finalZ <<
")"
689 <<
" mass " << nucleusMass <<
" "
690 <<
" excitE " << excitationE <<
G4endl;
698 initialExc = theInitial4Mom.
mag()-
700 G4cout <<
"GetExcitationEnergy: Initial nucleus A Z " << A <<
" " << Z <<
" " << initialExc <<
G4endl;
717 void G4BinaryCascade::BuildTargetList()
728 ClearAndDestroy(&theTargetList);
756 theTargetList.push_back(kt);
761 #ifdef debug_BIC_BuildTargetList
762 else {
G4cout <<
"nucleon is hit" << nucleon <<
G4endl;}
769 }
else if (currentZ==0 && currentA>=1 )
774 G4cerr <<
"G4BinaryCascade::BuildTargetList(): Fatal Error - invalid nucleus (A,Z)=("
775 << currentA <<
"," << currentZ <<
")" <<
G4endl;
778 currentInitialEnergy= theInitial4Mom.
e() + theProjectile4Momentum.
e();
780 #ifdef debug_BIC_BuildTargetList
781 G4cout <<
"G4BinaryCascade::BuildTargetList(): nucleus (A,Z)=("
782 << currentA <<
"," << currentZ <<
") mass: " << massInNucleus <<
783 ", theInitial4Mom " << theInitial4Mom <<
784 ", currentInitialEnergy " << currentInitialEnergy <<
G4endl;
794 std::vector<G4KineticTrack *>::iterator iter;
797 projectileA=projectileZ=0;
800 for(iter = secondaries->begin(); iter != secondaries->end(); ++iter)
802 if((*iter)->GetFormationTime() < StartingTime)
803 StartingTime = (*iter)->GetFormationTime();
808 for(iter = secondaries->begin(); iter != secondaries->end(); ++iter)
812 G4double FormTime = (*iter)->GetFormationTime() - StartingTime;
813 (*iter)->SetFormationTime(FormTime);
816 FindLateParticleCollision(*iter);
817 lateParticles4Momentum += (*iter)->GetTrackingMomentum();
818 lateA += (*iter)->GetDefinition()->GetBaryonNumber();
819 lateZ +=
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
823 theSecondaryList.push_back(*iter);
825 theProjectile4Momentum += (*iter)->GetTrackingMomentum();
826 projectileA += (*iter)->GetDefinition()->GetBaryonNumber();
827 projectileZ +=
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
828 #ifdef debug_BIC_Propagate
829 G4cout <<
" Adding initial secondary " << *iter
830 <<
" time" << (*iter)->GetFormationTime()
831 <<
", state " << (*iter)->GetState() <<
G4endl;
840 theProjectile4Momentum += mom;
844 G4double excitation= theProjectile4Momentum.
e() + initial_nuclear_mass - lateParticles4Momentum.e() - massInNucleus;
845 #ifdef debug_BIC_GetExcitationEnergy
846 G4cout <<
"BIC: Proj.e, nucl initial, nucl final, lateParticles"
847 << theProjectile4Momentum <<
", "
848 << initial_nuclear_mass<<
", " << massInNucleus <<
", "
849 << lateParticles4Momentum <<
G4endl;
850 G4cout <<
"BIC: Proj.e / initial excitation: " << theProjectile4Momentum.
e() <<
" / " << excitation <<
G4endl;
852 success = excitation > 0;
853 #ifdef debug_G4BinaryCascade
855 G4cout <<
"G4BinaryCascade::BuildLateParticleCollisions(): Proj.e / initial excitation: " << theProjectile4Momentum.
e() <<
" / " << excitation <<
G4endl;
865 secondaries->clear();
884 fragment = FindFragments();
887 if(fragment->
GetA() >1.5)
895 else if (theExcitationHandler)
897 precompoundProducts=theExcitationHandler->
BreakItUp(*fragment);
902 if (theTargetList.size() + theCapturedList.size() > 1 ) {
906 std::vector<G4KineticTrack *>::iterator i;
907 if ( theTargetList.size() == 1 ) {i=theTargetList.begin();}
908 if ( theCapturedList.size() == 1 ) {i=theCapturedList.begin();}
913 precompoundProducts->push_back(aNew);
921 precompoundProducts = DecayVoidNucleus();
923 return precompoundProducts;
931 if ( (theTargetList.size()+theCapturedList.size()) > 0 )
934 std::vector<G4KineticTrack *>::iterator aNuc;
936 std::vector<G4double> masses;
939 if ( theTargetList.size() != 0)
941 for ( aNuc=theTargetList.begin(); aNuc != theTargetList.end(); aNuc++)
943 G4double mass=(*aNuc)->GetDefinition()->GetPDGMass();
944 masses.push_back(mass);
949 if ( theCapturedList.size() != 0)
951 for(aNuc = theCapturedList.begin();
952 aNuc != theCapturedList.end(); aNuc++)
954 G4double mass=(*aNuc)->GetDefinition()->GetPDGMass();
955 masses.push_back(mass);
966 if ( eCMS < sumMass )
968 eCMS=sumMass + 2*
MeV*masses.size();
973 std::vector<G4LorentzVector*> * momenta=decay.
Decay(eCMS,masses);
974 std::vector<G4LorentzVector*>::iterator aMom=momenta->begin();
977 if ( theTargetList.size() != 0)
979 for ( aNuc=theTargetList.begin();
980 (aNuc != theTargetList.end()) && (aMom!=momenta->end());
986 result->push_back(aNew);
992 if ( theCapturedList.size() != 0)
994 for ( aNuc=theCapturedList.begin();
995 (aNuc != theCapturedList.end()) && (aMom!=momenta->end());
999 (*aNuc)->GetDefinition());
1002 result->push_back(aNew);
1018 for(i = 0; i< fs.size(); i++)
1025 products->push_back(aNew);
1027 #ifdef debug_BIC_Propagate_finals
1043 if ( precompoundProducts )
1045 std::vector<G4ReactionProduct *>::iterator j;
1046 for(j = precompoundProducts->begin(); j != precompoundProducts->end(); ++j)
1051 #ifdef debug_BIC_Propagate_finals
1054 pProduct *= precompoundLorentzboost;
1055 #ifdef debug_BIC_Propagate_finals
1058 pSumPreco += pProduct;
1059 (*j)->SetTotalEnergy(pProduct.e());
1060 (*j)->SetMomentum(pProduct.vect());
1061 (*j)->SetNewlyAdded(
true);
1062 products->push_back(*j);
1066 precompoundProducts->clear();
1067 delete precompoundProducts;
1075 for(std::vector<G4KineticTrack *>::iterator i = secondaries->begin();
1076 i != secondaries->end(); ++i)
1079 for(std::vector<G4BCAction *>::iterator j = theImR.begin();
1080 j!=theImR.end(); j++)
1083 const std::vector<G4CollisionInitialState *> & aCandList
1084 = (*j)->GetCollisions(*i, theTargetList, theCurrentTime);
1085 for(
size_t count=0; count<aCandList.size(); count++)
1097 void G4BinaryCascade::FindDecayCollision(
G4KineticTrack * secondary)
1100 const std::vector<G4CollisionInitialState *> & aCandList
1101 = theDecay->
GetCollisions(secondary, theTargetList, theCurrentTime);
1102 for(
size_t count=0; count<aCandList.size(); count++)
1109 void G4BinaryCascade::FindLateParticleCollision(
G4KineticTrack * secondary)
1114 if (((
G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes(secondary,tin,tout))
1119 }
else if ( tout > 0 )
1132 #ifdef debug_BIC_FindCollision
1133 G4cout <<
"FindLateP Particle, 4-mom, times newState "
1136 <<
" times " << tin <<
" " << tout <<
" "
1140 const std::vector<G4CollisionInitialState *> & aCandList
1141 = theLateParticle->
GetCollisions(secondary, theTargetList, theCurrentTime);
1142 for(
size_t count=0; count<aCandList.size(); count++)
1144 #ifdef debug_BIC_FindCollision
1145 G4cout <<
" Adding a late Col : " << aCandList[count] <<
G4endl;
1158 #ifdef debug_BIC_ApplyCollision
1159 G4cerr <<
"G4BinaryCascade::ApplyCollision start"<<
G4endl;
1160 theCollisionMgr->
Print();
1165 G4bool haveTarget=target_collection.size()>0;
1168 #ifdef debug_G4BinaryCascade
1169 G4cout <<
"G4BinaryCasacde::ApplyCollision(): StateError " << primary <<
G4endl;
1170 PrintKTVector(primary,std::string(
"primay- ..."));
1171 PrintKTVector(&target_collection,std::string(
"... targets"));
1174 theCollisionMgr->
Print();
1191 G4int initialBaryon(0);
1192 G4int initialCharge(0);
1200 G4double initial_Efermi=CorrectShortlivedPrimaryForFermi(primary,target_collection);
1206 #ifdef debug_BIC_ApplyCollision
1207 DebugApplyCollisionFail(collision, products);
1213 G4bool lateParticleCollision= (!haveTarget) && products && products->size() == 1;
1214 G4bool decayCollision= (!haveTarget) && products && products->size() > 1;
1218 #ifdef debug_G4BinaryCascade
1219 G4int lateBaryon(0), lateCharge(0);
1222 if ( lateParticleCollision )
1226 #ifdef debug_G4BinaryCascade
1227 lateBaryon = initialBaryon;
1228 lateCharge = initialCharge;
1230 initialBaryon=initialCharge=0;
1237 if (!lateParticleCollision)
1239 if( !products || products->size()==0 || !CheckPauliPrinciple(products) )
1241 #ifdef debug_BIC_ApplyCollision
1242 if (products)
G4cout <<
" ======Failed Pauli =====" <<
G4endl;
1243 G4cerr <<
"G4BinaryCascade::ApplyCollision blocked"<<
G4endl;
1251 if (! CorrectShortlivedFinalsForFermi(products, initial_Efermi)){
1257 #ifdef debug_BIC_ApplyCollision
1258 DebugApplyCollision(collision, products);
1262 if (products) ClearAndDestroy(products);
1263 if ( decayCollision ) FindDecayCollision(primary);
1269 G4int finalBaryon(0);
1270 G4int finalCharge(0);
1272 for(std::vector<G4KineticTrack *>::iterator i =products->begin(); i != products->end(); i++)
1274 if ( ! lateParticleCollision )
1276 (*i)->SetState(primary->
GetState());
1278 finalBaryon+=(*i)->GetDefinition()->GetBaryonNumber();
1279 finalCharge+=
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
1282 if (((
G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes((*i),tin,tout) &&
1283 tin < 0 && tout > 0 )
1285 PrintKTVector((*i),
"particle inside marked not-inside");
1286 G4cout <<
"tin tout: " << tin <<
" " << tout <<
G4endl;
1291 if (((
G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes((*i),tin,tout))
1298 else if ( tout > 0 )
1301 finalBaryon+=(*i)->GetDefinition()->GetBaryonNumber();
1302 finalCharge+=
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
1307 toFinalState.push_back((*i));
1313 toFinalState.push_back((*i));
1318 if(!toFinalState.empty())
1320 theFinalState.insert(theFinalState.end(),
1321 toFinalState.begin(),toFinalState.end());
1322 std::vector<G4KineticTrack *>::iterator iter1, iter2;
1323 for(iter1 = toFinalState.begin(); iter1 != toFinalState.end();
1326 iter2 = std::find(products->begin(), products->end(),
1328 if ( iter2 != products->end() ) products->erase(iter2);
1334 currentA += finalBaryon-initialBaryon;
1335 currentZ += finalCharge-initialCharge;
1339 oldSecondaries.push_back(primary);
1342 #ifdef debug_G4BinaryCascade
1343 if ( (finalBaryon-initialBaryon-lateBaryon) != 0 || (finalCharge-initialCharge-lateCharge) != 0 )
1345 G4cout <<
"G4BinaryCascade: Error in Balancing: " <<
G4endl;
1346 G4cout <<
"initial/final baryon number, initial/final Charge "
1347 << initialBaryon <<
" "<< finalBaryon <<
" "
1348 << initialCharge <<
" "<< finalCharge <<
" "
1350 <<
", with number of products: "<< products->size() <<
G4endl;
1351 G4cout << G4endl<<
"Initial condition are these:"<<
G4endl;
1364 for(
size_t ii=0; ii< oldTarget.size(); ii++)
1366 oldTarget[ii]->Hit();
1369 UpdateTracksAndCollisions(&oldSecondaries, &oldTarget, products);
1379 G4bool G4BinaryCascade::Absorb()
1387 std::vector<G4KineticTrack *>::iterator iter;
1389 for(iter = theSecondaryList.begin();
1390 iter != theSecondaryList.end(); ++iter)
1395 if(absorber.WillBeAbsorbed(*kt))
1397 absorbList.push_back(kt);
1402 if(absorbList.empty())
1406 for(iter = absorbList.begin(); iter != absorbList.end(); ++iter)
1409 if(!absorber.FindAbsorbers(*kt, theTargetList))
1410 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade::Absorb(): Cannot absorb a particle.");
1412 if(!absorber.FindProducts(*kt))
1413 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade::Absorb(): Cannot absorb a particle.");
1419 while(!CheckPauliPrinciple(products))
1424 ClearAndDestroy(products);
1425 if(!absorber.FindProducts(*kt))
1427 "G4BinaryCascade::Absorb(): Cannot absorb a particle.");
1433 toRemove.push_back(kt);
1434 toDelete.push_back(kt);
1436 UpdateTracksAndCollisions(&toRemove, absorbers, products);
1437 ClearAndDestroy(absorbers);
1439 ClearAndDestroy(&toDelete);
1452 std::vector<G4KineticTrack *>::iterator i;
1457 G4int particlesAboveCut=0;
1458 G4int particlesBelowCut=0;
1459 if ( verbose )
G4cout <<
" Capture: secondaries " << theSecondaryList.size() <<
G4endl;
1460 for(i = theSecondaryList.begin(); i != theSecondaryList.end(); ++i)
1477 ++particlesBelowCut;
1485 if (verbose)
G4cout <<
"Capture particlesAboveCut,particlesBelowCut, capturedEnergy,capturedEnergy/particlesBelowCut <? 0.2*theCutOnP "
1486 << particlesAboveCut <<
" " << particlesBelowCut <<
" " << capturedEnergy
1490 if(particlesBelowCut>0 && capturedEnergy/particlesBelowCut<0.2*theCutOnP)
1493 for(i = theSecondaryList.begin(); i != theSecondaryList.end(); ++i)
1501 captured.push_back(kt);
1503 theCapturedList.push_back(kt);
1507 UpdateTracksAndCollisions(&captured, NULL, NULL);
1522 fermiMom.
Init(A, Z);
1526 G4KineticTrackVector::iterator i;
1533 for(i = products->begin(); i != products->end(); ++i)
1535 definition = (*i)->GetDefinition();
1561 if(mom.
e() < eFermi )
1570 #ifdef debug_BIC_CheckPauli
1573 for(i = products->begin(); i != products->end(); ++i)
1575 definition = (*i)->GetDefinition();
1584 if ( mom.
e()-mom.
mag()+field > 160*
MeV )
1586 G4cout <<
"momentum problem pFermi=" << pFermi
1587 <<
" mom, mom.m " << mom <<
" " << mom.
mag()
1588 <<
" field " << field <<
G4endl;
1599 void G4BinaryCascade::StepParticlesOut()
1606 while( theSecondaryList.size() > 0 )
1611 std::vector<G4KineticTrack *>::iterator i;
1612 for(i = theSecondaryList.begin(); i != theSecondaryList.end(); ++i)
1620 ((
G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes(kt,tdummy,tStep);
1621 #ifdef debug_BIC_StepParticlesOut
1622 G4cout <<
" minTimeStep, tStep Particle " <<minTimeStep <<
" " <<tStep
1627 PrintKTVector(&theSecondaryList, std::string(
" state ERROR....."));
1628 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade::StepParticlesOut() particle not in nucleus");
1631 if(intersect && tStep<minTimeStep && tStep> 0 )
1633 minTimeStep = tStep;
1636 PrintKTVector(&theSecondaryList, std::string(
" state ERROR....."));
1637 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade::StepParticlesOut() particle not in nucleus");
1644 if(theCollisionMgr->
Entries() > 0)
1648 G4cout <<
" NextCollision * , Time= " << nextCollision <<
" "
1649 <<timeToCollision<<
G4endl;
1651 if ( timeToCollision > minTimeStep )
1653 DoTimeStep(minTimeStep);
1657 if (!DoTimeStep(timeToCollision) )
1669 if ( ApplyCollision(nextCollision))
1681 #ifdef debug_G4BinaryCascade
1682 G4cerr <<
"G4BinaryCascade.cc: Warning - aborting looping particle(s)" <<
G4endl;
1683 PrintKTVector(&theSecondaryList,
" looping particles added to theFinalState");
1687 std::vector<G4KineticTrack *>::iterator iter;
1688 for ( iter =theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
1690 theFinalState.push_back(*iter);
1692 theSecondaryList.clear();
1706 #ifdef debug_BIC_StepParticlesOut
1710 if ( counter > 100 && theCollisionMgr->
Entries() == 0)
1712 #ifdef debug_BIC_StepParticlesOut
1713 PrintKTVector(&theSecondaryList,std::string(
"stepping 100 steps"));
1715 FindCollisions(&theSecondaryList);
1730 G4double G4BinaryCascade::CorrectShortlivedPrimaryForFermi(
1739 if ( std::abs(PDGcode > 1000) && PDGcode != 2112 && PDGcode != 2212 )
1746 std::vector<G4KineticTrack *>::iterator titer;
1747 for ( titer=target_collection.begin() ; titer!=target_collection.end(); ++titer)
1765 for ( std::vector<G4KineticTrack *>::iterator i =products->begin(); i != products->end(); i++)
1767 G4int PDGcode=(*i)->GetDefinition()->GetPDGEncoding();
1769 final_Efermi+=((
G4RKPropagation *)thePropagator)->GetField(PDGcode,(*i)->GetPosition());
1770 if ( std::abs(PDGcode) > 1000 && PDGcode != 2112 && PDGcode != 2212 )
1772 resonances.push_back(*i);
1775 if ( resonances.size() > 0 )
1777 G4double delta_Fermi= (initial_Efermi-final_Efermi)/resonances.size();
1778 for (std::vector<G4KineticTrack *>::iterator res=resonances.begin(); res != resonances.end(); res++)
1782 G4double newEnergy=mom.
e() + delta_Fermi;
1783 G4double newEnergy2= newEnergy*newEnergy;
1785 if ( newEnergy2 < mass2 )
1798 void G4BinaryCascade::CorrectFinalPandE()
1806 #ifdef debug_BIC_CorrectFinalPandE
1810 if ( theFinalState.size() == 0 )
return;
1812 G4KineticTrackVector::iterator i;
1814 if ( pNucleus.
e() == 0 )
return;
1815 #ifdef debug_BIC_CorrectFinalPandE
1820 for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
1822 pFinals += (*i)->Get4Momentum();
1824 #ifdef debug_BIC_CorrectFinalPandE
1825 G4cout <<
"CorrectFinalPandE a final " << (*i)->GetDefinition()->GetParticleName()
1826 <<
" 4mom " << (*i)->Get4Momentum()<<
G4endl;
1829 #ifdef debug_BIC_CorrectFinalPandE
1830 G4cout <<
"CorrectFinalPandE pN pF: " <<pNucleus <<
" " <<pFinals <<
G4endl;
1836 #ifdef debug_BIC_CorrectFinalPandE
1837 G4cout <<
"CorrectFinalPandE pCM, CMS pCM " << pCM <<
" " <<toCMS*pCM<<
G4endl;
1838 G4cout <<
"CorrectFinal CMS pN pF " <<toCMS*pNucleus <<
" "
1840 <<
" nucleus initial mass : " <<GetFinal4Momentum().
mag()
1841 <<
" massInNucleus m(nucleus) m(finals) std::sqrt(s): " << massInNucleus <<
" " <<pNucleus.
mag()<<
" "
1842 << pFinals.mag() <<
" " << pCM.
mag() <<
G4endl;
1848 G4double m10 = GetIonMass(currentZ,currentA);
1850 if( s0-(m10+m20)*(m10+m20) < 0 )
1852 #ifdef debug_BIC_CorrectFinalPandE
1853 G4cout <<
"G4BinaryCascade::CorrectFinalPandE() : error! " <<
G4endl;
1855 G4cout <<
"not enough mass to correct: mass, A,Z, mass(nucl), mass(finals) "
1856 << std::sqrt(s0-(m10+m20)*(m10+m20)) <<
" "
1857 << currentA <<
" " << currentZ <<
" "
1858 << m10 <<
" " << m20
1862 PrintKTVector(&theFinalState,
" mass problem");
1868 G4double pInCM = std::sqrt((s0-(m10+m20)*(m10+m20))*(s0-(m10-m20)*(m10-m20))/(4.*s0));
1869 #ifdef debug_BIC_CorrectFinalPandE
1870 G4cout <<
" CorrectFinalPandE pInCM new, CURRENT, ratio : " << pInCM
1871 <<
" " << (pFinals).vect().mag()<<
" " << pInCM/(pFinals).vect().mag() <<
G4endl;
1873 if ( pFinals.vect().mag() > pInCM )
1878 G4double factor=std::max(0.98,pInCM/pFinals.vect().mag());
1880 for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
1883 G4ThreeVector p3(factor*(toCMS*(*i)->Get4Momentum()).vect());
1887 #ifdef debug_BIC_CorrectFinalPandE
1890 (*i)->Set4Momentum(
p);
1892 #ifdef debug_BIC_CorrectFinalPandE
1893 G4cout <<
"CorrectFinalPandE nucleus corrected mass : " << GetFinal4Momentum() <<
" "
1894 <<GetFinal4Momentum().
mag() << G4endl
1895 <<
" CMS pFinals , mag, 3.mag : " << qFinals <<
" " << qFinals.mag() <<
" " << qFinals.vect().mag()<<
G4endl;
1896 G4cerr <<
" -CorrectFinalPandE 5 " << factor <<
G4endl;
1899 #ifdef debug_BIC_CorrectFinalPandE
1900 else {
G4cerr <<
" -CorrectFinalPandE 6 - no correction done" <<
G4endl; }
1906 void G4BinaryCascade::UpdateTracksAndCollisions(
1912 std::vector<G4KineticTrack *>::iterator iter1, iter2;
1917 if(!oldSecondaries->empty())
1919 for(iter1 = oldSecondaries->begin(); iter1 != oldSecondaries->end();
1922 iter2 = std::find(theSecondaryList.begin(), theSecondaryList.end(),
1924 if ( iter2 != theSecondaryList.end() ) theSecondaryList.erase(iter2);
1934 if(oldTarget->size()!=0)
1938 for(iter1 = oldTarget->begin(); iter1 != oldTarget->end(); ++iter1)
1940 iter2 = std::find(theTargetList.begin(), theTargetList.end(),
1942 theTargetList.erase(iter2);
1950 if(!newSecondaries->empty())
1953 for(iter1 = newSecondaries->begin(); iter1 != newSecondaries->end();
1956 theSecondaryList.push_back(*iter1);
1959 PrintKTVector(*iter1,
"undefined in FindCollisions");
1965 FindCollisions(newSecondaries);
1980 ktv(out), wanted_state(astate)
1984 if ( (kt)->GetState() == wanted_state ) ktv->push_back(kt);
1995 #ifdef debug_BIC_DoTimeStep
1997 debug.push_back(
"======> DoTimeStep 1");
debug.dump();
1998 G4cerr <<
"G4BinaryCascade::DoTimeStep: enter step="<< theTimeStep
1999 <<
" , time="<<theCurrentTime <<
G4endl;
2000 PrintKTVector(&theSecondaryList, std::string(
"DoTimeStep - theSecondaryList"));
2005 std::vector<G4KineticTrack *>::iterator iter;
2008 std::for_each( theSecondaryList.begin(),theSecondaryList.end(),
2013 std::for_each( theSecondaryList.begin(),theSecondaryList.end(),
2018 #ifdef debug_BIC_DoTimeStep
2024 thePropagator->
Transport(theSecondaryList, dummy, theTimeStep);
2031 #ifdef debug_BIC_DoTimeStep
2032 G4cout <<
"DoTimeStep : theMomentumTransfer = " << theMomentumTransfer <<
G4endl;
2033 PrintKTVector(&theSecondaryList, std::string(
"DoTimeStep - secondaries aft trsprt"));
2039 std::for_each( kt_outside->begin(),kt_outside->end(),
2046 std::for_each( kt_inside->begin(),kt_inside->end(),
2056 kt_gone_in->clear();
2057 std::for_each( kt_outside->begin(),kt_outside->end(),
2060 kt_gone_out->clear();
2061 std::for_each( kt_inside->begin(),kt_inside->end(),
2064 #ifdef debug_BIC_DoTimeStep
2065 PrintKTVector(fail,std::string(
" Failed to go in/out -> miss_nucleus/captured"));
2066 PrintKTVector(kt_gone_in, std::string(
"recreated kt_gone_in"));
2067 PrintKTVector(kt_gone_out, std::string(
"recreated kt_gone_out"));
2073 std::for_each( kt_outside->begin(),kt_outside->end(),
2076 std::for_each( kt_outside->begin(),kt_outside->end(),
2079 #ifdef debug_BIC_DoTimeStep
2080 PrintKTVector(kt_gone_out, std::string(
"append gone_outs to final state.. theFinalState"));
2083 theFinalState.insert(theFinalState.end(),
2084 kt_gone_out->begin(),kt_gone_out->end());
2088 std::for_each( theSecondaryList.begin(),theSecondaryList.end(),
2094 if ( theCollisionMgr->
Entries()> 0 )
2096 if (kt_gone_out->size() )
2099 iter = std::find(kt_gone_out->begin(),kt_gone_out->end(),nextPrimary);
2100 if ( iter != kt_gone_out->end() )
2103 #ifdef debug_BIC_DoTimeStep
2104 G4cout <<
" DoTimeStep - WARNING: deleting current collision!" <<
G4endl;
2108 if ( kt_captured->size() )
2111 iter = std::find(kt_captured->begin(),kt_captured->end(),nextPrimary);
2112 if ( iter != kt_captured->end() )
2115 #ifdef debug_BIC_DoTimeStep
2116 G4cout <<
" DoTimeStep - WARNING: deleting current collision!" <<
G4endl;
2123 UpdateTracksAndCollisions(kt_gone_out,0 ,0);
2126 if ( kt_captured->size() )
2128 theCapturedList.insert(theCapturedList.end(),
2129 kt_captured->begin(),kt_captured->end());
2133 std::vector<G4KineticTrack *>::iterator i_captured;
2134 for(i_captured=kt_captured->begin();i_captured!=kt_captured->end();i_captured++)
2136 (*i_captured)->Hit();
2139 UpdateTracksAndCollisions(kt_captured, NULL, NULL);
2142 #ifdef debug_G4BinaryCascade
2145 std::for_each( theSecondaryList.begin(),theSecondaryList.end(),
2147 if ( currentZ != (GetTotalCharge(theTargetList)
2148 + GetTotalCharge(theCapturedList)
2149 + GetTotalCharge(*kt_inside)) )
2151 G4cout <<
" error-DoTimeStep aft, A, Z: " << currentA <<
" " << currentZ
2152 <<
" sum(tgt,capt,active) "
2153 << GetTotalCharge(theTargetList) + GetTotalCharge(theCapturedList) + GetTotalCharge(*kt_inside)
2154 <<
" targets: " << GetTotalCharge(theTargetList)
2155 <<
" captured: " << GetTotalCharge(theCapturedList)
2156 <<
" active: " << GetTotalCharge(*kt_inside)
2168 theCurrentTime += theTimeStep;
2182 std::vector<G4KineticTrack *>::iterator iter;
2187 G4int secondaries_in(0);
2188 G4int secondaryBarions_in(0);
2189 G4int secondaryCharge_in(0);
2192 for ( iter =in->begin(); iter != in->end(); ++iter)
2195 secondaryCharge_in +=
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
2196 if ((*iter)->GetDefinition()->GetBaryonNumber()!=0 )
2198 secondaryBarions_in += (*iter)->GetDefinition()->GetBaryonNumber();
2202 secondaryMass_in += (*iter)->GetDefinition()->GetPDGMass();
2208 G4double mass_initial= GetIonMass(currentZ,currentA);
2210 currentZ += secondaryCharge_in;
2211 currentA += secondaryBarions_in;
2216 G4double mass_final= GetIonMass(currentZ,currentA);
2218 G4double correction= secondaryMass_in + mass_initial - mass_final;
2219 if (secondaries_in>1)
2220 {correction /= secondaries_in;}
2222 #ifdef debug_BIC_CorrectBarionsOnBoundary
2223 G4cout <<
"CorrectBarionsOnBoundary,currentZ,currentA,"
2224 <<
"secondaryCharge_in,secondaryBarions_in,"
2225 <<
"energy correction,m_secondry,m_nucl_init,m_nucl_final "
2226 << currentZ <<
" "<< currentA <<
" "
2227 << secondaryCharge_in<<
" "<<secondaryBarions_in<<
" "
2228 << correction <<
" "
2229 << secondaryMass_in <<
" "
2230 << mass_initial <<
" "
2231 << mass_final <<
" "
2233 PrintKTVector(in,std::string(
"in be4 correction"));
2236 for ( iter = in->begin(); iter != in->end(); ++iter)
2238 if ((*iter)->GetTrackingMomentum().e()+correction > (*iter)->GetActualMass())
2240 (*iter)->UpdateTrackingMomentum((*iter)->GetTrackingMomentum().e() + correction);
2247 (*iter)->UpdateTrackingMomentum((*iter)->GetTrackingMomentum().e() + barrier);
2249 kt_fail->push_back(*iter);
2250 currentZ -=
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
2251 currentA -= (*iter)->GetDefinition()->GetBaryonNumber();
2256 #ifdef debug_BIC_CorrectBarionsOnBoundary
2257 G4cout <<
" CorrectBarionsOnBoundary, aft, A, Z, sec-Z,A,m,m_in_nucleus "
2258 << currentA <<
" " << currentZ <<
" "
2259 << secondaryCharge_in <<
" " << secondaryBarions_in <<
" "
2260 << secondaryMass_in <<
" "
2262 PrintKTVector(in,std::string(
"in AFT correction"));
2269 G4int secondaries_out(0);
2270 G4int secondaryBarions_out(0);
2271 G4int secondaryCharge_out(0);
2274 for ( iter =out->begin(); iter != out->end(); ++iter)
2277 secondaryCharge_out +=
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
2278 if ((*iter)->GetDefinition()->GetBaryonNumber() !=0 )
2280 secondaryBarions_out += (*iter)->GetDefinition()->GetBaryonNumber();
2284 secondaryMass_out += (*iter)->GetDefinition()->GetPDGMass();
2291 G4double mass_initial= GetIonMass(currentZ,currentA);
2292 currentA -=secondaryBarions_out;
2293 currentZ -=secondaryCharge_out;
2302 G4cerr <<
"G4BinaryCascade - secondaryBarions_out,secondaryCharge_out " <<
2303 secondaryBarions_out <<
" " << secondaryCharge_out <<
G4endl;
2304 PrintKTVector(&theTargetList,
"CorrectBarionsOnBoundary Target");
2305 PrintKTVector(&theCapturedList,
"CorrectBarionsOnBoundary Captured");
2306 PrintKTVector(&theSecondaryList,
"CorrectBarionsOnBoundary Secondaries");
2307 G4cerr <<
"G4BinaryCascade - currentA, currentZ " << currentA <<
" " << currentZ <<
G4endl;
2308 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade::CorrectBarionsOnBoundary() - fatal error");
2310 G4double mass_final=GetIonMass(currentZ,currentA);
2311 G4double correction= mass_initial - mass_final - secondaryMass_out;
2313 if (secondaries_out>1) correction /= secondaries_out;
2314 #ifdef debug_BIC_CorrectBarionsOnBoundary
2315 G4cout <<
"DoTimeStep,currentZ,currentA,"
2316 <<
"secondaries_out,"
2317 <<
"secondaryCharge_out,secondaryBarions_out,"
2318 <<
"energy correction,m_secondry,m_nucl_init,m_nucl_final "
2319 <<
" "<< currentZ <<
" "<< currentA <<
" "
2320 << secondaries_out <<
" "
2321 << secondaryCharge_out<<
" "<<secondaryBarions_out<<
" "
2322 << correction <<
" "
2323 << secondaryMass_out <<
" "
2324 << mass_initial <<
" "
2325 << mass_final <<
" "
2327 PrintKTVector(out,std::string(
"out be4 correction"));
2330 for ( iter = out->begin(); iter != out->end(); ++iter)
2332 if ((*iter)->GetTrackingMomentum().e()+correction > (*iter)->GetActualMass())
2334 (*iter)->UpdateTrackingMomentum((*iter)->GetTrackingMomentum().e() + correction);
2345 (*iter)->UpdateTrackingMomentum((*iter)->GetTrackingMomentum().e() - barrier);
2347 kt_fail->push_back(*iter);
2348 currentZ +=
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
2349 currentA += (*iter)->GetDefinition()->GetBaryonNumber();
2351 #ifdef debug_BIC_CorrectBarionsOnBoundary
2354 G4cout <<
"Not correcting outgoing " << *iter <<
" "
2355 << (*iter)->GetDefinition()->GetPDGEncoding() <<
" "
2356 << (*iter)->GetDefinition()->GetParticleName() <<
G4endl;
2357 PrintKTVector(out,std::string(
"outgoing, one not corrected"));
2363 #ifdef debug_BIC_CorrectBarionsOnBoundary
2364 PrintKTVector(out,std::string(
"out AFTER correction"));
2365 G4cout <<
" DoTimeStep, nucl-update, A, Z, sec-Z,A,m,m_in_nucleus, table-mass, delta "
2366 << currentA <<
" "<< currentZ <<
" "
2367 << secondaryCharge_out <<
" "<< secondaryBarions_out <<
" "<<
2368 secondaryMass_out <<
" "
2369 << massInNucleus <<
" "
2382 G4Fragment * G4BinaryCascade::FindFragments()
2386 #ifdef debug_BIC_FindFragments
2387 G4cout <<
"target, captured, secondary: "
2388 << theTargetList.size() <<
" "
2389 << theCapturedList.size()<<
" "
2390 << theSecondaryList.size()
2394 G4int a = theTargetList.size()+theCapturedList.size();
2396 G4KineticTrackVector::iterator i;
2397 for(i = theTargetList.begin(); i != theTargetList.end(); ++i)
2399 if(
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus) == 1 )
2405 G4int zCaptured = 0;
2407 for(i = theCapturedList.begin(); i != theCapturedList.end(); ++i)
2409 CapturedMomentum += (*i)->Get4Momentum();
2410 if(
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus) == 1 )
2416 G4int z = zTarget+zCaptured;
2418 #ifdef debug_G4BinaryCascade
2419 if ( z != (GetTotalCharge(theTargetList) + GetTotalCharge(theCapturedList)) )
2421 G4cout <<
" FindFragment Counting error z a " << z <<
" " <<a <<
" "
2422 << GetTotalCharge(theTargetList) <<
" " << GetTotalCharge(theCapturedList)<<
2424 PrintKTVector(&theTargetList, std::string(
"theTargetList"));
2425 PrintKTVector(&theCapturedList, std::string(
"theCapturedList"));
2439 if ( z < 1 )
return 0;
2442 G4int excitons = theCapturedList.size();
2443 #ifdef debug_BIC_FindFragments
2444 G4cout <<
"Fragment: a= " << a <<
" z= " << z <<
" particles= " << excitons
2445 <<
" Charged= " << zCaptured <<
" holes= " << holes
2446 <<
" excitE= " <<GetExcitationEnergy()
2447 <<
" Final4Momentum= " << GetFinalNucleusMomentum() <<
" capturMomentum= " << CapturedMomentum
2471 G4LorentzVector final4Momentum = theInitial4Mom + theProjectile4Momentum;
2473 for(G4KineticTrackVector::iterator i = theFinalState.begin(); i != theFinalState.end(); ++i)
2475 final4Momentum -= (*i)->Get4Momentum();
2476 finals += (*i)->Get4Momentum();
2479 if((final4Momentum.
vect()/final4Momentum.
e()).mag()>1.0 && currentA > 0)
2481 #ifdef debug_BIC_Final4Momentum
2483 G4cerr <<
"G4BinaryCascade::GetFinal4Momentum - Fatal"<<
G4endl;
2484 G4KineticTrackVector::iterator i;
2485 G4cerr <<
"Total initial 4-momentum " << theProjectile4Momentum <<
G4endl;
2486 G4cerr <<
" GetFinal4Momentum: Initial nucleus "<<theInitial4Mom<<
G4endl;
2487 for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
2489 G4cerr <<
" Final state: "<<(*i)->Get4Momentum()<<(*i)->GetDefinition()->GetParticleName()<<
G4endl;
2492 G4cerr<<
" Final4Momentum = "<<final4Momentum <<
" "<<final4Momentum.
m()<<
G4endl;
2493 G4cerr <<
" current A, Z = "<< currentA<<
", "<<currentZ<<
G4endl;
2499 return final4Momentum;
2510 G4KineticTrackVector::iterator i;
2512 for(i = theCapturedList.begin(); i != theCapturedList.end(); ++i)
2514 CapturedMomentum += (*i)->Get4Momentum();
2520 if ( NucleusMomentum.
e() > 0 )
2524 G4ThreeVector boost= (NucleusMomentum.
vect() -CapturedMomentum.vect())/NucleusMomentum.
e();
2525 if(boost.
mag2()>1.0)
2527 # ifdef debug_BIC_FinalNucleusMomentum
2528 G4cerr <<
"G4BinaryCascade::GetFinalNucleusMomentum - Fatal"<<
G4endl;
2530 G4cerr <<
"it 01"<<NucleusMomentum<<
" "<<CapturedMomentum<<
" "<<
G4endl;
2537 precompoundLorentzboost.
set( boost );
2538 #ifdef debug_debug_BIC_FinalNucleusMomentum
2539 G4cout <<
"GetFinalNucleusMomentum be4 boostNucleusMomentum, CapturedMomentum"<<NucleusMomentum<<
" "<<CapturedMomentum<<
" "<<
G4endl;
2541 NucleusMomentum *= nucleusBoost;
2542 #ifdef debug_BIC_FinalNucleusMomentum
2543 G4cout <<
"GetFinalNucleusMomentum aft boost GetFinal4Momentum= " <<NucleusMomentum <<
G4endl;
2546 return NucleusMomentum;
2564 std::vector<G4KineticTrack *>::iterator iter, jter;
2569 while(!done && tryCount++ <200)
2576 secs = theH1Scatterer->
Scatter(*(*secondaries).front(), aTarget);
2577 #ifdef debug_H1_BinaryCascade
2578 PrintKTVector(secs,
" From Scatter");
2580 for(
size_t ss=0; secs && ss<secs->size(); ss++)
2583 if((*secs)[ss]->GetDefinition()->IsShortLived()) done =
true;
2588 ClearAndDestroy(&theFinalState);
2589 for(current=0; secs && current<secs->size(); current++)
2591 if((*secs)[current]->GetDefinition()->IsShortLived())
2595 for(jter=dec->begin(); jter != dec->end(); jter++)
2598 secs->push_back(*jter);
2601 delete (*secs)[current];
2608 theFinalState.push_back((*secs)[current]);
2613 #ifdef debug_H1_BinaryCascade
2614 PrintKTVector(&theFinalState,
" FinalState");
2616 for(iter = theFinalState.begin(); iter != theFinalState.end(); ++iter)
2622 products->push_back(aNew);
2623 #ifdef debug_H1_BinaryCascade
2628 G4cout <<
"final shortlived : ";
2631 G4cout <<
"final un stable : ";
2638 theFinalState.clear();
2663 }
while (
sqr(x1) +
sqr(x2) > 1.);
2689 std::vector<G4KineticTrack *>::iterator i;
2690 for(i = ktv->begin(); i != ktv->end(); ++i)
2699 std::vector<G4ReactionProduct *>::iterator i;
2700 for(i = rpv->begin(); i != rpv->end(); ++i)
2709 if (comment.size() > 0 ) G4cout <<
"G4BinaryCascade::PrintKTVector() " << comment << G4endl;
2711 G4cout <<
" vector: " << ktv <<
", number of tracks: " << ktv->size()
2713 std::vector<G4KineticTrack *>::iterator i;
2716 for(count = 0, i = ktv->begin(); i != ktv->end(); ++i, ++count)
2719 G4cout <<
" track n. " << count;
2723 G4cout <<
"G4BinaryCascade::PrintKTVector():No KineticTrackVector given " <<
G4endl;
2727 void G4BinaryCascade::PrintKTVector(
G4KineticTrack * kt, std::string comment)
2730 if (comment.size() > 0 ) G4cout <<
"G4BinaryCascade::PrintKTVector() "<< comment << G4endl;
2743 G4cout <<
"G4BinaryCascade::PrintKTVector(): No Kinetictrack given" <<
G4endl;
2753 if ( Z > 0 && A >= Z )
2757 }
else if ( A > 0 && Z>0 )
2762 }
else if ( A >= 0 && Z<=0 )
2767 }
else if ( A == 0 && std::abs(Z)<2 )
2774 G4cerr <<
"G4BinaryCascade::GetIonMass() - invalid (A,Z) = ("
2775 << A <<
"," << Z <<
")" <<
G4endl;
2776 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade::GetIonMass() - giving up");
2785 std::vector<G4KineticTrack *>::iterator iter;
2786 decayKTV.
Decay(&theFinalState);
2788 for(iter = theFinalState.begin(); iter != theFinalState.end(); ++iter)
2791 aNew->
SetMomentum((*iter)->Get4Momentum().vect());
2793 Esecondaries +=(*iter)->Get4Momentum().e();
2796 products->push_back(aNew);
2800 for(iter = theCapturedList.begin(); iter != theCapturedList.end(); ++iter)
2803 aNew->
SetMomentum((*iter)->Get4Momentum().vect());
2805 Esecondaries +=(*iter)->Get4Momentum().e();
2808 products->push_back(aNew);
2812 while(theCollisionMgr->
Entries() > 0)
2819 if ( lates->size() == 1 ) {
2827 products->push_back(aNew);
2837 decayKTV.
Decay(&theSecondaryList);
2839 for(iter = theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
2842 aNew->
SetMomentum((*iter)->Get4Momentum().vect());
2844 Esecondaries +=(*iter)->Get4Momentum().e();
2847 products->push_back(aNew);
2851 for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter)
2853 SumMassNucleons += (*iter)->GetDefinition()->GetPDGMass();
2856 G4double Ekinetic=theProjectile4Momentum.e() + initial_nuclear_mass - Esecondaries - SumMassNucleons;
2859 if (theTargetList.size() ) Ekinetic /= theTargetList.size();
2866 for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter)
2870 G4double p=std::sqrt(
sqr(Ekinetic) + 2.*Ekinetic*mass);
2871 aNew->
SetMomentum(p*(*iter)->Get4Momentum().vect().unit());
2875 products->push_back(aNew);
2883 std::vector<G4KineticTrack *>::iterator iter;
2884 for(iter = secondaries->begin(); iter != secondaries->end(); ++iter)
2887 aNew->
SetMomentum((*iter)->Get4Momentum().vect());
2891 products->push_back(aNew);
2894 if (currentA == 1 && currentZ == 0) {
2896 }
else if (currentA == 1 && currentZ == 1) {
2898 }
else if (currentA == 2 && currentZ == 1) {
2900 }
else if (currentA == 3 && currentZ == 1) {
2902 }
else if (currentA == 3 && currentZ == 2) {
2904 }
else if (currentA == 4 && currentZ == 2) {
2910 if (fragment != 0) {
2916 products->push_back(theNew);
2921 void G4BinaryCascade::PrintWelcomeMessage()
2923 G4cout <<
"Thank you for using G4BinaryCascade. "<<
G4endl;
2933 for ( std::vector<G4KineticTrack *>::iterator i =products->begin(); i != products->end(); i++)
2935 G4int PDGcode=std::abs((*i)->GetDefinition()->GetPDGEncoding());
2936 if (std::abs(PDGcode)==211 || PDGcode==111 ) havePion=
true;
2939 if ( !products || havePion)
2942 <<
", with NO products! " <<
G4endl;
2943 G4cout << G4endl<<
"Initial condition are these:"<<
G4endl;
2959 G4bool G4BinaryCascade::CheckChargeAndBaryonNumber(
G4String where)
2961 static G4int lastdA(0), lastdZ(0);
2968 std::vector<G4KineticTrack *>::iterator i;
2969 G4int CapturedA(0), CapturedZ(0);
2970 G4int secsA(0), secsZ(0);
2971 for ( i=theCapturedList.begin(); i!=theCapturedList.end(); ++i) {
2972 CapturedA += (*i)->GetDefinition()->GetBaryonNumber();
2973 CapturedZ +=
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
2976 for ( i=theSecondaryList.begin(); i!=theSecondaryList.end(); ++i) {
2978 secsA += (*i)->GetDefinition()->GetBaryonNumber();
2979 secsZ +=
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
2983 for ( i=theFinalState.begin(); i!=theFinalState.end(); ++i) {
2984 fStateA += (*i)->GetDefinition()->GetBaryonNumber();
2985 fStateZ +=
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
2988 G4int deltaA= iStateA - secsA - fStateA -currentA - lateA;
2989 G4int deltaZ= iStateZ - secsZ - fStateZ -currentZ - lateZ;
2991 if (deltaA != 0 || deltaZ!=0 ) {
2992 if (deltaA != lastdA || deltaZ != lastdZ ) {
2993 G4cout <<
"baryon/charge imbalance - " << where << G4endl
2994 <<
"deltaA " <<deltaA<<
", iStateA "<<iStateA<<
", CapturedA "<<CapturedA <<
", secsA "<<secsA
2995 <<
", fStateA "<<fStateA <<
", currentA "<<currentA <<
", lateA "<<lateA << G4endl
2996 <<
"deltaZ "<<deltaZ<<
", iStateZ "<<iStateZ<<
", CapturedZ "<<CapturedZ <<
", secsZ "<<secsZ
2997 <<
", fStateZ "<<fStateZ <<
", currentZ "<<currentZ <<
", lateZ "<<lateZ << G4endl<<
G4endl;
3001 }
else { lastdA=lastdZ=0;}
3010 PrintKTVector(collision->
GetPrimary(),std::string(
" Primary particle"));
3012 PrintKTVector(products,std::string(
" Scatterer products"));
3029 <<
" " << initial << G4endl;;
3032 for (
unsigned int it=0; it < ktv.size(); it++)
3045 <<
" " << initial <<
" Excit " << thisExcitation << G4endl;;
3050 G4int product_barions(0);
3053 for (
unsigned int it=0; it < products->size(); it++)
3065 <<
" " <<
final << G4endl;;
3070 G4int finalA = currentA;
3071 G4int finalZ = currentZ;
3074 finalA -= product_barions;
3075 finalZ -= GetTotalCharge(*products);
3080 G4cout <<
" current/final a,z " << currentA <<
" " << currentZ <<
" "<< finalA<<
" "<< finalZ
3081 <<
" delta-mass " << delta<<
G4endl;
3084 G4cout <<
" initE/ E_out/ Mfinal/ Excit " << currentInitialEnergy
3085 <<
" " <<
final <<
" "
3087 << currentInitialEnergy -
final - mass_out
3089 currentInitialEnergy-=
final;
3098 G4ReactionProductVector::iterator iter;
3106 for(iter = products->begin(); iter != products->end(); ++iter)
3116 Efinal += (*iter)->GetTotalEnergy();
3117 pFinal += (*iter)->GetMomentum();
3121 G4cout <<
"BIC E/p delta " <<