Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -24,7 +24,6 @@
// ********************************************************************
//
// $Id: G4AntiNuclElastic.cc - A.Galoyan 02.05.2011
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Geant4 Header : G4AntiNuclElastic
//
@@ -1,140 +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$
//
//---------------------------------------------------------------------
//
// Geant4 Class : G4CHIPSElastic
//
// Author : V.Ivanchenko 29 June 2009
//
// Modified:
// 13.01.10: M.Kosov: Use G4Q(Pr/Neut)ElasticCS instead of G4QElasticCS
//
//---------------------------------------------------------------------
// CHIPS model of hadron elastic scattering
//
#include "G4CHIPSElastic.hh"
#include "G4VQCrossSection.hh"
#include "G4ParticleDefinition.hh"
#include "G4QProtonElasticCrossSection.hh"
#include "G4QNeutronElasticCrossSection.hh"
#include "G4QAntiBaryonElasticCrossSection.hh" // Uzhi
#include "G4QPionPlusElasticCrossSection.hh" // Uzhi
#include "G4QPionMinusElasticCrossSection.hh" // Uzhi
#include "G4QKaonPlusElasticCrossSection.hh" // Uzhi
#include "G4QKaonMinusElasticCrossSection.hh" // Uzhi
#include <iostream>
G4VQCrossSection* G4CHIPSElastic::pxsManager = 0;
G4VQCrossSection* G4CHIPSElastic::nxsManager = 0;
G4VQCrossSection* G4CHIPSElastic::PBARxsManager = 0; // Uzhi
G4VQCrossSection* G4CHIPSElastic::PIPxsManager = 0;
G4VQCrossSection* G4CHIPSElastic::PIMxsManager = 0;
G4VQCrossSection* G4CHIPSElastic::KPxsManager = 0;
G4VQCrossSection* G4CHIPSElastic::KMxsManager = 0;
G4CHIPSElastic::G4CHIPSElastic() : G4HadronElastic("hElasticCHIPS")
{
if(!pxsManager)
{
pxsManager = G4QProtonElasticCrossSection::GetPointer();
nxsManager = G4QNeutronElasticCrossSection::GetPointer();
PBARxsManager = G4QAntiBaryonElasticCrossSection::GetPointer(); // Uzhi
PIPxsManager = G4QPionPlusElasticCrossSection::GetPointer(); // Uzhi
PIMxsManager = G4QPionMinusElasticCrossSection::GetPointer(); // Uzhi
KPxsManager = G4QKaonPlusElasticCrossSection::GetPointer(); // Uzhi
KMxsManager = G4QKaonMinusElasticCrossSection::GetPointer(); // Uzhi
}
//Description();
}
G4CHIPSElastic::~G4CHIPSElastic()
{}
void G4CHIPSElastic::Description() const
{
char* dirName = getenv("G4PhysListDocDir");
if (dirName) {
std::ofstream outFile;
G4String outFileName = GetModelName() + ".html";
G4String pathName = G4String(dirName) + "/" + outFileName;
outFile.open(pathName);
outFile << "<html>\n";
outFile << "<head>\n";
outFile << "<title>Description of G4CHIPSElastic</title>\n";
outFile << "</head>\n";
outFile << "<body>\n";
outFile << "The G4CHIPSElastic model performs hadron-nucleus elastic\n"
<< "scattering using the parameterized elastic cross sections\n"
<< "of M. Kossov\n";
outFile << "</body>\n";
outFile << "</html>\n";
outFile.close();
}
}
G4double
G4CHIPSElastic::SampleInvariantT(const G4ParticleDefinition* p,
G4double plab, G4int Z, G4int A)
{
G4int N = A - Z;
if(Z == 1 && N == 2) { N = 1; }
else if(Z == 2 && N == 1) { N = 2; }
G4int projPDG = p->GetPDGEncoding();
G4double cs = 0.;
if (projPDG==2212) { cs = pxsManager->GetCrossSection(false,plab,Z,N,projPDG); }
else if(projPDG==2112) { cs = nxsManager->GetCrossSection(false,plab,Z,N,projPDG); }
else if(projPDG==-2212){ cs = PBARxsManager->GetCrossSection(false,plab,Z,N,projPDG); } //Pbar
else if(projPDG== 211) { cs = PIPxsManager->GetCrossSection(false,plab,Z,N,projPDG); } // Pi+
else if(projPDG==-211) { cs = PIMxsManager->GetCrossSection(false,plab,Z,N,projPDG); } // Pi-
else if(projPDG== 321) { cs = KPxsManager->GetCrossSection(false,plab,Z,N,projPDG); } // K+
else if(projPDG==-321) { cs = KMxsManager->GetCrossSection(false,plab,Z,N,projPDG); } // K-
G4double t = 0.0;
if(cs > 0.0)
{
if (projPDG== 2212) { t = pxsManager->GetExchangeT(Z,N,projPDG); }
else if(projPDG== 2112) { t = nxsManager->GetExchangeT(Z,N,projPDG); }
else if(projPDG==-2212) { t = PBARxsManager->GetExchangeT(Z,N,projPDG); } // Pbar
else if(projPDG== 211) { t = PIPxsManager->GetExchangeT(Z,N,projPDG); } // Pi+
else if(projPDG== -211) { t = PIMxsManager->GetExchangeT(Z,N,projPDG); } // Pi-
else if(projPDG== 321) { t = KPxsManager->GetExchangeT(Z,N,projPDG); } // K+
else if(projPDG== -321) { t = KMxsManager->GetExchangeT(Z,N,projPDG); } // K-
}
else { t = G4HadronElastic::SampleInvariantT(p, plab, Z, A); }
return t;
}
@@ -1,179 +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$
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4CHIPSElasticXS
//
// Author Ivantchenko, Geant4, 3-Aug-09
//
// Modifications:
// 31-05-2011 V.Uzhinsky added anti-baryons, Pi+, Pi-, K+, K- cross sections
// 23-08-2011 V.Ivanchenko migration to new design and cleanup
//
#include "G4CHIPSElasticXS.hh"
#include "G4HadronicException.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleDefinition.hh"
#include "G4Element.hh"
#include "G4Proton.hh"
#include "G4Neutron.hh"
#include "G4VQCrossSection.hh"
#include "G4QProtonElasticCrossSection.hh"
#include "G4QNeutronElasticCrossSection.hh"
#include "G4QAntiBaryonElasticCrossSection.hh" // Uzhi
#include "G4QPionMinusElasticCrossSection.hh" // Uzhi
#include "G4QPionPlusElasticCrossSection.hh" // Uzhi
#include "G4QKaonMinusElasticCrossSection.hh" // Uzhi
#include "G4QKaonPlusElasticCrossSection.hh" // Uzhi
G4CHIPSElasticXS::G4CHIPSElasticXS()
: G4VCrossSectionDataSet("CHIPSElasticXS"),
theProton(G4Proton::Proton()),
theNeutron(G4Neutron::Neutron()),
thEnergy(19*CLHEP::MeV),
isInitialized(false)
{
// verboseLevel = 0;
pCManager = G4QProtonElasticCrossSection::GetPointer();
nCManager = G4QNeutronElasticCrossSection::GetPointer();
PBARxsManager = G4QAntiBaryonElasticCrossSection::GetPointer(); // Uzhi
PIPxsManager = G4QPionPlusElasticCrossSection::GetPointer(); // Uzhi
PIMxsManager = G4QPionMinusElasticCrossSection::GetPointer(); // Uzhi
KPxsManager = G4QKaonPlusElasticCrossSection::GetPointer(); // Uzhi
KMxsManager = G4QKaonMinusElasticCrossSection::GetPointer(); // Uzhi
//Description();
theParticle = 0;
}
G4CHIPSElasticXS::~G4CHIPSElasticXS()
{}
void G4CHIPSElasticXS::Description() const
{
char* dirName = getenv("G4PhysListDocDir");
if (dirName) {
std::ofstream outFile;
G4String outFileName = GetName() + ".html";
G4String pathName = G4String(dirName) + "/" + outFileName;
outFile.open(pathName);
outFile << "<html>\n";
outFile << "<head>\n";
outFile << "<title>Description of CHIPS Elastic Cross Section</title>\n";
outFile << "</head>\n";
outFile << "<body>\n";
outFile << "G4CHIPSElasticXS provides hadron-nuclear elastic scattering\n"
<< "cross sections for protons and neutrons with incident energies\n"
<< "between 19 MeV and X GeV. These cross sections represent\n"
<< "parameterizations developed by M. Kossov. (more detail)\n";
outFile << "</body>\n";
outFile << "</html>\n";
outFile.close();
}
}
G4bool
G4CHIPSElasticXS::IsIsoApplicable(const G4DynamicParticle* dyn,
G4int Z, G4int /*A*/,
const G4Element*, const G4Material*)
{
return (Z <= 2 && dyn->GetKineticEnergy() > thEnergy);
}
G4double
G4CHIPSElasticXS::GetIsoCrossSection(const G4DynamicParticle* dyn,
G4int Z, G4int A,
const G4Isotope*, const G4Element*,
const G4Material*)
{
G4int N = A - Z;
if(Z == 1) {
if(N > 1) { N = 1; }
} else if(Z == 2) { N = 2; }
G4double momentum = dyn->GetTotalMomentum();
G4int uPDGcode = dyn->GetPDGcode();
G4VQCrossSection* CHIPSmanager = 0;
G4double cross = 0.0;
switch(uPDGcode) {
case 2212:
CHIPSmanager=pCManager;
break;
case 2112:
CHIPSmanager=nCManager;
break;
case -2212:
CHIPSmanager=PBARxsManager;
break;
case -2112:
CHIPSmanager=PBARxsManager;
break;
case 211:
CHIPSmanager=PIPxsManager;
break;
case -211:
CHIPSmanager=PIMxsManager;
break;
case 321:
CHIPSmanager=KPxsManager;
break;
case -321:
CHIPSmanager=KMxsManager;
break;
case 130:
break;
case 310:
break;
case 311:
break;
case -311:
break;
default:
throw G4HadronicException(__FILE__, __LINE__,
"G4CHIPSElasticXS: not applicable for a particle");
return cross;
}
if(CHIPSmanager) {
cross = CHIPSmanager->GetCrossSection(false,momentum,Z,N,uPDGcode);
} else {
cross = 0.5*(KPxsManager->GetCrossSection(false,momentum,Z,N,uPDGcode) +
KMxsManager->GetCrossSection(false,momentum,Z,N,uPDGcode));
}
return cross;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ChargeExchange.cc 66892 2013-01-17 10:57:59Z gunter $
//
//
// G4 Model: Charge and strangness exchange based on G4LightMedia model
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ChargeExchangeProcess.cc 66892 2013-01-17 10:57:59Z gunter $
//
//
// Geant4 Hadron Charge Exchange Process -- source file
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4ChipsElasticModel.cc 66892 2013-01-17 10:57:59Z gunter $
//
//---------------------------------------------------------------------
//
@@ -46,8 +46,6 @@
G4ChipsElasticModel::G4ChipsElasticModel() : G4HadronElastic("hElasticCHIPS")
{
if(!pxsManager)
{
pxsManager = (G4ChipsProtonElasticXS*)G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet(G4ChipsProtonElasticXS::Default_Name());
nxsManager = (G4ChipsNeutronElasticXS*)G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet(G4ChipsNeutronElasticXS::Default_Name());
PBARxsManager = (G4ChipsAntiBaryonElasticXS*)G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet(G4ChipsAntiBaryonElasticXS::Default_Name());
@@ -55,7 +53,6 @@ G4ChipsElasticModel::G4ChipsElasticModel() : G4HadronElastic("hElasticCHIPS")
PIMxsManager = (G4ChipsPionMinusElasticXS*)G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet(G4ChipsPionMinusElasticXS::Default_Name());
KPxsManager = (G4ChipsKaonPlusElasticXS*)G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet(G4ChipsKaonPlusElasticXS::Default_Name());
KMxsManager = (G4ChipsKaonMinusElasticXS*)G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet(G4ChipsKaonMinusElasticXS::Default_Name());
}
//Description();
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4DiffuseElastic.cc 70682 2013-06-04 07:57:01Z gcosmo $
//
//
// Physics model class G4DiffuseElastic
@@ -191,7 +191,7 @@ G4DiffuseElastic::GetInvElasticXsc( const G4ParticleDefinition* particle,
else if (iZ == 1 && iA == 3) theDef = G4Triton::Triton();
else if (iZ == 2 && iA == 3) theDef = G4He3::He3();
else if (iZ == 2 && iA == 4) theDef = theAlpha;
else theDef = G4ParticleTable::GetParticleTable()->FindIon(iZ,iA,0,iZ);
else theDef = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(iZ,iA,0);
G4double tmass = theDef->GetPDGMass();
@@ -278,7 +278,7 @@ G4DiffuseElastic::GetInvElasticSumXsc( const G4ParticleDefinition* particle,
else if (iZ == 1 && iA == 3) theDef = G4Triton::Triton();
else if (iZ == 2 && iA == 3) theDef = G4He3::He3();
else if (iZ == 2 && iA == 4) theDef = theAlpha;
else theDef = G4ParticleTable::GetParticleTable()->FindIon(iZ,iA,0,iZ);
else theDef = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(iZ,iA,0);
G4double tmass = theDef->GetPDGMass();
@@ -328,7 +328,7 @@ G4DiffuseElastic::GetInvCoulombElasticXsc( const G4ParticleDefinition* particle,
else if (iZ == 1 && iA == 3) theDef = G4Triton::Triton();
else if (iZ == 2 && iA == 3) theDef = G4He3::He3();
else if (iZ == 2 && iA == 4) theDef = theAlpha;
else theDef = G4ParticleTable::GetParticleTable()->FindIon(iZ,iA,0,iZ);
else theDef = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(iZ,iA,0);
G4double tmass = theDef->GetPDGMass();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ElasticHadrNucleusHE.cc 66892 2013-01-17 10:57:59Z gunter $
//
//
// The generator of high energy hadron-nucleus elastic scattering
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4HadronElastic.cc 66892 2013-01-17 10:57:59Z gunter $
//
// Geant4 Header : G4HadronElastic
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4NuclNuclDiffuseElastic.cc 71874 2013-06-27 13:39:59Z gunter $
//
//
// Physics model class G4NuclNuclDiffuseElastic
@@ -217,7 +217,7 @@ G4NuclNuclDiffuseElastic::GetInvElasticXsc( const G4ParticleDefinition* particle
else if (iZ == 1 && iA == 3) theDef = G4Triton::Triton();
else if (iZ == 2 && iA == 3) theDef = G4He3::He3();
else if (iZ == 2 && iA == 4) theDef = theAlpha;
else theDef = G4ParticleTable::GetParticleTable()->FindIon(iZ,iA,0,iZ);
else theDef = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(iZ,iA,0);
G4double tmass = theDef->GetPDGMass();
@@ -304,7 +304,7 @@ G4NuclNuclDiffuseElastic::GetInvElasticSumXsc( const G4ParticleDefinition* parti
else if (iZ == 1 && iA == 3) theDef = G4Triton::Triton();
else if (iZ == 2 && iA == 3) theDef = G4He3::He3();
else if (iZ == 2 && iA == 4) theDef = theAlpha;
else theDef = G4ParticleTable::GetParticleTable()->FindIon(iZ,iA,0,iZ);
else theDef = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(iZ,iA,0);
G4double tmass = theDef->GetPDGMass();
@@ -354,7 +354,7 @@ G4NuclNuclDiffuseElastic::GetInvCoulombElasticXsc( const G4ParticleDefinition* p
else if (iZ == 1 && iA == 3) theDef = G4Triton::Triton();
else if (iZ == 2 && iA == 3) theDef = G4He3::He3();
else if (iZ == 2 && iA == 4) theDef = theAlpha;
else theDef = G4ParticleTable::GetParticleTable()->FindIon(iZ,iA,0,iZ);
else theDef = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(iZ,iA,0);
G4double tmass = theDef->GetPDGMass();
@@ -1382,6 +1382,703 @@ void G4NuclNuclDiffuseElastic::TestAngleTable(const G4ParticleDefinition* thePar
return;
}
/////////////////////////////////////////////////////////////////
//
//
G4double G4NuclNuclDiffuseElastic::GetLegendrePol(G4int n, G4double theta)
{
G4double legPol, epsilon = 1.e-6;
G4double x = std::cos(theta);
if ( n < 0 ) legPol = 0.;
else if( n == 0 ) legPol = 1.;
else if( n == 1 ) legPol = x;
else if( n == 2 ) legPol = (3.*x*x-1.)/2.;
else if( n == 3 ) legPol = (5.*x*x*x-3.*x)/2.;
else if( n == 4 ) legPol = (35.*x*x*x*x-30.*x*x+3.)/8.;
else if( n == 5 ) legPol = (63.*x*x*x*x*x-70.*x*x*x+15.*x)/8.;
else if( n == 6 ) legPol = (231.*x*x*x*x*x*x-315.*x*x*x*x+105.*x*x-5.)/16.;
else
{
// legPol = ( (2*n-1)*x*GetLegendrePol(n-1,x) - (n-1)*GetLegendrePol(n-2,x) )/n;
legPol = std::sqrt( 2./(n*CLHEP::pi*std::sin(theta+epsilon)) )*std::sin( (n+0.5)*theta+0.25*CLHEP::pi );
}
return legPol;
}
/////////////////////////////////////////////////////////////////
//
//
G4complex G4NuclNuclDiffuseElastic::GetErfComp(G4complex z, G4int nMax)
{
G4int n;
G4double n2, cofn, shny, chny, fn, gn;
G4double x = z.real();
G4double y = z.imag();
G4double outRe = 0., outIm = 0.;
G4double twox = 2.*x;
G4double twoxy = twox*y;
G4double twox2 = twox*twox;
G4double cof1 = std::exp(-x*x)/CLHEP::pi;
G4double cos2xy = std::cos(twoxy);
G4double sin2xy = std::sin(twoxy);
G4double twoxcos2xy = twox*cos2xy;
G4double twoxsin2xy = twox*sin2xy;
for( n = 1; n <= nMax; n++)
{
n2 = n*n;
cofn = std::exp(-0.5*n2)/(n2+twox2); // /(n2+0.5*twox2);
chny = std::cosh(n*y);
shny = std::sinh(n*y);
fn = twox - twoxcos2xy*chny + n*sin2xy*shny;
gn = twoxsin2xy*chny + n*cos2xy*shny;
fn *= cofn;
gn *= cofn;
outRe += fn;
outIm += gn;
}
outRe *= 2*cof1;
outIm *= 2*cof1;
if(std::abs(x) < 0.0001)
{
outRe += GetErf(x);
outIm += cof1*y;
}
else
{
outRe += GetErf(x) + cof1*(1-cos2xy)/twox;
outIm += cof1*sin2xy/twox;
}
return G4complex(outRe, outIm);
}
/////////////////////////////////////////////////////////////////
//
//
G4complex G4NuclNuclDiffuseElastic::GetErfInt(G4complex z) // , G4int nMax)
{
G4double outRe, outIm;
G4double x = z.real();
G4double y = z.imag();
fReZ = x;
G4Integrator<G4NuclNuclDiffuseElastic,G4double(G4NuclNuclDiffuseElastic::*)(G4double)> integral;
outRe = integral.Legendre96(this,&G4NuclNuclDiffuseElastic::GetExpSin, 0., y );
outIm = integral.Legendre96(this,&G4NuclNuclDiffuseElastic::GetExpCos, 0., y );
outRe *= 2./std::sqrt(CLHEP::pi);
outIm *= 2./std::sqrt(CLHEP::pi);
outRe += GetErf(x);
return G4complex(outRe, outIm);
}
/////////////////////////////////////////////////////////////////
//
//
G4complex G4NuclNuclDiffuseElastic::GammaLess(G4double theta)
{
G4double sinThetaR = 2.*fHalfRutThetaTg/(1. + fHalfRutThetaTg2);
G4double cosHalfThetaR2 = 1./(1. + fHalfRutThetaTg2);
G4double u = std::sqrt(0.5*fProfileLambda/sinThetaR);
G4double kappa = u/std::sqrt(CLHEP::pi);
G4double dTheta = theta - fRutherfordTheta;
u *= dTheta;
G4double u2 = u*u;
G4double u2m2p3 = u2*2./3.;
G4complex im = G4complex(0.,1.);
G4complex order = G4complex(u,u);
order /= std::sqrt(2.);
G4complex gamma = CLHEP::pi*kappa*GetErfcInt(-order)*std::exp(im*(u*u+0.25*CLHEP::pi));
G4complex a0 = 0.5*(1. + 4.*(1.+im*u2)*cosHalfThetaR2/3.)/sinThetaR;
G4complex a1 = 0.5*(1. + 2.*(1.+im*u2m2p3)*cosHalfThetaR2)/sinThetaR;
G4complex out = gamma*(1. - a1*dTheta) - a0;
return out;
}
/////////////////////////////////////////////////////////////////
//
//
G4complex G4NuclNuclDiffuseElastic::GammaMore(G4double theta)
{
G4double sinThetaR = 2.*fHalfRutThetaTg/(1. + fHalfRutThetaTg2);
G4double cosHalfThetaR2 = 1./(1. + fHalfRutThetaTg2);
G4double u = std::sqrt(0.5*fProfileLambda/sinThetaR);
G4double kappa = u/std::sqrt(CLHEP::pi);
G4double dTheta = theta - fRutherfordTheta;
u *= dTheta;
G4double u2 = u*u;
G4double u2m2p3 = u2*2./3.;
G4complex im = G4complex(0.,1.);
G4complex order = G4complex(u,u);
order /= std::sqrt(2.);
G4complex gamma = CLHEP::pi*kappa*GetErfcInt(order)*std::exp(im*(u*u+0.25*CLHEP::pi));
G4complex a0 = 0.5*(1. + 4.*(1.+im*u2)*cosHalfThetaR2/3.)/sinThetaR;
G4complex a1 = 0.5*(1. + 2.*(1.+im*u2m2p3)*cosHalfThetaR2)/sinThetaR;
G4complex out = -gamma*(1. - a1*dTheta) - a0;
return out;
}
/////////////////////////////////////////////////////////////////
//
//
G4complex G4NuclNuclDiffuseElastic::AmplitudeNear(G4double theta)
{
G4double kappa = std::sqrt(0.5*fProfileLambda/std::sin(theta)/CLHEP::pi);
G4complex out = G4complex(kappa/fWaveVector,0.);
out *= PhaseNear(theta);
if( theta <= fRutherfordTheta )
{
out *= GammaLess(theta) + ProfileNear(theta);
// out *= GammaMore(theta) + ProfileNear(theta);
out += CoulombAmplitude(theta);
}
else
{
out *= GammaMore(theta) + ProfileNear(theta);
// out *= GammaLess(theta) + ProfileNear(theta);
}
return out;
}
/////////////////////////////////////////////////////////////////
//
//
G4complex G4NuclNuclDiffuseElastic::AmplitudeSim(G4double theta)
{
G4double sinThetaR = 2.*fHalfRutThetaTg/(1. + fHalfRutThetaTg2);
G4double dTheta = 0.5*(theta - fRutherfordTheta);
G4double sindTheta = std::sin(dTheta);
G4double persqrt2 = std::sqrt(0.5);
G4complex order = G4complex(persqrt2,persqrt2);
order *= std::sqrt(0.5*fProfileLambda/sinThetaR)*2.*sindTheta;
// order *= std::sqrt(0.5*fProfileLambda/sinThetaR)*2.*dTheta;
G4complex out;
if ( theta <= fRutherfordTheta )
{
out = 1. - 0.5*GetErfcInt(-order)*ProfileNear(theta);
}
else
{
out = 0.5*GetErfcInt(order)*ProfileNear(theta);
}
out *= CoulombAmplitude(theta);
return out;
}
/////////////////////////////////////////////////////////////////
//
//
G4complex G4NuclNuclDiffuseElastic::AmplitudeGla(G4double theta)
{
G4int n;
G4double T12b, b, b2; // cosTheta = std::cos(theta);
G4complex out = G4complex(0.,0.), shiftC, shiftN;
G4complex im = G4complex(0.,1.);
for( n = 0; n < fMaxL; n++)
{
shiftC = std::exp( im*2.*CalculateCoulombPhase(n) );
// b = ( fZommerfeld + std::sqrt( fZommerfeld*fZommerfeld + n*(n+1) ) )/fWaveVector;
b = ( std::sqrt( G4double(n*(n+1)) ) )/fWaveVector;
b2 = b*b;
T12b = fSumSigma*std::exp(-b2/fNuclearRadiusSquare)/CLHEP::pi/fNuclearRadiusSquare;
shiftN = std::exp( -0.5*(1.-im*fEtaRatio)*T12b ) - 1.;
out += (2.*n+1.)*shiftC*shiftN*GetLegendrePol(n, theta);
}
out /= 2.*im*fWaveVector;
out += CoulombAmplitude(theta);
return out;
}
/////////////////////////////////////////////////////////////////
//
//
G4complex G4NuclNuclDiffuseElastic::AmplitudeGG(G4double theta)
{
G4int n;
G4double T12b, a, aTemp, b2, sinThetaH = std::sin(0.5*theta);
G4double sinThetaH2 = sinThetaH*sinThetaH;
G4complex out = G4complex(0.,0.);
G4complex im = G4complex(0.,1.);
a = -fSumSigma/CLHEP::twopi/fNuclearRadiusSquare;
b2 = fWaveVector*fWaveVector*fNuclearRadiusSquare*sinThetaH2;
aTemp = a;
for( n = 1; n < fMaxL; n++)
{
T12b = aTemp*std::exp(-b2/n)/n;
aTemp *= a;
out += T12b;
G4cout<<"out = "<<out<<G4endl;
}
out *= -4.*im*fWaveVector/CLHEP::pi;
out += CoulombAmplitude(theta);
return out;
}
///////////////////////////////////////////////////////////////////////////////
//
// Test for given particle and element table of momentum, angle probability.
// For the partMom in CMS.
void G4NuclNuclDiffuseElastic::InitParameters(const G4ParticleDefinition* theParticle,
G4double partMom, G4double Z, G4double A)
{
fAtomicNumber = Z; // atomic number
fAtomicWeight = A; // number of nucleons
fNuclearRadius2 = CalculateNuclearRad(fAtomicWeight);
G4double A1 = G4double( theParticle->GetBaryonNumber() );
fNuclearRadius1 = CalculateNuclearRad(A1);
// fNuclearRadius = std::sqrt(fNuclearRadius1*fNuclearRadius1+fNuclearRadius2*fNuclearRadius2);
fNuclearRadius = fNuclearRadius1 + fNuclearRadius2;
G4double a = 0.;
G4double z = theParticle->GetPDGCharge();
G4double m1 = theParticle->GetPDGMass();
fWaveVector = partMom/CLHEP::hbarc;
G4double lambda = fCofLambda*fWaveVector*fNuclearRadius;
G4cout<<"kR = "<<lambda<<G4endl;
if( z )
{
a = partMom/m1; // beta*gamma for m1
fBeta = a/std::sqrt(1+a*a);
fZommerfeld = CalculateZommerfeld( fBeta, z, fAtomicNumber);
fRutherfordRatio = fZommerfeld/fWaveVector;
fAm = CalculateAm( partMom, fZommerfeld, fAtomicNumber);
}
G4cout<<"fZommerfeld = "<<fZommerfeld<<G4endl;
fProfileLambda = lambda; // *std::sqrt(1.-2*fZommerfeld/lambda);
G4cout<<"fProfileLambda = "<<fProfileLambda<<G4endl;
fProfileDelta = fCofDelta*fProfileLambda;
fProfileAlpha = fCofAlpha*fProfileLambda;
CalculateCoulombPhaseZero();
CalculateRutherfordAnglePar();
return;
}
///////////////////////////////////////////////////////////////////////////////
//
// Test for given particle and element table of momentum, angle probability.
// For the partMom in CMS.
void G4NuclNuclDiffuseElastic::InitDynParameters(const G4ParticleDefinition* theParticle,
G4double partMom)
{
G4double a = 0.;
G4double z = theParticle->GetPDGCharge();
G4double m1 = theParticle->GetPDGMass();
fWaveVector = partMom/CLHEP::hbarc;
G4double lambda = fCofLambda*fWaveVector*fNuclearRadius;
if( z )
{
a = partMom/m1; // beta*gamma for m1
fBeta = a/std::sqrt(1+a*a);
fZommerfeld = CalculateZommerfeld( fBeta, z, fAtomicNumber);
fRutherfordRatio = fZommerfeld/fWaveVector;
fAm = CalculateAm( partMom, fZommerfeld, fAtomicNumber);
}
fProfileLambda = lambda; // *std::sqrt(1.-2*fZommerfeld/lambda);
fProfileDelta = fCofDelta*fProfileLambda;
fProfileAlpha = fCofAlpha*fProfileLambda;
CalculateCoulombPhaseZero();
CalculateRutherfordAnglePar();
return;
}
///////////////////////////////////////////////////////////////////////////////
//
// Test for given particle and element table of momentum, angle probability.
// For the partMom in CMS.
void G4NuclNuclDiffuseElastic::InitParametersGla(const G4DynamicParticle* aParticle,
G4double partMom, G4double Z, G4double A)
{
fAtomicNumber = Z; // target atomic number
fAtomicWeight = A; // target number of nucleons
fNuclearRadius2 = CalculateNuclearRad(fAtomicWeight); // target nucleus radius
G4double A1 = G4double( aParticle->GetDefinition()->GetBaryonNumber() );
fNuclearRadius1 = CalculateNuclearRad(A1); // projectile nucleus radius
fNuclearRadiusSquare = fNuclearRadius1*fNuclearRadius1+fNuclearRadius2*fNuclearRadius2;
G4double a = 0., kR12;
G4double z = aParticle->GetDefinition()->GetPDGCharge();
G4double m1 = aParticle->GetDefinition()->GetPDGMass();
fWaveVector = partMom/CLHEP::hbarc;
G4double pN = A1 - z;
if( pN < 0. ) pN = 0.;
G4double tN = A - Z;
if( tN < 0. ) tN = 0.;
G4double pTkin = aParticle->GetKineticEnergy();
pTkin /= A1;
fSumSigma = (Z*z+pN*tN)*GetHadronNucleonXscNS(theProton, pTkin, theProton) +
(z*tN+pN*Z)*GetHadronNucleonXscNS(theProton, pTkin, theNeutron);
G4cout<<"fSumSigma = "<<fSumSigma/CLHEP::millibarn<<" mb"<<G4endl;
G4cout<<"pi*R2 = "<<CLHEP::pi*fNuclearRadiusSquare/CLHEP::millibarn<<" mb"<<G4endl;
kR12 = fWaveVector*std::sqrt(fNuclearRadiusSquare);
G4cout<<"k*sqrt(R2) = "<<kR12<<" "<<G4endl;
fMaxL = (G4int(kR12)+1)*4;
G4cout<<"fMaxL = "<<fMaxL<<" "<<G4endl;
if( z )
{
a = partMom/m1; // beta*gamma for m1
fBeta = a/std::sqrt(1+a*a);
fZommerfeld = CalculateZommerfeld( fBeta, z, fAtomicNumber);
fAm = CalculateAm( partMom, fZommerfeld, fAtomicNumber);
}
CalculateCoulombPhaseZero();
return;
}
/////////////////////////////////////////////////////////////////////////////////////
//
// Returns nucleon-nucleon cross-section based on N. Starkov parametrisation of
// data from mainly http://wwwppds.ihep.su:8001/c5-6A.html database
// projectile nucleon is pParticle with pTkin shooting target nucleon tParticle
G4double
G4NuclNuclDiffuseElastic::GetHadronNucleonXscNS( G4ParticleDefinition* pParticle,
G4double pTkin,
G4ParticleDefinition* tParticle)
{
G4double xsection(0), /*Delta,*/ A0, B0;
G4double hpXsc(0);
G4double hnXsc(0);
G4double targ_mass = tParticle->GetPDGMass();
G4double proj_mass = pParticle->GetPDGMass();
G4double proj_energy = proj_mass + pTkin;
G4double proj_momentum = std::sqrt(pTkin*(pTkin+2*proj_mass));
G4double sMand = CalcMandelstamS ( proj_mass , targ_mass , proj_momentum );
sMand /= CLHEP::GeV*CLHEP::GeV; // in GeV for parametrisation
proj_momentum /= CLHEP::GeV;
proj_energy /= CLHEP::GeV;
proj_mass /= CLHEP::GeV;
G4double logS = std::log(sMand);
// General PDG fit constants
// fEtaRatio=Re[f(0)]/Im[f(0)]
if( proj_momentum >= 1.2 )
{
fEtaRatio = 0.13*(logS - 5.8579332)*std::pow(sMand,-0.18);
}
else if( proj_momentum >= 0.6 )
{
fEtaRatio = -75.5*(std::pow(proj_momentum,0.25)-0.95)/
(std::pow(3*proj_momentum,2.2)+1);
}
else
{
fEtaRatio = 15.5*proj_momentum/(27*proj_momentum*proj_momentum*proj_momentum+2);
}
G4cout<<"fEtaRatio = "<<fEtaRatio<<G4endl;
// xsc
if( proj_momentum >= 10. ) // high energy: pp = nn = np
// if( proj_momentum >= 2.)
{
//Delta = 1.;
//if( proj_energy < 40. ) Delta = 0.916+0.0021*proj_energy;
if( proj_momentum >= 10.)
{
B0 = 7.5;
A0 = 100. - B0*std::log(3.0e7);
xsection = A0 + B0*std::log(proj_energy) - 11
+ 103*std::pow(2*0.93827*proj_energy + proj_mass*proj_mass+
0.93827*0.93827,-0.165); // mb
}
}
else // low energy pp = nn != np
{
if(pParticle == tParticle) // pp or nn // nn to be pp
{
if( proj_momentum < 0.73 )
{
hnXsc = 23 + 50*( std::pow( std::log(0.73/proj_momentum), 3.5 ) );
}
else if( proj_momentum < 1.05 )
{
hnXsc = 23 + 40*(std::log(proj_momentum/0.73))*
(std::log(proj_momentum/0.73));
}
else // if( proj_momentum < 10. )
{
hnXsc = 39.0 +
75*(proj_momentum - 1.2)/(std::pow(proj_momentum,3.0) + 0.15);
}
xsection = hnXsc;
}
else // pn to be np
{
if( proj_momentum < 0.8 )
{
hpXsc = 33+30*std::pow(std::log(proj_momentum/1.3),4.0);
}
else if( proj_momentum < 1.4 )
{
hpXsc = 33+30*std::pow(std::log(proj_momentum/0.95),2.0);
}
else // if( proj_momentum < 10. )
{
hpXsc = 33.3+
20.8*(std::pow(proj_momentum,2.0)-1.35)/
(std::pow(proj_momentum,2.50)+0.95);
}
xsection = hpXsc;
}
}
xsection *= CLHEP::millibarn; // parametrised in mb
G4cout<<"xsection = "<<xsection/CLHEP::millibarn<<" mb"<<G4endl;
return xsection;
}
/////////////////////////////////////////////////////////////////
//
// The ratio el/ruth for Fresnel smooth nucleus profile
G4double G4NuclNuclDiffuseElastic::GetRatioGen(G4double theta)
{
G4double sinThetaR = 2.*fHalfRutThetaTg/(1. + fHalfRutThetaTg2);
G4double dTheta = 0.5*(theta - fRutherfordTheta);
G4double sindTheta = std::sin(dTheta);
G4double prof = Profile(theta);
G4double prof2 = prof*prof;
// G4double profmod = std::abs(prof);
G4double order = std::sqrt(fProfileLambda/sinThetaR/CLHEP::pi)*2.*sindTheta;
order = std::abs(order); // since sin changes sign!
// G4cout<<"order = "<<order<<G4endl;
G4double cosFresnel = GetCint(order);
G4double sinFresnel = GetSint(order);
G4double out;
if ( theta <= fRutherfordTheta )
{
out = 1. + 0.5*( (0.5-cosFresnel)*(0.5-cosFresnel)+(0.5-sinFresnel)*(0.5-sinFresnel) )*prof2;
out += ( cosFresnel + sinFresnel - 1. )*prof;
}
else
{
out = 0.5*( (0.5-cosFresnel)*(0.5-cosFresnel)+(0.5-sinFresnel)*(0.5-sinFresnel) )*prof2;
}
return out;
}
///////////////////////////////////////////////////////////////////
//
// For the calculation of arg Gamma(z) one needs complex extension
// of ln(Gamma(z))
G4complex G4NuclNuclDiffuseElastic::GammaLogarithm(G4complex zz)
{
const G4double cof[6] = { 76.18009172947146, -86.50532032941677,
24.01409824083091, -1.231739572450155,
0.1208650973866179e-2, -0.5395239384953e-5 } ;
register G4int j;
G4complex z = zz - 1.0;
G4complex tmp = z + 5.5;
tmp -= (z + 0.5) * std::log(tmp);
G4complex ser = G4complex(1.000000000190015,0.);
for ( j = 0; j <= 5; j++ )
{
z += 1.0;
ser += cof[j]/z;
}
return -tmp + std::log(2.5066282746310005*ser);
}
/////////////////////////////////////////////////////////////
//
// Bessel J0 function based on rational approximation from
// J.F. Hart, Computer Approximations, New York, Willey 1968, p. 141
G4double G4NuclNuclDiffuseElastic::BesselJzero(G4double value)
{
G4double modvalue, value2, fact1, fact2, arg, shift, bessel;
modvalue = std::fabs(value);
if ( value < 8.0 && value > -8.0 )
{
value2 = value*value;
fact1 = 57568490574.0 + value2*(-13362590354.0
+ value2*( 651619640.7
+ value2*(-11214424.18
+ value2*( 77392.33017
+ value2*(-184.9052456 ) ) ) ) );
fact2 = 57568490411.0 + value2*( 1029532985.0
+ value2*( 9494680.718
+ value2*(59272.64853
+ value2*(267.8532712
+ value2*1.0 ) ) ) );
bessel = fact1/fact2;
}
else
{
arg = 8.0/modvalue;
value2 = arg*arg;
shift = modvalue-0.785398164;
fact1 = 1.0 + value2*(-0.1098628627e-2
+ value2*(0.2734510407e-4
+ value2*(-0.2073370639e-5
+ value2*0.2093887211e-6 ) ) );
fact2 = -0.1562499995e-1 + value2*(0.1430488765e-3
+ value2*(-0.6911147651e-5
+ value2*(0.7621095161e-6
- value2*0.934945152e-7 ) ) );
bessel = std::sqrt(0.636619772/modvalue)*(std::cos(shift)*fact1 - arg*std::sin(shift)*fact2 );
}
return bessel;
}
/////////////////////////////////////////////////////////////
//
// Bessel J1 function based on rational approximation from
// J.F. Hart, Computer Approximations, New York, Willey 1968, p. 141
G4double G4NuclNuclDiffuseElastic::BesselJone(G4double value)
{
G4double modvalue, value2, fact1, fact2, arg, shift, bessel;
modvalue = std::fabs(value);
if ( modvalue < 8.0 )
{
value2 = value*value;
fact1 = value*(72362614232.0 + value2*(-7895059235.0
+ value2*( 242396853.1
+ value2*(-2972611.439
+ value2*( 15704.48260
+ value2*(-30.16036606 ) ) ) ) ) );
fact2 = 144725228442.0 + value2*(2300535178.0
+ value2*(18583304.74
+ value2*(99447.43394
+ value2*(376.9991397
+ value2*1.0 ) ) ) );
bessel = fact1/fact2;
}
else
{
arg = 8.0/modvalue;
value2 = arg*arg;
shift = modvalue - 2.356194491;
fact1 = 1.0 + value2*( 0.183105e-2
+ value2*(-0.3516396496e-4
+ value2*(0.2457520174e-5
+ value2*(-0.240337019e-6 ) ) ) );
fact2 = 0.04687499995 + value2*(-0.2002690873e-3
+ value2*( 0.8449199096e-5
+ value2*(-0.88228987e-6
+ value2*0.105787412e-6 ) ) );
bessel = std::sqrt( 0.636619772/modvalue)*(std::cos(shift)*fact1 - arg*std::sin(shift)*fact2);
if (value < 0.0) bessel = -bessel;
}
return bessel;
}
//
//
/////////////////////////////////////////////////////////////////////////////////