48G4int G4BinaryLightIonReaction::theBLIR_ID = -1;
56 theProjectileFragmentation(ptr),
57 pA(0),pZ(0), tA(0),tZ(0),spectatorA(0),spectatorZ(0),
58 projectile3dNucleus(0),target3dNucleus(0)
65 theProjectileFragmentation = pre;
70 debug_G4BinaryLightIonReactionResults=std::getenv(
"debug_G4BinaryLightIonReactionResults")!=0;
78 outFile <<
"G4Binary Light Ion Cascade is an intra-nuclear cascade model\n"
79 <<
"using G4BinaryCasacde to model the interaction of a light\n"
80 <<
"nucleus with a nucleus.\n"
81 <<
"The lighter of the two nuclei is treated like a set of projectiles\n"
82 <<
"which are transported simultaneously through the heavier nucleus.\n";
94 if(std::getenv(
"BLICDEBUG") )
G4cerr <<
" ######### Binary Light Ion Reaction starts ######### " <<
G4endl;
95 G4ping debug(
"debug_G4BinaryLightIonReaction");
105 G4bool swapped=SetLighterAsProjectile(mom, toBreit);
119 if( (mom.
t()-mom.
mag())/pA < 50*MeV )
123 cascaders=FuseNucleiAndPrompound(mom);
138 result=Interact(mom,toBreit);
144 G4cerr <<
"G4BinaryLightIonReaction no final state for: " <<
G4endl;
150 G4cerr <<
" Target nucleus (A,Z)=("
151 << (swapped?pA:tA) <<
","
152 << (swapped?pZ:tZ) <<
")" <<
G4endl;
153 G4cerr <<
" if frequent, please submit above information as bug report"
164 G4double theStatisticalExEnergy = GetProjectileExcitation();
169 pInitialState.
setT(pInitialState.
getT() +
173 delete target3dNucleus;target3dNucleus=0;
174 delete projectile3dNucleus;projectile3dNucleus=0;
185 std::vector<G4ReactionProduct *>::iterator iter;
198 while (std::abs(momentum.
e()-pspectators.
e()) > 10*MeV)
204 G4bool EnergyIsCorrect=EnergyAndMomentumCorrector(cascaders, pCorrect);
205 if ( ! EnergyIsCorrect && debug_G4BinaryLightIonReactionResults)
207 G4cout <<
"Warning - G4BinaryLightIonReaction E/P correction for cascaders failed" <<
G4endl;
210 for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
212 pFinalState +=
G4LorentzVector( (*iter)->GetMomentum(), (*iter)->GetTotalEnergy() );
214 momentum=pInitialState-pFinalState;
215 if (++loopcount > 10 )
217 if ( momentum.
vect().
mag() - momentum.
e()> 10*keV )
219 G4cerr <<
"G4BinaryLightIonReaction.cc: Cannot correct 4-momentum of cascade particles" <<
G4endl;
231 if ( momentum.
vect().
mag() - momentum.
e()< 10*keV )
234 DeExciteSpectatorNucleus(spectators, cascaders, theStatisticalExEnergy, momentum);
237 for (iter=spectators->begin();iter!=spectators->end();iter++)
242 for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
248 G4cout <<
"G4BinaryLightIonReaction.cc: mom check: " << momentum
250 <<
" .. pInitialState/pFinalState/spectators " << pInitialState <<
" "
251 << pFinalState <<
" " << pspectators <<
G4endl
252 <<
" .. A,Z " << spectatorA <<
" "<< spectatorZ <<
G4endl;
253 G4cout <<
"G4BinaryLightIonReaction invalid final state for: " <<
G4endl;
261 G4cout <<
" if frequent, please submit above information as bug report"
263#ifdef debug_G4BinaryLightIonReaction
265 ed <<
"G4BinaryLightIonreaction: Terminate for above error" <<
G4endl;
291 G4ReactionProductVector::iterator iter;
292 #ifdef debug_BLIR_result
297 for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
299 if((*iter)->GetNewlyAdded())
303 (*iter)->GetTotalEnergy(),
304 (*iter)->GetMomentum() );
306 #ifdef debug_BLIR_result
319 aNew.
SetTime(timePrimary + time);
332#ifdef debug_BLIR_result
347 if(std::getenv(
"BLICDEBUG") )
G4cerr <<
" ######### Binary Light Ion Reaction number ends ######### " <<
G4endl;
355G4bool G4BinaryLightIonReaction::EnergyAndMomentumCorrector(
359 const int nAttemptScale = 2500;
360 const double ErrLimit = 1.E-6;
365 G4double TotalCollisionMass = TotalCollisionMom.
m();
368 for(i = 0; i < Output->size(); i++)
370 SumMom +=
G4LorentzVector((*Output)[i]->GetMomentum(),(*Output)[i]->GetTotalEnergy());
371 SumMass += (*Output)[i]->GetDefinition()->GetPDGMass();
375 if (SumMass > TotalCollisionMass)
return FALSE;
376 SumMass = SumMom.m2();
377 if (SumMass < 0)
return FALSE;
378 SumMass = std::sqrt(SumMass);
384 for(i = 0; i < Output->size(); i++)
388 (*Output)[i]->SetMomentum(mom.
vect());
389 (*Output)[i]->SetTotalEnergy(mom.
e());
399 for(cAttempt = 0; cAttempt < nAttemptScale; cAttempt++)
402 for(i = 0; i < Output->size(); i++)
406 G4double E = std::sqrt(HadronMom.
vect().
mag2() +
sqr((*Output)[i]->GetDefinition()->GetPDGMass()));
408 (*Output)[i]->SetMomentum(HadronMom.
vect());
409 (*Output)[i]->SetTotalEnergy(HadronMom.
e());
413 Scale = TotalCollisionMass/Sum - 1;
415 if (std::abs(Scale) <= ErrLimit
416 || OldScale == Scale)
418 if (debug_G4BinaryLightIonReactionResults)
G4cout <<
"E/p corrector: " << cAttempt <<
G4endl;
425 factor=std::max(1.,
G4Log(std::abs(OldScale/(OldScale-Scale))));
430 if( (!success) && debug_G4BinaryLightIonReactionResults)
432 G4cout <<
"G4G4BinaryLightIonReaction::EnergyAndMomentumCorrector - Warning"<<
G4endl;
433 G4cout <<
" Scale not unity at end of iteration loop: "<<TotalCollisionMass<<
" "<<Sum<<
" "<<Scale<<
G4endl;
434 G4cout <<
" Increase number of attempts or increase ERRLIMIT"<<
G4endl;
440 for(i = 0; i < Output->size(); i++)
444 (*Output)[i]->SetMomentum(mom.
vect());
445 (*Output)[i]->SetTotalEnergy(mom.
e());
456 tmp = tA; tA=pA; pA=tmp;
457 tmp = tZ; tZ=pZ; pZ=tmp;
471 if (m2Compound <
sqr(mFused) ) {
493 for(
size_t count = 0; count<cascaders->size(); count++)
495 cascaders->operator[](count)->SetNewlyAdded(
true);
512 projectile3dNucleus->
Init(pA, pZ);
519 target3dNucleus->
Init(tA, tZ);
530 #ifdef debug_BLIR_finalstate
534 nucleonMom.setZ(nucleonMom.vect().mag());
537 theFermi.
Init(pA,pZ);
544 nucleonPosition +=
pos;
551 initalState->push_back(it1);
552 #ifdef debug_BLIR_finalstate
557 result=theModel->
Propagate(initalState, target3dNucleus);
558 #ifdef debug_BLIR_finalstate
559 if( result && result->size()>0)
562 G4ReactionProductVector::iterator iter;
564 for (iter=result->begin(); iter !=result->end(); ++iter)
566 presult +=
G4LorentzVector((*iter)->GetMomentum(),(*iter)->GetTotalEnergy());
569 G4cout <<
"BLIC check result : initial " << pinitial <<
" mass tgt " << target3dNucleus->
GetMass()
570 <<
" final " << presult
575 if( result && result->size()==0)
582 delete target3dNucleus;
583 delete projectile3dNucleus;
589 }
while (! result && tryCount< 150);
592G4double G4BinaryLightIonReaction::GetProjectileExcitation()
597 G4double theStatisticalExEnergy = 0;
607 G4double localFermiEnergy = std::sqrt(nucMass*nucMass + localPfermi*localPfermi) - nucMass;
609 theStatisticalExEnergy += deltaE;
612 return theStatisticalExEnergy;
618 spectatorA=spectatorZ=0;
621 for(i=0; i<result->size(); i++)
623 if( (*result)[i]->GetNewlyAdded() )
625 pFinalState +=
G4LorentzVector( (*result)[i]->GetMomentum(), (*result)[i]->GetTotalEnergy() );
626 cascaders->push_back((*result)[i]);
630 pspectators +=
G4LorentzVector( (*result)[i]->GetMomentum(), (*result)[i]->GetTotalEnergy() );
631 spectators->push_back((*result)[i]);
633 spectatorZ+=
G4lrint((*result)[i]->GetDefinition()->GetPDGCharge()/eplus);
660 if(spectatorZ>0 && spectatorA>1)
669 pFragment=
G4LorentzVector(0,0,0,mFragment+std::max(0.,theStatisticalExEnergy) );
672 proFrag = theHandler->
BreakItUp(aProRes);
681 G4ReactionProductVector::iterator ispectator;
682 for (ispectator=spectators->begin();ispectator!=spectators->end();ispectator++)
687 else if(spectatorA!=0)
689 G4ReactionProductVector::iterator ispectator;
690 for (ispectator=spectators->begin();ispectator!=spectators->end();ispectator++)
692 (*ispectator)->SetNewlyAdded(
true);
693 cascaders->push_back(*ispectator);
694 pFinalState+=
G4LorentzVector((*ispectator)->GetMomentum(),(*ispectator)->GetTotalEnergy());
706 G4ReactionProductVector::iterator ii;
709 for(ii=proFrag->begin(); ii!=proFrag->end(); ii++)
711 (*ii)->SetNewlyAdded(
true);
713 tmp *= boost_fragments;
714 (*ii)->SetMomentum(tmp.vect());
715 (*ii)->SetTotalEnergy(tmp.e());
729 G4bool EnergyIsCorrect=EnergyAndMomentumCorrector(cascaders, pCas);
730 if ( ! EnergyIsCorrect && debug_G4BinaryLightIonReactionResults)
732 G4cout <<
"G4BinaryLightIonReaction E/P correction for nucleus failed, will try to correct overall" <<
G4endl;
738 for(ii=proFrag->begin(); ii!=proFrag->end(); ii++)
740 cascaders->push_back(*ii);
745 if ( ! EnergyIsCorrect )
748 if (! EnergyAndMomentumCorrector(cascaders,pInitialState))
750 if(debug_G4BinaryLightIonReactionResults)
751 G4cout <<
"G4BinaryLightIonReaction E/P corrections failed" <<
G4endl;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Log(G4double x)
CLHEP::HepLorentzRotation G4LorentzRotation
CLHEP::HepLorentzVector G4LorentzVector
std::vector< G4ReactionProduct * > G4ReactionProductVector
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
HepLorentzRotation & rotateY(double delta)
HepLorentzRotation & rotateZ(double delta)
HepLorentzRotation inverse() const
Hep3Vector boostVector() const
void setVect(const Hep3Vector &)
virtual G4ReactionProductVector * Propagate(G4KineticTrackVector *, G4V3DNucleus *)
virtual ~G4BinaryLightIonReaction()
G4BinaryLightIonReaction(G4VPreCompoundModel *ptr=0)
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &theNucleus)
virtual void ModelDescription(std::ostream &) const
G4LorentzVector Get4Momentum() const
void Set4Momentum(const G4LorentzVector &momentum)
G4ReactionProductVector * BreakItUp(const G4Fragment &theInitialState)
G4Nucleon * GetNextNucleon()
const G4VNuclearDensity * GetNuclearDensity() const
void Init(G4int theA, G4int theZ, G4int numberOfLambdas=0)
G4double GetOuterRadius()
G4double GetFermiMomentum(G4double density)
void Init(G4int anA, G4int aZ)
void SetZandA_asInt(G4int Znew, G4int Anew, G4int Lnew=0)
void SetNumberOfCharged(G4int value)
void SetNumberOfHoles(G4int valueTot, G4int valueP=0)
void SetMomentum(const G4LorentzVector &value)
void SetNumberOfParticles(G4int value)
void SetStatusChange(G4HadFinalStateStatus aS)
void AddSecondary(G4DynamicParticle *aP, G4int mod=-1)
void SetEnergyChange(G4double anEnergy)
void SetMomentumChange(const G4ThreeVector &aV)
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4LorentzVector & Get4Momentum() const
G4double GetGlobalTime() const
void SetTime(G4double aT)
void SetCreatorModelID(G4int id)
G4HadronicInteraction * FindModel(const G4String &name)
static G4HadronicInteractionRegistry * Instance()
G4double GetIonMass(G4int Z, G4int A, G4int nL=0, G4int lvl=0) const
CascadeState SetState(const CascadeState new_state)
void SetProjectilePotential(const G4double aPotential)
const G4LorentzVector & Get4Momentum() const
const G4ThreeVector & GetPosition() const
const G4LorentzVector & GetMomentum() const
virtual const G4ParticleDefinition * GetDefinition() const
G4double GetPDGMass() const
G4double GetPDGCharge() const
G4int GetBaryonNumber() const
G4IonTable * GetIonTable() const
static G4ParticleTable * GetParticleTable()
static G4int GetModelID(const G4int modelIndex)
G4double GetTotalEnergy() const
G4ThreeVector GetMomentum() const
G4double GetDensity(const G4ThreeVector &aPosition) const
virtual G4ReactionProductVector * DeExcite(G4Fragment &aFragment)=0
G4ExcitationHandler * GetExcitationHandler() const
G4LorentzVector operator()(G4LorentzVector a, G4ReactionProduct *b)