Import Geant4 9.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:15:05 +02:00
parent b79225fb37
commit 74cad5e589
3877 changed files with 234205 additions and 167127 deletions
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FTFModel.cc,v 1.13 2008/12/09 10:40:52 vuzhinsk Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4FTFModel.cc,v 1.34 2009/12/15 19:14:31 vuzhinsk Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// ------------------------------------------------------------
@@ -37,48 +37,46 @@
// ------------------------------------------------------------
#include "G4FTFModel.hh"
#include "G4FTFParameters.hh" // Uzhi 29.03.08
#include "G4FTFParameters.hh"
#include "G4FTFParticipants.hh"
#include "G4DiffractiveSplitableHadron.hh"
#include "G4InteractionContent.hh"
#include "G4LorentzRotation.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4ios.hh"
#include <utility> // Uzhi 29.03.08
#include <utility>
#include "G4IonTable.hh"
// Class G4FTFModel
G4FTFModel::G4FTFModel():theExcitation(new G4DiffractiveExcitation()),
theElastic(new G4ElasticHNScattering()) // Uzhi 29.03.08
theElastic(new G4ElasticHNScattering())
{
G4VPartonStringModel::SetThisPointer(this);
theParameters=0; // Uzhi 9.12.08
theParameters=0;
NumberOfInvolvedNucleon=0;
}
/*
G4FTFModel::G4FTFModel(G4double , G4double , G4double ):theExcitation(new // Uzhi 9.12.08 G4DiffractiveExcitation())
{
G4VPartonStringModel::SetThisPointer(this);
}
G4FTFModel::G4FTFModel(G4DiffractiveExcitation * anExcitation)
:
theExcitation(anExcitation)
{
G4VPartonStringModel::SetThisPointer(this);
}
*/
G4FTFModel::~G4FTFModel()
{
if( theParameters != 0 ) delete theParameters; // Uzhi 5.12.08
// Because FTF model can be called for various particles
// theParameters must be erased at the end of each call.
// Thus the delete is olso in G4FTFModel::GetStrings() method
if( theExcitation != 0 ) delete theExcitation; // Uzhi 5.12.08
if( theElastic != 0 ) delete theElastic; // Uzhi 5.12.08
}
// Thus the delete is also in G4FTFModel::GetStrings() method
if( theParameters != 0 ) delete theParameters;
if( theExcitation != 0 ) delete theExcitation;
if( theElastic != 0 ) delete theElastic;
if( NumberOfInvolvedNucleon != 0)
{
for(G4int i=0; i < NumberOfInvolvedNucleon; i++)
{
G4VSplitableHadron * aNucleon = TheInvolvedNucleon[i]->GetSplitableHadron();
if(aNucleon) delete aNucleon;
}
}
}
const G4FTFModel & G4FTFModel::operator=(const G4FTFModel &)
{
@@ -86,7 +84,6 @@ const G4FTFModel & G4FTFModel::operator=(const G4FTFModel &)
return *this;
}
int G4FTFModel::operator==(const G4FTFModel &right) const
{
return this==&right;
@@ -101,115 +98,515 @@ int G4FTFModel::operator!=(const G4FTFModel &right) const
void G4FTFModel::Init(const G4Nucleus & aNucleus, const G4DynamicParticle & aProjectile)
{
theProjectile = aProjectile;
//G4cout<<"G4FTFModel::Init "<<aNucleus.GetN()<<" "<<aNucleus.GetZ()<<G4endl;
theParticipants.Init(aNucleus.GetN(),aNucleus.GetZ());
// Uzhi N-mass number Z-charge ------------------------- Uzhi 29.03.08
// ----------- N-mass number Z-charge -------------------------
// --- cms energy
G4double s = sqr( theProjectile.GetMass() ) +
sqr( G4Proton::Proton()->GetPDGMass() ) +
2*theProjectile.GetTotalEnergy()*G4Proton::Proton()->GetPDGMass();
/*
G4cout << " primary Total E (GeV): " << theProjectile.GetTotalEnergy()/GeV << G4endl;
G4cout << " primary Mass (GeV): " << theProjectile.GetMass() /GeV << G4endl;
G4cout << "cms std::sqrt(s) (GeV) = " << std::sqrt(s) / GeV << G4endl;
*/
if( theParameters != 0 ) delete theParameters; // Uzhi 9.12.08
if( theParameters != 0 ) delete theParameters;
theParameters = new G4FTFParameters(theProjectile.GetDefinition(),
aNucleus.GetN(),aNucleus.GetZ(),
s);// ------------------------- Uzhi 19.04.08
//theParameters->SetProbabilityOfElasticScatt(0.); // To turn on/off (1/0) elastic scattering
s);
//theParameters->SetProbabilityOfElasticScatt(0.);
// To turn on/off (1/0) elastic scattering
}
// ------------------------------------------------------------
struct DeleteVSplitableHadron { void operator()(G4VSplitableHadron * aH){ delete aH;} };
// ------------------------------------------------------------
G4ExcitedStringVector * G4FTFModel::GetStrings()
{
//G4cout<<"theParticipants.GetList"<<G4endl;
{
G4ExcitedStringVector * theStrings(0);
theParticipants.GetList(theProjectile,theParameters);
//G4cout<<"ExciteParticipants()"<<G4endl;
if (! ExciteParticipants()) return NULL;;
//G4cout<<"theStrings = BuildStrings()"<<G4endl;
G4ExcitedStringVector * theStrings = BuildStrings();
//G4cout<<"Return to theStrings "<<G4endl;
if( theParameters != 0 ) // Uzhi 9.12.08
{ // Uzhi 9.12.08
delete theParameters; // Uzhi 9.12.08
theParameters=0; // Uzhi 9.12.08
} // Uzhi 9.12.08
return theStrings;
ReggeonCascade();
G4bool Success(true);
if( PutOnMassShell() )
{
if( ExciteParticipants() )
{
theStrings = BuildStrings();
GetResidualNucleus();
if( theParameters != 0 )
{
delete theParameters;
theParameters=0;
}
} else // if( ExciteParticipants() )
{ Success=false;}
} else // if( PutOnMassShell() )
{ Success=false;}
if(!Success)
{
// -------------- Erase the projectile ----------------
std::vector<G4VSplitableHadron *> primaries;
theParticipants.StartLoop(); // restart a loop
while ( theParticipants.Next() )
{
const G4InteractionContent & interaction=theParticipants.GetInteraction();
// do not allow for duplicates ...
if ( primaries.end() == std::find(primaries.begin(), primaries.end(),
interaction.GetProjectile()) )
primaries.push_back(interaction.GetProjectile());
}
std::for_each(primaries.begin(), primaries.end(), DeleteVSplitableHadron());
primaries.clear();
}
// -------------- Cleaning of the memory --------------
// -------------- Erase the target nucleons -----------
G4VSplitableHadron * aNucleon = 0;
for(G4int i=0; i < NumberOfInvolvedNucleon; i++)
{
aNucleon = TheInvolvedNucleon[i]->GetSplitableHadron();
if(aNucleon) delete aNucleon;
}
NumberOfInvolvedNucleon=0;
return theStrings;
}
//-------------------------------------------------------------------
void G4FTFModel::ReggeonCascade()
{ //--- Implementation of reggeon theory inspired model-------
NumberOfInvolvedNucleon=0;
theParticipants.StartLoop();
while (theParticipants.Next())
{
const G4InteractionContent & collision=theParticipants.GetInteraction();
G4Nucleon * TargetNucleon=collision.GetTargetNucleon();
TheInvolvedNucleon[NumberOfInvolvedNucleon]=TargetNucleon;
NumberOfInvolvedNucleon++;
G4double XofWoundedNucleon = TargetNucleon->GetPosition().x();
G4double YofWoundedNucleon = TargetNucleon->GetPosition().y();
theParticipants.theNucleus->StartLoop();
G4Nucleon * Neighbour(0);
while ( (Neighbour = theParticipants.theNucleus->GetNextNucleon()) )
{
if(!Neighbour->AreYouHit())
{
G4double impact2= sqr(XofWoundedNucleon - Neighbour->GetPosition().x()) +
sqr(YofWoundedNucleon - Neighbour->GetPosition().y());
if(G4UniformRand() < theParameters->GetCofNuclearDestruction()*
std::exp(-impact2/theParameters->GetR2ofNuclearDestruction()))
{ // The neighbour nucleon is involved in the reggeon cascade
TheInvolvedNucleon[NumberOfInvolvedNucleon]=Neighbour;
NumberOfInvolvedNucleon++;
G4VSplitableHadron *targetSplitable;
targetSplitable = new G4DiffractiveSplitableHadron(*Neighbour);
Neighbour->Hit(targetSplitable);
targetSplitable->SetStatus(2);
}
} // end of if(!Neighbour->AreYouHit())
} // end of while (theParticipant.theNucleus->GetNextNucleon())
} // end of while (theParticipants.Next())
// ---------------- Calculation of creation time for each target nucleon -----------
theParticipants.StartLoop(); // restart a loop
theParticipants.Next();
G4VSplitableHadron * primary = theParticipants.GetInteraction().GetProjectile();
G4double betta_z=primary->Get4Momentum().pz()/primary->Get4Momentum().e();
primary->SetTimeOfCreation(0.);
G4double ZcoordinateOfPreviousCollision(0.);
G4double ZcoordinateOfCurrentInteraction(0.);
G4double TimeOfPreviousCollision(0.);
G4double TimeOfCurrentCollision(0);
theParticipants.theNucleus->StartLoop();
G4Nucleon * aNucleon;
G4bool theFirstInvolvedNucleon(true);
while ( (aNucleon = theParticipants.theNucleus->GetNextNucleon()) )
{
if(aNucleon->AreYouHit())
{
if(theFirstInvolvedNucleon)
{
ZcoordinateOfPreviousCollision=aNucleon->GetPosition().z();
theFirstInvolvedNucleon=false;
}
ZcoordinateOfCurrentInteraction=aNucleon->GetPosition().z();
TimeOfCurrentCollision=TimeOfPreviousCollision+
(ZcoordinateOfCurrentInteraction-ZcoordinateOfPreviousCollision)/betta_z;
// It is assumed that the nucleons are ordered on increasing z-coordinate ------------
aNucleon->GetSplitableHadron()->SetTimeOfCreation(TimeOfCurrentCollision);
ZcoordinateOfPreviousCollision=ZcoordinateOfCurrentInteraction;
TimeOfPreviousCollision=TimeOfCurrentCollision;
} // end of if(aNucleon->AreYouHit())
} // end of while (theParticipant.theNucleus->GetNextNucleon())
//
// The algorithm can be improved, but it will be more complicated, and will require
// changes in G4DiffractiveExcitation.cc and G4ElasticHNScattering.cc
} // Uzhi 26 July 2009
// ------------------------------------------------------------
struct DeleteVSplitableHadron { void operator()(G4VSplitableHadron * aH){delete aH;} };
G4bool G4FTFModel::PutOnMassShell()
{
// -------------- Properties of the projectile ----------------
theParticipants.StartLoop(); // restart a loop
theParticipants.Next();
G4VSplitableHadron * primary = theParticipants.GetInteraction().GetProjectile();
G4LorentzVector Pprojectile=primary->Get4Momentum();
// To get original projectile particle
if(Pprojectile.z() < 0.){return false;}
G4double Mprojectile = Pprojectile.mag();
G4double M2projectile = Pprojectile.mag2();
//-------------------------------------------------------------
G4LorentzVector Psum = Pprojectile;
G4double SumMasses = Mprojectile + 20.*MeV; // 13.12.09
// Separation energy for projectile
//--------------- Target nucleus ------------------------------
G4V3DNucleus *theNucleus = GetWoundedNucleus();
G4Nucleon * aNucleon;
G4int ResidualMassNumber=theNucleus->GetMassNumber();
G4int ResidualCharge =theNucleus->GetCharge();
ResidualExcitationEnergy=0.;
G4LorentzVector PnuclearResidual(0.,0.,0.,0.);
G4double ExcitationEnergyPerWoundedNucleon=
theParameters->GetExcitationEnergyPerWoundedNucleon();
theNucleus->StartLoop();
while ((aNucleon = theNucleus->GetNextNucleon()))
{
if(aNucleon->AreYouHit())
{ // Involved nucleons
Psum += aNucleon->Get4Momentum();
SumMasses += aNucleon->GetDefinition()->GetPDGMass();
SumMasses += 20.*MeV; // 13.12.09 Separation energy for a nucleon
ResidualMassNumber--;
ResidualCharge-=(G4int) aNucleon->GetDefinition()->GetPDGCharge();
ResidualExcitationEnergy+=ExcitationEnergyPerWoundedNucleon;
}
else
{ // Spectator nucleons
PnuclearResidual += aNucleon->Get4Momentum();
} // end of if(!aNucleon->AreYouHit())
} // end of while (theNucleus->GetNextNucleon())
Psum += PnuclearResidual;
G4double ResidualMass(0.);
if(ResidualMassNumber == 0)
{
ResidualMass=0.;
ResidualExcitationEnergy=0.;
}
else
{
ResidualMass=G4ParticleTable::GetParticleTable()->GetIonTable()->
GetIonMass(ResidualCharge ,ResidualMassNumber);
if(ResidualMassNumber == 1) {ResidualExcitationEnergy=0.;}
}
// ResidualMass +=ResidualExcitationEnergy; // Will be given after checks
SumMasses += ResidualMass;
//-------------------------------------------------------------
G4double SqrtS=Psum.mag();
G4double S=Psum.mag2();
if(SqrtS < SumMasses) {return false;} // It is impossible to simulate
// after putting nuclear nucleons
// on mass-shell
if(SqrtS < SumMasses+ResidualExcitationEnergy) {ResidualExcitationEnergy=0.;}
ResidualMass +=ResidualExcitationEnergy;
SumMasses +=ResidualExcitationEnergy;
//-------------------------------------------------------------
// Sampling of nucleons what are transfered to delta-isobars --
G4int MaxNumberOfDeltas = (int)((SqrtS - SumMasses)/(400.*MeV));
G4int NumberOfDeltas(0);
if(theNucleus->GetMassNumber() != 1)
{
G4double ProbDeltaIsobar(0.); // 1. *** Can be set if it is needed
for(G4int i=0; i < NumberOfInvolvedNucleon; i++ )
{
if((G4UniformRand() < ProbDeltaIsobar)&&(NumberOfDeltas < MaxNumberOfDeltas))
{
NumberOfDeltas++;
G4VSplitableHadron * targetSplitable=TheInvolvedNucleon[i]->GetSplitableHadron();
SumMasses-=targetSplitable->GetDefinition()->GetPDGMass();
G4int PDGcode = targetSplitable->GetDefinition()->GetPDGEncoding();
G4int newPDGcode = PDGcode/10; newPDGcode=newPDGcode*10+4; // Delta
G4ParticleDefinition* ptr =
G4ParticleTable::GetParticleTable()->FindParticle(newPDGcode);
targetSplitable->SetDefinition(ptr);
SumMasses+=targetSplitable->GetDefinition()->GetPDGMass();
}
} // end of for(G4int i=0; i < NumberOfInvolvedNucleon; i++ )
} // end of if(theNucleus.GetMassNumber() != 1)
//-------------------------------------------------------------
G4LorentzRotation toCms(-1*Psum.boostVector());
G4LorentzVector Ptmp=toCms*Pprojectile;
if ( Ptmp.pz() <= 0. )
{ // "String" moving backwards in CMS, abort collision !!
//G4cout << " abort ColliDeleteVSplitableHadronsion!! " << G4endl;
return false;
}
// toCms.rotateZ(-1*Ptmp.phi()); // Uzhi 5.12.09
// toCms.rotateY(-1*Ptmp.theta()); // Uzhi 5.12.09
G4LorentzRotation toLab(toCms.inverse());
//-------------------------------------------------------------
//------- Ascribing of the involved nucleons Pt and Xminus ----
G4double Dcor = theParameters->GetDofNuclearDestruction()/
theNucleus->GetMassNumber();
G4double AveragePt2 = theParameters->GetPt2ofNuclearDestruction();
G4double maxPtSquare = theParameters->GetMaxPt2ofNuclearDestruction();
G4double M2target(0.);
G4double WminusTarget(0.);
G4double WplusProjectile(0.);
G4int NumberOfTries(0);
G4double ScaleFactor(1.);
G4bool OuterSuccess(true);
do // while (!OuterSuccess)
{
OuterSuccess=true;
do // while (SqrtS < Mprojectile + std::sqrt(M2target))
{ // while (DecayMomentum < 0.)
NumberOfTries++;
if(NumberOfTries == 100*(NumberOfTries/100)) // 100
{ // At large number of tries it would be better to reduce the values
ScaleFactor/=2.;
Dcor *=ScaleFactor;
AveragePt2 *=ScaleFactor;
}
G4ThreeVector PtSum(0.,0.,0.);
G4double XminusSum(0.);
G4double Xminus(0.);
G4bool InerSuccess=true;
do // while(!InerSuccess);
{
InerSuccess=true;
PtSum =G4ThreeVector(0.,0.,0.);
XminusSum=0.;
for(G4int i=0; i < NumberOfInvolvedNucleon; i++ )
{
G4Nucleon * aNucleon = TheInvolvedNucleon[i];
G4ThreeVector tmpPt = GaussianPt(AveragePt2, maxPtSquare);
PtSum += tmpPt;
G4ThreeVector tmpX=GaussianPt(Dcor*Dcor, 1.);
Xminus=tmpX.x();
XminusSum+=Xminus;
G4LorentzVector tmp(tmpPt.x(),tmpPt.y(),Xminus,0.);
aNucleon->SetMomentum(tmp);
} // end of for(G4int i=0; i < NumberOfInvolvedNucleon; i++ )
//---------------------------------------------------------------------------
G4double DeltaX(0.);
G4double DeltaY(0.);
G4double DeltaXminus(0.);
if(ResidualMassNumber == 0)
{
DeltaX = PtSum.x()/NumberOfInvolvedNucleon;
DeltaY = PtSum.y()/NumberOfInvolvedNucleon;
DeltaXminus = (XminusSum-1.)/NumberOfInvolvedNucleon;
}
else
{
DeltaXminus = -1./theNucleus->GetMassNumber();
}
XminusSum=1.;
M2target =0.;
for(G4int i=0; i < NumberOfInvolvedNucleon; i++ )
{
G4Nucleon * aNucleon = TheInvolvedNucleon[i];
Xminus = aNucleon->Get4Momentum().pz() - DeltaXminus;
XminusSum-=Xminus;
if((Xminus <= 0.) || (Xminus > 1.) ||
(XminusSum <=0.) || (XminusSum > 1.)) {InerSuccess=false; break;}
G4double Px=aNucleon->Get4Momentum().px() - DeltaX;
G4double Py=aNucleon->Get4Momentum().py() - DeltaY;
M2target +=(aNucleon->GetSplitableHadron()->GetDefinition()->GetPDGMass()*
aNucleon->GetSplitableHadron()->GetDefinition()->GetPDGMass() +
Px*Px + Py*Py)/Xminus;
G4LorentzVector tmp(Px,Py,Xminus,0.);
aNucleon->SetMomentum(tmp);
} // end of for(G4int i=0; i < NumberOfInvolvedNucleon; i++ )
if(InerSuccess && (ResidualMassNumber != 0))
{
M2target +=(ResidualMass*ResidualMass + PtSum.mag2())/XminusSum;
}
} while(!InerSuccess);
} while (SqrtS < Mprojectile + std::sqrt(M2target));
//-------------------------------------------------------------
G4double DecayMomentum2= S*S+M2projectile*M2projectile+M2target*M2target
-2.*S*M2projectile - 2.*S*M2target
-2.*M2projectile*M2target;
WminusTarget=(S-M2projectile+M2target+std::sqrt(DecayMomentum2))/2./SqrtS;
WplusProjectile=SqrtS - M2target/WminusTarget;
//-------------------------------------------------------------
for(G4int i=0; i < NumberOfInvolvedNucleon; i++ )
{
G4Nucleon * aNucleon = TheInvolvedNucleon[i];
G4LorentzVector tmp=aNucleon->Get4Momentum();
G4double Mt2 = sqr(tmp.x())+sqr(tmp.y())+
aNucleon->GetSplitableHadron()->GetDefinition()->GetPDGMass()*
aNucleon->GetSplitableHadron()->GetDefinition()->GetPDGMass();
G4double Xminus=tmp.z();
G4double Pz=-WminusTarget*Xminus/2. + Mt2/(2.*WminusTarget*Xminus);
G4double E = WminusTarget*Xminus/2. + Mt2/(2.*WminusTarget*Xminus);
if( E+Pz > WplusProjectile ){OuterSuccess=false; break;}
} // end of for(G4int i=0; i < NumberOfInvolvedNucleon; i++ )
} while(!OuterSuccess);
//-------------------------------------------------------------
G4double Pzprojectile=WplusProjectile/2. - M2projectile/2./WplusProjectile;
G4double Eprojectile =WplusProjectile/2. + M2projectile/2./WplusProjectile;
Pprojectile.setPz(Pzprojectile); Pprojectile.setE(Eprojectile);
Pprojectile.transform(toLab); // The work with the projectile
primary->Set4Momentum(Pprojectile); // is finished at the moment.
//-------------------------------------------------------------
G4ThreeVector Residual3Momentum(0.,0.,1.);
for(G4int i=0; i < NumberOfInvolvedNucleon; i++ )
{
G4Nucleon * aNucleon = TheInvolvedNucleon[i];
G4LorentzVector tmp=aNucleon->Get4Momentum();
Residual3Momentum-=tmp.vect();
G4double Mt2 = sqr(tmp.x())+sqr(tmp.y())+
aNucleon->GetSplitableHadron()->GetDefinition()->GetPDGMass()*
aNucleon->GetSplitableHadron()->GetDefinition()->GetPDGMass();
G4double Xminus=tmp.z();
G4double Pz=-WminusTarget*Xminus/2. + Mt2/(2.*WminusTarget*Xminus);
G4double E = WminusTarget*Xminus/2. + Mt2/(2.*WminusTarget*Xminus);
tmp.setPz(Pz);
tmp.setE(E);
tmp.transform(toLab);
aNucleon->SetMomentum(tmp);
G4VSplitableHadron * targetSplitable=aNucleon->GetSplitableHadron();
targetSplitable->Set4Momentum(tmp);
} // end of for(G4int i=0; i < NumberOfInvolvedNucleon; i++ )
G4double Mt2Residual=sqr(ResidualMass) +
sqr(Residual3Momentum.x())+sqr(Residual3Momentum.y());
G4double PzResidual=-WminusTarget*Residual3Momentum.z()/2. +
Mt2Residual/(2.*WminusTarget*Residual3Momentum.z());
G4double EResidual = WminusTarget*Residual3Momentum.z()/2. +
Mt2Residual/(2.*WminusTarget*Residual3Momentum.z());
Residual4Momentum.setPx(Residual3Momentum.x());
Residual4Momentum.setPy(Residual3Momentum.y());
Residual4Momentum.setPz(PzResidual);
Residual4Momentum.setE(EResidual);
Residual4Momentum.transform(toLab);
//-------------------------------------------------------------
return true;
}
// ------------------------------------------------------------
G4bool G4FTFModel::ExciteParticipants()
{
/* // Uzhi 29.03.08 For elastic Scatt.
G4cout<<" In ExciteParticipants() "<<theParticipants.theInteractions.size()<<G4endl;
G4cout<<" test Params Tot "<<theParameters->GetTotalCrossSection()<<G4endl;
G4cout<<" test Params Ela "<<theParameters->GetElasticCrossSection()<<G4endl;
G4int counter=0;
*/ // Uzhi 29.03.08
G4bool Successfull(false);
// do { // } while (Successfull == false) // Closed 15.12.09
Successfull=false;
theParticipants.StartLoop();
while (theParticipants.Next())
{
const G4InteractionContent & collision=theParticipants.GetInteraction();
/*
counter++;
G4cout<<" Inter # "<<counter<<G4endl;
*/
G4VSplitableHadron * projectile=collision.GetProjectile();
G4VSplitableHadron * target=collision.GetTarget();
// // Uzhi 29.03.08
G4bool Successfull;
if(G4UniformRand()< theParameters->GetProbabilityOfElasticScatt())
{
//G4cout<<"Elastic"<<G4endl;
Successfull=theElastic->ElasticScattering(projectile, target, theParameters);
{ // Elastic scattering -------------------------
if(theElastic->ElasticScattering(projectile, target, theParameters))
{
Successfull = Successfull || true;
} else
{
Successfull = Successfull || false;
target->SetStatus(2);
}
}
else
{
//G4cout<<"Inelastic"<<G4endl;
Successfull=theExcitation->ExciteParticipants(projectile, target, theParameters);
{ // Inelastic scattering ----------------------
if(theExcitation->ExciteParticipants(projectile, target,
theParameters, theElastic))
{
Successfull = Successfull || true;
} else
{
Successfull = Successfull || false;
target->SetStatus(2);
}
}
// if(!Successfull)
// // Uzhi 29.03.08
// if ( ! theExcitation->ExciteParticipants(projectile, target) )
if(!Successfull)
{
// give up, clean up
std::vector<G4VSplitableHadron *> primaries;
std::vector<G4VSplitableHadron *> targets;
theParticipants.StartLoop(); // restart a loop
while ( theParticipants.Next() )
{
const G4InteractionContent & interaction=theParticipants.GetInteraction();
// do not allow for duplicates ...
if ( primaries.end() == std::find(primaries.begin(), primaries.end(),
interaction.GetProjectile()) )
primaries.push_back(interaction.GetProjectile());
if ( targets.end() == std::find(targets.begin(), targets.end(),
interaction.GetTarget()) )
targets.push_back(interaction.GetTarget());
}
std::for_each(primaries.begin(), primaries.end(), DeleteVSplitableHadron());
primaries.clear();
std::for_each(targets.begin(), targets.end(), DeleteVSplitableHadron());
targets.clear();
return false;
} // End of the loop Uzhi
}
return true;
} // end of while (theParticipants.Next())
// } while (Successfull == false); // Closed 15.12.09
return Successfull;
}
// ------------------------------------------------------------
G4ExcitedStringVector * G4FTFModel::BuildStrings()
@@ -221,49 +618,91 @@ G4ExcitedStringVector * G4FTFModel::BuildStrings()
strings = new G4ExcitedStringVector();
std::vector<G4VSplitableHadron *> primaries;
std::vector<G4VSplitableHadron *> targets;
G4ExcitedString * FirstString(0); // If there will be a kink,
G4ExcitedString * SecondString(0); // two strings will be produced.
theParticipants.StartLoop(); // restart a loop
while ( theParticipants.Next() )
{
const G4InteractionContent & interaction=theParticipants.GetInteraction();
// do not allow for duplicates ...
if ( primaries.end() == std::find(primaries.begin(), primaries.end(),
interaction.GetProjectile()) )
primaries.push_back(interaction.GetProjectile());
if ( targets.end() == std::find(targets.begin(), targets.end(),
interaction.GetTarget()) )
targets.push_back(interaction.GetTarget());
primaries.push_back(interaction.GetProjectile());
}
// G4cout << "BuildStrings prim/targ " << primaries.size() << " , " <<
// targets.size() << G4endl;
unsigned int ahadron;
// Only for hA-interactions Uzhi -------------------------------------
for ( ahadron=0; ahadron < primaries.size() ; ahadron++)
{
//G4ThreeVector aPosition=primaries[ahadron]->GetPosition();
//G4cout<<"Proj Build "<<aPosition<<" "<<primaries[ahadron]->GetTimeOfCreation()<<G4endl;
G4bool isProjectile=true;
strings->push_back(theExcitation->String(primaries[ahadron], isProjectile));
G4bool isProjectile(0);
if(primaries[ahadron]->GetStatus() == 1) {isProjectile=true; }
if(primaries[ahadron]->GetStatus() == 3) {isProjectile=false;}
FirstString=0; SecondString=0;
theExcitation->CreateStrings(primaries[ahadron], isProjectile,
FirstString, SecondString,
theParameters);
if(FirstString != 0) strings->push_back(FirstString);
if(SecondString != 0) strings->push_back(SecondString);
}
for ( ahadron=0; ahadron < targets.size() ; ahadron++)
for (G4int ahadron=0; ahadron < NumberOfInvolvedNucleon ; ahadron++)
{
//G4ThreeVector aPosition=targets[ahadron]->GetPosition();
//G4cout<<"Targ Build "<<aPosition<<" "<<targets[ahadron]->GetTimeOfCreation()<<G4endl;
G4bool isProjectile=false;
strings->push_back(theExcitation->String(targets[ahadron], isProjectile));
if(TheInvolvedNucleon[ahadron]->GetSplitableHadron()->GetStatus() !=0) //== 2)
{
G4bool isProjectile=false;
FirstString=0; SecondString=0;
theExcitation->CreateStrings(
TheInvolvedNucleon[ahadron]->GetSplitableHadron(),
isProjectile,
FirstString, SecondString,
theParameters);
if(FirstString != 0) strings->push_back(FirstString);
if(SecondString != 0) strings->push_back(SecondString);
}
}
std::for_each(primaries.begin(), primaries.end(), DeleteVSplitableHadron());
primaries.clear();
std::for_each(targets.begin(), targets.end(), DeleteVSplitableHadron());
targets.clear();
return strings;
}
// ------------------------------------------------------------
void G4FTFModel::GetResidualNucleus()
{ // This method is needed for the correct application of G4PrecompoundModelInterface
G4double DeltaExcitationE=ResidualExcitationEnergy/
(G4double) NumberOfInvolvedNucleon;
G4LorentzVector DeltaPResidualNucleus = Residual4Momentum/
(G4double) NumberOfInvolvedNucleon;
for(G4int i=0; i < NumberOfInvolvedNucleon; i++ )
{
G4Nucleon * aNucleon = TheInvolvedNucleon[i];
// G4LorentzVector tmp=aNucleon->Get4Momentum()-DeltaPResidualNucleus;
G4LorentzVector tmp=-DeltaPResidualNucleus;
aNucleon->SetMomentum(tmp);
aNucleon->SetBindingEnergy(DeltaExcitationE);
} // end of for(G4int i=0; i < NumberOfInvolvedNucleon; i++ )
}
// ------------------------------------------------------------
G4ThreeVector G4FTFModel::GaussianPt(G4double AveragePt2, G4double maxPtSquare) const
{ // @@ this method is used in FTFModel as well. Should go somewhere common!
G4double Pt2(0.);
if(AveragePt2 <= 0.) {Pt2=0.;}
else
{
Pt2 = -AveragePt2 * std::log(1. + G4UniformRand() *
(std::exp(-maxPtSquare/AveragePt2)-1.));
}
G4double Pt=std::sqrt(Pt2);
G4double phi=G4UniformRand() * twopi;
return G4ThreeVector (Pt*std::cos(phi), Pt*std::sin(phi), 0.);
}