Import Geant4 8.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:55:03 +02:00
parent 216a75eeb1
commit fe73f43734
6714 changed files with 118229 additions and 68144 deletions
@@ -24,14 +24,16 @@
// ********************************************************************
//
//
// $Id: G4ChargeExchange.cc,v 1.3 2006/06/29 20:09:19 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4ChargeExchange.cc,v 1.7 2006/10/20 15:22:24 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// G4 Model: Charge and strangness exchange based on G4LightMedia model
// 28 May 2006 V.Ivanchenko
//
// Modified:
// 07-Jun-06 V.Ivanchenko fix problem of rotation of final state
// 25-Jul-06 V.Ivanchenko add 19 MeV low energy, below which S-wave is sampled
//
#include "G4ChargeExchange.hh"
@@ -46,20 +48,21 @@
G4ChargeExchange::G4ChargeExchange(G4HadronElastic* hel, G4double elim,
G4double plow, G4double ehigh)
G4double ehigh)
: G4HadronicInteraction(),
fElastic(hel),
native(false),
ekinlim(elim),
plablow(plow),
ekinhigh(ehigh)
{
SetMinEnergy( 0.0*GeV );
SetMaxEnergy( DBL_MAX );
SetMaxEnergy( 100.*TeV );
ekinlow = 19.0*MeV;
verboseLevel= 0;
if(!fElastic) {
native = true;
fElastic = new G4HadronElastic(elim, plow, ehigh);
fElastic = new G4HadronElastic();
}
qCManager = fElastic->GetCS();
hElastic = fElastic->GetHElastic();
@@ -105,16 +108,22 @@ G4HadFinalState* G4ChargeExchange::ApplyYourself(
{
theParticleChange.Clear();
const G4HadProjectile* aParticle = &aTrack;
G4double ekin = aParticle->GetKineticEnergy();
G4double aTarget = targetNucleus.GetN();
G4double zTarget = targetNucleus.GetZ();
theParticleChange.SetEnergyChange(aTrack.GetKineticEnergy());
theParticleChange.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
G4int Z = static_cast<G4int>(zTarget);
G4int A = static_cast<G4int>(aTarget);
if(A < 3) return &theParticleChange;
if(ekin == 0.0 || A < 3) {
theParticleChange.SetEnergyChange(ekin);
theParticleChange.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
return &theParticleChange;
}
G4double plab = aParticle->GetTotalMomentum();
G4double ekin = aParticle->GetKineticEnergy();
if (verboseLevel > 1)
G4cout << "G4ChargeExchange::DoIt: Incident particle plab="
<< plab/GeV << " GeV/c "
@@ -253,7 +262,7 @@ G4HadFinalState* G4ChargeExchange::ApplyYourself(
G4ThreeVector p1 = lv1.vect();
G4double e1 = 0.5*etot*(1.0 + (m21*m21 - m11*m11)/(etot*etot));
G4double e2 = etot - e1;
// G4double e2 = etot - e1;
G4double ptot = std::sqrt(e1*e1 - m11*m11);
G4double tmax = 4.0*ptot*ptot;
@@ -261,14 +270,12 @@ G4HadFinalState* G4ChargeExchange::ApplyYourself(
// Choose generator
G4ElasticGenerator gtype = fLElastic;
if ((theParticle == theProton || theParticle == theNeutron) && Z <= 2) {
if ((theParticle == theProton || theParticle == theNeutron) &&
Z <= 2 && ekin >= ekinlow) {
gtype = fQElastic;
if(Z == 1 && N == 2) N = 1;
else if (Z == 2 && N == 1) N = 2;
} else if(ekin >= ekinhigh) {
gtype = fHElastic;
} else if(plab <= plablow) {
gtype = fSWave;
} else {
if(ekin >= ekinlow) gtype = fSWave;
else if(ekin >= ekinhigh) gtype = fHElastic;
}
// Sample t
@@ -277,14 +284,41 @@ G4HadFinalState* G4ChargeExchange::ApplyYourself(
G4cout << "G4ChargeExchange: Z= " << Z << " N= "
<< N << " pdg= " << projPDG
<< " mom(GeV)= " << plab/GeV << " " << qCManager << G4endl;
if(Z == 1 && N == 2) N = 1;
else if (Z == 2 && N == 1) N = 2;
G4double cs = qCManager->GetCrossSection(false,plab,Z,N,projPDG);
if(cs > 0.0) t = qCManager->GetExchangeT(Z,N,projPDG);
else gtype = fSWave;
}
if(gtype == fSWave) t = G4UniformRand()*tmax;
else if(gtype == fHElastic) t = hElastic->SampleT(theParticle,plab,Z,A);
else if(gtype == fLElastic) t = GeV*GeV*fElastic->SampleT(ptot,m1,m2,aTarget);
if(gtype == fHElastic) {
t = hElastic->SampleT(theParticle,plab,Z,A);
if(t > tmax) gtype = fSWave;
}
if(gtype == fLElastic) {
t = GeV*GeV*fElastic->SampleT(ptot,m1,m2,aTarget);
if(t > tmax) gtype = fSWave;
}
// NaN finder
if(!(t < 0.0 || t >= 0.0)) {
if (verboseLevel > -1) {
G4cout << "G4ChargeExchange:WARNING: Z= " << Z << " N= "
<< N << " pdg= " << projPDG
<< " mom(GeV)= " << plab/GeV
<< " the model type " << gtype;
if(gtype == fQElastic) G4cout << " CHIPS ";
else if(gtype == fLElastic) G4cout << " LElastic ";
else if(gtype == fHElastic) G4cout << " HElastic ";
G4cout << " t= " << t
<< " S-wave will be sampled"
<< G4endl;
}
gtype = fSWave;
}
if(gtype == fSWave) t = G4UniformRand()*tmax;
if(verboseLevel>1)
G4cout <<"type= " << gtype <<" t= " << t << " tmax= " << tmax
@@ -300,11 +334,9 @@ G4HadFinalState* G4ChargeExchange::ApplyYourself(
G4cout << "cos(t)=" << cost << " std::sin(t)=" << sint << G4endl;
G4ThreeVector v1(sint*std::cos(phi),sint*std::sin(phi),cost);
p1 = p1.unit();
v1.rotateUz(p1);
v1 *= ptot;
G4LorentzVector nlv1(v1.x(),v1.y(),v1.z(),e1);
G4LorentzVector nlv0(-v1.x(),-v1.y(),-v1.z(),e2);
G4LorentzVector nlv0 = lv0 + lv1 - nlv1;
nlv0.boost(bst);
nlv1.boost(bst);
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ChargeExchangeProcess.cc,v 1.4 2006/06/29 20:09:21 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4ChargeExchangeProcess.cc,v 1.7 2006/08/10 15:44:28 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// Geant4 Hadron Elastic Scattering Process -- header file
@@ -34,6 +34,8 @@
//
// Modified:
// 24-Apr-06 V.Ivanchenko add neutron scattering on hydrogen from CHIPS
// 07-Jun-06 V.Ivanchenko fix problem of rotation of final state
// 25-Jul-06 V.Ivanchenko add 19 MeV low energy for CHIPS
//
//
@@ -55,7 +57,7 @@
G4ChargeExchangeProcess::G4ChargeExchangeProcess(const G4String& procName)
: G4HadronicProcess(procName), first(true)
{
thEnergy = 1.*keV;
thEnergy = 19.*MeV;
verboseLevel= 1;
qCManager = 0;
AddDataSet(new G4HadronElasticDataSet);
@@ -187,7 +189,8 @@ G4double G4ChargeExchangeProcess::GetMicroscopicCrossSection(
if(iz == 1) return x;
// CHIPS cross sections
G4double momentum = dp->GetTotalMomentum();
if(iz <= -2 && (theParticle == theProton || theParticle == theNeutron)) {
if(iz == 2 && dp->GetKineticEnergy() > thEnergy &&
(theParticle == theProton || theParticle == theNeutron)) {
G4double momentum = dp->GetTotalMomentum();
if(verboseLevel>1)
G4cout << "G4ChargeExchangeProcess compute CHIPS CS for Z= 2, N=2 "
@@ -201,6 +204,20 @@ G4double G4ChargeExchangeProcess::GetMicroscopicCrossSection(
<< G4endl;
x = store->GetCrossSection(dp, elm, temp);
}
// NaN finder
if(!(x < 0.0 || x >= 0.0)) {
if (verboseLevel > -1) {
G4cout << "G4ChargeExchangeProcess WARNING: Z= " << iz
<< " pdg= " << pPDG
<< " mom(GeV)= " << dp->GetTotalMomentum()/GeV
<< " cross= " << x
<< " set to zero"
<< G4endl;
}
x = 0.0;
}
if(verboseLevel>1)
G4cout << "G4ChargeExchangeProcess cross(mb)= " << x/millibarn
<< " E(MeV)= " << dp->GetKineticEnergy()
@@ -277,6 +294,7 @@ G4VParticleChange* G4ChargeExchangeProcess::PostStepDoIt(
aParticleChange.Initialize(track);
G4HadFinalState* result = hadi->ApplyYourself(thePro, targetNucleus);
G4ThreeVector indir = track.GetMomentumDirection();
G4int nsec = result->GetNumberOfSecondaries();
if(verboseLevel>1)
@@ -293,6 +311,11 @@ G4VParticleChange* G4ChargeExchangeProcess::PostStepDoIt(
aParticleChange.SetNumberOfSecondaries(nsec);
for(G4int j=0; j<nsec; j++) {
G4DynamicParticle* p = result->GetSecondary(j)->GetParticle();
G4ThreeVector pdir = p->GetMomentumDirection();
// G4cout << "recoil " << pdir << G4endl;
pdir = pdir.rotateUz(indir);
// G4cout << "recoil rotated " << pdir << G4endl;
p->SetMomentumDirection(pdir);
aParticleChange.AddSecondary(p);
}
}
File diff suppressed because it is too large Load Diff
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HadronElastic.cc,v 1.19 2006/06/29 20:09:27 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4HadronElastic.cc,v 1.39 2006/11/23 14:51:30 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// Physics model class G4HadronElastic (derived from G4LElastic)
@@ -48,6 +48,13 @@
// charge exchange; remove limitation on incident momentum;
// add s-wave regim below some momentum
// 24-Apr-06 V.Ivanchenko add neutron scattering on hydrogen from CHIPS
// 07-Jun-06 V.Ivanchenko fix problem of rotation
// 25-Jul-06 V.Ivanchenko add 19 MeV low energy, below which S-wave is sampled
// 02-Aug-06 V.Ivanchenko introduce energy cut on the aria of S-wave for pions
// 24-Aug-06 V.Ivanchenko switch on G4ElasticHadrNucleusHE
// 31-Aug-06 V.Ivanchenko do not sample sacttering for particles with kinetic
// energy below 10 keV
// 16-Nov-06 V.Ivanchenko Simplify logic of choosing of the model for sampling
//
#include "G4HadronElastic.hh"
@@ -62,16 +69,22 @@
#include "G4Neutron.hh"
#include "G4Deuteron.hh"
#include "G4Alpha.hh"
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
G4HadronElastic::G4HadronElastic(G4double elim, G4double plow, G4double ehigh)
G4HadronElastic::G4HadronElastic(G4double, G4double, G4double)
: G4HadronicInteraction()
{
SetMinEnergy( 0.0*GeV );
SetMaxEnergy( DBL_MAX );
SetMaxEnergy( 100.*TeV );
verboseLevel= 0;
plablow = plow;
ekinhigh = ehigh;
ekinlim = elim;
lowEnergyRecoilLimit = 100.*keV;
lowEnergyLimitQ = 19.0*MeV;
lowEnergyLimitHE = 0.4*GeV;
lowEnergyLimitHE = DBL_MAX;
lowestEnergyLimit= 10.0*keV;
plabLowLimit = 20.0*MeV;
qCManager = G4QElasticCrossSection::GetPointer();
hElastic = new G4ElasticHadrNucleusHE();
@@ -79,6 +92,8 @@ G4HadronElastic::G4HadronElastic(G4double elim, G4double plow, G4double ehigh)
theNeutron = G4Neutron::Neutron();
theDeuteron = G4Deuteron::Deuteron();
theAlpha = G4Alpha::Alpha();
thePionPlus = G4PionPlus::PionPlus();
thePionMinus= G4PionMinus::PionMinus();
}
G4HadronElastic::~G4HadronElastic()
@@ -100,14 +115,19 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
{
theParticleChange.Clear();
const G4HadProjectile* aParticle = &aTrack;
G4double ekin = aParticle->GetKineticEnergy();
if(ekin <= lowestEnergyLimit) {
theParticleChange.SetEnergyChange(ekin);
theParticleChange.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
return &theParticleChange;
}
G4double aTarget = targetNucleus.GetN();
G4double zTarget = targetNucleus.GetZ();
// Elastic scattering off Hydrogen
G4double plab = aParticle->GetTotalMomentum();
G4double ekin = aParticle->GetKineticEnergy();
if (verboseLevel >1)
G4cout << "G4HadronElastic::DoIt: Incident particle plab="
<< plab/GeV << " GeV/c "
@@ -130,21 +150,21 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
G4ParticleDefinition * theDef = 0;
if(Z == 1 && A == 1) theDef = G4Proton::Proton();
else if (Z == 1 && A == 2) theDef = G4Deuteron::Deuteron();
if(Z == 1 && A == 1) theDef = theProton;
else if (Z == 1 && A == 2) theDef = theDeuteron;
else if (Z == 1 && A == 3) theDef = G4Triton::Triton();
else if (Z == 2 && A == 3) theDef = G4He3::He3();
else if (Z == 2 && A == 4) theDef = G4Alpha::Alpha();
else if (Z == 2 && A == 4) theDef = theAlpha;
else theDef = G4ParticleTable::GetParticleTable()->FindIon(Z,A,0,Z);
G4double m2 = theDef->GetPDGMass();
G4LorentzVector lv1 = aParticle->Get4Momentum();
G4LorentzVector lv0(0.0,0.0,0.0,m2);
G4LorentzVector lv = lv0 + lv1;
G4LorentzVector lv(0.0,0.0,0.0,m2);
lv += lv1;
G4ThreeVector bst = lv.boostVector();
lv1.boost(-bst);
lv0.boost(-bst);
G4ThreeVector p1 = lv1.vect();
G4double ptot = p1.mag();
G4double tmax = 4.0*ptot*ptot;
@@ -152,24 +172,31 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
// Choose generator
G4ElasticGenerator gtype = fLElastic;
if ((theParticle == theProton || theParticle == theNeutron) && Z == 1
&& N == 0) {
gtype = fQElastic;
} else if(ekin >= ekinhigh) {
gtype = fHElastic;
} else if(plab <= plablow) {
gtype = fSWave;
}
// Q-elastic for p,n scattering on H and He
if ((theParticle == theProton || theParticle == theNeutron)
&& Z <= 2 && ekin >= lowEnergyLimitQ)
gtype = fQElastic;
// HE-elastic for energetic projectiles
else if(ekin >= lowEnergyLimitHE && A < 238)
gtype = fHElastic;
// S-wave for very low energy
else if(plab < plabLowLimit) gtype = fSWave;
//
// Sample t
//
if(gtype == fQElastic) {
if (verboseLevel >1)
G4cout << "G4HadronElastic: Z= " << Z << " N= "
<< N << " pdg= " << projPDG
<< " mom(GeV)= " << plab/GeV << " " << qCManager << G4endl;
if(Z == 1 && N == 2) N = 1;
else if(Z == 2 && N == 1) N = 2;
G4double cs = qCManager->GetCrossSection(false,plab,Z,N,projPDG);
if(cs > 0.0) t = qCManager->GetExchangeT(Z,N,projPDG);
else gtype = fSWave;
else gtype = fLElastic;
}
if(gtype == fLElastic) {
@@ -182,6 +209,22 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
if(t > tmax) gtype = fSWave;
}
// NaN finder
if(!(t < 0.0 || t >= 0.0)) {
if (verboseLevel > 0) {
G4cout << "G4HadronElastic:WARNING: Z= " << Z << " N= "
<< N << " pdg= " << projPDG
<< " mom(GeV)= " << plab/GeV
<< " the model type " << gtype;
if(gtype == fQElastic) G4cout << " CHIPS ";
else if(gtype == fLElastic) G4cout << " LElastic ";
else if(gtype == fHElastic) G4cout << " HElastic ";
G4cout << " S-wave will be sampled"
<< G4endl;
}
gtype = fSWave;
}
if(gtype == fSWave) t = G4UniformRand()*tmax;
if(verboseLevel>1)
@@ -198,20 +241,16 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
G4cout << "cos(t)=" << cost << " std::sin(t)=" << sint << G4endl;
G4ThreeVector v1(sint*std::cos(phi),sint*std::sin(phi),cost);
p1 = p1.unit();
v1.rotateUz(p1);
v1 *= ptot;
G4LorentzVector nlv1(v1.x(),v1.y(),v1.z(),std::sqrt(ptot*ptot + m1*m1));
G4LorentzVector nlv0 = lv0 + lv1 - nlv1;
nlv0.boost(bst);
nlv1.boost(bst);
G4double eFinal = nlv1.e() - m1;
if (verboseLevel > 1)
G4cout << " P0= "<< nlv0 << " P1= "
<< nlv1<<" m= " << m1 << " ekin0= " << eFinal
<< " ekin1= " << nlv0.e() - m2
G4cout << "Scattered: "
<< nlv1<<" m= " << m1 << " ekin(MeV)= " << eFinal
<< " Proj: 4-mom " << lv1
<<G4endl;
if(eFinal < 0.0) {
G4cout << "G4HadronElastic WARNING ekin= " << eFinal
@@ -221,16 +260,24 @@ G4HadFinalState* G4HadronElastic::ApplyYourself(
<< " on " << theDef->GetParticleName()
<< G4endl;
eFinal = 0.0;
nlv1.setE(m1);
}
theParticleChange.SetMomentumChange(nlv1.vect().unit());
theParticleChange.SetEnergyChange(eFinal);
G4LorentzVector nlv0 = lv - nlv1;
G4double erec = nlv0.e() - m2;
if(erec > ekinlim) {
if (verboseLevel > 1)
G4cout << "Recoil: "
<< nlv0<<" m= " << m2 << " ekin(MeV)= " << erec
<<G4endl;
if(erec > lowEnergyRecoilLimit) {
G4DynamicParticle * aSec = new G4DynamicParticle(theDef, nlv0);
theParticleChange.AddSecondary(aSec);
} else {
if(erec < 0.0) erec = 0.0;
theParticleChange.SetLocalEnergyDeposit(erec);
}
@@ -1,239 +0,0 @@
//
// ********************************************************************
// * 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: G4HadronValues.cc,v 1.16 2006/06/29 20:09:29 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// G4HadronValues class
//
//
// Kinematic and dynamic values
// N. Starkov 2003.
//
// Modifications:
// 14.11.05 Use PDG code instead of static particle pointers (N.Starkov)
// 23.11.05 cleanup (V.Ivanchenko)
//
#include "globals.hh"
#include "G4HadronValues.hh"
G4HadronValues::G4HadronValues()
{}
G4HadronValues::~G4HadronValues()
{}
void
G4HadronValues::GetHadronValues(const G4DynamicParticle* aHadron)
{
G4int iHadron(-1), iHadrCode;
iHadrCode = aHadron->GetDefinition()->GetPDGEncoding();
// G4cout<<" Code "<<iHadrCode<<G4endl;
if( iHadrCode == 2212 ||
iHadrCode == 2112 ||
iHadrCode == 3122 ||
iHadrCode == 3222 ||
iHadrCode == 3112 ||
iHadrCode == 3212 ||
iHadrCode == 3312 ||
iHadrCode == 3322 ||
iHadrCode == 3334 ) iHadron = 0;
else if(
iHadrCode == -2212 ||
iHadrCode == -2112 ||
iHadrCode == -3122 ||
iHadrCode == -3222 ||
iHadrCode == -3112 ||
iHadrCode == -3212 ||
iHadrCode == -3312 ||
iHadrCode == -3322 ||
iHadrCode == -3334 ) iHadron = 1;
else if( iHadrCode == 211) iHadron = 2;
else if( iHadrCode == -211) iHadron = 3;
else if( iHadrCode == 321) iHadron = 4;
else if( iHadrCode == -321) iHadron = 5;
else {
G4cout << "G4HadronValues::GetHadronValues iHadrCode= "
<< iHadrCode
<< " " << aHadron->GetDefinition()->GetParticleName()
<< G4endl;
G4Exception(" There is not method for this hadron ");
}
G4double mHadr = aHadron->GetMass()/1000.; // In GeV
G4double HadrEnergy = aHadron->GetTotalEnergy()/1000.; // In GeV
G4double HadrMoment = aHadron->GetTotalMomentum()/1000.; // In GeV
G4double sHadr = 2*HadrEnergy*0.938+0.938*0.938+mHadr*mHadr;
G4double sqrS = std::sqrt(sHadr);
G4double Ecm = (sHadr-mHadr*mHadr+0.938*.938)/2/sqrS;
MomentumCM = std::sqrt(Ecm*Ecm-0.938*0.938);
if(HadrEnergy-mHadr<1.0)
{
G4cout<<HadrEnergy<<G4endl;
G4Exception(" The hadron Energy is very low for this method!");
}
switch (iHadron)
{
case 0: // proton
G4double Delta;
Delta=1;
if(HadrEnergy<40)
Delta = 0.916+0.0021*HadrEnergy;
HadrTot = 5.2+5.2*std::log(HadrEnergy)
+51*std::pow(HadrEnergy,-0.35); // mb
HadrSlope = 6.44+0.88*std::log(sHadr)-1; // GeV-2
HadrReIm = 0.13*std::log(sHadr/350)*std::pow(sHadr,-0.18);
DDSect2 = 11; //mb*GeV-2
DDSect3 = 3; //mb*GeV-2
// if(HadrEnergy>1000) HadrReIm=0.15;
if( iHadrCode == 3122 || iHadrCode == 3222 ||
iHadrCode == 3112 || iHadrCode == 3212 )
{
HadrTot *=0.80;
HadrSlope *=0.85;
}
if( iHadrCode == 3312 || iHadrCode == 3322 )
{
HadrTot *=0.70;
HadrSlope *=0.75;
}
if( iHadrCode == 3334)
{
HadrTot *=0.60;
HadrSlope *=0.65;
}
break;
case 1: // antiproton
sqrS = std::sqrt(sHadr);
HadrTot = 5.2+5.2*std::log(HadrEnergy)
+123.2*std::pow(HadrEnergy,-0.5); // mb
HadrSlope = 8.32+0.57*std::log(sHadr); //GeV-2
if(HadrEnergy<1000)
HadrReIm =0.06*(sqrS-2.236)*(sqrS-14.14)*std::pow(sHadr,-0.8);
else
HadrReIm = 0.6*std::log(sHadr/350)*std::pow(sHadr,-0.25);
DDSect2 = 11; //mb*GeV-2
DDSect3 = 3; //mb*GeV-2
// if(HadrEnergy>1000) HadrReIm=0.15;
if( iHadrCode == -3122 || iHadrCode == -3222 ||
iHadrCode == -3112 || iHadrCode == -3212 )
{
HadrTot *=0.75;
HadrSlope *=0.85;
}
if( iHadrCode == -3312 || iHadrCode == -3322 )
{
HadrTot *=0.65;
HadrSlope *=0.75;
}
if( iHadrCode == -3334)
{
HadrTot *=0.55;
HadrSlope *=0.65;
}
break;
case 2: // pi plus
if(HadrMoment>2.0)
HadrTot = 10.6+2.*std::log(HadrEnergy)+
25*std::pow(HadrEnergy,-0.43); // mb
else HadrTot = 40-50*(HadrMoment-1.5)*(HadrMoment-1.7);
HadrSlope = 7.28+0.245*std::log(sHadr); //GeV-2
HadrReIm = 0.2*std::log(sHadr/100)*std::pow(sHadr,-0.15);
DDSect2 = 4.6; //mb*GeV-2
DDSect3 = 1.33; //mb*GeV-2
break;
case 3: // pi minus
HadrTot = 10.6+2*std::log(HadrEnergy)+
30*std::pow(HadrEnergy,-0.43); // mb
if(HadrMoment<1.399)
HadrTot = HadrTot+21.0/0.4*(1.4-HadrMoment);
HadrSlope = 7.28+0.245*std::log(sHadr); // GeV-2
HadrReIm = 0.2*std::log(sHadr/100)*std::pow(sHadr,-0.15);
DDSect2 = 4.6; //mb*GeV-2
DDSect3 = 1.33; //mb*GeV-2
break;
case 4: // K plus
HadrTot = 10.6+1.8*std::log(HadrEnergy)+
9.0*std::pow(HadrEnergy,-0.55); // mb
if(HadrEnergy>100) HadrSlope = 15.0;
else
// HadrSlope = 5.28+1.76*std::log(sHadr)-
HadrSlope = 1.0+1.76*std::log(sHadr)-
2.84*std::pow(sHadr,-0.5); // GeV-2
HadrReIm = 0.4*(sHadr-20)*(sHadr-150)*std::pow(sHadr+50,-2.1);
DDSect2 = 3.5; //mb*GeV-2
DDSect3 = 1.03; //mb*GeV-2
break;
case 5: // K minus
HadrTot = 10+1.8*std::log(HadrEnergy)
+25*std::pow(HadrEnergy,-0.5); // mb
HadrSlope = 6.98+0.127*std::log(sHadr); // GeV-2
// if(HadrEnergy<8) HadrReIm = 0.7;
// else
HadrReIm = 0.4*(sHadr-20)*(sHadr-20)*std::pow(sHadr+50,-2.1);
DDSect2 = 3.5; //mb*GeV-2
DDSect3 = 1.03; //mb*GeV-2
break;
}
}
/* end of file */
@@ -1,226 +0,0 @@
//
// ********************************************************************
// * 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: G4IntegrHadrNucleus.cc,v 1.14 2006/06/29 20:09:31 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// IntegrHadrNucleus.cc
#include "globals.hh"
#include "G4IntegrHadrNucleus.hh"
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
void G4IntegrHadrNucleus::
GetIntegralCrSec(G4Nucleus * aNucleus)
{
G4int i, l;
G4double N, N1, N2, N3, N4, Delta, Inel1;
G4double Tot0, Inel0, Prod0, Prod1,
ak, Delt, Delt2, Delt3;
G4double Rnucl, R0, Stot, Bhad, Asq, MbToB, Pi1;
G4double Dtot, Dprod, Rnuc2, RB, R2B, bk, bd;
G4int Anucleus = (int) aNucleus->GetN();
if(Anucleus==2 || Anucleus==3)
G4Exception(" This nucleus is very light for this model !!!");
if(Anucleus>238)
G4Exception(" This nucleus is very heavy for this model !!!");
MbToB = 2.568;
Pi1 = 3.1416;
Stot = HadrTot*MbToB; //{In GeV-2}
Bhad = HadrSlope; //{In GeV-2}
Asq = 1+HadrReIm*HadrReIm;
R0 = std::sqrt(0.99); //{ This is fermi}
if (Anucleus >10) R0 = std::sqrt(0.84);
if (Anucleus >20) R0 = std::sqrt((35.34+0.5*Anucleus)
/(40.97+Anucleus));
if (Anucleus == 16) R0 = std::sqrt(0.75);
if (Anucleus == 58) R0 = std::sqrt(0.6);
// R0 = std::sqrt(0.64);
Rnucl = R0*std::pow(static_cast<double>(Anucleus),0.3333); //{In Fermi }
if(Anucleus == 4) Rnucl = 1.2;
Rnuc2 = Rnucl*Rnucl*MbToB*10; //{ In GeV-2}
RB = Rnuc2+Bhad;
R2B = RB+Bhad;
Delta = Stot/R2B/2/Pi1;
Delt = Delta*Asq*0.5;
Delt2 = Delta*2;
Delt3 = Stot/RB/Bhad/16/Pi1*Asq*R2B;
Tot0 = 0;
Inel0 = 0;
Inel1=0;
N = N1 = -1/Delta;
N3 = -1/Delt2;
Prod0 = 0;
for (i=1; i<= Anucleus; i++)
{
N = -N*Delta*(Anucleus-i+1)/i;
N1 = -N1*Delta*(2*Anucleus-i+1)/i;
N3 = -N3*Delt2*(Anucleus-i+1)/i;
Tot0 = Tot0+N/i;
Inel0 = Inel0+N1/i;
N2 = 1;
N4 = 1;
Inel1 = 0;
Prod1 = 0;
for (l=0; l<= i; l++)
{
// Inel1 = Inel1+N2/(i+l);
Prod1 = Prod1+N4*RB/(i*RB+l*Bhad);
// N2 = -N2*Delt*(i-l)/(l+1);
N4 = -N4*Delt3*(i-l)/(l+1);
} // l
// Inel2 = Inel2+Inel1*N3;
Prod0 = Prod0+Prod1*N3;
if(std::fabs(N1/i/Inel0) < 0.0001) break;
} // i
Tot0 = Tot0*HadrTot;
Inel0 = Inel0*HadrTot*0.5;
// Inel2 = Inel2*HadrTot;
Prod0 = Prod0*HadrTot;
Tot00 = Tot0;
ak = (Rnuc2*2*Pi1/Stot);
G4double DDSect1 = (DDSect2+DDSect3*std::log(1.06*2*HadrEnergy
/Rnucl/std::sqrt(25.68)/4));
Dtot = 8*Pi1*ak/HadrTot*(1-(1+Anucleus/ak)
*std::exp(-Anucleus/ak))*DDSect1/MbToB;
DTot00 = Dtot;
bk = (1-1/ak)/Stot/(1-1/ak/4);
bd = bk*bk*DDSect1*(1-(1+Anucleus/ak*(1-1/ak/4))*
std::exp(-Anucleus/ak*(1-1/4/ak)))*Rnuc2;
Dprod = bd*4*Pi1*Pi1*MbToB;
TotalCrSec = Tot0-Dtot;
InelCrSec = Inel0-Dprod;
// InelCrSec1 = Inel2;
ProdCrSec = Prod0-Dprod;
ElasticCrSec = TotalCrSec-InelCrSec;
QuasyElasticCrSec = InelCrSec-ProdCrSec;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
G4double
G4IntegrHadrNucleus::GetElasticCrossSection(
const G4DynamicParticle * aHadron,
G4Nucleus * aNucleus)
{
HadrEnergy = aHadron->GetTotalEnergy()/1000;
G4double MassH = aHadron->GetMass()/1000;
if(HadrEnergy-MassH < 1.0)
G4Exception(" The hadron energy is very low for this model !!!");
G4HadronValues::GetHadronValues(aHadron);
GetIntegralCrSec(aNucleus);
return(ElasticCrSec);
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
G4double
G4IntegrHadrNucleus::GetTotalCrossSection(
const G4DynamicParticle * aHadron,
G4Nucleus * aNucleus)
{
HadrEnergy = aHadron->GetTotalEnergy()/1000;
G4double MassH = aHadron->GetMass()/1000;
if(HadrEnergy-MassH < 1.0)
G4Exception(" The hadron energy is very low for this model !!!");
G4HadronValues::GetHadronValues(aHadron);
GetIntegralCrSec(aNucleus);
return(TotalCrSec);
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
G4double
G4IntegrHadrNucleus::GetInelasticCrossSection(
const G4DynamicParticle * aHadron,
G4Nucleus * aNucleus)
{
HadrEnergy = aHadron->GetTotalEnergy()/1000;
G4double MassH = aHadron->GetMass()/1000;
if(HadrEnergy-MassH < 1.0)
G4Exception(" The hadron energy is very low for this model !!!");
G4HadronValues::GetHadronValues(aHadron);
GetIntegralCrSec(aNucleus);
return(InelCrSec);
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
G4double
G4IntegrHadrNucleus::GetProductionCrossSection(
const G4DynamicParticle * aHadron,
G4Nucleus * aNucleus)
{
HadrEnergy = aHadron->GetTotalEnergy()/1000;
G4double MassH = aHadron->GetMass()/1000;
if(HadrEnergy-MassH < 1.0)
G4Exception(" The hadron energy is very low for this model !!!");
G4HadronValues::GetHadronValues(aHadron);
GetIntegralCrSec(aNucleus);
return(ProdCrSec);
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
G4double
G4IntegrHadrNucleus::GetQuasyElasticCrossSection(
const G4DynamicParticle * aHadron,
G4Nucleus * aNucleus)
{
HadrEnergy = aHadron->GetTotalEnergy()/1000;
G4double MassH = aHadron->GetMass()/1000;
if(HadrEnergy-MassH < 1.0)
G4Exception(" The hadron energy is very low for this model !!!");
G4HadronValues::GetHadronValues(aHadron);
GetIntegralCrSec(aNucleus);
return(QuasyElasticCrSec);
}
/* end of file */
@@ -87,7 +87,8 @@ G4LEpp::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
G4double ek = aParticle->GetKineticEnergy();
G4ThreeVector theInitial = aParticle->Get4Momentum().vect();
if (verboseLevel > 1) {
// if (verboseLevel > 1)
{
G4double E = aParticle->GetTotalEnergy();
G4double E0 = aParticle->GetDefinition()->GetPDGMass();
G4double Q = aParticle->GetDefinition()->GetPDGCharge();
@@ -23,15 +23,19 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UHadronElasticProcess.cc,v 1.15 2006/06/29 20:09:37 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4UHadronElasticProcess.cc,v 1.28 2006/11/16 20:09:13 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Geant4 Hadron Elastic Scattering Process -- header file
//
// Created 21 April 2006 V.Ivanchenko
//
// Modified:
// 24-Apr-06 V.Ivanchenko add neutron scattering on hydrogen from CHIPS
// 24.04.06 V.Ivanchenko add neutron scattering on hydrogen from CHIPS
// 07.06.06 V.Ivanchenko fix problem of rotation of final state
// 25.07.06 V.Ivanchenko add 19 MeV low energy for CHIPS
// 26.09.06 V.Ivanchenko add lowestEnergy
// 20.10.06 V.Ivanchenko initialise lowestEnergy=0 for neitrals, eV for charged
//
//
@@ -47,18 +51,17 @@
#include "G4IsotopeVector.hh"
#include "G4Neutron.hh"
#include "G4Proton.hh"
#include "G4NeutronHPElasticData.hh"
#include "G4HadronElastic.hh"
G4UHadronElasticProcess::G4UHadronElasticProcess(const G4String& pName, G4bool fl)
: G4HadronicProcess(pName), flagHP(fl), first(true)
G4UHadronElasticProcess::G4UHadronElasticProcess(const G4String& pName, G4double)
: G4HadronicProcess(pName), lowestEnergy(0.0), first(true)
{
AddDataSet(new G4HadronElasticDataSet);
theProton = G4Proton::Proton();
theNeutron = G4Neutron::Neutron();
thEnergy = 1.*keV;
theProton = G4Proton::Proton();
theNeutron = G4Neutron::Neutron();
thEnergy = 19.0*MeV;
verboseLevel= 1;
qCManager = 0;
qCManager = 0;
}
G4UHadronElasticProcess::~G4UHadronElasticProcess()
@@ -78,15 +81,22 @@ BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
if(!qCManager) qCManager = G4QElasticCrossSection::GetPointer();
theParticle = &aParticleType;
pPDG = theParticle->GetPDGEncoding();
if(theParticle == theNeutron && flagHP)
AddDataSet(new G4NeutronHPElasticData());
store = G4HadronicProcess::GetCrossSectionDataStore();
// defined lowest threshold for the projectile
if(theParticle->GetPDGCharge() != 0.0) lowestEnergy = eV;
if(verboseLevel>1)
if(verboseLevel>1 ||
(verboseLevel==1 && theParticle == theNeutron)) {
G4cout << G4endl;
G4cout << "G4UHadronElasticProcess for "
<< theParticle->GetParticleName()
<< G4endl;
<< theParticle->GetParticleName()
<< " PDGcode= " << pPDG
<< " Elow(MeV)= " << thEnergy/MeV
<< " Elowest(eV)= " << lowestEnergy/eV
<< G4endl;
}
}
store->BuildPhysicsTable(aParticleType);
}
@@ -97,20 +107,16 @@ G4double G4UHadronElasticProcess::GetMeanFreePath(const G4Track& track,
{
*cond = NotForced;
const G4DynamicParticle* dp = track.GetDynamicParticle();
const G4Material* material = track.GetMaterial();
cross = 0.0;
G4double x = DBL_MAX;
// The process is effective only above the threshold
if(dp->GetKineticEnergy() < thEnergy) return x;
// Compute cross sesctions
const G4Material* material = track.GetMaterial();
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
G4double temp = material->GetTemperature();
G4int nelm = material->GetNumberOfElements();
xsecH[0] = 0.0;
xsecH[1] = 0.0;
G4int nelm = material->GetNumberOfElements();
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess get mfp for "
<< theParticle->GetParticleName()
@@ -143,44 +149,45 @@ G4double G4UHadronElasticProcess::GetMicroscopicCrossSection(
// gives the microscopic cross section in GEANT4 internal units
G4int iz = G4int(elm->GetZ());
G4double x = 0.0;
// CHIPS cross sections
if(iz <= 2 && (theParticle == theProton || theParticle == theNeutron)) {
if(iz <= 2 && dp->GetKineticEnergy() > thEnergy &&
(theParticle == theProton || theParticle == theNeutron)) {
G4double momentum = dp->GetTotalMomentum();
if(iz == 1) {
G4IsotopeVector* isv = elm->GetIsotopeVector();
G4int ni = 0;
if(isv) ni = isv->size();
if(ni > 0) {
G4double* ab = elm->GetRelativeAbundanceVector();
x = 0.0;
for(G4int j=0; j<ni; j++) {
G4int N = elm->GetIsotope(j)->GetN() - 1;
if(N == 0 || N == 1) {
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess compute CHIPS CS for Z= 1, N= "
<< N << " pdg= " << pPDG
<< " mom(GeV)= " << momentum/GeV
<< " " << qCManager << G4endl;
G4double y = ab[j]*
qCManager->GetCrossSection(false,momentum,1,N,pPDG);
xsecH[N] += y;
x += y;
}
G4IsotopeVector* isv = elm->GetIsotopeVector();
G4int ni = 0;
if(isv) ni = isv->size();
if(ni > 0) {
G4double* ab = elm->GetRelativeAbundanceVector();
x = 0.0;
for(G4int j=0; j<ni; j++) {
G4int N = elm->GetIsotope(j)->GetN() - iz;
if(iz == 1) {
if(N > 1) N = 1;
} else {
N = 2;
}
} else {
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess compute CHIPS CS for Z= 1, N= 0"
<< " pdg= " << pPDG
<< " mom(GeV)= " << momentum/GeV << " " << qCManager << G4endl;
x = qCManager->GetCrossSection(false,momentum,1,0,pPDG);
xsecH[0] = x;
G4cout << "G4UHadronElasticProcess compute CHIPS CS for Z= " << iz
<< " N= " << N << " pdg= " << pPDG
<< " mom(GeV)= " << momentum/GeV
<< " " << qCManager << G4endl;
G4double y = ab[j]*qCManager->GetCrossSection(false,momentum,iz,N,pPDG);
x += y;
xsecH[j] = x;
}
} else {
G4int N = 0;
if(iz == 2) N = 2;
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess compute CHIPS CS for Z= 2, N=2 "
G4cout << "G4UHadronElasticProcess compute CHIPS CS for Z= " << iz
<< " N= " << N
<< " pdg= " << pPDG
<< G4endl;
x = qCManager->GetCrossSection(false,momentum,2,2,pPDG);
x = qCManager->GetCrossSection(false,momentum,iz,N,pPDG);
}
// GHAD cross section
} else {
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess compute GHAD CS for element "
@@ -188,6 +195,19 @@ G4double G4UHadronElasticProcess::GetMicroscopicCrossSection(
<< G4endl;
x = store->GetCrossSection(dp, elm, temp);
}
// NaN finder
if(!(x < 0.0 || x >= 0.0)) {
if (verboseLevel > 1) {
G4cout << "G4UHadronElasticProcess:WARNING: Z= " << iz
<< " pdg= " << pPDG
<< " mom(GeV)= " << dp->GetTotalMomentum()/GeV
<< " cross= " << x
<< " set to zero"
<< G4endl;
}
x = 0.0;
}
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess cross(mb)= " << x/millibarn
<< " E(MeV)= " << dp->GetKineticEnergy()
@@ -204,10 +224,14 @@ G4VParticleChange* G4UHadronElasticProcess::PostStepDoIt(
{
G4ForceCondition cn;
aParticleChange.Initialize(track);
G4double mfp = GetMeanFreePath(track, 0.0, &cn);
if(mfp == DBL_MAX) return G4VDiscreteProcess::PostStepDoIt(track,step);
G4double kineticEnergy = track.GetKineticEnergy();
if(kineticEnergy <= lowestEnergy)
return G4VDiscreteProcess::PostStepDoIt(track,step);
G4double mfp = GetMeanFreePath(track, 0.0, &cn);
if(mfp == DBL_MAX)
return G4VDiscreteProcess::PostStepDoIt(track,step);
G4Material* material = track.GetMaterial();
// Select element
@@ -230,26 +254,33 @@ G4VParticleChange* G4UHadronElasticProcess::PostStepDoIt(
if(isv) ni = isv->size();
if(ni == 1) {
A = G4double(elm->GetIsotope(0)->GetN());
} else if(ni == 0) {
A = elm->GetN();
} else if(ni > 1) {
if(iz == 1 && theParticle == theProton) {
A = 1.;
if(G4UniformRand()*(xsecH[0] + xsec[1]) > xsec[0]) A = 2.;
G4int j = -1;
ni--;
// Special treatment of hydrogen and helium for CHIPS
if(iz <= 2 && (theParticle == theProton || theParticle == theNeutron)) {
G4double x = G4UniformRand()*xsecH[ni];
do {j++;} while (x > xsecH[j] && j < ni);
// Abandance vector
} else {
G4double* ab = elm->GetRelativeAbundanceVector();
G4double y = G4UniformRand();
G4int j = -1;
ni--;
do {
j++;
y -= ab[j];
} while (y > 0.0 && j < ni);
A = G4double(elm->GetIsotope(j)->GetN());
}
}
A = G4double(elm->GetIsotope(j)->GetN());
}
G4HadronicInteraction* hadi =
ChooseHadronicInteraction( kineticEnergy, material, elm);
// Initialize the hadronic projectile from the track
// G4cout << "track " << track.GetDynamicParticle()->Get4Momentum()<<G4endl;
G4HadProjectile thePro(track);
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess::PostStepDoIt for "
@@ -260,18 +291,26 @@ G4VParticleChange* G4UHadronElasticProcess::PostStepDoIt(
aParticleChange.Initialize(track);
G4HadFinalState* result = hadi->ApplyYourself(thePro, targetNucleus);
G4ThreeVector indir = track.GetMomentumDirection();
G4ThreeVector outdir = (result->GetMomentumChange()).rotateUz(indir);
if(verboseLevel>1)
G4cout << "Efin= " << result->GetEnergyChange()
<< " de= " << result->GetLocalEnergyDeposit()
<< " nsec= " << result->GetNumberOfSecondaries()
<< " dir= " << outdir
<< G4endl;
aParticleChange.ProposeEnergy(result->GetEnergyChange());
aParticleChange.ProposeMomentumDirection(result->GetMomentumChange());
aParticleChange.ProposeMomentumDirection(outdir);
if(result->GetNumberOfSecondaries() > 0) {
aParticleChange.SetNumberOfSecondaries(1);
G4DynamicParticle* p = result->GetSecondary(0)->GetParticle();
G4ThreeVector pdir = p->GetMomentumDirection();
// G4cout << "recoil " << pdir << G4endl;
pdir = pdir.rotateUz(indir);
// G4cout << "recoil rotated " << pdir << G4endl;
p->SetMomentumDirection(pdir);
aParticleChange.AddSecondary(p);
} else {
aParticleChange.SetNumberOfSecondaries(0);
@@ -319,3 +358,4 @@ DumpPhysicsTable(const G4ParticleDefinition& aParticleType)
{
store->DumpPhysicsTable(aParticleType);
}