Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4EventGenerator.cc 67999 2013-03-13 11:14:32Z gcosmo $
// $Id: G4EventGenerator.cc 100828 2016-11-02 15:25:59Z gcosmo $
//
// G4EventGenerator
@@ -49,7 +49,8 @@ G4EventGenerator::~G4EventGenerator()
const G4EventGenerator & G4EventGenerator::operator=(const G4EventGenerator &)
{
throw G4HadronicException(__FILE__, __LINE__, "G4EventGenerator::operator= meant to not be accessable");
throw G4HadronicException(__FILE__, __LINE__,
"G4EventGenerator::operator= meant to not be accessable");
return *this;
}
@@ -63,3 +64,4 @@ int G4EventGenerator::operator!=(const G4EventGenerator &) const
{
return 1;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4InteractionContent.cc 89732 2015-04-29 09:00:48Z gcosmo $
// $Id: G4InteractionContent.cc 100828 2016-11-02 15:25:59Z gcosmo $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -40,13 +40,13 @@
#include "G4SystemOfUnits.hh"
G4InteractionContent::G4InteractionContent(G4VSplitableHadron *aPrimaryParticipant)
: theNumberOfHard(0), theNumberOfSoft(0), theNumberOfDiffractive(0),
theInteractionTime(0.), curStatus(0)
: theNumberOfHard(0), theNumberOfSoft(0), theNumberOfDiffractive(0),
theInteractionTime(0.), curStatus(0)
{
theProjectile=aPrimaryParticipant;
theTarget=0;
theProjectileNucleon=0;
theTargetNucleon=0;
theProjectile=aPrimaryParticipant;
theTarget=0;
theProjectileNucleon=0;
theTargetNucleon=0;
}
G4InteractionContent::~G4InteractionContent()
@@ -55,7 +55,7 @@ G4InteractionContent::~G4InteractionContent()
G4bool G4InteractionContent::operator<(const G4InteractionContent &right) const
{
return this->GetInteractionTime() < right.GetInteractionTime();
return this->GetInteractionTime() < right.GetInteractionTime();
}
void G4InteractionContent::SetInteractionTime(G4double aValue)
@@ -66,5 +66,7 @@ G4double G4InteractionContent::GetInteractionTime() const
void G4InteractionContent::SetStatus(G4int aValue)
{curStatus = aValue;}
G4int G4InteractionContent::GetStatus() const
{return curStatus;}
@@ -0,0 +1,326 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4PomeronCrossSection.cc 100828 2016-11-02 15:25:59Z gcosmo $
//
#include "G4PomeronCrossSection.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Pow.hh"
#include "G4Exp.hh"
#include "G4Log.hh"
G4PomeronCrossSection::G4PomeronCrossSection() :
pomeron_Alpha(0), pomeron_Alpha_Hard(0), pomeron_Alphaprime(0),
pomeron_C(0), pomeron_Gamma(0), pomeron_Gamma_Hard(0),
pomeron_Rsquare(0), pomeron_S(0)
{}
G4PomeronCrossSection::~G4PomeronCrossSection()
{;}
//**********************************************************************************************
G4PomeronCrossSection::G4PomeronCrossSection(const G4ParticleDefinition * particle)
{
G4int Encoding = std::abs(particle->GetPDGEncoding());
if (std::abs(particle->GetBaryonNumber())!=0)
InitForNucleon();
else if (Encoding/100== 3 || Encoding/10 == 3)
InitForKaon();
else
InitForPion();
}
//**********************************************************************************************
G4PomeronCrossSection::G4PomeronCrossSection(const G4Proton * )
{
InitForNucleon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4Neutron * )
{
InitForNucleon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4PionPlus * )
{
InitForPion();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4PionMinus * )
{
InitForPion();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4PionZero * )
{
InitForPion();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonPlus * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonMinus * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonZero * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonZeroLong * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonZeroShort * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4Gamma * )
{
InitForGamma();
}
G4double G4PomeronCrossSection::GetTotalCrossSection(const G4double S)
{
G4double FZ2= Expand(Z(S)/2);
return SigP(S) * FZ2;
}
G4double G4PomeronCrossSection::GetElasticCrossSection(const G4double S)
{
return SigP(S)/pomeron_C *(Expand(Z(S)/2) - Expand(Z(S)));
}
G4double G4PomeronCrossSection::GetDiffractiveCrossSection(const G4double S)
{
return ( pomeron_C -1) * GetElasticCrossSection(S);
}
G4double G4PomeronCrossSection::GetInelasticCrossSection(const G4double S)
{
return GetTotalCrossSection(S) - GetElasticCrossSection(S);
}
//-------------------------Probabilities ----------------------------
G4double G4PomeronCrossSection::GetTotalProbability(const G4double S,
const G4double impactsquare)
{
return 2/pomeron_C*(1-G4Exp(-1*Eikonal(S,impactsquare)));
}
G4double G4PomeronCrossSection::GetDiffractiveProbability(const G4double S,
const G4double impactsquare)
{
return (pomeron_C-1)/pomeron_C *
(GetTotalProbability(S,impactsquare) - GetNondiffractiveProbability(S,impactsquare));
}
G4double G4PomeronCrossSection::GetNondiffractiveProbability(const G4double S,
const G4double impactsquare)
{
return (1-G4Exp(-2*Eikonal(S,impactsquare)))/pomeron_C;
}
G4double G4PomeronCrossSection::GetElasticProbability(const G4double S,
const G4double impactsquare)
{
return (GetTotalProbability(S,impactsquare) - GetInelasticProbability(S,impactsquare));
}
G4double G4PomeronCrossSection::GetInelasticProbability(const G4double S,
const G4double impactsquare)
{
return GetNondiffractiveProbability(S,impactsquare) + GetDiffractiveProbability(S,impactsquare);
}
G4double G4PomeronCrossSection::GetCutPomeronProbability(const G4double S,
const G4double impactsquare, const G4int nPomerons)
{
G4double factorial=G4Pow::GetInstance()->factorial(nPomerons);
return G4Exp(-2*Eikonal(S,impactsquare))/pomeron_C*
G4Pow::GetInstance()->powN(2*Eikonal(S,impactsquare),nPomerons)/factorial;
}
// ---------------Temporary --- GF
void G4PomeronCrossSection::Setgamma(const G4double agam)
{
pomeron_Gamma=agam/GeV/GeV;
}
//----------------- private/Implementation methods
void G4PomeronCrossSection::InitForNucleon()
{
//pomeron_S= 3.0*GeV*GeV;
pomeron_S= 2.7*GeV*GeV;
//pomeron_Gamma= 2.16/GeV/GeV;
//pomeron_Gamma= 3.96/GeV/GeV;
pomeron_Gamma= (2.6+3.96)/GeV/GeV;
pomeron_C= 1.4;
pomeron_Rsquare= 3.56/GeV/GeV;
//pomeron_Alpha= 1.0808;
pomeron_Alpha= 0.9808;
pomeron_Alphaprime= 0.25/GeV/GeV;
pomeron_Gamma_Hard = 0.0002/GeV/GeV; // Note! if pomeron_Gamma_Hard != 0 to fit total pp-crosscection
// pomeron_Gamma_Soft shold be 2.35/GeV/GeV
pomeron_Alpha_Hard = 1.47;
}
void G4PomeronCrossSection::InitForPion()
{
pomeron_S= 1.5*GeV*GeV;
//pomeron_Gamma= 1.46/GeV/GeV;
pomeron_Gamma= 2.17/GeV/GeV;
pomeron_C= 1.6;
pomeron_Rsquare= 2.36/GeV/GeV;
pomeron_Alpha= 1.0808;
pomeron_Alphaprime= 0.25/GeV/GeV;
pomeron_Gamma_Hard = 0.0002/GeV/GeV;
pomeron_Alpha_Hard = 1.47;
}
void G4PomeronCrossSection::InitForKaon()
{
pomeron_S= 2.3*GeV*GeV;
//pomeron_Gamma= 1.31/GeV/GeV;
pomeron_Gamma= 1.92/GeV/GeV;
pomeron_C= 1.8;
pomeron_Rsquare= 1.96/GeV/GeV;
pomeron_Alpha= 1.0808;
pomeron_Alphaprime= 0.25/GeV/GeV;
pomeron_Gamma_Hard = 0.0002/GeV/GeV;
pomeron_Alpha_Hard = 1.47;
}
void G4PomeronCrossSection::InitForGamma()
{
pomeron_S= 1.7*GeV*GeV;
//pomeron_Gamma= 1.42/GeV/GeV;
pomeron_Gamma= 2.07/GeV/GeV;
pomeron_C= 1.7;
pomeron_Rsquare= 2.16/GeV/GeV;
pomeron_Alpha= 1.0808;
pomeron_Alphaprime= 0.25/GeV/GeV;
pomeron_Gamma_Hard = 0.0002/GeV/GeV;
pomeron_Alpha_Hard = 1.47;
}
G4double G4PomeronCrossSection::Expand(G4double z)
{
G4double sum=1.;
G4double current=1.;
for (G4int j=2; j<21; j++ ) {
current *= -z *(j-1)/sqr(j);
sum+=current;
}
return sum;
}
G4double G4PomeronCrossSection::Power(const G4double S)
{
return pomeron_Gamma * G4Pow::GetInstance()->powA(S/pomeron_S, pomeron_Alpha -1);
}
G4double G4PomeronCrossSection::Z(const G4double S)
{
return 2*pomeron_C * Power(S) / Lambda(S);
}
G4double G4PomeronCrossSection::Lambda(const G4double S)
{
return pomeron_Rsquare+pomeron_Alphaprime*G4Log(S/pomeron_S);
}
G4double G4PomeronCrossSection::SigP(const G4double S)
{
return 8 * pi * hbarc_squared * Power(S);
}
G4double G4PomeronCrossSection::Eikonal(const G4double S, const G4double impactsquare)
{
return Z(S)/2 * G4Exp(-impactsquare/(4*Lambda(S)*hbarc_squared));
}
//*************************************************************************************************
G4double G4PomeronCrossSection::PowerSoft(const G4double S)
{
return pomeron_Gamma * G4Pow::GetInstance()->powA(S/pomeron_S, pomeron_Alpha -1);
}
G4double G4PomeronCrossSection::PowerHard(const G4double S)
{
return pomeron_Gamma_Hard*G4Pow::GetInstance()->powA(S/pomeron_S, pomeron_Alpha_Hard -1);
}
G4double G4PomeronCrossSection::LambdaSoft(const G4double S)
{
return pomeron_Rsquare+pomeron_Alphaprime*G4Log(S/pomeron_S);
}
G4double G4PomeronCrossSection::LambdaHard(const G4double /*S*/)
{
return pomeron_Rsquare; //+pomeron_Alphaprime*G4Log(s/pomeron_S);
}
G4double G4PomeronCrossSection::Zsoft(const G4double S)
{
return 2*pomeron_C*PowerHard(S) / LambdaSoft(S);
}
G4double G4PomeronCrossSection::Zhard(const G4double S)
{
return 2*pomeron_C*PowerHard(S)/LambdaHard(S);
}
G4double G4PomeronCrossSection::SoftEikonal(G4double S, G4double impactsquare)
{
return Zsoft(S)/2*G4Exp(-impactsquare/LambdaSoft(S)/hbarc_squared/4);
}
G4double G4PomeronCrossSection::HardEikonal(G4double S, G4double impactsquare)
{
return Zhard(S)/2*G4Exp(-impactsquare/LambdaHard(S)/hbarc_squared/4);
}
//*************************************************************************************************
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4StringModel.cc 67999 2013-03-13 11:14:32Z gcosmo $
// $Id: G4StringModel.cc 100828 2016-11-02 15:25:59Z gcosmo $
//
// G4StringModel
#include "G4StringModel.hh"
@@ -34,7 +34,6 @@ the3DNucleus(0), theStringFragmentationModel(0),theGenerator(0)
{
}
G4StringModel::~G4StringModel()
{
}
@@ -47,7 +46,8 @@ the3DNucleus(0), theStringFragmentationModel(0),theGenerator(0)
const G4StringModel & G4StringModel::operator=(const G4StringModel &)
{
throw G4HadronicException(__FILE__, __LINE__, "G4StringModel::operator= meant to not be accessable");
throw G4HadronicException(__FILE__, __LINE__,
"G4StringModel::operator= meant to not be accessable");
return *this;
}
@@ -61,3 +61,4 @@ int G4StringModel::operator!=(const G4StringModel &) const
{
return 1;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VParticipants.cc 83684 2014-09-09 12:37:39Z gcosmo $
// $Id: G4VParticipants.cc 100828 2016-11-02 15:25:59Z gcosmo $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -48,7 +48,7 @@ G4VParticipants::G4VParticipants() : theNucleus(NULL),
G4VParticipants::~G4VParticipants()
{
// G4cout << "G4VParticipants::~G4VParticipants()" << G4endl;
// G4cout << "G4VParticipants::~G4VParticipants()" << G4endl;
if ( theNucleus != NULL ) delete theNucleus;
if ( theProjectileNucleus != NULL ) delete theProjectileNucleus;
}
@@ -81,3 +81,4 @@ void G4VParticipants::SetProjectileNucleus(G4V3DNucleus * aNucleus)
if (theProjectileNucleus != NULL) delete theProjectileNucleus;
theProjectileNucleus = aNucleus;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VPartonStringModel.cc 91858 2015-08-07 13:57:22Z gcosmo $
// $Id: G4VPartonStringModel.cc 100828 2016-11-02 15:25:59Z gcosmo $
//
//// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -45,259 +45,282 @@
#include "G4IonTable.hh"
G4VPartonStringModel::G4VPartonStringModel(const G4String& modelName)
: G4VHighEnergyGenerator(modelName),
stringFragmentationModel(0),
theThis(0)
: G4VHighEnergyGenerator(modelName), stringFragmentationModel(0), theThis(0)
{
// Make shure Shotrylived partyicles are constructed.
G4ShortLivedConstructor ShortLived;
ShortLived.ConstructParticle();
// Make sure that Shortlived particles are constructed.
G4ShortLivedConstructor ShortLived;
ShortLived.ConstructParticle();
}
G4VPartonStringModel::~G4VPartonStringModel()
{
}
G4KineticTrackVector * G4VPartonStringModel::Scatter(const G4Nucleus &theNucleus,
const G4DynamicParticle &aPrimary)
G4KineticTrackVector * G4VPartonStringModel::Scatter( const G4Nucleus &theNucleus,
const G4DynamicParticle &aPrimary )
{
G4ExcitedStringVector * strings = NULL;
G4DynamicParticle thePrimary = aPrimary;
G4LorentzVector SumStringMom( 0.0, 0.0, 0.0, 0.0 );
G4KineticTrackVector * theResult = 0;
G4DynamicParticle thePrimary=aPrimary;
#ifdef debug_PartonStringModel
G4cout<<G4endl;
G4cout<<"-----------------------Parton-String model is runnung ------------"<<G4endl;
G4cout<<"Projectile Name Mass "<<thePrimary.GetDefinition()->GetParticleName()<<" "
<<thePrimary.GetMass()<<G4endl;
G4cout<<" Momentum "<<thePrimary.Get4Momentum()<<G4endl;
G4cout<<"Target nucleus A Z "<<theNucleus.GetA_asInt()<<" "
<<theNucleus.GetZ_asInt()<<G4endl<<G4endl;
G4int Bsum=thePrimary.GetDefinition()->GetBaryonNumber() + theNucleus.GetA_asInt();
G4int Qsum=thePrimary.GetDefinition()->GetPDGCharge() + theNucleus.GetZ_asInt();
G4cout<<"Initial baryon number "<<Bsum<<G4endl;
G4cout<<"Initial charge "<<Qsum<<G4endl;
#ifdef debug_PartonStringModel
G4cout << G4endl;
G4cout << "-----------------------Parton-String model is runnung ------------" << G4endl;
G4cout << "Projectile Name Mass " << thePrimary.GetDefinition()->GetParticleName() << " "
<< thePrimary.GetMass() << G4endl;
G4cout << " Momentum " << thePrimary.Get4Momentum() << G4endl;
G4cout << "Target nucleus A Z " << theNucleus.GetA_asInt() << " "
<< theNucleus.GetZ_asInt() << G4endl << G4endl;
G4int Bsum = thePrimary.GetDefinition()->GetBaryonNumber() + theNucleus.GetA_asInt();
G4int Qsum = thePrimary.GetDefinition()->GetPDGCharge() + theNucleus.GetZ_asInt();
G4cout << "Initial baryon number " << Bsum << G4endl;
G4cout << "Initial charge " << Qsum << G4endl;
G4cout << "-------------- Parton-String model: Generation of strings -------" << G4endl
<< G4endl;
Bsum -= theNucleus.GetA_asInt(); Qsum -= theNucleus.GetZ_asInt();
if(theThis->GetProjectileNucleus()) {
if ( theThis->GetProjectileNucleus() ) {
Bsum -= thePrimary.GetDefinition()->GetBaryonNumber();
Qsum -= thePrimary.GetDefinition()->GetPDGCharge();
}
#endif
G4LorentzRotation toZ;
G4LorentzVector Ptmp=thePrimary.Get4Momentum();
toZ.rotateZ(-1*Ptmp.phi());
toZ.rotateY(-1*Ptmp.theta());
thePrimary.Set4Momentum(toZ*Ptmp);
G4LorentzRotation toLab(toZ.inverse());
G4int attempts = 0, maxAttempts=20;
while ( strings == NULL ) /* Loop checking, 07.08.2015, A.Ribon */
{
if (attempts++ > maxAttempts )
{
throw G4HadronicException(__FILE__, __LINE__,
"G4VPartonStringModel::Scatter(): fails to generate strings");
}
theThis->Init(theNucleus,thePrimary);
strings = GetStrings();
}
G4double stringEnergy(0);
G4LorentzVector SumStringMom(0.,0.,0.,0.);
#ifdef debug_PartonStringModel
G4cout<<"Parton-String model: Number of produced strings "<<strings->size()<<G4endl;
#endif
for ( unsigned int astring=0; astring < strings->size(); astring++)
{
// rotate string to lab frame, models have it aligned to z
if((*strings)[astring]->IsExcited())
{
stringEnergy += (*strings)[astring]->GetLeftParton()->Get4Momentum().t();
stringEnergy += (*strings)[astring]->GetRightParton()->Get4Momentum().t();
(*strings)[astring]->LorentzRotate(toLab);
SumStringMom+=(*strings)[astring]->Get4Momentum();
#ifdef debug_PartonStringModel
G4cout<<"String No "<<astring+1<<" "<<(*strings)[astring]->Get4Momentum()<<" "
<<(*strings)[astring]->Get4Momentum().mag()
<<" Partons "<<(*strings)[astring]->GetLeftParton()->GetDefinition()->GetPDGEncoding()
<<" "<<(*strings)[astring]->GetRightParton()->GetDefinition()->GetPDGEncoding()<<G4endl;
#endif
}
else
{
stringEnergy += (*strings)[astring]->GetKineticTrack()->Get4Momentum().t();
(*strings)[astring]->LorentzRotate(toLab);
SumStringMom+=(*strings)[astring]->GetKineticTrack()->Get4Momentum();
#ifdef debug_PartonStringModel
G4cout<<"A track No "<<astring+1<<" "
<<(*strings)[astring]->GetKineticTrack()->Get4Momentum()<<" "
<<(*strings)[astring]->GetKineticTrack()->Get4Momentum().mag()<<" "
<<(*strings)[astring]->GetKineticTrack()->GetDefinition()->GetParticleName()<<G4endl;
#endif
}
}
#ifdef debug_PartonStringModel
G4cout<<G4endl<<"SumString4Mom "<<SumStringMom<<G4endl;
G4LorentzVector TargetResidual4Momentum(0.,0.,0.,0.);
G4LorentzVector ProjectileResidual4Momentum(0.,0.,0.,0.);
G4int hitsT(0), charged_hitsT(0);
G4int hitsP(0), charged_hitsP(0);
G4double ExcitationEt(0.), ExcitationEp(0.);
#endif
G4V3DNucleus * ProjResNucleus=theThis->GetProjectileNucleus();
G4Nucleon * theNuclNucleon(0);
if(ProjResNucleus != 0)
{
theNuclNucleon = ProjResNucleus->StartLoop() ?
ProjResNucleus->GetNextNucleon() : NULL;
while( theNuclNucleon ) /* Loop checking, 07.08.2015, A.Ribon */
{
if(theNuclNucleon->AreYouHit())
{
G4LorentzVector tmp=toLab*theNuclNucleon->Get4Momentum();
#ifdef debug_PartonStringModel
ProjectileResidual4Momentum += tmp;
hitsP++;
if ( theNuclNucleon->GetDefinition() == G4Proton::Proton() ) ++charged_hitsP;
ExcitationEp +=theNuclNucleon->GetBindingEnergy();
#endif
theNuclNucleon->SetMomentum(tmp);
}
theNuclNucleon = ProjResNucleus->GetNextNucleon();
}
#ifdef debug_PartonStringModel
G4cout<<"Projectile residual A, Z and E* "
<<thePrimary.GetDefinition()->GetBaryonNumber() - hitsP<<" "
<<thePrimary.GetDefinition()->GetPDGCharge() - charged_hitsP<<" "
<<ExcitationEp<<G4endl;
G4cout<<"Projectile residual 4 momentum "<<ProjectileResidual4Momentum<<G4endl;
#endif
}
G4V3DNucleus * ResNucleus=theThis->GetWoundedNucleus();
// loop over wounded nucleus
theNuclNucleon = ResNucleus->StartLoop() ?
ResNucleus->GetNextNucleon() : NULL;
while( theNuclNucleon ) /* Loop checking, 07.08.2015, A.Ribon */
{
if(theNuclNucleon->AreYouHit())
{
G4LorentzVector tmp=toLab*theNuclNucleon->Get4Momentum();
#ifdef debug_PartonStringModel
TargetResidual4Momentum += tmp;
hitsT++;
if ( theNuclNucleon->GetDefinition() == G4Proton::Proton() ) ++charged_hitsT;
ExcitationEt +=theNuclNucleon->GetBindingEnergy();
#endif
theNuclNucleon->SetMomentum(tmp);
}
theNuclNucleon = ResNucleus->GetNextNucleon();
}
#ifdef debug_PartonStringModel
G4cout<<"Target residual A, Z and E* "
<<theNucleus.GetA_asInt() - hitsT<<" "
<<theNucleus.GetZ_asInt() - charged_hitsT<<" "
<<ExcitationEt<<G4endl;
G4cout<<"Target residual 4 momentum "<<TargetResidual4Momentum<<G4endl;
Bsum+=( hitsT + hitsP);
Qsum+=(charged_hitsT + charged_hitsP);
G4cout<<"Hitted # of nucleons of projectile and target "<<hitsP<<" "<<hitsT<<G4endl;
G4cout<<"Hitted # of protons of projectile and target "
<<charged_hitsP<<" "<<charged_hitsT<<G4endl<<G4endl;
G4cout<<"Bsum Qsum "<<Bsum<<" "<<Qsum<<G4endl;
#endif
//=========================================================================================
// Fragment strings
G4KineticTrackVector * theResult = 0;
G4double InvMass=SumStringMom.mag();
G4double SumMass(0.);
attempts = 0;
maxAttempts=100;
#ifdef debug_PartonStringModel
G4LorentzVector SumPsecondr(0.,0.,0.,0.);
G4int QsumSec(0), BsumSec(0);
G4int QsumSec( 0 ), BsumSec( 0 );
G4LorentzVector SumPsecondr( 0.0, 0.0, 0.0, 0.0 );
#endif
do
{
attempts++;
if(theResult != 0)
{
std::for_each(theResult->begin(), theResult->end(), DeleteKineticTrack());
delete theResult;
}
G4LorentzRotation toZ;
G4LorentzVector Ptmp = thePrimary.Get4Momentum();
toZ.rotateZ( -1*Ptmp.phi() );
toZ.rotateY( -1*Ptmp.theta() );
thePrimary.Set4Momentum( toZ*Ptmp );
G4LorentzRotation toLab( toZ.inverse() );
theResult = stringFragmentationModel->FragmentStrings(strings);
G4bool Success = true;
G4int attempts = 0, maxAttempts = 1000;
do {
if(attempts > maxAttempts ) break;
if ( attempts++ > maxAttempts ) {
G4ExceptionDescription ed;
ed << " Projectile Name Mass " << thePrimary.GetDefinition()->GetParticleName()
<< " " << thePrimary.GetMass()<< G4endl;
ed << " Momentum " << thePrimary.Get4Momentum() << G4endl;
ed << " Target nucleus A Z " << theNucleus.GetA_asInt() << " "
<< theNucleus.GetZ_asInt() << G4endl;
G4Exception( "G4VPartonStringModel::Scatter(): fails to generate or fragment strings ",
"HAD_PARTON_STRING_001", JustWarning, ed );
}
#ifdef debug_PartonStringModel
G4cout<<"Attempt to fragment the strings "<<attempts<<G4endl;
G4cout<<"Parton-String model: Number of produced particles "<<theResult->size()<<G4endl;
SumPsecondr = G4LorentzVector(0.,0.,0.,0.);
QsumSec = 0; BsumSec = 0;
#endif
Success = true;
SumMass=0.;
theThis->Init( theNucleus, thePrimary );
strings = GetStrings();
if ( strings == 0 ) {
Success = false;
continue;
}
G4double stringEnergy( 0.0 );
SumStringMom = G4LorentzVector( 0.0, 0.0, 0.0, 0.0 );
for ( unsigned int i=0; i < theResult->size(); i++)
{
SumMass+=(*theResult)[i]->Get4Momentum().mag();
#ifdef debug_PartonStringModel
G4cout<<i<<" : "<<(*theResult)[i]->GetDefinition()->GetParticleName()<<" "
<<(*theResult)[i]->Get4Momentum()<<" "
<<(*theResult)[i]->Get4Momentum().mag()<<" "
<<(*theResult)[i]->GetDefinition()->GetPDGMass()<<G4endl;
SumPsecondr+=(*theResult)[i]->Get4Momentum();
G4cout << "------------ Parton-String model: Number of produced strings ---- " << strings->size() << G4endl;
#endif
for ( unsigned int astring = 0; astring < strings->size(); astring++ ) {
// rotate string to lab frame, models have it aligned to z
if ( (*strings)[astring]->IsExcited() ) {
stringEnergy += (*strings)[astring]->GetLeftParton()->Get4Momentum().t();
stringEnergy += (*strings)[astring]->GetRightParton()->Get4Momentum().t();
(*strings)[astring]->LorentzRotate( toLab );
SumStringMom += (*strings)[astring]->Get4Momentum();
#ifdef debug_PartonStringModel
G4cout << "String No " << astring + 1 << " " << (*strings)[astring]->Get4Momentum()
<< " " << (*strings)[astring]->Get4Momentum().mag()
<< " Partons " << (*strings)[astring]->GetLeftParton()->GetDefinition()->GetPDGEncoding()
<< " " << (*strings)[astring]->GetRightParton()->GetDefinition()->GetPDGEncoding()
<<G4endl;
#endif
} else {
stringEnergy += (*strings)[astring]->GetKineticTrack()->Get4Momentum().t();
(*strings)[astring]->LorentzRotate( toLab );
SumStringMom += (*strings)[astring]->GetKineticTrack()->Get4Momentum();
#ifdef debug_PartonStringModel
G4cout << "A track No " << astring + 1 << " "
<< (*strings)[astring]->GetKineticTrack()->Get4Momentum() << " "
<< (*strings)[astring]->GetKineticTrack()->Get4Momentum().mag() << " "
<< (*strings)[astring]->GetKineticTrack()->GetDefinition()->GetParticleName()
<< G4endl;
#endif
}
}
#ifdef debug_PartonStringModel
G4cout << G4endl << "SumString4Mom " << SumStringMom << G4endl;
G4LorentzVector TargetResidual4Momentum( 0.0, 0.0, 0.0, 0.0 );
G4LorentzVector ProjectileResidual4Momentum( 0.0, 0.0, 0.0, 0.0 );
G4int hitsT( 0 ), charged_hitsT( 0 );
G4int hitsP( 0 ), charged_hitsP( 0 );
G4double ExcitationEt( 0.0 ), ExcitationEp( 0.0 );
#endif
G4V3DNucleus * ProjResNucleus = theThis->GetProjectileNucleus();
G4Nucleon * theNuclNucleon( 0 );
if ( ProjResNucleus != 0 ) {
theNuclNucleon = ProjResNucleus->StartLoop() ? ProjResNucleus->GetNextNucleon() : NULL;
while ( theNuclNucleon ) { /* Loop checking, 07.08.2015, A.Ribon */
if ( theNuclNucleon->AreYouHit() ) {
G4LorentzVector tmp = toLab * theNuclNucleon->Get4Momentum();
#ifdef debug_PartonStringModel
ProjectileResidual4Momentum += tmp;
hitsP++;
if ( theNuclNucleon->GetDefinition() == G4Proton::Proton() ) ++charged_hitsP;
ExcitationEp += theNuclNucleon->GetBindingEnergy();
#endif
theNuclNucleon->SetMomentum( tmp );
}
theNuclNucleon = ProjResNucleus->GetNextNucleon();
}
#ifdef debug_PartonStringModel
G4cout << "Projectile residual A, Z and E* "
<< thePrimary.GetDefinition()->GetBaryonNumber() - hitsP << " "
<< thePrimary.GetDefinition()->GetPDGCharge() - charged_hitsP << " "
<< ExcitationEp << G4endl;
G4cout << "Projectile residual 4 momentum " << ProjectileResidual4Momentum << G4endl;
#endif
}
G4V3DNucleus * ResNucleus = theThis->GetWoundedNucleus();
// loop over wounded nucleus
theNuclNucleon = ResNucleus->StartLoop() ? ResNucleus->GetNextNucleon() : NULL;
while ( theNuclNucleon ) { /* Loop checking, 07.08.2015, A.Ribon */
if ( theNuclNucleon->AreYouHit() ) {
G4LorentzVector tmp = toLab * theNuclNucleon->Get4Momentum();
#ifdef debug_PartonStringModel
TargetResidual4Momentum += tmp;
hitsT++;
if ( theNuclNucleon->GetDefinition() == G4Proton::Proton() ) ++charged_hitsT;
ExcitationEt += theNuclNucleon->GetBindingEnergy();
#endif
theNuclNucleon->SetMomentum( tmp );
}
theNuclNucleon = ResNucleus->GetNextNucleon();
}
#ifdef debug_PartonStringModel
G4cout << "Target residual A, Z and E* "
<< theNucleus.GetA_asInt() - hitsT << " "
<< theNucleus.GetZ_asInt() - charged_hitsT << " "
<< ExcitationEt << G4endl;
G4cout << "Target residual 4 momentum " << TargetResidual4Momentum << G4endl;
Bsum += ( hitsT + hitsP );
Qsum += ( charged_hitsT + charged_hitsP );
G4cout << "Hitted # of nucleons of projectile and target "
<< hitsP << " " << hitsT << G4endl;
G4cout << "Hitted # of protons of projectile and target "
<< charged_hitsP << " " << charged_hitsT << G4endl << G4endl;
G4cout << "Bsum Qsum " << Bsum << " " << Qsum << G4endl << G4endl;
#endif
//--- Fragment strings ---
#ifdef debug_PartonStringModel
G4cout << "------Parton-String model: Number of produced strings ----------- " << strings->size() << G4endl;
#endif
G4double InvMass = SumStringMom.mag();
G4double SumMass( 0.0 );
#ifdef debug_PartonStringModel
QsumSec = 0; BsumSec = 0;
SumPsecondr = G4LorentzVector( 0.0, 0.0, 0.0, 0.0 );
#endif
if ( theResult != 0 ) {
std::for_each( theResult->begin(), theResult->end(), DeleteKineticTrack() );
delete theResult;
}
theResult = stringFragmentationModel->FragmentStrings( strings );
if ( theResult == 0 ) {
Success = false;
continue;
}
#ifdef debug_PartonStringModel
G4cout << "Attempt to fragment the strings " << attempts << G4endl;
G4cout << "Parton-String model: Number of produced particles " << theResult->size() << G4endl;
SumPsecondr = G4LorentzVector( 0.0, 0.0, 0.0, 0.0 );
QsumSec = 0; BsumSec = 0;
#endif
SumMass = 0.0;
for ( unsigned int i = 0; i < theResult->size(); i++ ) {
SumMass += (*theResult)[i]->Get4Momentum().mag();
#ifdef debug_PartonStringModel
G4cout << i << " : " << (*theResult)[i]->GetDefinition()->GetParticleName() << " "
<< (*theResult)[i]->Get4Momentum() << " "
<< (*theResult)[i]->Get4Momentum().mag() << " "
<< (*theResult)[i]->GetDefinition()->GetPDGMass() << G4endl;
SumPsecondr += (*theResult)[i]->Get4Momentum();
BsumSec += (*theResult)[i]->GetDefinition()->GetBaryonNumber();
QsumSec += (*theResult)[i]->GetDefinition()->GetPDGCharge();
#endif
}
#ifdef debug_PartonStringModel
G4cout << G4endl << "-----------------------Parton-String model: balances -------------" << G4endl;
if ( Qsum != QsumSec ) {
G4cout << "Charge is not conserved!!! ----" << G4endl;
G4cout << " Qsum != QsumSec " << Qsum << " " << QsumSec << G4endl;
}
if ( Bsum != BsumSec ) {
G4cout << "Baryon number is not conserved!!!" << G4endl;
G4cout << " Bsum != BsumSec " << Bsum << " " << BsumSec << G4endl;
}
#endif
}
#ifdef debug_PartonStringModel
if(Qsum != QsumSec) {
G4cout<<"Charge is not conserved!!! ----"<<G4endl;
G4cout<<" Qsum != QsumSec "<<Qsum<<" "<<QsumSec<<G4endl;
}
if(Bsum != BsumSec) {
G4cout<<"Baryon number is not conserved!!!"<<G4endl;
G4cout<<" Bsum != BsumSec "<<Bsum<<" "<<BsumSec<<G4endl;
}
#endif
} while(SumMass > InvMass); /* Loop checking, 07.08.2015, A.Ribon */
if ( SumMass > InvMass || SumMass == 0.0 ) Success = false;
std::for_each(strings->begin(), strings->end(), DeleteString() );
delete strings;
std::for_each( strings->begin(), strings->end(), DeleteString() );
delete strings;
#ifdef debug_PartonStringModel
G4cout<<G4endl<<"Baryon number balance "<<Bsum-BsumSec<<G4endl;
G4cout <<"Charge balance "<<Qsum-QsumSec<<G4endl;
G4cout <<"4 momentum balance "<<SumStringMom-SumPsecondr<<G4endl;
G4cout<<"End of string model work ------------"<<G4endl<<G4endl;
#endif
} while ( ! Success ); /* Loop checking, 07.08.2015, A.Ribon */
#ifdef debug_PartonStringModel
G4cout << "Baryon number balance " << Bsum - BsumSec << G4endl;
G4cout << "Charge balance " << Qsum - QsumSec << G4endl;
G4cout << "4 momentum balance " << SumStringMom - SumPsecondr << G4endl;
G4cout << "---------------------End of Parton-String model work -------------" << G4endl << G4endl;
#endif
return theResult;
}
void G4VPartonStringModel::ModelDescription(std::ostream& outFile) const
{
outFile << GetModelName() << " has no description yet.\n";
outFile << GetModelName() << " has no description yet.\n";
}
G4V3DNucleus * G4VPartonStringModel::GetProjectileNucleus() const
{ return 0;}
G4V3DNucleus * G4VPartonStringModel::GetProjectileNucleus() const
{
return 0;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VSplitableHadron.cc 83684 2014-09-09 12:37:39Z gcosmo $
// $Id: G4VSplitableHadron.cc 100828 2016-11-02 15:25:59Z gcosmo $
//
// ------------------------------------------------------------
@@ -40,51 +40,49 @@
#include "G4VKineticNucleon.hh"
G4VSplitableHadron::G4VSplitableHadron()
: theDefinition(NULL), TimeOfCreation(0.), theCollisionCount(0),
curStatus(0), isSplit(false)
: theDefinition(NULL), TimeOfCreation(0.), theCollisionCount(0), curStatus(0), isSplit(false)
{
}
G4VSplitableHadron::G4VSplitableHadron(const G4ReactionProduct & aPrimary)
: TimeOfCreation(0.), theCollisionCount(0),
curStatus(0), isSplit(false)
: TimeOfCreation(0.), theCollisionCount(0), curStatus(0), isSplit(false)
{
theDefinition=aPrimary.GetDefinition();
the4Momentum.setVect(aPrimary.GetMomentum());
the4Momentum.setE(aPrimary.GetTotalEnergy());
theDefinition=aPrimary.GetDefinition();
the4Momentum.setVect(aPrimary.GetMomentum());
the4Momentum.setE(aPrimary.GetTotalEnergy());
}
G4VSplitableHadron::G4VSplitableHadron(const G4Nucleon & aNucleon)
{
TimeOfCreation = 0.;
theCollisionCount= 0;
isSplit = false;
theDefinition =aNucleon.GetParticleType();
the4Momentum =aNucleon.GetMomentum();
thePosition =aNucleon.GetPosition();
curStatus = 0;
TimeOfCreation = 0.;
theCollisionCount= 0;
isSplit = false;
theDefinition =aNucleon.GetParticleType();
the4Momentum =aNucleon.GetMomentum();
thePosition =aNucleon.GetPosition();
curStatus = 0;
}
G4VSplitableHadron::G4VSplitableHadron(const G4VKineticNucleon * aNucleon)
{
TimeOfCreation = 0.;
theCollisionCount= 0;
isSplit = false;
theDefinition =aNucleon->GetDefinition();
the4Momentum =aNucleon->Get4Momentum();
thePosition =aNucleon->GetPosition();
curStatus = 0;
TimeOfCreation = 0.;
theCollisionCount= 0;
isSplit = false;
theDefinition =aNucleon->GetDefinition();
the4Momentum =aNucleon->Get4Momentum();
thePosition =aNucleon->GetPosition();
curStatus = 0;
}
G4VSplitableHadron::G4VSplitableHadron(const G4VSplitableHadron &right)
{
TimeOfCreation = 0.; // Uzhi 8.05.08
theCollisionCount= 0;
isSplit = false;
theDefinition = right.GetDefinition();
the4Momentum = right.Get4Momentum();
thePosition = right.GetPosition();
curStatus = 0;
TimeOfCreation = 0.;
theCollisionCount= 0;
isSplit = false;
theDefinition = right.GetDefinition();
the4Momentum = right.Get4Momentum();
thePosition = right.GetPosition();
curStatus = 0;
}
@@ -95,19 +93,20 @@ G4VSplitableHadron::~G4VSplitableHadron()
const G4VSplitableHadron & G4VSplitableHadron::operator=(const G4VSplitableHadron &)
{
throw G4HadronicException(__FILE__, __LINE__, "G4VSplitableHadron::operator= meant to not be accessable");
throw G4HadronicException(__FILE__, __LINE__,
"G4VSplitableHadron::operator= meant to not be accessable");
return *this;
}
int G4VSplitableHadron::operator==(const G4VSplitableHadron &right) const
{
return this==&right;
return this==&right;
}
int G4VSplitableHadron::operator!=(const G4VSplitableHadron &right) const
{
return this!=&right;
return this!=&right;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VStringFragmentation.cc 67999 2013-03-13 11:14:32Z gcosmo $
// $Id: G4VStringFragmentation.cc 100828 2016-11-02 15:25:59Z gcosmo $
//
// G4VStringFragmentation
#include "G4VStringFragmentation.hh"
@@ -43,7 +43,8 @@ G4VStringFragmentation::~G4VStringFragmentation()
const G4VStringFragmentation & G4VStringFragmentation::operator=(const G4VStringFragmentation &)
{
throw G4HadronicException(__FILE__, __LINE__, "G4VStringFragmentation::operator= meant to not be accessable");
throw G4HadronicException(__FILE__, __LINE__,
"G4VStringFragmentation::operator= meant to not be accessable");
return *this;
}