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 if(getenv(
"BCDEBUG") )
G4cerr <<
" ######### Binary Cascade Reaction starts ######### "<<
G4endl;
217 if(initial4Momentum.
e()-initial4Momentum.
m()<theBCminP &&
231 if(!getenv(
"I_Am_G4BinaryCascade_Developer") )
238 G4cerr <<
"You are using G4BinaryCascade for projectiles other than nucleons or pions."<<
G4endl;
239 G4cerr <<
"If you want to continue, please switch on the developer environment: "<<
G4endl;
240 G4cerr <<
"setenv I_Am_G4BinaryCascade_Developer 1 "<<G4endl<<
G4endl;
241 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade - used for unvalid particle type - Fatal");
246 thePrimaryType = definition;
247 thePrimaryEscape =
false;
251 G4int interactionCounter = 0;
259 ClearAndDestroy(products);
273 initialPosition=GetSpherePoint(1.1*radius, initial4Momentum);
274 kt =
new G4KineticTrack(definition, 0., initialPosition, initial4Momentum);
278 secondaries->push_back(kt);
285 }
while(! products );
287 if(++interactionCounter>99)
break;
288 }
while(products->size() == 0);
290 if(products->size()>0)
296 G4ReactionProductVector::iterator iter;
298 for(iter = products->begin(); iter != products->end(); ++iter)
302 (*iter)->GetTotalEnergy(),
303 (*iter)->GetMomentum());
311 if(getenv(
"BCDEBUG") )
G4cerr <<
" ######### Binary Cascade Reaction void, return intial state ######### "<<
G4endl;
317 ClearAndDestroy(products);
323 if(getenv(
"BCDEBUG") )
G4cerr <<
" ######### Binary Cascade Reaction ends ######### "<<
G4endl;
333 #ifdef debug_BIC_Propagate
334 G4cout <<
"G4BinaryCascade Propagate starting -------------------------------------------------------" <<
G4endl;
343 ClearAndDestroy(&theCapturedList);
344 ClearAndDestroy(&theSecondaryList);
345 theSecondaryList.clear();
346 ClearAndDestroy(&theFinalState);
347 std::vector<G4KineticTrack *>::iterator iter;
358 #ifdef debug_BIC_GetExcitationEnergy
359 G4cout <<
"ExcitationEnergy0 " << GetExcitationEnergy() <<
G4endl;
364 G4bool success = BuildLateParticleCollisions(secondaries);
367 products=HighEnergyModelFSProducts(products, secondaries);
368 ClearAndDestroy(secondaries);
371 #ifdef debug_G4BinaryCascade
372 G4cout <<
"G4BinaryCascade::Propagate: warning - high energy model failed energy conservation, returning unchanged high energy final state" <<
G4endl;
382 FindCollisions(&theSecondaryList);
385 if(theCollisionMgr->
Entries() == 0 )
389 #ifdef debug_BIC_return
399 G4bool haveProducts =
false;
400 G4int collisionCount=0;
402 while(theCollisionMgr->
Entries() > 0 && currentZ)
415 if(theCollisionMgr->
Entries() > 0)
419 #ifdef debug_BIC_Propagate_Collisions
420 G4cout <<
" NextCollision * , Time, curtime = " << nextCollision <<
" "
435 if (ApplyCollision(nextCollision))
454 products = FillVoidNucleusProducts(products);
455 #ifdef debug_BIC_return
456 G4cout <<
"return @ Z=0 after collision loop "<<
G4endl;
457 PrintKTVector(&theSecondaryList,std::string(
" theSecondaryList"));
458 G4cout <<
"theTargetList size: " << theTargetList.size() <<
G4endl;
459 PrintKTVector(&theTargetList,std::string(
" theTargetList"));
460 PrintKTVector(&theCapturedList,std::string(
" theCapturedList"));
462 G4cout <<
" ExcitE be4 Correct : " <<GetExcitationEnergy() <<
G4endl;
463 G4cout <<
" Mom Transfered to nucleus : " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
464 PrintKTVector(&theFinalState,std::string(
" FinalState uncorrected"));
465 G4cout <<
"returned products: " << products->size() <<
G4endl;
484 #ifdef debug_BIC_return
491 #ifdef debug_BIC_Propagate
492 G4cout <<
" Momentum transfer to Nucleus " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
499 if ( theSecondaryList.size() > 0 )
501 #ifdef debug_G4BinaryCascade
502 G4cerr <<
"G4BinaryCascade: Warning, have active particles at end" <<
G4endl;
503 PrintKTVector(&theSecondaryList,
"active particles @ end added to theFinalState");
506 for ( iter =theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
508 theFinalState.push_back(*iter);
510 theSecondaryList.clear();
513 while ( theCollisionMgr->
Entries() > 0 )
515 #ifdef debug_G4BinaryCascade
516 G4cerr <<
" Warning: remove left over collision(s) " <<
G4endl;
521 #ifdef debug_BIC_Propagate_Excitation
523 PrintKTVector(&theSecondaryList,std::string(
" theSecondaryList"));
524 G4cout <<
"theTargetList size: " << theTargetList.size() <<
G4endl;
526 PrintKTVector(&theCapturedList,std::string(
" theCapturedList"));
528 G4cout <<
" ExcitE be4 Correct : " <<GetExcitationEnergy() <<
G4endl;
529 G4cout <<
" Mom Transfered to nucleus : " << theMomentumTransfer <<
" " << theMomentumTransfer.
mag() <<
G4endl;
530 PrintKTVector(&theFinalState,std::string(
" FinalState uncorrected"));
536 G4double ExcitationEnergy=GetExcitationEnergy();
538 #ifdef debug_BIC_Propagate_finals
539 PrintKTVector(&theFinalState,std::string(
" FinalState be4 corr"));
540 G4cout <<
" Excitation Energy prefinal, #collisions:, out, captured "
541 << ExcitationEnergy <<
" "
542 << collisionCount <<
" "
543 << theFinalState.size() <<
" "
544 << theCapturedList.size()<<
G4endl;
547 if (ExcitationEnergy < 0 )
549 G4int maxtry=5, ntry=0;
552 ExcitationEnergy=GetExcitationEnergy();
553 }
while ( ++ntry < maxtry && ExcitationEnergy < 0 );
556 #ifdef debug_BIC_Propagate_finals
557 PrintKTVector(&theFinalState,std::string(
" FinalState corrected"));
558 G4cout <<
" Excitation Energy final, #collisions:, out, captured "
559 << ExcitationEnergy <<
" "
560 << collisionCount <<
" "
561 << theFinalState.size() <<
" "
562 << theCapturedList.size()<<
G4endl;
566 if ( ExcitationEnergy < 0. )
581 ClearAndDestroy(products);
583 #ifdef debug_BIC_return
594 products= ProductsAddFinalState(products, theFinalState);
596 products= ProductsAddPrecompound(products, precompoundProducts);
601 thePrimaryEscape =
true;
603 #ifdef debug_BIC_return
612 G4double G4BinaryCascade::GetExcitationEnergy()
617 #if defined(debug_G4BinaryCascade) || defined(debug_BIC_GetExcitationEnergy)
618 G4int finalA = theTargetList.size()+theCapturedList.size();
619 G4int finalZ = GetTotalCharge(theTargetList)+GetTotalCharge(theCapturedList);
620 if ( (currentA - finalA) != 0 || (currentZ - finalZ) != 0 )
622 G4cerr <<
"G4BIC:GetExcitationEnergy(): Nucleon counting error current/final{A,Z} "
623 << currentA <<
" " << finalA <<
" "<< currentZ <<
" " << finalZ <<
G4endl;
634 else if (currentZ==0 )
637 else {nucleusMass = GetFinalNucleusMomentum().
mag()
642 #ifdef debug_G4BinaryCascade
643 G4cout <<
"G4BinaryCascade::GetExcitationEnergy(): Warning - invalid nucleus (A,Z)=("
644 << currentA <<
"," << currentZ <<
")" <<
G4endl;
649 #ifdef debug_BIC_GetExcitationEnergy
651 debug.push_back(
"====> current A, Z");
652 debug.push_back(currentZ);
653 debug.push_back(currentA);
654 debug.push_back(
"====> final A, Z");
655 debug.push_back(finalZ);
656 debug.push_back(finalA);
657 debug.push_back(nucleusMass);
658 debug.push_back(GetFinalNucleusMomentum().mag());
664 excitationE = GetFinalNucleusMomentum().
mag() - nucleusMass;
670 #ifdef debug_BIC_GetExcitationEnergy
672 if ( excitationE < 0 )
674 G4cout <<
"negative ExE final Ion mass " <<nucleusMass<<
G4endl;
676 if(finalZ>.5)
G4cout <<
" Final nuclmom/mass " << Nucl_mom <<
" " << Nucl_mom.
mag()
677 <<
" (A,Z)=("<< finalA <<
","<<finalZ <<
")"
678 <<
" mass " << nucleusMass <<
" "
679 <<
" excitE " << excitationE <<
G4endl;
687 initialExc = theInitial4Mom.
mag()-
689 G4cout <<
"GetExcitationEnergy: Initial nucleus A Z " << A <<
" " << Z <<
" " << initialExc <<
G4endl;
706 void G4BinaryCascade::BuildTargetList()
717 ClearAndDestroy(&theTargetList);
745 theTargetList.push_back(kt);
750 #ifdef debug_BIC_BuildTargetList
751 else {
G4cout <<
"nucleon is hit" << nucleon <<
G4endl;}
758 }
else if (currentZ==0 && currentA>=1 )
763 G4cerr <<
"G4BinaryCascade::BuildTargetList(): Fatal Error - invalid nucleus (A,Z)=("
764 << currentA <<
"," << currentZ <<
")" <<
G4endl;
767 currentInitialEnergy= theInitial4Mom.
e() + theProjectile4Momentum.
e();
769 #ifdef debug_BIC_BuildTargetList
770 G4cout <<
"G4BinaryCascade::BuildTargetList(): nucleus (A,Z)=("
771 << currentA <<
"," << currentZ <<
") mass: " << massInNucleus <<
772 ", theInitial4Mom " << theInitial4Mom <<
773 ", currentInitialEnergy " << currentInitialEnergy <<
G4endl;
783 std::vector<G4KineticTrack *>::iterator iter;
786 projectileA=projectileZ=0;
789 for(iter = secondaries->begin(); iter != secondaries->end(); ++iter)
791 if((*iter)->GetFormationTime() < StartingTime)
792 StartingTime = (*iter)->GetFormationTime();
797 for(iter = secondaries->begin(); iter != secondaries->end(); ++iter)
801 G4double FormTime = (*iter)->GetFormationTime() - StartingTime;
802 (*iter)->SetFormationTime(FormTime);
805 FindLateParticleCollision(*iter);
806 lateParticles4Momentum += (*iter)->GetTrackingMomentum();
807 lateA += (*iter)->GetDefinition()->GetBaryonNumber();
808 lateZ +=
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
812 theSecondaryList.push_back(*iter);
814 theProjectile4Momentum += (*iter)->GetTrackingMomentum();
815 projectileA += (*iter)->GetDefinition()->GetBaryonNumber();
816 projectileZ +=
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
817 #ifdef debug_BIC_Propagate
818 G4cout <<
" Adding initial secondary " << *iter
819 <<
" time" << (*iter)->GetFormationTime()
820 <<
", state " << (*iter)->GetState() <<
G4endl;
829 theProjectile4Momentum += mom;
833 G4double excitation= theProjectile4Momentum.
e() + initial_nuclear_mass - lateParticles4Momentum.e() - massInNucleus;
834 #ifdef debug_BIC_GetExcitationEnergy
835 G4cout <<
"BIC: Proj.e, nucl initial, nucl final, lateParticles"
836 << theProjectile4Momentum <<
", "
837 << initial_nuclear_mass<<
", " << massInNucleus <<
", "
838 << lateParticles4Momentum <<
G4endl;
839 G4cout <<
"BIC: Proj.e / initial excitation: " << theProjectile4Momentum.
e() <<
" / " << excitation <<
G4endl;
841 success = excitation > 0;
842 #ifdef debug_G4BinaryCascade
844 G4cout <<
"G4BinaryCascade::BuildLateParticleCollisions(): Proj.e / initial excitation: " << theProjectile4Momentum.
e() <<
" / " << excitation <<
G4endl;
854 secondaries->clear();
873 fragment = FindFragments();
876 if(fragment->
GetA() >1.5)
884 else if (theExcitationHandler)
886 precompoundProducts=theExcitationHandler->
BreakItUp(*fragment);
891 if (theTargetList.size() + theCapturedList.size() > 1 ) {
895 std::vector<G4KineticTrack *>::iterator i;
896 if ( theTargetList.size() == 1 ) {i=theTargetList.begin();}
897 if ( theCapturedList.size() == 1 ) {i=theCapturedList.begin();}
902 precompoundProducts->push_back(aNew);
910 precompoundProducts = DecayVoidNucleus();
912 return precompoundProducts;
920 if ( (theTargetList.size()+theCapturedList.size()) > 0 )
923 std::vector<G4KineticTrack *>::iterator aNuc;
925 std::vector<G4double> masses;
928 if ( theTargetList.size() != 0)
930 for ( aNuc=theTargetList.begin(); aNuc != theTargetList.end(); aNuc++)
932 G4double mass=(*aNuc)->GetDefinition()->GetPDGMass();
933 masses.push_back(mass);
938 if ( theCapturedList.size() != 0)
940 for(aNuc = theCapturedList.begin();
941 aNuc != theCapturedList.end(); aNuc++)
943 G4double mass=(*aNuc)->GetDefinition()->GetPDGMass();
944 masses.push_back(mass);
955 if ( eCMS < sumMass )
957 eCMS=sumMass + 2*
MeV*masses.size();
962 std::vector<G4LorentzVector*> * momenta=decay.
Decay(eCMS,masses);
963 std::vector<G4LorentzVector*>::iterator aMom=momenta->begin();
966 if ( theTargetList.size() != 0)
968 for ( aNuc=theTargetList.begin();
969 (aNuc != theTargetList.end()) && (aMom!=momenta->end());
975 result->push_back(aNew);
981 if ( theCapturedList.size() != 0)
983 for ( aNuc=theCapturedList.begin();
984 (aNuc != theCapturedList.end()) && (aMom!=momenta->end());
988 (*aNuc)->GetDefinition());
991 result->push_back(aNew);
1007 for(i = 0; i< fs.size(); i++)
1014 products->push_back(aNew);
1016 #ifdef debug_BIC_Propagate_finals
1032 if ( precompoundProducts )
1034 std::vector<G4ReactionProduct *>::iterator j;
1035 for(j = precompoundProducts->begin(); j != precompoundProducts->end(); ++j)
1040 #ifdef debug_BIC_Propagate_finals
1043 pProduct *= precompoundLorentzboost;
1044 #ifdef debug_BIC_Propagate_finals
1047 pSumPreco += pProduct;
1048 (*j)->SetTotalEnergy(pProduct.e());
1049 (*j)->SetMomentum(pProduct.vect());
1050 (*j)->SetNewlyAdded(
true);
1051 products->push_back(*j);
1055 precompoundProducts->clear();
1056 delete precompoundProducts;
1064 for(std::vector<G4KineticTrack *>::iterator i = secondaries->begin();
1065 i != secondaries->end(); ++i)
1068 for(std::vector<G4BCAction *>::iterator j = theImR.begin();
1069 j!=theImR.end(); j++)
1072 const std::vector<G4CollisionInitialState *> & aCandList
1073 = (*j)->GetCollisions(*i, theTargetList, theCurrentTime);
1074 for(
size_t count=0; count<aCandList.size(); count++)
1086 void G4BinaryCascade::FindDecayCollision(
G4KineticTrack * secondary)
1089 const std::vector<G4CollisionInitialState *> & aCandList
1090 = theDecay->
GetCollisions(secondary, theTargetList, theCurrentTime);
1091 for(
size_t count=0; count<aCandList.size(); count++)
1098 void G4BinaryCascade::FindLateParticleCollision(
G4KineticTrack * secondary)
1103 if (((
G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes(secondary,tin,tout))
1108 }
else if ( tout > 0 )
1121 #ifdef debug_BIC_FindCollision
1122 G4cout <<
"FindLateP Particle, 4-mom, times newState "
1125 <<
" times " << tin <<
" " << tout <<
" "
1129 const std::vector<G4CollisionInitialState *> & aCandList
1130 = theLateParticle->
GetCollisions(secondary, theTargetList, theCurrentTime);
1131 for(
size_t count=0; count<aCandList.size(); count++)
1133 #ifdef debug_BIC_FindCollision
1134 G4cout <<
" Adding a late Col : " << aCandList[count] <<
G4endl;
1147 #ifdef debug_BIC_ApplyCollision
1148 G4cerr <<
"G4BinaryCascade::ApplyCollision start"<<
G4endl;
1149 theCollisionMgr->
Print();
1154 G4bool haveTarget=target_collection.size()>0;
1157 #ifdef debug_G4BinaryCascade
1158 G4cout <<
"G4BinaryCasacde::ApplyCollision(): StateError " << primary <<
G4endl;
1159 PrintKTVector(primary,std::string(
"primay- ..."));
1160 PrintKTVector(&target_collection,std::string(
"... targets"));
1163 theCollisionMgr->
Print();
1180 G4int initialBaryon(0);
1181 G4int initialCharge(0);
1189 G4double initial_Efermi=CorrectShortlivedPrimaryForFermi(primary,target_collection);
1195 #ifdef debug_BIC_ApplyCollision
1196 DebugApplyCollisionFail(collision, products);
1202 G4bool lateParticleCollision= (!haveTarget) && products && products->size() == 1;
1203 G4bool decayCollision= (!haveTarget) && products && products->size() > 1;
1207 #ifdef debug_G4BinaryCascade
1208 G4int lateBaryon(0), lateCharge(0);
1211 if ( lateParticleCollision )
1215 #ifdef debug_G4BinaryCascade
1216 lateBaryon = initialBaryon;
1217 lateCharge = initialCharge;
1219 initialBaryon=initialCharge=0;
1226 if (!lateParticleCollision)
1228 if( !products || products->size()==0 || !CheckPauliPrinciple(products) )
1230 #ifdef debug_BIC_ApplyCollision
1231 if (products)
G4cout <<
" ======Failed Pauli =====" <<
G4endl;
1232 G4cerr <<
"G4BinaryCascade::ApplyCollision blocked"<<
G4endl;
1240 if (! CorrectShortlivedFinalsForFermi(products, initial_Efermi)){
1246 #ifdef debug_BIC_ApplyCollision
1247 DebugApplyCollision(collision, products);
1251 if (products) ClearAndDestroy(products);
1252 if ( decayCollision ) FindDecayCollision(primary);
1258 G4int finalBaryon(0);
1259 G4int finalCharge(0);
1261 for(std::vector<G4KineticTrack *>::iterator i =products->begin(); i != products->end(); i++)
1263 if ( ! lateParticleCollision )
1265 (*i)->SetState(primary->
GetState());
1267 finalBaryon+=(*i)->GetDefinition()->GetBaryonNumber();
1268 finalCharge+=
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
1271 if (((
G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes((*i),tin,tout) &&
1272 tin < 0 && tout > 0 )
1274 PrintKTVector((*i),
"particle inside marked not-inside");
1275 G4cout <<
"tin tout: " << tin <<
" " << tout <<
G4endl;
1280 if (((
G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes((*i),tin,tout))
1287 else if ( tout > 0 )
1290 finalBaryon+=(*i)->GetDefinition()->GetBaryonNumber();
1291 finalCharge+=
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
1296 toFinalState.push_back((*i));
1302 toFinalState.push_back((*i));
1307 if(!toFinalState.empty())
1309 theFinalState.insert(theFinalState.end(),
1310 toFinalState.begin(),toFinalState.end());
1311 std::vector<G4KineticTrack *>::iterator iter1, iter2;
1312 for(iter1 = toFinalState.begin(); iter1 != toFinalState.end();
1315 iter2 = std::find(products->begin(), products->end(),
1317 if ( iter2 != products->end() ) products->erase(iter2);
1323 currentA += finalBaryon-initialBaryon;
1324 currentZ += finalCharge-initialCharge;
1328 oldSecondaries.push_back(primary);
1331 #ifdef debug_G4BinaryCascade
1332 if ( (finalBaryon-initialBaryon-lateBaryon) != 0 || (finalCharge-initialCharge-lateCharge) != 0 )
1334 G4cout <<
"G4BinaryCascade: Error in Balancing: " <<
G4endl;
1335 G4cout <<
"initial/final baryon number, initial/final Charge "
1336 << initialBaryon <<
" "<< finalBaryon <<
" "
1337 << initialCharge <<
" "<< finalCharge <<
" "
1339 <<
", with number of products: "<< products->size() <<
G4endl;
1340 G4cout << G4endl<<
"Initial condition are these:"<<
G4endl;
1353 for(
size_t ii=0; ii< oldTarget.size(); ii++)
1355 oldTarget[ii]->Hit();
1358 UpdateTracksAndCollisions(&oldSecondaries, &oldTarget, products);
1368 G4bool G4BinaryCascade::Absorb()
1376 std::vector<G4KineticTrack *>::iterator iter;
1378 for(iter = theSecondaryList.begin();
1379 iter != theSecondaryList.end(); ++iter)
1384 if(absorber.WillBeAbsorbed(*kt))
1386 absorbList.push_back(kt);
1391 if(absorbList.empty())
1395 for(iter = absorbList.begin(); iter != absorbList.end(); ++iter)
1398 if(!absorber.FindAbsorbers(*kt, theTargetList))
1399 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade::Absorb(): Cannot absorb a particle.");
1401 if(!absorber.FindProducts(*kt))
1402 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade::Absorb(): Cannot absorb a particle.");
1408 while(!CheckPauliPrinciple(products))
1413 ClearAndDestroy(products);
1414 if(!absorber.FindProducts(*kt))
1416 "G4BinaryCascade::Absorb(): Cannot absorb a particle.");
1422 toRemove.push_back(kt);
1423 toDelete.push_back(kt);
1425 UpdateTracksAndCollisions(&toRemove, absorbers, products);
1426 ClearAndDestroy(absorbers);
1428 ClearAndDestroy(&toDelete);
1441 std::vector<G4KineticTrack *>::iterator i;
1446 G4int particlesAboveCut=0;
1447 G4int particlesBelowCut=0;
1448 if ( verbose )
G4cout <<
" Capture: secondaries " << theSecondaryList.size() <<
G4endl;
1449 for(i = theSecondaryList.begin(); i != theSecondaryList.end(); ++i)
1466 ++particlesBelowCut;
1474 if (verbose)
G4cout <<
"Capture particlesAboveCut,particlesBelowCut, capturedEnergy,capturedEnergy/particlesBelowCut <? 0.2*theCutOnP "
1475 << particlesAboveCut <<
" " << particlesBelowCut <<
" " << capturedEnergy
1479 if(particlesBelowCut>0 && capturedEnergy/particlesBelowCut<0.2*theCutOnP)
1482 for(i = theSecondaryList.begin(); i != theSecondaryList.end(); ++i)
1490 captured.push_back(kt);
1492 theCapturedList.push_back(kt);
1496 UpdateTracksAndCollisions(&captured, NULL, NULL);
1511 fermiMom.
Init(A, Z);
1515 G4KineticTrackVector::iterator i;
1522 for(i = products->begin(); i != products->end(); ++i)
1524 definition = (*i)->GetDefinition();
1550 if(mom.
e() < eFermi )
1559 #ifdef debug_BIC_CheckPauli
1562 for(i = products->begin(); i != products->end(); ++i)
1564 definition = (*i)->GetDefinition();
1573 if ( mom.
e()-mom.
mag()+field > 160*
MeV )
1575 G4cout <<
"momentum problem pFermi=" << pFermi
1576 <<
" mom, mom.m " << mom <<
" " << mom.
mag()
1577 <<
" field " << field <<
G4endl;
1588 void G4BinaryCascade::StepParticlesOut()
1595 while( theSecondaryList.size() > 0 )
1600 std::vector<G4KineticTrack *>::iterator i;
1601 for(i = theSecondaryList.begin(); i != theSecondaryList.end(); ++i)
1609 ((
G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes(kt,tdummy,tStep);
1610 #ifdef debug_BIC_StepParticlesOut
1611 G4cout <<
" minTimeStep, tStep Particle " <<minTimeStep <<
" " <<tStep
1616 PrintKTVector(&theSecondaryList, std::string(
" state ERROR....."));
1617 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade::StepParticlesOut() particle not in nucleus");
1620 if(intersect && tStep<minTimeStep && tStep> 0 )
1622 minTimeStep = tStep;
1625 PrintKTVector(&theSecondaryList, std::string(
" state ERROR....."));
1626 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade::StepParticlesOut() particle not in nucleus");
1633 if(theCollisionMgr->
Entries() > 0)
1637 G4cout <<
" NextCollision * , Time= " << nextCollision <<
" "
1638 <<timeToCollision<<
G4endl;
1640 if ( timeToCollision > minTimeStep )
1642 DoTimeStep(minTimeStep);
1646 if (!DoTimeStep(timeToCollision) )
1658 if ( ApplyCollision(nextCollision))
1670 #ifdef debug_G4BinaryCascade
1671 G4cerr <<
"G4BinaryCascade.cc: Warning - aborting looping particle(s)" <<
G4endl;
1672 PrintKTVector(&theSecondaryList,
" looping particles added to theFinalState");
1676 std::vector<G4KineticTrack *>::iterator iter;
1677 for ( iter =theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
1679 theFinalState.push_back(*iter);
1681 theSecondaryList.clear();
1695 #ifdef debug_BIC_StepParticlesOut
1699 if ( counter > 100 && theCollisionMgr->
Entries() == 0)
1701 #ifdef debug_BIC_StepParticlesOut
1702 PrintKTVector(&theSecondaryList,std::string(
"stepping 100 steps"));
1704 FindCollisions(&theSecondaryList);
1719 G4double G4BinaryCascade::CorrectShortlivedPrimaryForFermi(
1728 if ( std::abs(PDGcode) > 1000 && PDGcode != 2112 && PDGcode != 2212 )
1735 std::vector<G4KineticTrack *>::iterator titer;
1736 for ( titer=target_collection.begin() ; titer!=target_collection.end(); ++titer)
1754 for ( std::vector<G4KineticTrack *>::iterator i =products->begin(); i != products->end(); i++)
1756 G4int PDGcode=(*i)->GetDefinition()->GetPDGEncoding();
1758 final_Efermi+=((
G4RKPropagation *)thePropagator)->GetField(PDGcode,(*i)->GetPosition());
1759 if ( std::abs(PDGcode) > 1000 && PDGcode != 2112 && PDGcode != 2212 )
1761 resonances.push_back(*i);
1764 if ( resonances.size() > 0 )
1766 G4double delta_Fermi= (initial_Efermi-final_Efermi)/resonances.size();
1767 for (std::vector<G4KineticTrack *>::iterator res=resonances.begin(); res != resonances.end(); res++)
1771 G4double newEnergy=mom.
e() + delta_Fermi;
1772 G4double newEnergy2= newEnergy*newEnergy;
1774 if ( newEnergy2 < mass2 )
1787 void G4BinaryCascade::CorrectFinalPandE()
1795 #ifdef debug_BIC_CorrectFinalPandE
1799 if ( theFinalState.size() == 0 )
return;
1801 G4KineticTrackVector::iterator i;
1803 if ( pNucleus.
e() == 0 )
return;
1804 #ifdef debug_BIC_CorrectFinalPandE
1809 for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
1811 pFinals += (*i)->Get4Momentum();
1813 #ifdef debug_BIC_CorrectFinalPandE
1814 G4cout <<
"CorrectFinalPandE a final " << (*i)->GetDefinition()->GetParticleName()
1815 <<
" 4mom " << (*i)->Get4Momentum()<<
G4endl;
1818 #ifdef debug_BIC_CorrectFinalPandE
1819 G4cout <<
"CorrectFinalPandE pN pF: " <<pNucleus <<
" " <<pFinals <<
G4endl;
1825 #ifdef debug_BIC_CorrectFinalPandE
1826 G4cout <<
"CorrectFinalPandE pCM, CMS pCM " << pCM <<
" " <<toCMS*pCM<<
G4endl;
1827 G4cout <<
"CorrectFinal CMS pN pF " <<toCMS*pNucleus <<
" "
1829 <<
" nucleus initial mass : " <<GetFinal4Momentum().
mag()
1830 <<
" massInNucleus m(nucleus) m(finals) std::sqrt(s): " << massInNucleus <<
" " <<pNucleus.
mag()<<
" "
1831 << pFinals.mag() <<
" " << pCM.
mag() <<
G4endl;
1837 G4double m10 = GetIonMass(currentZ,currentA);
1839 if( s0-(m10+m20)*(m10+m20) < 0 )
1841 #ifdef debug_BIC_CorrectFinalPandE
1842 G4cout <<
"G4BinaryCascade::CorrectFinalPandE() : error! " <<
G4endl;
1844 G4cout <<
"not enough mass to correct: mass, A,Z, mass(nucl), mass(finals) "
1845 << std::sqrt(s0-(m10+m20)*(m10+m20)) <<
" "
1846 << currentA <<
" " << currentZ <<
" "
1847 << m10 <<
" " << m20
1851 PrintKTVector(&theFinalState,
" mass problem");
1857 G4double pInCM = std::sqrt((s0-(m10+m20)*(m10+m20))*(s0-(m10-m20)*(m10-m20))/(4.*s0));
1858 #ifdef debug_BIC_CorrectFinalPandE
1859 G4cout <<
" CorrectFinalPandE pInCM new, CURRENT, ratio : " << pInCM
1860 <<
" " << (pFinals).vect().mag()<<
" " << pInCM/(pFinals).vect().mag() <<
G4endl;
1862 if ( pFinals.vect().mag() > pInCM )
1869 for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
1872 G4ThreeVector p3(factor*(toCMS*(*i)->Get4Momentum()).vect());
1876 #ifdef debug_BIC_CorrectFinalPandE
1879 (*i)->Set4Momentum(
p);
1881 #ifdef debug_BIC_CorrectFinalPandE
1882 G4cout <<
"CorrectFinalPandE nucleus corrected mass : " << GetFinal4Momentum() <<
" "
1883 <<GetFinal4Momentum().
mag() << G4endl
1884 <<
" CMS pFinals , mag, 3.mag : " << qFinals <<
" " << qFinals.mag() <<
" " << qFinals.vect().mag()<<
G4endl;
1885 G4cerr <<
" -CorrectFinalPandE 5 " << factor <<
G4endl;
1888 #ifdef debug_BIC_CorrectFinalPandE
1889 else {
G4cerr <<
" -CorrectFinalPandE 6 - no correction done" <<
G4endl; }
1895 void G4BinaryCascade::UpdateTracksAndCollisions(
1901 std::vector<G4KineticTrack *>::iterator iter1, iter2;
1906 if(!oldSecondaries->empty())
1908 for(iter1 = oldSecondaries->begin(); iter1 != oldSecondaries->end();
1911 iter2 = std::find(theSecondaryList.begin(), theSecondaryList.end(),
1913 if ( iter2 != theSecondaryList.end() ) theSecondaryList.erase(iter2);
1923 if(oldTarget->size()!=0)
1927 for(iter1 = oldTarget->begin(); iter1 != oldTarget->end(); ++iter1)
1929 iter2 = std::find(theTargetList.begin(), theTargetList.end(),
1931 theTargetList.erase(iter2);
1939 if(!newSecondaries->empty())
1942 for(iter1 = newSecondaries->begin(); iter1 != newSecondaries->end();
1945 theSecondaryList.push_back(*iter1);
1948 PrintKTVector(*iter1,
"undefined in FindCollisions");
1954 FindCollisions(newSecondaries);
1969 ktv(out), wanted_state(astate)
1973 if ( (kt)->GetState() == wanted_state ) ktv->push_back(kt);
1984 #ifdef debug_BIC_DoTimeStep
1986 debug.push_back(
"======> DoTimeStep 1");
debug.dump();
1987 G4cerr <<
"G4BinaryCascade::DoTimeStep: enter step="<< theTimeStep
1988 <<
" , time="<<theCurrentTime <<
G4endl;
1989 PrintKTVector(&theSecondaryList, std::string(
"DoTimeStep - theSecondaryList"));
1994 std::vector<G4KineticTrack *>::iterator iter;
1997 std::for_each( theSecondaryList.begin(),theSecondaryList.end(),
2002 std::for_each( theSecondaryList.begin(),theSecondaryList.end(),
2007 #ifdef debug_BIC_DoTimeStep
2013 thePropagator->
Transport(theSecondaryList, dummy, theTimeStep);
2020 #ifdef debug_BIC_DoTimeStep
2021 G4cout <<
"DoTimeStep : theMomentumTransfer = " << theMomentumTransfer <<
G4endl;
2022 PrintKTVector(&theSecondaryList, std::string(
"DoTimeStep - secondaries aft trsprt"));
2028 std::for_each( kt_outside->begin(),kt_outside->end(),
2035 std::for_each( kt_inside->begin(),kt_inside->end(),
2045 kt_gone_in->clear();
2046 std::for_each( kt_outside->begin(),kt_outside->end(),
2049 kt_gone_out->clear();
2050 std::for_each( kt_inside->begin(),kt_inside->end(),
2053 #ifdef debug_BIC_DoTimeStep
2054 PrintKTVector(fail,std::string(
" Failed to go in/out -> miss_nucleus/captured"));
2055 PrintKTVector(kt_gone_in, std::string(
"recreated kt_gone_in"));
2056 PrintKTVector(kt_gone_out, std::string(
"recreated kt_gone_out"));
2062 std::for_each( kt_outside->begin(),kt_outside->end(),
2065 std::for_each( kt_outside->begin(),kt_outside->end(),
2068 #ifdef debug_BIC_DoTimeStep
2069 PrintKTVector(kt_gone_out, std::string(
"append gone_outs to final state.. theFinalState"));
2072 theFinalState.insert(theFinalState.end(),
2073 kt_gone_out->begin(),kt_gone_out->end());
2077 std::for_each( theSecondaryList.begin(),theSecondaryList.end(),
2083 if ( theCollisionMgr->
Entries()> 0 )
2085 if (kt_gone_out->size() )
2088 iter = std::find(kt_gone_out->begin(),kt_gone_out->end(),nextPrimary);
2089 if ( iter != kt_gone_out->end() )
2092 #ifdef debug_BIC_DoTimeStep
2093 G4cout <<
" DoTimeStep - WARNING: deleting current collision!" <<
G4endl;
2097 if ( kt_captured->size() )
2100 iter = std::find(kt_captured->begin(),kt_captured->end(),nextPrimary);
2101 if ( iter != kt_captured->end() )
2104 #ifdef debug_BIC_DoTimeStep
2105 G4cout <<
" DoTimeStep - WARNING: deleting current collision!" <<
G4endl;
2112 UpdateTracksAndCollisions(kt_gone_out,0 ,0);
2115 if ( kt_captured->size() )
2117 theCapturedList.insert(theCapturedList.end(),
2118 kt_captured->begin(),kt_captured->end());
2122 std::vector<G4KineticTrack *>::iterator i_captured;
2123 for(i_captured=kt_captured->begin();i_captured!=kt_captured->end();i_captured++)
2125 (*i_captured)->Hit();
2128 UpdateTracksAndCollisions(kt_captured, NULL, NULL);
2131 #ifdef debug_G4BinaryCascade
2134 std::for_each( theSecondaryList.begin(),theSecondaryList.end(),
2136 if ( currentZ != (GetTotalCharge(theTargetList)
2137 + GetTotalCharge(theCapturedList)
2138 + GetTotalCharge(*kt_inside)) )
2140 G4cout <<
" error-DoTimeStep aft, A, Z: " << currentA <<
" " << currentZ
2141 <<
" sum(tgt,capt,active) "
2142 << GetTotalCharge(theTargetList) + GetTotalCharge(theCapturedList) + GetTotalCharge(*kt_inside)
2143 <<
" targets: " << GetTotalCharge(theTargetList)
2144 <<
" captured: " << GetTotalCharge(theCapturedList)
2145 <<
" active: " << GetTotalCharge(*kt_inside)
2157 theCurrentTime += theTimeStep;
2171 std::vector<G4KineticTrack *>::iterator iter;
2176 G4int secondaries_in(0);
2177 G4int secondaryBarions_in(0);
2178 G4int secondaryCharge_in(0);
2181 for ( iter =in->begin(); iter != in->end(); ++iter)
2184 secondaryCharge_in +=
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
2185 if ((*iter)->GetDefinition()->GetBaryonNumber()!=0 )
2187 secondaryBarions_in += (*iter)->GetDefinition()->GetBaryonNumber();
2191 secondaryMass_in += (*iter)->GetDefinition()->GetPDGMass();
2197 G4double mass_initial= GetIonMass(currentZ,currentA);
2199 currentZ += secondaryCharge_in;
2200 currentA += secondaryBarions_in;
2205 G4double mass_final= GetIonMass(currentZ,currentA);
2207 G4double correction= secondaryMass_in + mass_initial - mass_final;
2208 if (secondaries_in>1)
2209 {correction /= secondaries_in;}
2211 #ifdef debug_BIC_CorrectBarionsOnBoundary
2212 G4cout <<
"CorrectBarionsOnBoundary,currentZ,currentA,"
2213 <<
"secondaryCharge_in,secondaryBarions_in,"
2214 <<
"energy correction,m_secondry,m_nucl_init,m_nucl_final "
2215 << currentZ <<
" "<< currentA <<
" "
2216 << secondaryCharge_in<<
" "<<secondaryBarions_in<<
" "
2217 << correction <<
" "
2218 << secondaryMass_in <<
" "
2219 << mass_initial <<
" "
2220 << mass_final <<
" "
2222 PrintKTVector(in,std::string(
"in be4 correction"));
2225 for ( iter = in->begin(); iter != in->end(); ++iter)
2227 if ((*iter)->GetTrackingMomentum().e()+correction > (*iter)->GetActualMass())
2229 (*iter)->UpdateTrackingMomentum((*iter)->GetTrackingMomentum().e() + correction);
2236 (*iter)->UpdateTrackingMomentum((*iter)->GetTrackingMomentum().e() + barrier);
2238 kt_fail->push_back(*iter);
2239 currentZ -=
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
2240 currentA -= (*iter)->GetDefinition()->GetBaryonNumber();
2245 #ifdef debug_BIC_CorrectBarionsOnBoundary
2246 G4cout <<
" CorrectBarionsOnBoundary, aft, A, Z, sec-Z,A,m,m_in_nucleus "
2247 << currentA <<
" " << currentZ <<
" "
2248 << secondaryCharge_in <<
" " << secondaryBarions_in <<
" "
2249 << secondaryMass_in <<
" "
2251 PrintKTVector(in,std::string(
"in AFT correction"));
2258 G4int secondaries_out(0);
2259 G4int secondaryBarions_out(0);
2260 G4int secondaryCharge_out(0);
2263 for ( iter =out->begin(); iter != out->end(); ++iter)
2266 secondaryCharge_out +=
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
2267 if ((*iter)->GetDefinition()->GetBaryonNumber() !=0 )
2269 secondaryBarions_out += (*iter)->GetDefinition()->GetBaryonNumber();
2273 secondaryMass_out += (*iter)->GetDefinition()->GetPDGMass();
2280 G4double mass_initial= GetIonMass(currentZ,currentA);
2281 currentA -=secondaryBarions_out;
2282 currentZ -=secondaryCharge_out;
2291 G4cerr <<
"G4BinaryCascade - secondaryBarions_out,secondaryCharge_out " <<
2292 secondaryBarions_out <<
" " << secondaryCharge_out <<
G4endl;
2293 PrintKTVector(&theTargetList,
"CorrectBarionsOnBoundary Target");
2294 PrintKTVector(&theCapturedList,
"CorrectBarionsOnBoundary Captured");
2295 PrintKTVector(&theSecondaryList,
"CorrectBarionsOnBoundary Secondaries");
2296 G4cerr <<
"G4BinaryCascade - currentA, currentZ " << currentA <<
" " << currentZ <<
G4endl;
2297 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade::CorrectBarionsOnBoundary() - fatal error");
2299 G4double mass_final=GetIonMass(currentZ,currentA);
2300 G4double correction= mass_initial - mass_final - secondaryMass_out;
2302 if (secondaries_out>1) correction /= secondaries_out;
2303 #ifdef debug_BIC_CorrectBarionsOnBoundary
2304 G4cout <<
"DoTimeStep,currentZ,currentA,"
2305 <<
"secondaries_out,"
2306 <<
"secondaryCharge_out,secondaryBarions_out,"
2307 <<
"energy correction,m_secondry,m_nucl_init,m_nucl_final "
2308 <<
" "<< currentZ <<
" "<< currentA <<
" "
2309 << secondaries_out <<
" "
2310 << secondaryCharge_out<<
" "<<secondaryBarions_out<<
" "
2311 << correction <<
" "
2312 << secondaryMass_out <<
" "
2313 << mass_initial <<
" "
2314 << mass_final <<
" "
2316 PrintKTVector(out,std::string(
"out be4 correction"));
2319 for ( iter = out->begin(); iter != out->end(); ++iter)
2321 if ((*iter)->GetTrackingMomentum().e()+correction > (*iter)->GetActualMass())
2323 (*iter)->UpdateTrackingMomentum((*iter)->GetTrackingMomentum().e() + correction);
2334 (*iter)->UpdateTrackingMomentum((*iter)->GetTrackingMomentum().e() - barrier);
2336 kt_fail->push_back(*iter);
2337 currentZ +=
G4lrint((*iter)->GetDefinition()->GetPDGCharge()/
eplus);
2338 currentA += (*iter)->GetDefinition()->GetBaryonNumber();
2340 #ifdef debug_BIC_CorrectBarionsOnBoundary
2343 G4cout <<
"Not correcting outgoing " << *iter <<
" "
2344 << (*iter)->GetDefinition()->GetPDGEncoding() <<
" "
2345 << (*iter)->GetDefinition()->GetParticleName() <<
G4endl;
2346 PrintKTVector(out,std::string(
"outgoing, one not corrected"));
2352 #ifdef debug_BIC_CorrectBarionsOnBoundary
2353 PrintKTVector(out,std::string(
"out AFTER correction"));
2354 G4cout <<
" DoTimeStep, nucl-update, A, Z, sec-Z,A,m,m_in_nucleus, table-mass, delta "
2355 << currentA <<
" "<< currentZ <<
" "
2356 << secondaryCharge_out <<
" "<< secondaryBarions_out <<
" "<<
2357 secondaryMass_out <<
" "
2358 << massInNucleus <<
" "
2371 G4Fragment * G4BinaryCascade::FindFragments()
2375 #ifdef debug_BIC_FindFragments
2376 G4cout <<
"target, captured, secondary: "
2377 << theTargetList.size() <<
" "
2378 << theCapturedList.size()<<
" "
2379 << theSecondaryList.size()
2383 G4int a = theTargetList.size()+theCapturedList.size();
2385 G4KineticTrackVector::iterator i;
2386 for(i = theTargetList.begin(); i != theTargetList.end(); ++i)
2388 if(
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus) == 1 )
2394 G4int zCaptured = 0;
2396 for(i = theCapturedList.begin(); i != theCapturedList.end(); ++i)
2398 CapturedMomentum += (*i)->Get4Momentum();
2399 if(
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus) == 1 )
2405 G4int z = zTarget+zCaptured;
2407 #ifdef debug_G4BinaryCascade
2408 if ( z != (GetTotalCharge(theTargetList) + GetTotalCharge(theCapturedList)) )
2410 G4cout <<
" FindFragment Counting error z a " << z <<
" " <<a <<
" "
2411 << GetTotalCharge(theTargetList) <<
" " << GetTotalCharge(theCapturedList)<<
2413 PrintKTVector(&theTargetList, std::string(
"theTargetList"));
2414 PrintKTVector(&theCapturedList, std::string(
"theCapturedList"));
2428 if ( z < 1 )
return 0;
2431 G4int excitons = theCapturedList.size();
2432 #ifdef debug_BIC_FindFragments
2433 G4cout <<
"Fragment: a= " << a <<
" z= " << z <<
" particles= " << excitons
2434 <<
" Charged= " << zCaptured <<
" holes= " << holes
2435 <<
" excitE= " <<GetExcitationEnergy()
2436 <<
" Final4Momentum= " << GetFinalNucleusMomentum() <<
" capturMomentum= " << CapturedMomentum
2457 G4LorentzVector final4Momentum = theInitial4Mom + theProjectile4Momentum;
2459 for(G4KineticTrackVector::iterator i = theFinalState.begin(); i != theFinalState.end(); ++i)
2461 final4Momentum -= (*i)->Get4Momentum();
2462 finals += (*i)->Get4Momentum();
2465 if((final4Momentum.
vect()/final4Momentum.
e()).mag()>1.0 && currentA > 0)
2467 #ifdef debug_BIC_Final4Momentum
2469 G4cerr <<
"G4BinaryCascade::GetFinal4Momentum - Fatal"<<
G4endl;
2470 G4KineticTrackVector::iterator i;
2471 G4cerr <<
"Total initial 4-momentum " << theProjectile4Momentum <<
G4endl;
2472 G4cerr <<
" GetFinal4Momentum: Initial nucleus "<<theInitial4Mom<<
G4endl;
2473 for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
2475 G4cerr <<
" Final state: "<<(*i)->Get4Momentum()<<(*i)->GetDefinition()->GetParticleName()<<
G4endl;
2478 G4cerr<<
" Final4Momentum = "<<final4Momentum <<
" "<<final4Momentum.
m()<<
G4endl;
2479 G4cerr <<
" current A, Z = "<< currentA<<
", "<<currentZ<<
G4endl;
2485 return final4Momentum;
2496 G4KineticTrackVector::iterator i;
2498 for(i = theCapturedList.begin(); i != theCapturedList.end(); ++i)
2500 CapturedMomentum += (*i)->Get4Momentum();
2506 if ( NucleusMomentum.
e() > 0 )
2510 G4ThreeVector boost= (NucleusMomentum.
vect() -CapturedMomentum.vect())/NucleusMomentum.
e();
2511 if(boost.
mag2()>1.0)
2513 # ifdef debug_BIC_FinalNucleusMomentum
2514 G4cerr <<
"G4BinaryCascade::GetFinalNucleusMomentum - Fatal"<<
G4endl;
2516 G4cerr <<
"it 01"<<NucleusMomentum<<
" "<<CapturedMomentum<<
" "<<
G4endl;
2523 precompoundLorentzboost.
set( boost );
2524 #ifdef debug_debug_BIC_FinalNucleusMomentum
2525 G4cout <<
"GetFinalNucleusMomentum be4 boostNucleusMomentum, CapturedMomentum"<<NucleusMomentum<<
" "<<CapturedMomentum<<
" "<<
G4endl;
2527 NucleusMomentum *= nucleusBoost;
2528 #ifdef debug_BIC_FinalNucleusMomentum
2529 G4cout <<
"GetFinalNucleusMomentum aft boost GetFinal4Momentum= " <<NucleusMomentum <<
G4endl;
2532 return NucleusMomentum;
2549 std::vector<G4KineticTrack *>::iterator iter, jter;
2554 while(!done && tryCount++ <200)
2561 secs = theH1Scatterer->
Scatter(*(*secondaries).front(), aTarget);
2562 #ifdef debug_H1_BinaryCascade
2563 PrintKTVector(secs,
" From Scatter");
2565 for(
size_t ss=0; secs && ss<secs->size(); ss++)
2568 if((*secs)[ss]->GetDefinition()->IsShortLived()) done =
true;
2572 ClearAndDestroy(&theFinalState);
2573 ClearAndDestroy(secondaries);
2576 for(
size_t current=0; secs && current<secs->size(); current++)
2578 if((*secs)[current]->GetDefinition()->IsShortLived())
2582 for(jter=dec->begin(); jter != dec->end(); jter++)
2585 secs->push_back(*jter);
2588 delete (*secs)[current];
2595 theFinalState.push_back((*secs)[current]);
2600 #ifdef debug_H1_BinaryCascade
2601 PrintKTVector(&theFinalState,
" FinalState");
2603 for(iter = theFinalState.begin(); iter != theFinalState.end(); ++iter)
2609 products->push_back(aNew);
2610 #ifdef debug_H1_BinaryCascade
2615 G4cout <<
"final shortlived : ";
2618 G4cout <<
"final un stable : ";
2625 theFinalState.clear();
2650 }
while (
sqr(x1) +
sqr(x2) > 1.);
2676 std::vector<G4KineticTrack *>::iterator i;
2677 for(i = ktv->begin(); i != ktv->end(); ++i)
2686 std::vector<G4ReactionProduct *>::iterator i;
2687 for(i = rpv->begin(); i != rpv->end(); ++i)
2696 if (comment.size() > 0 )
G4cout <<
"G4BinaryCascade::PrintKTVector() " << comment << G4endl;
2698 G4cout <<
" vector: " << ktv <<
", number of tracks: " << ktv->size()
2700 std::vector<G4KineticTrack *>::iterator i;
2703 for(count = 0, i = ktv->begin(); i != ktv->end(); ++i, ++count)
2706 G4cout <<
" track n. " << count;
2710 G4cout <<
"G4BinaryCascade::PrintKTVector():No KineticTrackVector given " <<
G4endl;
2714 void G4BinaryCascade::PrintKTVector(
G4KineticTrack * kt, std::string comment)
2717 if (comment.size() > 0 )
G4cout <<
"G4BinaryCascade::PrintKTVector() "<< comment << G4endl;
2730 G4cout <<
"G4BinaryCascade::PrintKTVector(): No Kinetictrack given" <<
G4endl;
2740 if ( Z > 0 && A >= Z )
2744 }
else if ( A > 0 && Z>0 )
2749 }
else if ( A >= 0 && Z<=0 )
2754 }
else if ( A == 0 && std::abs(Z)<2 )
2761 G4cerr <<
"G4BinaryCascade::GetIonMass() - invalid (A,Z) = ("
2762 << A <<
"," << Z <<
")" <<
G4endl;
2763 throw G4HadronicException(__FILE__, __LINE__,
"G4BinaryCascade::GetIonMass() - giving up");
2772 std::vector<G4KineticTrack *>::iterator iter;
2773 decayKTV.
Decay(&theFinalState);
2775 for(iter = theFinalState.begin(); iter != theFinalState.end(); ++iter)
2778 aNew->
SetMomentum((*iter)->Get4Momentum().vect());
2780 Esecondaries +=(*iter)->Get4Momentum().e();
2783 products->push_back(aNew);
2787 for(iter = theCapturedList.begin(); iter != theCapturedList.end(); ++iter)
2790 aNew->
SetMomentum((*iter)->Get4Momentum().vect());
2792 Esecondaries +=(*iter)->Get4Momentum().e();
2795 products->push_back(aNew);
2799 while(theCollisionMgr->
Entries() > 0)
2806 if ( lates->size() == 1 ) {
2814 products->push_back(aNew);
2824 decayKTV.
Decay(&theSecondaryList);
2826 for(iter = theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
2829 aNew->
SetMomentum((*iter)->Get4Momentum().vect());
2831 Esecondaries +=(*iter)->Get4Momentum().e();
2834 products->push_back(aNew);
2838 for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter)
2840 SumMassNucleons += (*iter)->GetDefinition()->GetPDGMass();
2843 G4double Ekinetic=theProjectile4Momentum.e() + initial_nuclear_mass - Esecondaries - SumMassNucleons;
2846 if (theTargetList.size() ) Ekinetic /= theTargetList.size();
2853 for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter)
2857 G4double p=std::sqrt(
sqr(Ekinetic) + 2.*Ekinetic*mass);
2858 aNew->
SetMomentum(p*(*iter)->Get4Momentum().vect().unit());
2862 products->push_back(aNew);
2870 std::vector<G4KineticTrack *>::iterator iter;
2871 for(iter = secondaries->begin(); iter != secondaries->end(); ++iter)
2874 aNew->
SetMomentum((*iter)->Get4Momentum().vect());
2878 products->push_back(aNew);
2881 if (currentA == 1 && currentZ == 0) {
2883 }
else if (currentA == 1 && currentZ == 1) {
2885 }
else if (currentA == 2 && currentZ == 1) {
2887 }
else if (currentA == 3 && currentZ == 1) {
2889 }
else if (currentA == 3 && currentZ == 2) {
2891 }
else if (currentA == 4 && currentZ == 2) {
2897 if (fragment != 0) {
2903 products->push_back(theNew);
2908 void G4BinaryCascade::PrintWelcomeMessage()
2910 G4cout <<
"Thank you for using G4BinaryCascade. "<<
G4endl;
2920 for ( std::vector<G4KineticTrack *>::iterator i =products->begin(); i != products->end(); i++)
2922 G4int PDGcode=std::abs((*i)->GetDefinition()->GetPDGEncoding());
2923 if (std::abs(PDGcode)==211 || PDGcode==111 ) havePion=
true;
2926 if ( !products || havePion)
2929 <<
", with NO products! " <<
G4endl;
2930 G4cout << G4endl<<
"Initial condition are these:"<<
G4endl;
2946 G4bool G4BinaryCascade::CheckChargeAndBaryonNumber(
G4String where)
2948 static G4int lastdA(0), lastdZ(0);
2955 std::vector<G4KineticTrack *>::iterator i;
2956 G4int CapturedA(0), CapturedZ(0);
2957 G4int secsA(0), secsZ(0);
2958 for ( i=theCapturedList.begin(); i!=theCapturedList.end(); ++i) {
2959 CapturedA += (*i)->GetDefinition()->GetBaryonNumber();
2960 CapturedZ +=
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
2963 for ( i=theSecondaryList.begin(); i!=theSecondaryList.end(); ++i) {
2965 secsA += (*i)->GetDefinition()->GetBaryonNumber();
2966 secsZ +=
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
2970 for ( i=theFinalState.begin(); i!=theFinalState.end(); ++i) {
2971 fStateA += (*i)->GetDefinition()->GetBaryonNumber();
2972 fStateZ +=
G4lrint((*i)->GetDefinition()->GetPDGCharge()/
eplus);
2975 G4int deltaA= iStateA - secsA - fStateA -currentA - lateA;
2976 G4int deltaZ= iStateZ - secsZ - fStateZ -currentZ - lateZ;
2978 if (deltaA != 0 || deltaZ!=0 ) {
2979 if (deltaA != lastdA || deltaZ != lastdZ ) {
2980 G4cout <<
"baryon/charge imbalance - " << where << G4endl
2981 <<
"deltaA " <<deltaA<<
", iStateA "<<iStateA<<
", CapturedA "<<CapturedA <<
", secsA "<<secsA
2982 <<
", fStateA "<<fStateA <<
", currentA "<<currentA <<
", lateA "<<lateA << G4endl
2983 <<
"deltaZ "<<deltaZ<<
", iStateZ "<<iStateZ<<
", CapturedZ "<<CapturedZ <<
", secsZ "<<secsZ
2984 <<
", fStateZ "<<fStateZ <<
", currentZ "<<currentZ <<
", lateZ "<<lateZ << G4endl<<
G4endl;
2988 }
else { lastdA=lastdZ=0;}
2997 PrintKTVector(collision->
GetPrimary(),std::string(
" Primary particle"));
2999 PrintKTVector(products,std::string(
" Scatterer products"));
3016 <<
" " << initial << G4endl;;
3019 for (
unsigned int it=0; it < ktv.size(); it++)
3032 <<
" " << initial <<
" Excit " << thisExcitation << G4endl;;
3037 G4int product_barions(0);
3040 for (
unsigned int it=0; it < products->size(); it++)
3052 <<
" " <<
final << G4endl;;
3057 G4int finalA = currentA;
3058 G4int finalZ = currentZ;
3061 finalA -= product_barions;
3062 finalZ -= GetTotalCharge(*products);
3067 G4cout <<
" current/final a,z " << currentA <<
" " << currentZ <<
" "<< finalA<<
" "<< finalZ
3068 <<
" delta-mass " << delta<<
G4endl;
3071 G4cout <<
" initE/ E_out/ Mfinal/ Excit " << currentInitialEnergy
3072 <<
" " <<
final <<
" "
3074 << currentInitialEnergy -
final - mass_out
3076 currentInitialEnergy-=
final;
3085 G4ReactionProductVector::iterator iter;
3093 for(iter = products->begin(); iter != products->end(); ++iter)
3103 Efinal += (*iter)->GetTotalEnergy();
3104 pFinal += (*iter)->GetMomentum();
3108 G4cout <<
"BIC E/p delta " <<
G4double GetWeightChange() const
G4bool IsParticipant() const
static G4Triton * TritonDefinition()
Hep3Vector boostVector() const
void Update4Momentum(G4double aEnergy)
static G4He3 * He3Definition()
CascadeState GetState() const
const G4LorentzVector & GetMomentum() const
virtual G4int GetCharge()=0
CLHEP::Hep3Vector G4ThreeVector
const G4HadProjectile * GetPrimaryProjectile() const
virtual G4ReactionProductVector * DeExcite(G4Fragment &aFragment)=0
const G4ThreeVector & GetPosition() const
virtual G4bool StartLoop()=0
G4VPreCompoundModel * GetDeExcitation() const
virtual void Transport(G4KineticTrackVector &theActive, const G4KineticTrackVector &theSpectators, G4double theTimeStep)=0
void RemoveCollision(G4CollisionInitialState *collision)
virtual const G4VNuclearDensity * GetNuclearDensity() const =0
G4KineticTrack * GetPrimary(void)
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4bool GetPDGStable() const
G4CollisionInitialState * GetNextCollision()
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
virtual G4int GetMassNumber()=0
static G4Proton * ProtonDefinition()
virtual G4ThreeVector GetMomentumTransfer() const =0
G4double G4NeutronHPJENDLHEData::G4double result
virtual const std::vector< G4CollisionInitialState * > & GetCollisions(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &, G4double theCurrentTime)
void SetNumberOfHoles(G4int valueTot, G4int valueP=0)
G4int GetPDGEncoding() const
G4double GetActualMass() const
virtual G4KineticTrackVector * Scatter(const G4KineticTrack &trk1, const G4KineticTrack &trk2)
virtual const G4ThreeVector & GetPosition() const
static void ConstructParticle()
#define _CheckChargeAndBaryonNumber_(val)
virtual void PropagateModelDescription(std::ostream &) const
G4ReactionProductVector * BreakItUp(const G4Fragment &theInitialState) const
virtual G4double CoulombBarrier()=0
const G4String & GetParticleName() const
std::vector< G4LorentzVector * > * Decay(const G4double, const std::vector< G4double > &) const
void RemoveTracksCollisions(G4KineticTrackVector *ktv)
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &theNucleus)
G4ParticleDefinition * GetDefinition() const
void SetNewlyAdded(const G4bool f)
G4double GetBarrier(G4int encoding)
void SetStatusChange(G4HadFinalStateStatus aS)
std::vector< G4ReactionProduct * > G4ReactionProductVector
virtual G4double GetOuterRadius()=0
G4KineticTrackVector * GetFinalState()
void SetMinEnergy(G4double anEnergy)
G4ParticleDefinition * GetDefinition() const
virtual ~G4BinaryCascade()
G4ExcitationHandler * GetExcitationHandler() const
G4IonTable * GetIonTable() const
G4GLOB_DLL std::ostream G4cout
CascadeState SetState(const CascadeState new_state)
ParticleList decay(Cluster *const c)
Carries out a cluster decay.
const G4ParticleDefinition * GetDefinition() const
virtual void Init(G4int theA, G4int theZ)=0
G4bool nucleon(G4int ityp)
static G4PionMinus * PionMinusDefinition()
G4double GetIonMass(G4int Z, G4int A, G4int L=0, G4int lvl=0) const
const G4LorentzVector & GetMomentum() const
void SetNucleon(G4Nucleon *aN)
G4double GetKineticEnergy() const
void SetTotalEnergy(const G4double en)
G4double GetFermiMomentum(G4double density)
static G4PionPlus * PionPlusDefinition()
static G4Proton * Proton()
HepLorentzRotation & set(double bx, double by, double bz)
virtual void Init(G4V3DNucleus *theNucleus)=0
G4int GetTargetBaryonNumber()
static G4Neutron * Neutron()
void Set4Momentum(const G4LorentzVector &a4Momentum)
void SetNumberOfParticles(G4int value)
G4KineticTrackVector & GetTargetCollection(void)
virtual G4ReactionProductVector * Propagate(G4KineticTrackVector *, G4V3DNucleus *)
const G4LorentzVector & Get4Momentum() const
virtual const std::vector< G4CollisionInitialState * > & GetCollisions(G4KineticTrack *aProjectile, std::vector< G4KineticTrack * > &, G4double theCurrentTime)
G4BinaryCascade(G4VPreCompoundModel *ptr=0)
void AddCollision(G4double time, G4KineticTrack *proj, G4KineticTrack *target=NULL)
G4double GetKineticEnergy() const
G4HadronicInteraction * FindModel(const G4String &name)
void operator()(G4KineticTrack *&kt) const
G4bool IsShortLived() const
void SetEnergyChange(G4double anEnergy)
virtual void ModelDescription(std::ostream &) const
virtual G4HadFinalState * ApplyYourself(const G4HadProjectile &thePrimary, G4Nucleus &theNucleus)=0
void Init(G4int anA, G4int aZ)
void Decay(G4KineticTrackVector *tracks) const
G4double GetPDGMass() const
G4double GetDensity(const G4ThreeVector &aPosition) const
static G4ParticleTable * GetParticleTable()
T max(const T t1, const T t2)
brief Return the largest of the two arguments
const G4LorentzVector & GetTrackingMomentum() const
static G4HadronicInteractionRegistry * Instance()
G4BCAction * GetGenerator()
Hep3Vector orthogonal() const
G4VPreCompoundModel * theDeExcitation
G4double GetField(G4int encoding, G4ThreeVector pos)
void SetMaxEnergy(const G4double anEnergy)
void SetDeExcitation(G4VPreCompoundModel *ptr)
G4HadFinalState theParticleChange
virtual G4double GetMass()=0
virtual G4ParticleDefinition * GetDefinition() const
Hep3Vector cross(const Hep3Vector &) const
G4V3DNucleus * the3DNucleus
virtual G4Nucleon * GetNextNucleon()=0
HepLorentzRotation inverse() const
void SetNumberOfCharged(G4int value)
G4double GetCollisionTime(void)
const G4LorentzVector & Get4Momentum() const
G4double GetPDGCharge() const
void SetEnergyMomentumCheckLevels(G4double relativeLevel, G4double absoluteLevel)
static G4Deuteron * DeuteronDefinition()
static G4Alpha * AlphaDefinition()
static G4Neutron * NeutronDefinition()
void SetMomentumChange(const G4ThreeVector &aV)
SelectFromKTV(G4KineticTrackVector *out, G4KineticTrack::CascadeState astate)
void AddSecondary(G4DynamicParticle *aP)
G4GLOB_DLL std::ostream G4cerr
G4int GetBaryonNumber() const
CLHEP::HepLorentzVector G4LorentzVector