Import Geant4 8.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:44:26 +02:00
parent 8a51e0bc40
commit 216a75eeb1
8717 changed files with 360418 additions and 141343 deletions
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.3 2003/10/08 16:42:19 hpw Exp $
# $Id: GNUmakefile,v 1.5 2006/04/18 16:53:05 vnivanch Exp $
# -----------------------------------------------------------
# GNUmakefile for hadronic library. Gabriele Cosmo, 18/9/96.
# -----------------------------------------------------------
@@ -21,6 +21,9 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/hadronic/management/include/ \
-I$(G4BASE)/processes/hadronic/models/management/include/ \
-I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/interface/include/ \
-I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/body/include/ \
-I$(G4BASE)/processes/hadronic/models/neutron_hp/include/ \
-I$(G4BASE)/processes/hadronic/util/include \
-I$(G4BASE)/processes/hadronic/cross_sections/include/ \
-I$(G4BASE)/particles/management/include \
@@ -30,8 +33,5 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/myexample/include
CPPFLAGS+=-I$(G4INSTALL)/tests/tools/include -DMAKEHBOOK -DMAKEBOOK
include $(G4INSTALL)/config/common.gmk
@@ -14,6 +14,57 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
21 June 2006 - V.Ivanchenko (hadr-cohe-V08-00-09)
-----------------------------------------------
Fix - remove nan values n scattering on deuteron (V.Ivanchenko)
17 June 2006 - V.Ivanchenko (ghad-cohe-V08-00-08)
-----------------------------------------------
Use sampling of final state for n, p scattering on deuteron
and alpha from LElastic (V.Ivanchenko)
7 June 2006 - V.Ivanchenko (ghad-cohe-V08-00-07)
-----------------------------------------------
Fix complilation warnings at WINDOWS (V.Ivanchenko)
2 June 2006 - V.Ivanchenko (ghad-cohe-V08-00-06)
-----------------------------------------------
Fix complilation warnings at SUN (V.Ivanchenko)
1 June 2006 - V.Ivanchenko (ghad-cohe-V08-00-05)
-----------------------------------------------
Add regime of HElastic which is not using data files (N.Starkov)
Cleanup (V.Ivanchenko)
30 May 2006 - V.Ivanchenko (ghad-cohe-V08-00-04)
-----------------------------------------------
Add ChargeExchangeProcess, cleanup G4HadronElastic
2 May 2006 - V.Ivanchenko (ghad-cohe-V08-00-03)
-----------------------------------------------
Rename G4LElasticB -> G4HadronElastic
25 April 2006 - V.Ivanchenko (ghad-cohe-V08-00-02)
-------------------------------------------------
G4UHadronElasticProcess and G4LElasticB: use np scattering from CHIPS,
fix run time warnings
Rename G4LElasticB by G4HadronElastic
24 April 2006 - V.Ivanchenko (ghad-cohe-V08-00-01)
-------------------------------------------------
G4UHadronElasticProcess - new process allows to use G4Isotopes composition
of elements defined by user and uses cross sections from
CHIPS and HP models when appropriate
13 April 2006 - V.Ivanchenko (ghad-cohe-V08-00-00)
-------------------------------------------------
G4LElasticB - moved from low_energy; bug fixes - remove charge
exchange option, remove low limit on primary momentum;
add limit on secondary kinetic energy; add only s-wave
regime for low momentum scattering
GNUmakfile - introduce dependence on chips
28 Nov 2005 - G. Cosmo (hadr-cohe-V07-01-05)
---------------------------------------------
Migrated to <sstream> from G4ElasticHadrNucleusHE.
@@ -0,0 +1,126 @@
//
// ********************************************************************
// * 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: G4ChargeExchange.hh,v 1.2 2006/06/29 20:08:55 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// G4 Model: Charge and strangness exchange based on G4LightMedia model
// 28 May 2006 V.Ivanchenko
//
// Modified:
//
//
#ifndef G4ChargeExchange_h
#define G4ChargeExchange_h 1
// Class Description
// Final state production model for hadron nuclear coherent charge exchange;
// Class Description - End
#include "globals.hh"
#include "G4HadronicInteraction.hh"
#include "G4HadProjectile.hh"
#include "G4Nucleus.hh"
class G4ParticleDefinition;
class G4VQCrossSection;
class G4ElasticHadrNucleusHE;
class G4HadronElastic;
class G4ChargeExchange : public G4HadronicInteraction
{
public:
G4ChargeExchange(G4HadronElastic* hel = 0,
G4double elim = 100.*keV,
G4double plow = 200.*MeV,
G4double ehigh= GeV);
virtual ~G4ChargeExchange();
virtual G4HadFinalState * ApplyYourself(
const G4HadProjectile & aTrack,
G4Nucleus & targetNucleus);
void SetMomentumLow(G4double value);
void SetKinEnergyHigh(G4double value);
private:
G4VQCrossSection* qCManager;
G4ElasticHadrNucleusHE* hElastic;
G4HadronElastic* fElastic;
G4bool native;
G4ParticleDefinition* theProton;
G4ParticleDefinition* theNeutron;
G4ParticleDefinition* theAProton;
G4ParticleDefinition* theANeutron;
G4ParticleDefinition* thePiPlus;
G4ParticleDefinition* thePiMinus;
G4ParticleDefinition* thePiZero;
G4ParticleDefinition* theKPlus;
G4ParticleDefinition* theKMinus;
G4ParticleDefinition* theK0S;
G4ParticleDefinition* theK0L;
G4ParticleDefinition* theL;
G4ParticleDefinition* theAntiL;
G4ParticleDefinition* theSPlus;
G4ParticleDefinition* theASPlus;
G4ParticleDefinition* theSMinus;
G4ParticleDefinition* theASMinus;
G4ParticleDefinition* theS0;
G4ParticleDefinition* theAS0;
G4ParticleDefinition* theXiMinus;
G4ParticleDefinition* theXi0;
G4ParticleDefinition* theAXiMinus;
G4ParticleDefinition* theAXi0;
G4ParticleDefinition* theOmega;
G4ParticleDefinition* theAOmega;
G4ParticleDefinition* theD;
G4ParticleDefinition* theT;
G4ParticleDefinition* theA;
G4ParticleDefinition* theHe3;
G4double ekinlim; // in MeV
G4double plablow; // in MeV/c
G4double ekinhigh; // in MeV/c
};
inline void G4ChargeExchange::SetMomentumLow(G4double value)
{
plablow = value;
}
inline void G4ChargeExchange::SetKinEnergyHigh(G4double value)
{
ekinhigh = value;
}
#endif
@@ -0,0 +1,128 @@
//
// ********************************************************************
// * 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: G4ChargeExchangeProcess.hh,v 1.2 2006/06/29 20:08:57 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// Geant4 Hadron Elastic Charge Exchange Process -- header file
//
// Created 21 April 2006 V.Ivanchenko
//
// Modified:
//
// Class Description
// Process for hadron nuclear elastic scattering using optimal
// combination of Geant4 models
// Class Description - End
#ifndef G4ChargeExchangeProcess_h
#define G4ChargeExchangeProcess_h 1
#include "globals.hh"
#include "G4HadronicProcess.hh"
#include "G4Nucleus.hh"
class G4VQCrossSection;
class G4ParticleDefinition;
class G4CrossSectionDataStore;
class G4PhysicsLinearVector;
class G4ChargeExchangeProcess : public G4HadronicProcess
{
public:
G4ChargeExchangeProcess(const G4String& procName = "chargeExc");
virtual ~G4ChargeExchangeProcess();
virtual G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
const G4Step& aStep);
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
virtual void BuildPhysicsTable(const G4ParticleDefinition& aParticleType);
virtual void DumpPhysicsTable(const G4ParticleDefinition& aParticleType);
virtual G4double GetMeanFreePath(const G4Track&, G4double, G4ForceCondition*);
virtual G4double GetMicroscopicCrossSection(const G4DynamicParticle* aParticle,
const G4Element* anElement,
G4double aTemp);
void SetQElasticCrossSection(G4VQCrossSection*);
private:
G4VQCrossSection* qCManager;
const G4ParticleDefinition* theParticle;
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* theNeutron;
const G4ParticleDefinition* theAProton;
const G4ParticleDefinition* theANeutron;
const G4ParticleDefinition* thePiPlus;
const G4ParticleDefinition* thePiMinus;
const G4ParticleDefinition* thePiZero;
const G4ParticleDefinition* theKPlus;
const G4ParticleDefinition* theKMinus;
const G4ParticleDefinition* theK0S;
const G4ParticleDefinition* theK0L;
const G4ParticleDefinition* theL;
const G4ParticleDefinition* theAntiL;
const G4ParticleDefinition* theSPlus;
const G4ParticleDefinition* theASPlus;
const G4ParticleDefinition* theSMinus;
const G4ParticleDefinition* theASMinus;
const G4ParticleDefinition* theS0;
const G4ParticleDefinition* theAS0;
const G4ParticleDefinition* theXiMinus;
const G4ParticleDefinition* theXi0;
const G4ParticleDefinition* theAXiMinus;
const G4ParticleDefinition* theAXi0;
const G4ParticleDefinition* theOmega;
const G4ParticleDefinition* theAOmega;
const G4ParticleDefinition* theD;
const G4ParticleDefinition* theT;
const G4ParticleDefinition* theA;
const G4ParticleDefinition* theHe3;
G4CrossSectionDataStore* store;
G4Nucleus targetNucleus;
G4PhysicsLinearVector* factors;
G4double xsec[40];
G4double cross;
G4double thEnergy;
G4int pPDG;
G4bool first;
};
#endif
@@ -1,40 +1,41 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4DiffElasticHadrNucleus.hh,v 1.13 2005/11/25 19:17:32 dennis Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4DiffElasticHadrNucleus.hh,v 1.15 2006/06/29 20:08:59 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// G4DiffElasticHadrNucleus header file
//
// High energy hadron-nucleus elastic scattering
// Kinetic energy T > 1 GeV
// N. Starkov 2003.
// N. Starkov 2003.
//
// Modifications:
// 14.11.05 The HE elastic scattering on proton is added (N.Starkov)
// 23.11.05 int -> G4int, fabs -> abs (V.Ivanchenko)
// 30.05.06 New version, which not uses elastic data (N.Starkov)
// 30.05.06 cleanup (V.Ivanchenko)
//
#ifndef G4DiffElasticHadrNucleus_h
@@ -45,14 +46,52 @@
#include "G4HadronValues.hh"
#include "G4IntegrHadrNucleus.hh"
class G4DiffElasticHadrNucleus: public G4IntegrHadrNucleus
// ###############################################
class NucleusParameters
{
public:
NucleusParameters() {;}
virtual ~NucleusParameters(){;}
NucleusParameters & operator= (const NucleusParameters &t)
{
if(this!=&t)
{
R1 = t.R1;
R2 = t.R2;
Aeff = t.Aeff;
Pnucl = t.Pnucl;
}
return *this;
}
void GetNucleusParameters(G4int AtWeight);
G4double R1, R2, Aeff, Pnucl;
};
// ################################################
class G4DiffElasticHadrNucleus: public //G4HadronValues
G4IntegrHadrNucleus
{
public:
G4DiffElasticHadrNucleus();
G4DiffElasticHadrNucleus() : // G4HadronValues(),
G4IntegrHadrNucleus()
{
Factors();
Binom();
r0 = 1.1; // The WS's parameters
r01 = 1.16;
rAmax = 2.5;
NpointsB = 500;
FmToGeV = 5.068;
Fm2ToGeV2= FmToGeV*FmToGeV;
}
~G4DiffElasticHadrNucleus();
virtual ~G4DiffElasticHadrNucleus() {;}
G4double HadrNuclDifferCrSec(
const G4DynamicParticle * aHadron,
@@ -84,13 +123,13 @@ public:
G4double p);
// ====================================================
G4double MyJ0(G4double x)
{
G4double x1, x2, x3, x4, x5, x6, x7, f0, th0, res;
{
G4double x1, x2, x3, x4, x5, x6, x7, f0, th0, res;
x2 = x*x/9.0;
x2 = x*x/9.0;
if(std::abs(x)<=3.0)
{
if(std::fabs(x)<=3.0)
{
x3 = x2*x2;
x4 = x3*x2;
x5 = x4*x2;
@@ -99,9 +138,9 @@ public:
res = 1.0-2.2499997*x2+1.2656208*x3-
0.3163866*x4+0.0444479*x5-
0.0039444*x6+0.0002100*x7;
}
else
{
}
else
{
x1 = x/3.0;
x3 = x2*x1;
x4 = x3*x1;
@@ -116,12 +155,12 @@ public:
0.00054125/x4-0.00029333/x5+
0.00013558/x6;
res = f0*std::cos(th0)/std::sqrt(x);
}
return res;
}
}
return res;
}
// +++++++++++++++++++++++++++++++++++++++++++++
G4double MyI0(G4double x)
{
{
G4double p1=1.0, p2=3.5156229, p3=3.0899424,
p4=1.2067492, p5=0.2659732, p6=3.360768e-2,
p7=4.5813e-3;
@@ -129,61 +168,113 @@ public:
q4=-1.57565e-3, q5=9.16281e-3, q6=-2.057706e-2,
q7=2.635537e-2, q8=-1.647633e-2, q9=3.922377e-3;
G4double k1=3.75, ax=std::abs(x), y=0.0, result=0.0;
G4double k1=3.75, ax=std::fabs(x), y=0.0, result=0.0;
if(ax<k1)
{
G4double xx = x/k1;
y = xx*xx;
result = p1+y*(p2+y*(p3+y*(p4+y*(p5+y*(p6+y*p7)))));
}
{
G4double xx = x/k1;
y = xx*xx;
result = p1+y*(p2+y*(p3+y*(p4+y*(p5+y*(p6+y*p7)))));
}
else
{
y = k1/ax;
result = std::exp(ax)/std::sqrt(ax)*(q1+y*(q2+y*(q3+y*(q4+
y*(q5+y*(q6+y*(q7+y*(q8+y*q9))))))));
}
return result;
}
{
y = k1/ax;
result = std::exp(ax)/std::sqrt(ax)*(q1+y*(q2+y*(q3+y*(q4+
y*(q5+y*(q6+y*(q7+y*(q8+y*q9))))))));
}
return result;
}
private:
void Factors();
// private:
// ++++++++++++++++++++++++++++++++++++++++++++++++++
G4double binom(G4int N, G4int M)
{
G4double Fact1 = 1;
if ((N>1) & (N>=M))
{
Fact1 = Factorials[N]/Factorials[M]/
Factorials[N-M];
}
return Fact1;
}
void Binom()
{
G4int N, M;
G4double Fact1, J;
for(N=0; N<240; N++)
{
J = 1;
for(M=0; M<=N; M++)
{
Fact1 = 1;
if ((N>0) && (N>M) && M>0)
{
J = J*(N-M+1)/M;
Fact1 = J;
}
SetBinom[N][M] = Fact1;
// G4cout<<" N M "<<N<<" "<<M<<" F "<<Fact1<<G4endl;
}
}
return;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++
G4double binom(G4int N, G4int M)
{
G4double Fact1 = 1;
if((N>1) & (N>=M))
Fact1 = Factorials[N]/Factorials[M]/Factorials[N-M];
return Fact1;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++
G4double Factorial(G4int N)
{
G4double Res=1;
{
G4double Res=1;
if(N == 0) return Res;
if(N == 0) return Res;
if(N < 100) for(G4int M = 1; M<=N; M++) Res = Res*M;
if(N < 100) for(G4int M = 1; M<=N; M++) Res = Res*M;
if(N >= 100) Res = 2.50662827*
std::exp(static_cast<double>(-N-1))*
std::pow(static_cast<double>(N+1),N+0.5)*
(1+1/12/(N+1)+1/288/(N+1)/(N+1)-
139/51840/(N+1)/(N+1)/(N+1)-
571/2488320/(N+1)/(N+1)/(N+1)/(N+1));
if(N >= 100) Res = 2.50662827*
std::exp(static_cast<double>(-N-1))*
std::pow(static_cast<double>(N+1),N+0.5)*
(1.+1./12./(N+1)+1./288./(N+1)/(N+1)-
139./51840./(N+1)/(N+1)/(N+1)-
571./2488320./(N+1)/(N+1)/(N+1)/(N+1));
return Res;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++
void Factors()
{
G4int ii, ll, mm;
G4double Sum1, Fac1, Fac3, Sum3;
return Res;
}
Factorials[0] = 1;
for( ii = 1; ii<140; ii++)
{
Factorials[ii] = Factorial(ii);
if(ii >= 100) Mnoj[ii] = 3.03; // there is the saturation
else
{
Sum1 = 0;
Fac1 = 1;
for( ll = 0; ll<=ii; ll++)
{
Fac1 = binom(ii,ll);
Fac3 = 1;
Sum3 = 1;
for( mm = 1; mm<=ii-ll; mm++)
{
Fac3 = binom(ii-ll,mm);
Sum3 = Sum3 + 1/Fac3;
} // mm
Sum1 = Sum1 + Sum3/Fac1;
} // ll
Mnoj[ii] = Sum1;
} // else
} // ii
Mnoj[0] = 1;
} // Factors
// --------------------------------------------------------
public:
G4double Fm2ToGeV2, FmToGeV;
G4double SigTot, Slope, ReOnIm, HdrE, ConstU, Q2;
G4double ProtonM, HadronM, HadronE, Sh, PM2, HM2;
@@ -201,6 +292,7 @@ public:
G4double r0, r01, rAmax;
G4double BoundaryP[7], BoundaryTL[7], BoundaryTG[7];
G4int NpointsB, HadrCodes[7], Intern;
G4double SetBinom[240][240];
};
#endif
@@ -1,32 +1,34 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4ElasticHadrNucleusHE.hh,v 1.17 2005/11/23 11:24:08 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// $Id: G4ElasticHadrNucleusHE.hh,v 1.25 2006/06/29 20:09:01 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// G4ElasticHadrNucleusHe.hh
//
// G4ElasticHadrNucleusHe header file
//
// The generator of high energy hadron-nucleus elastic scattering
// The hadron kinetic energy T > 1 GeV
// N. Starkov 2003.
@@ -34,7 +36,7 @@
// Modifications:
// 19.05.04 Variant for G4 6.1: The 'ApplyYourself' was changed
// 14.11.05 The HE elastic scattering on proton is added (N.Starkov)
// 23.11.05 cleanup (V.Ivanchenko)
// 30.05.06 Version without use of elastic data (N.Starkov)
//
#ifndef G4ElasticHadrNucleusHE_h
@@ -68,9 +70,25 @@
class ElasticData
{
public:
G4String hadrName;
G4int nuclAtomicNumber;
G4double TableE[ONE*AreaNumb];
G4double TableQ2[ONQ2];
G4double TableFQ2[ONQ2];
G4double TableCrossSec[ONQ2XE*AreaNumb];
G4double CurrentT;
G4int CurrentN, Nstep;
G4double RandMax, theMaxQ2;
G4double Weight, dQ2;
G4double theR1, R2, Pnucl, Aeff;
NucleusParameters NucPar;
ElasticData() {};
~ElasticData() {};
ElasticData() {;}
ElasticData(G4String HadrName, G4int AtomWeight);
virtual ~ElasticData(){;}
ElasticData (const ElasticData &t)
{
@@ -78,18 +96,28 @@ public:
hadrName = t.hadrName;
nuclAtomicNumber = t.nuclAtomicNumber;
for(k = 0; k<ONE*AreaNumb; k++) TableE[k] = t.TableE[k];
for(k = 0; k<ONQ2; k++) TableQ2[k] = t.TableQ2[k];
for(k = 0; k< ONQ2XE*AreaNumb; k++)
TableCrossSec[k] = t.TableCrossSec[k];
theR1 = t.theR1;
R2 = t.R2;
Aeff = t.Aeff;
Pnucl = t.Pnucl;
theMaxQ2 = t.theMaxQ2;
dQ2 = t.dQ2;
NucPar = t.NucPar;
}
ElasticData & operator=(const ElasticData &t)
{
G4int k;
if(this!=&t)
if(this!=&t)
{
hadrName = t.hadrName;
nuclAtomicNumber = t.nuclAtomicNumber;
@@ -99,9 +127,18 @@ public:
for(k = 0; k<ONQ2; k++) TableQ2[k] = t.TableQ2[k];
for(k = 0; k< ONQ2XE*AreaNumb; k++)
TableCrossSec[k] = t.TableCrossSec[k];
}
return *this;
TableCrossSec[k] = t.TableCrossSec[k];
theR1 = t.theR1;
R2 = t.R2;
Aeff = t.Aeff;
Pnucl = t.Pnucl;
theMaxQ2 = t.theMaxQ2;
NucPar = t.NucPar;
dQ2 = t.dQ2;
}
return *this;
}
void Clean()
@@ -116,110 +153,115 @@ public:
for(k = 0; k< ONQ2XE*AreaNumb; k++) TableCrossSec[k] = 0;
theR1 = 0;
R2 = 0;
Aeff = 0;
Pnucl = 0;
theMaxQ2 = 0;
}
G4String hadrName;
G4int nuclAtomicNumber;
G4double TableE[ONE*AreaNumb];
G4double TableQ2[ONQ2];
G4double TableCrossSec[ONQ2XE*AreaNumb];
G4double GetQ2limit(G4double aR1);
G4int GetNumberE(G4double E);
};
// ############################################################
class G4ElasticHadrNucleusHE : public G4DiffElasticHadrNucleus,
public G4HadronicInteraction
{
public:
G4ElasticHadrNucleusHE(const G4ParticleDefinition * aHadron,
G4Nucleus * aNucleus);
G4Nucleus * aNucleus);
G4ElasticHadrNucleusHE();
~G4ElasticHadrNucleusHE();
virtual ~G4ElasticHadrNucleusHE() {;}
G4HadFinalState * ApplyYourself( const G4HadProjectile &aTrack,
G4Nucleus &aNucleus);
G4Nucleus &aNucleus);
G4double RandomElastic0();
G4double RandomElastic1( const G4DynamicParticle * aHadron,
const ElasticData * aData);
void GetHadronNucleusData(G4DynamicParticle * aParticle,
G4Nucleus * aNucleus,
ElasticData & ElD );
G4double SampleT(const G4ParticleDefinition* p,
G4double pTotLabMomentum, G4int Z, G4int N);
G4double SampleT1(const G4ParticleDefinition* p,
G4double pTotLabMomentum, G4int Z, G4int N);
G4bool GetHadronNucleusData(G4DynamicParticle * aParticle,
G4Nucleus * aNucleus,
ElasticData & ElD );
private:
public:
G4int ReadOfData(G4ParticleDefinition * aParticle,
G4Nucleus * aNucleus);
G4double GetQ2limit(G4double R1);
G4double GetQ2limit(G4double aR1);
void CreationArray(const G4DynamicParticle * aHadron,
G4Nucleus * aNucleus);
G4Nucleus * aNucleus);
void ArrayForHeavy(const G4DynamicParticle * aHadron,
G4Nucleus * aNucleus);
G4Nucleus * aNucleus);
void ArrayForLight(const G4DynamicParticle * aHadron,
G4Nucleus * aNucleus);
G4Nucleus * aNucleus);
G4double InterPol(G4double X1, G4double X2, G4double X3,
G4double Y1, G4double Y2, G4double Y3,
G4double X);
G4double Y1, G4double Y2, G4double Y3,
G4double X);
G4double HadronNucleusQ2(G4DynamicParticle * aHadron,
G4Nucleus & aNucleus);
G4Nucleus & aNucleus);
G4double HadronNucleusQ2_2(G4DynamicParticle * aHadron,
G4int A, G4int kk,
ElasticData * pElD);
G4double GetLightFq2(G4int N, G4double Q, G4int Step,
NucleusParameters * NP);
G4int GetBinom(G4int m, G4int n);
// ======================================================
G4DynamicParticle aHad;
G4float GetFt(G4double T);
G4float GetDistrFun(G4double Q2);
G4double GetQ2(G4double Ran);
G4double GetQ2_2(G4int N, G4double * Q,
G4double * F, G4double R);
G4double HadronProtonQ2(G4DynamicParticle * aHadron);
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++
G4double Factorial1(G4int N)
{
G4double Res=1;
if(N == 0) return Res;
if(N < 100) for(G4int M = 1; M<=N; M++) Res = Res*M;
else Res = 2.50662827*
std::exp(static_cast<double>(-N-1))*
std::pow(static_cast<double>(N+1),N+0.5)*
(1+1/12/(N+1)+1/288/(N+1)/(N+1)-
139/51840/(N+1)/(N+1)/(N+1)-
571/2488320/(N+1)/(N+1)/(N+1)/(N+1));
return Res;
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++
G4DynamicParticle aHad;
G4double Weight;
G4int HadrCode;
G4String HadronName;
// G4double RR1, R2, Pnucl, Aeff;
std::vector<ElasticData> SetOfElasticData;
ElasticData ElD;
NucleusParameters NucPar;
G4IonTable * MyIonTable;
G4DiffElasticHadrNucleus aDiffElHadNcls;
// G4HadFinalState FinState;
G4int Nstep, // The number of steps on Q2
iKindWork, //
iContr, //
iPoE; // The number of steps on E
G4int iTypeWork;
G4int iTypeWork, CurrentN;
G4double aNucleon;
// ,* pTableCrSec, // The array of distr. func.
// // at all energies
// * pTableE; // The array of E values
G4double iQ2[ONQ2], // The array of Q2 values
pTableCrSec[ONQ2XE*AreaNumb],
pTableE[ONE*AreaNumb],
iIntgr[ONQ2], // The array of distr. func.
// at one energy
// at one energy
Factorials1[250]; // The array for factorials
G4double dEbeg1, dEend1, dQ2, maxQ2;
G4double dEbeg1, dEend1, dQ2, maxQ2, RandMax;
}; // The end of the class description
// ######################################################
#endif
@@ -0,0 +1,126 @@
//
// ********************************************************************
// * 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: G4HadronElastic.hh,v 1.11 2006/06/29 20:09:03 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// G4 Model: Low energy elastic scattering with 4-momentum balance
// Derived fron G4LElastic of F.W. Jones, TRIUMF, 04-JUN-96
// Uses G4ElasticHadrNucleusHE and G4VQCrossSection
//
// Modified:
// 14-Dec-05 V.Ivanchenko rename the class
// 13-Apr-06 V.Ivanchenko move to coherent_elastic
//
//
// Class Description
// Final state production model for hadron nuclear elastic scattering;
// Class Description - End
#ifndef G4HadronElastic_h
#define G4HadronElastic_h 1
#include "globals.hh"
#include "G4HadronicInteraction.hh"
#include "G4HadProjectile.hh"
#include "G4Nucleus.hh"
enum G4ElasticGenerator
{
fLElastic = 0,
fHElastic,
fQElastic,
fSWave
};
class G4ParticleDefinition;
class G4VQCrossSection;
class G4ElasticHadrNucleusHE;
class G4HadronElastic : public G4HadronicInteraction
{
public:
G4HadronElastic(G4double elim = 100.*keV,
G4double plow = 20.*MeV,
G4double ehigh= DBL_MAX);
virtual ~G4HadronElastic();
G4HadFinalState * ApplyYourself(const G4HadProjectile & aTrack,
G4Nucleus & targetNucleus);
G4VQCrossSection* GetCS();
G4ElasticHadrNucleusHE* GetHElastic();
void SetMomentumLow(G4double value);
void SetKinEnergyHigh(G4double value);
G4double SampleT(G4double p, G4double m1, G4double m2, G4double A);
private:
G4int Rtmi(G4double* x, G4double xli, G4double xri, G4double eps,
G4int iend,
G4double aa, G4double bb, G4double cc, G4double dd,
G4double rr);
G4double Fctcos(G4double t,
G4double aa, G4double bb, G4double cc, G4double dd,
G4double rr);
void Defs1(G4double p, G4double px, G4double py, G4double pz,
G4double pxinc, G4double pyinc, G4double pzinc,
G4double* pxnew, G4double* pynew, G4double* pznew);
G4VQCrossSection* qCManager;
G4ElasticHadrNucleusHE* hElastic;
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* theNeutron;
const G4ParticleDefinition* theDeuteron;
const G4ParticleDefinition* theAlpha;
G4double ekinlim; // in MeV
G4double plablow; // in MeV/c
G4double ekinhigh; // in MeV/c
};
inline void G4HadronElastic::SetMomentumLow(G4double value)
{
plablow = value;
}
inline void G4HadronElastic::SetKinEnergyHigh(G4double value)
{
ekinhigh = value;
}
#endif
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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.hh,v 1.9 2005/11/23 11:24:08 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4HadronValues.hh,v 1.10 2006/06/29 20:09:05 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
// G4IntegrHadrNucleus.hh
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
//
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
//
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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: G4UHadronElasticProcess.hh,v 1.5 2006/06/29 20:09:17 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Geant4 Hadron Elastic Scattering Process -- header file
//
// Created 21 April 2006 V.Ivanchenko
//
// Modified:
//
// Class Description
// Process for hadron nuclear elastic scattering using optimal
// combination of Geant4 models
// Class Description - End
#ifndef G4UHadronElasticProcess_h
#define G4UHadronElasticProcess_h 1
#include "globals.hh"
#include "G4HadronicProcess.hh"
#include "G4Nucleus.hh"
class G4VQCrossSection;
class G4ParticleDefinition;
class G4CrossSectionDataStore;
class G4UHadronElasticProcess : public G4HadronicProcess
{
public:
G4UHadronElasticProcess(const G4String& procName = "hElastic", G4bool fl = true);
virtual ~G4UHadronElasticProcess();
virtual G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
const G4Step& aStep);
virtual G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
virtual void BuildPhysicsTable(const G4ParticleDefinition& aParticleType);
virtual void DumpPhysicsTable(const G4ParticleDefinition& aParticleType);
virtual G4double GetMeanFreePath(const G4Track&, G4double, G4ForceCondition*);
virtual G4double GetMicroscopicCrossSection(const G4DynamicParticle* aParticle,
const G4Element* anElement,
G4double aTemp);
void SetQElasticCrossSection(G4VQCrossSection*);
private:
G4VQCrossSection* qCManager;
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* theNeutron;
const G4ParticleDefinition* theParticle;
G4CrossSectionDataStore* store;
G4Nucleus targetNucleus;
G4double xsec[40];
G4double xsecH[2];
G4double cross;
G4double thEnergy;
G4int pPDG;
G4bool flagHP;
G4bool first;
};
#endif
@@ -0,0 +1,329 @@
//
// ********************************************************************
// * 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: G4ChargeExchange.cc,v 1.3 2006/06/29 20:09:19 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// G4 Model: Charge and strangness exchange based on G4LightMedia model
// 28 May 2006 V.Ivanchenko
//
// Modified:
//
#include "G4ChargeExchange.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4IonTable.hh"
#include "G4QElasticCrossSection.hh"
#include "G4VQCrossSection.hh"
#include "G4ElasticHadrNucleusHE.hh"
#include "Randomize.hh"
#include "G4HadronElastic.hh"
G4ChargeExchange::G4ChargeExchange(G4HadronElastic* hel, G4double elim,
G4double plow, G4double ehigh)
: G4HadronicInteraction(),
fElastic(hel),
native(false),
ekinlim(elim),
plablow(plow),
ekinhigh(ehigh)
{
SetMinEnergy( 0.0*GeV );
SetMaxEnergy( DBL_MAX );
verboseLevel= 0;
if(!fElastic) {
native = true;
fElastic = new G4HadronElastic(elim, plow, ehigh);
}
qCManager = fElastic->GetCS();
hElastic = fElastic->GetHElastic();
theProton = G4Proton::Proton();
theNeutron = G4Neutron::Neutron();
theAProton = G4AntiProton::AntiProton();
theANeutron = G4AntiNeutron::AntiNeutron();
thePiPlus = G4PionPlus::PionPlus();
thePiMinus = G4PionMinus::PionMinus();
thePiZero = G4PionZero::PionZero();
theKPlus = G4KaonPlus::KaonPlus();
theKMinus = G4KaonMinus::KaonMinus();
theK0S = G4KaonZeroShort::KaonZeroShort();
theK0L = G4KaonZeroLong::KaonZeroLong();
theL = G4Lambda::Lambda();
theAntiL = G4AntiLambda::AntiLambda();
theSPlus = G4SigmaPlus::SigmaPlus();
theASPlus = G4AntiSigmaPlus::AntiSigmaPlus();
theSMinus = G4SigmaMinus::SigmaMinus();
theASMinus = G4AntiSigmaMinus::AntiSigmaMinus();
theS0 = G4SigmaZero::SigmaZero();
theAS0 = G4AntiSigmaZero::AntiSigmaZero();
theXiMinus = G4XiMinus::XiMinus();
theXi0 = G4XiZero::XiZero();
theAXiMinus = G4AntiXiMinus::AntiXiMinus();
theAXi0 = G4AntiXiZero::AntiXiZero();
theOmega = G4OmegaMinus::OmegaMinus();
theAOmega = G4AntiOmegaMinus::AntiOmegaMinus();
theD = G4Deuteron::Deuteron();
theT = G4Triton::Triton();
theA = G4Alpha::Alpha();
theA = G4He3::He3();
}
G4ChargeExchange::~G4ChargeExchange()
{
if(native) delete fElastic;
}
G4HadFinalState* G4ChargeExchange::ApplyYourself(
const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
{
theParticleChange.Clear();
const G4HadProjectile* aParticle = &aTrack;
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;
G4double plab = aParticle->GetTotalMomentum();
G4double ekin = aParticle->GetKineticEnergy();
if (verboseLevel > 1)
G4cout << "G4ChargeExchange::DoIt: Incident particle plab="
<< plab/GeV << " GeV/c "
<< " ekin(MeV) = " << ekin/MeV << " "
<< aParticle->GetDefinition()->GetParticleName() << G4endl;
// Scattered particle referred to axis of incident particle
const G4ParticleDefinition* theParticle = aParticle->GetDefinition();
G4double m1 = theParticle->GetPDGMass();
G4int N = A - Z;
G4int projPDG = theParticle->GetPDGEncoding();
if (verboseLevel > 1)
G4cout << "G4ChargeExchange for " << theParticle->GetParticleName()
<< " PDGcode= " << projPDG << " on nucleus Z= " << Z
<< " A= " << A << " N= " << N
<< G4endl;
G4ParticleDefinition * theDef = 0;
if (Z == 1 && A == 3) theDef = theT;
else if (Z == 2 && A == 3) theDef = theHe3;
else if (Z == 2 && A == 4) theDef = theA;
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;
G4ThreeVector bst = lv.boostVector();
lv1.boost(-bst);
lv0.boost(-bst);
// Sample final particles
G4bool theHyperon = false;
G4ParticleDefinition* theRecoil = 0;
G4ParticleDefinition* theSecondary = 0;
if(theParticle == theProton) {
theSecondary = theNeutron;
Z++;
} else if(theParticle == theNeutron) {
theSecondary = theProton;
Z--;
} else if(theParticle == thePiPlus) {
theSecondary = thePiZero;
Z++;
} else if(theParticle == thePiMinus) {
theSecondary = thePiZero;
Z--;
} else if(theParticle == theKPlus) {
if(G4UniformRand()<0.5) theSecondary = theK0S;
else theSecondary = theK0L;
Z++;
} else if(theParticle == theKMinus) {
if(G4UniformRand()<0.5) theSecondary = theK0S;
else theSecondary = theK0L;
Z--;
} else if(theParticle == theK0S || theParticle == theK0L) {
if(G4UniformRand()*aTarget < zTarget) {
theSecondary = theKPlus;
Z--;
} else {
theSecondary = theKMinus;
Z++;
}
} else if(theParticle == theANeutron) {
theSecondary = theAProton;
Z++;
} else if(theParticle == theAProton) {
theSecondary = theANeutron;
Z--;
} else if(theParticle == theL) {
G4double x = G4UniformRand();
if(G4UniformRand()*aTarget < zTarget) {
if(x < 0.2) {
theSecondary = theS0;
} else if (x < 0.4) {
theSecondary = theSPlus;
Z--;
} else if (x < 0.6) {
theSecondary = theProton;
theRecoil = theL;
theHyperon = true;
A--;
} else if (x < 0.8) {
theSecondary = theProton;
theRecoil = theS0;
theHyperon = true;
A--;
} else {
theSecondary = theNeutron;
theRecoil = theSPlus;
theHyperon = true;
A--;
}
} else {
if(x < 0.2) {
theSecondary = theS0;
} else if (x < 0.4) {
theSecondary = theSMinus;
Z++;
} else if (x < 0.6) {
theSecondary = theNeutron;
theRecoil = theL;
A--;
theHyperon = true;
} else if (x < 0.8) {
theSecondary = theNeutron;
theRecoil = theS0;
theHyperon = true;
A--;
} else {
theSecondary = theProton;
theRecoil = theSMinus;
theHyperon = true;
A--;
}
}
}
if (Z == 1 && A == 2) theDef = theD;
else if (Z == 1 && A == 3) theDef = theT;
else if (Z == 2 && A == 3) theDef = theHe3;
else if (Z == 2 && A == 4) theDef = theA;
else theDef = G4ParticleTable::GetParticleTable()->FindIon(Z,A,0,Z);
G4double m11 = theSecondary->GetPDGMass();
G4double m21 = theDef->GetPDGMass();
if(theRecoil) m21 += theRecoil->GetPDGMass();
else theRecoil = theDef;
G4double etot = lv0.e() + lv1.e();
if(etot < m11 + m21) return &theParticleChange;
G4ThreeVector p1 = lv1.vect();
G4double e1 = 0.5*etot*(1.0 + (m21*m21 - m11*m11)/(etot*etot));
G4double e2 = etot - e1;
G4double ptot = std::sqrt(e1*e1 - m11*m11);
G4double tmax = 4.0*ptot*ptot;
G4double t = 0.0;
// Choose generator
G4ElasticGenerator gtype = fLElastic;
if ((theParticle == theProton || theParticle == theNeutron) && Z <= 2) {
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;
}
// Sample t
if(gtype == fQElastic) {
if (verboseLevel > 1)
G4cout << "G4ChargeExchange: Z= " << Z << " N= "
<< N << " pdg= " << projPDG
<< " mom(GeV)= " << plab/GeV << " " << qCManager << G4endl;
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(verboseLevel>1)
G4cout <<"type= " << gtype <<" t= " << t << " tmax= " << tmax
<< " ptot= " << ptot << G4endl;
// Sampling in CM system
G4double phi = G4UniformRand()*twopi;
G4double cost = 1. - 2.0*t/tmax;
if(std::abs(cost) > 1.0) cost = -1.0 + 2.0*G4UniformRand();
G4double sint = std::sqrt((1.0-cost)*(1.0+cost));
if (verboseLevel > 1)
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);
nlv0.boost(bst);
nlv1.boost(bst);
theParticleChange.SetStatusChange(stopAndKill);
G4DynamicParticle * aSec = new G4DynamicParticle(theSecondary, nlv1);
theParticleChange.AddSecondary(aSec);
G4double erec = nlv0.e() - m21;
if(theHyperon) {
theParticleChange.SetLocalEnergyDeposit(erec);
aSec = new G4DynamicParticle();
aSec->SetDefinition(theRecoil);
aSec->SetKineticEnergy(0.0);
} else if(erec > ekinlim) {
aSec = new G4DynamicParticle(theRecoil, nlv0);
theParticleChange.AddSecondary(aSec);
} else {
theParticleChange.SetLocalEnergyDeposit(erec);
}
return &theParticleChange;
}
@@ -0,0 +1,320 @@
//
// ********************************************************************
// * 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: G4ChargeExchangeProcess.cc,v 1.4 2006/06/29 20:09:21 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// 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
//
//
#include "G4ChargeExchangeProcess.hh"
#include "globals.hh"
#include "G4CrossSectionDataStore.hh"
#include "G4HadronElasticDataSet.hh"
#include "G4VQCrossSection.hh"
#include "G4QElasticCrossSection.hh"
#include "G4QCHIPSWorld.hh"
#include "G4Element.hh"
#include "G4ElementVector.hh"
#include "G4IsotopeVector.hh"
#include "G4Neutron.hh"
#include "G4Proton.hh"
#include "G4HadronElastic.hh"
#include "G4PhysicsLinearVector.hh"
G4ChargeExchangeProcess::G4ChargeExchangeProcess(const G4String& procName)
: G4HadronicProcess(procName), first(true)
{
thEnergy = 1.*keV;
verboseLevel= 1;
qCManager = 0;
AddDataSet(new G4HadronElasticDataSet);
theProton = G4Proton::Proton();
theNeutron = G4Neutron::Neutron();
theAProton = G4AntiProton::AntiProton();
theANeutron = G4AntiNeutron::AntiNeutron();
thePiPlus = G4PionPlus::PionPlus();
thePiMinus = G4PionMinus::PionMinus();
thePiZero = G4PionZero::PionZero();
theKPlus = G4KaonPlus::KaonPlus();
theKMinus = G4KaonMinus::KaonMinus();
theK0S = G4KaonZeroShort::KaonZeroShort();
theK0L = G4KaonZeroLong::KaonZeroLong();
theL = G4Lambda::Lambda();
theAntiL = G4AntiLambda::AntiLambda();
theSPlus = G4SigmaPlus::SigmaPlus();
theASPlus = G4AntiSigmaPlus::AntiSigmaPlus();
theSMinus = G4SigmaMinus::SigmaMinus();
theASMinus = G4AntiSigmaMinus::AntiSigmaMinus();
theS0 = G4SigmaZero::SigmaZero();
theAS0 = G4AntiSigmaZero::AntiSigmaZero();
theXiMinus = G4XiMinus::XiMinus();
theXi0 = G4XiZero::XiZero();
theAXiMinus = G4AntiXiMinus::AntiXiMinus();
theAXi0 = G4AntiXiZero::AntiXiZero();
theOmega = G4OmegaMinus::OmegaMinus();
theAOmega = G4AntiOmegaMinus::AntiOmegaMinus();
theD = G4Deuteron::Deuteron();
theT = G4Triton::Triton();
theA = G4Alpha::Alpha();
theA = G4He3::He3();
}
G4ChargeExchangeProcess::~G4ChargeExchangeProcess()
{
delete factors;
}
void G4ChargeExchangeProcess::SetQElasticCrossSection(G4VQCrossSection* p)
{
qCManager = p;
}
void G4ChargeExchangeProcess::
BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
{
if(first) {
first = false;
theParticle = &aParticleType;
pPDG = theParticle->GetPDGEncoding();
store = G4HadronicProcess::GetCrossSectionDataStore();
const size_t n = 10;
if(theParticle == thePiPlus || theParticle == thePiMinus ||
theParticle == theKPlus || theParticle == theKMinus ||
theParticle == theK0S || theParticle == theK0L) {
G4double F[n] = {0.33,0.27,0.29,0.31,0.27,0.18,0.13,0.1,0.09,0.07};
factors = new G4PhysicsLinearVector(0.0,1.8*GeV,n);
for(size_t i=0; i<n; i++) {factors->PutValue(i,F[i]);}
} else {
G4double F[n] = {0.50,0.45,0.40,0.35,0.30,0.25,0.06,0.04,0.005,0.0};
factors = new G4PhysicsLinearVector(0.0,3.6*GeV,n);
for(size_t i=0; i<n; i++) {factors->PutValue(i,F[i]);}
}
if(verboseLevel>1)
G4cout << "G4ChargeExchangeProcess for "
<< theParticle->GetParticleName()
<< G4endl;
}
store->BuildPhysicsTable(aParticleType);
}
G4double G4ChargeExchangeProcess::GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* cond)
{
*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 G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
G4double temp = material->GetTemperature();
G4int nelm = material->GetNumberOfElements();
if(verboseLevel>1)
G4cout << "G4ChargeExchangeProcess get mfp for "
<< theParticle->GetParticleName()
<< " p(GeV)= " << dp->GetTotalMomentum()/GeV
<< " in " << material->GetName()
<< G4endl;
for (G4int i=0; i<nelm; i++) {
const G4Element* elm = (*theElementVector)[i];
G4double x = GetMicroscopicCrossSection(dp, elm, temp);
cross += theAtomNumDensityVector[i]*x;
xsec[i] = cross;
}
if(verboseLevel>1)
G4cout << "G4ChargeExchangeProcess cross(1/mm)= " << cross
<< " E(MeV)= " << dp->GetKineticEnergy()
<< " " << theParticle->GetParticleName()
<< " in " << material->GetName()
<< G4endl;
if(cross > DBL_MIN) x = 1./cross;
return x;
}
G4double G4ChargeExchangeProcess::GetMicroscopicCrossSection(
const G4DynamicParticle* dp,
const G4Element* elm,
G4double temp)
{
// gives the microscopic cross section in GEANT4 internal units
G4double Z = elm->GetZ();
G4int iz = G4int(Z);
G4double x = 0.0;
if(iz == 1) return x;
// CHIPS cross sections
G4double momentum = dp->GetTotalMomentum();
if(iz <= -2 && (theParticle == theProton || theParticle == theNeutron)) {
G4double momentum = dp->GetTotalMomentum();
if(verboseLevel>1)
G4cout << "G4ChargeExchangeProcess compute CHIPS CS for Z= 2, N=2 "
<< G4endl;
x = qCManager->GetCrossSection(false,momentum,2,2,pPDG);
} else {
if(verboseLevel>1)
G4cout << "G4ChargeExchangeProcess compute GHAD CS for element "
<< elm->GetName()
<< G4endl;
x = store->GetCrossSection(dp, elm, temp);
}
if(verboseLevel>1)
G4cout << "G4ChargeExchangeProcess cross(mb)= " << x/millibarn
<< " E(MeV)= " << dp->GetKineticEnergy()
<< " " << theParticle->GetParticleName()
<< " in Z= " << iz
<< G4endl;
G4bool b;
G4double A = elm->GetN();
x *= factors->GetValue(momentum, b)/std::pow(A, 0.42);
if(theParticle == thePiPlus || theParticle == theProton ||
theParticle == theKPlus || theParticle == theANeutron)
x *= (1.0 - Z/A);
else if(theParticle == thePiMinus || theParticle == theNeutron ||
theParticle == theKMinus || theParticle == theAProton)
x *= Z/A;
return x;
}
G4VParticleChange* G4ChargeExchangeProcess::PostStepDoIt(
const G4Track& track,
const G4Step& step)
{
G4ForceCondition* cn = 0;
aParticleChange.Initialize(track);
G4double mfp = GetMeanFreePath(track, 0.0, cn);
if(mfp == DBL_MAX) return G4VDiscreteProcess::PostStepDoIt(track,step);
G4double kineticEnergy = track.GetKineticEnergy();
G4Material* material = track.GetMaterial();
// Select element
const G4ElementVector* theElementVector = material->GetElementVector();
G4Element* elm = (*theElementVector)[0];
G4int nelm = material->GetNumberOfElements() - 1;
if (nelm > 0) {
G4double x = G4UniformRand()*cross;
G4int i = -1;
do {i++;} while (x > xsec[i] && i < nelm);
elm = (*theElementVector)[i];
}
G4double Z = elm->GetZ();
G4double A = elm->GetN();
// Select isotope
G4IsotopeVector* isv = elm->GetIsotopeVector();
G4int ni = 0;
if(isv) ni = isv->size();
if(ni == 1) {
A = G4double(elm->GetIsotope(0)->GetN());
} else if(ni > 1) {
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());
}
G4HadronicInteraction* hadi =
ChooseHadronicInteraction( kineticEnergy, material, elm);
// Initialize the hadronic projectile from the track
G4HadProjectile thePro(track);
if(verboseLevel>1)
G4cout << "G4ChargeExchangeProcess::PostStepDoIt for "
<< theParticle->GetParticleName()
<< " Target Z= " << Z
<< " A= " << A << G4endl;
targetNucleus.SetParameters(A, Z);
aParticleChange.Initialize(track);
G4HadFinalState* result = hadi->ApplyYourself(thePro, targetNucleus);
G4int nsec = result->GetNumberOfSecondaries();
if(verboseLevel>1)
G4cout << "Efin= " << result->GetEnergyChange()
<< " de= " << result->GetLocalEnergyDeposit()
<< " nsec= " << nsec
<< G4endl;
if(nsec > 0) {
aParticleChange.ProposeEnergy(0.0);
aParticleChange.ProposeTrackStatus(fStopAndKill);
aParticleChange.ProposeLocalEnergyDeposit(result->GetLocalEnergyDeposit());
aParticleChange.SetNumberOfSecondaries(nsec);
for(G4int j=0; j<nsec; j++) {
G4DynamicParticle* p = result->GetSecondary(j)->GetParticle();
aParticleChange.AddSecondary(p);
}
}
result->Clear();
return G4VDiscreteProcess::PostStepDoIt(track,step);
}
G4bool G4ChargeExchangeProcess::
IsApplicable(const G4ParticleDefinition& aParticleType)
{
const G4ParticleDefinition* p = &aParticleType;
return (p == thePiPlus || p == thePiMinus ||
p == theProton || p == theNeutron ||
p == theAProton|| p == theANeutron||
p == theKPlus || p == theKMinus ||
p == theK0S || p == theK0L ||
p == theL);
}
void G4ChargeExchangeProcess::
DumpPhysicsTable(const G4ParticleDefinition& aParticleType)
{
store->DumpPhysicsTable(aParticleType);
}
@@ -1,102 +1,149 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4DiffElasticHadrNucleus.cc,v 1.18 2005/11/24 19:05:56 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// G4DiffElasticHadrNucleus class
// $Id: G4DiffElasticHadrNucleus.cc,v 1.23 2006/06/29 20:09:23 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Geant4 class G4DiffElasticHadrNucleus
//
// High energy hadron-nucleus elastic scattering
// Kinetic energy T > 1 GeV
// N. Starkov 2003.
//
// Modifications:
// 14.11.05 The HE elastic scattering on proton is added (N.Starkov)
// 23.11.05 int -> G4int, fabs -> abs (V.Ivanchenko)
// 30.05.06 New version, which not uses elastic data (N.Starkov)
// 30.05.06 cleanup (int -> G4int) (V.Ivanchenko)
//
#include "globals.hh"
#include "G4DiffElasticHadrNucleus.hh"
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ##########################################################
void NucleusParameters::GetNucleusParameters(G4int Nucleus)
{
if(Nucleus == 208)
{
// R1 = 20.73; R2 = 15.74.
R1 = 4.1408*std::pow(static_cast<double>(Nucleus),0.3018);
R2 = 3.806*std::pow(Nucleus-10.068,0.2685);
Pnucl = 0.9;
Aeff = 1.1;
R1 = 19.5;
R2 = 15.74;
Pnucl = 0.4;
Aeff = 0.7;
}
G4DiffElasticHadrNucleus::G4DiffElasticHadrNucleus() :
G4IntegrHadrNucleus()
{
Factors();
r0 = 1.1; // The WS's parameters
r01 = 1.16;
rAmax = 2.5;
NpointsB = 500;
}
else if(Nucleus == 90)
{
R1 = 16.50;
R2 = 11.62;
Pnucl = 0.4;
Aeff = 0.9;
R1 = 16.5;
R2 = 11.62;
Pnucl = 0.4;
Aeff = 0.7;
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
else if(Nucleus == 58)
{
R1 = 15.0;
R2 = 9.9;
Pnucl = 0.45;
Aeff = 0.85;
}
else if(Nucleus == 16)
{
R1 = 10.50;
R2 = 5.5;
Pnucl = 0.7;
Aeff = 0.98;
// R1 = 11.3;
// R2 = 2.5;
// Pnucl = 0.75;
// Aeff = 0.9;
}
else
{
if(Nucleus == 28)
R1 = 4.25*std::pow(static_cast<double>(Nucleus-1),0.309);
else
R1 = 4.45*std::pow(static_cast<double>(Nucleus-1),0.309);
R2 = 2.3*std::pow(static_cast<double>(Nucleus),0.36);
Pnucl = 0.176+0.00167*Nucleus+
8.69E-6*Nucleus*Nucleus;
Aeff = 0.9;
}
G4DiffElasticHadrNucleus::~G4DiffElasticHadrNucleus()
{;}
if(Nucleus == 9)
{
R1 = 9.0;
R2 = 7.0;
Pnucl = 0.190;
Aeff = 0.9;
}
/*
if(Nucleus == 12)
{
R1 = 9.336;
R2 = 5.63;
Pnucl = 0.197;
Aeff = 01.0;
}
*/
/*
if(Nucleus == 11)
{
R1 = 10.8;
R2 = 7.5;
Pnucl = 0.85;
Aeff = 1.2;
}
*/
if(Nucleus == 4)
{
R1 = 5.5;
R2 = 3.7;
Pnucl = 0.4;
Aeff = 0.87;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++
void G4DiffElasticHadrNucleus::Factors()
{
G4int ii, ll, mm;
G4double Sum1, Fac1, Fac3, Sum3;
Factorials[0] = 1;
for( ii = 1; ii<250; ii++)
{
if(ii >= 100) Mnoj[ii] = 3.03; // there is the saturation
else
{
Sum1 = 0;
Fac1 = 1;
Factorials[ii] = Factorial(ii);
for( ll = 0; ll<=ii; ll++)
{
Fac1 = binom(ii,ll);
Fac3 = 1;
Sum3 = 1;
for( mm = 1; mm<=ii-ll; mm++)
{
Fac3 = binom(ii-ll,mm);
Sum3 = Sum3 + 1/Fac3;
} // mm
Sum1 = Sum1 + Sum3/Fac1;
} // ll
Mnoj[ii] = Sum1;
} // else
} // ii
Mnoj[0] = 1;
} // Factors
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// G4cout<<" Nucl.Par. "<<Nucleus<<" R1 "<<R1<<G4endl;
}
// ##########################################################
void G4DiffElasticHadrNucleus::
GetNucleusParameters(G4Nucleus * aNucleus)
{
G4int Nucleus = (G4int)aNucleus->GetN();
// G4cout<<" Nucl.Par. "<<Nucleus<<G4endl;
if(Nucleus == 208)
{
// R1 = 20.73; R2 = 15.74.
@@ -183,6 +230,8 @@ void G4DiffElasticHadrNucleus::
Pnucl = 0.4;
Aeff = 0.87;
}
// G4cout<<" Nucl.Par. "<<Nucleus<<" R1 "<<R1<<G4endl;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -191,46 +240,39 @@ void G4DiffElasticHadrNucleus::
const G4DynamicParticle * aHadron,
G4Nucleus * aNucleus,
G4double aQ2)
{
{
// ------ All external kinematical variables are in MeV -------
// ------ but internal in GeV !!!! ------
G4double HadrEnergy = aHadron->GetTotalEnergy()/1000; // GeV
G4double MassH = aHadron->GetMass()/1000;
G4double energy = aHadron->GetTotalEnergy()/GeV; // GeV
G4double MassH = aHadron->GetMass()/GeV;
G4int Nucleus = (G4int)aNucleus->GetN();
G4cout << "G4DiffElasticHadrNucleus:: HadrNuclDifferCrSec: "
<< aHadron->GetDefinition()->GetParticleName()
<< " code= " << aHadron->GetDefinition()->GetPDGEncoding()
<< " nuc= " << Nucleus
<< G4endl;
G4int Nucleus = (G4int)aNucleus->GetN();
if(Nucleus==2 || Nucleus == 3)
G4Exception(" This model does not work for nuclei with A=3 0r A= 4");
G4Exception(" This model does not work for nuclei with A=3 0r A= 4");
if(Nucleus>238)
G4Exception(" This nucleus is very heavy for this model !!!");
G4Exception(" This nucleus is very heavy for this model !!!");
if(HadrEnergy-MassH < 1.0)
G4Exception(" The hadron kinetic energy is very low for this model (energy must be > 1000 MeV");
if(energy-MassH < 1.0)
G4Exception(" The hadron kinetic energy is low for this model (< 1 GeV");
G4HadronValues::GetHadronValues(aHadron);
GetTotalCrossSection(aHadron, aNucleus);
GetNucleusParameters(aNucleus);
G4double Q2 = aQ2/1000/1000; // GeV
G4double MomentumCMN, S, MassN, EcmH;
G4double theQ2 = aQ2/GeV/GeV; // GeV
// MassH = aHadron->GetMass()/1000;
MassN = Nucleus*0.938;
S = 2*MassN*HadrEnergy+MassN*MassN+MassH*MassH;
EcmH = (S-MassN*MassN+MassH*MassH)/2/std::sqrt(S);
MomentumCMN = std::sqrt(EcmH*EcmH-MassH*MassH);
G4double MassN =
aNucleus->AtomicMass(aNucleus->GetN(),aNucleus->GetZ())/GeV;
G4double S = 2*MassN*energy+MassN*MassN+MassH*MassH;
G4double ecmH = (S-MassN*MassN+MassH*MassH)/2/std::sqrt(S);
G4double momentumCMN = std::sqrt(ecmH*ecmH-MassH*MassH);
G4double MbToB = 2.568; // from mb to GeV^-2
G4double Pi1 = 3.1416;
G4double Pi1 = pi;
G4double Stot = HadrTot*MbToB; //In GeV-2
G4double Bhad = HadrSlope; //In GeV-2
G4double Asq = 1+HadrReIm*HadrReIm;
@@ -255,10 +297,10 @@ void G4DiffElasticHadrNucleus::
G4double R22Apd = 2/R22Ap;
G4double R12ApdR22Ap = 0.5*(R12Apd+R22Apd);
G4double DDSec1p = (DDSect2+DDSect3*std::log(1.06*2*HadrEnergy/R1/4));
G4double DDSec2p = (DDSect2+DDSect3*std::log(1.06*2*HadrEnergy/
G4double DDSec1p = (DDSect2+DDSect3*std::log(1.06*2*energy/R1/4));
G4double DDSec2p = (DDSect2+DDSect3*std::log(1.06*2*energy/
std::sqrt((R12+R22)/2)/4));
G4double DDSec3p = (DDSect2+DDSect3*std::log(1.06*2*HadrEnergy/R2/4));
G4double DDSec3p = (DDSect2+DDSect3*std::log(1.06*2*energy/R2/4));
G4double Norm = (R12*R1-Pnucl*R22*R2)*Aeff;
G4double Normp = (R12*R1-Pnuclp*R22*R2)*Aeff;
@@ -283,21 +325,21 @@ void G4DiffElasticHadrNucleus::
{
N = -N*Unucl*(Nucleus-i+1)/i*Rho2;
N4 = 1;
Prod1 = std::exp(-Q2/i*R12B/4)/i*R12B;
Prod1 = std::exp(-theQ2/i*R12B/4)/i*R12B;
medTot = R12B/i;
for(G4int l=1; l<=i; l++)
{
exp1 = l/R22B+(i-l)/R12B;
N4 = -N4*(i-l+1)/l*N2;
Prod1 = Prod1+N4/exp1*std::exp(-Q2/exp1/4);
Prod1 = Prod1+N4/exp1*std::exp(-theQ2/exp1/4);
medTot = medTot+N4/exp1;
} // end l
ReElasticAmpl0 = ReElasticAmpl0+Prod1*N*std::sin(FiH*i);
ImElasticAmpl0 = ImElasticAmpl0+Prod1*N*std::cos(FiH*i);
Tot1 = Tot1+medTot*N*std::cos(FiH*i);
if(std::abs(Prod1*N/ImElasticAmpl0) < 0.000001) break;
if(std::fabs(Prod1*N/ImElasticAmpl0) < 0.000001) break;
} // i
ImElasticAmpl0 = ImElasticAmpl0*Pi1/2.568; // The amplitude in mB
@@ -305,9 +347,9 @@ void G4DiffElasticHadrNucleus::
Tot1 = Tot1*Pi1*2.0/2.568;
G4double N1p = 1;
G4double Din1 = 0.5*(R13Ap*R13Ap*std::exp(-Q2/8*R12Ap)/2*R12Ap/2*DDSec1p-
2*R23Ap*R13Ap/2/R12ApdR22Ap*std::exp(-Q2/4/R12ApdR22Ap)*DDSec2p+
R23Ap*R23Ap/2*R22Ap/2*std::exp(-Q2/8*R22Ap)*DDSec3p); // at i=0
G4double Din1 = 0.5*(R13Ap*R13Ap*std::exp(-theQ2/8*R12Ap)/2*R12Ap/2*DDSec1p-
2*R23Ap*R13Ap/2/R12ApdR22Ap*std::exp(-theQ2/4/R12ApdR22Ap)*DDSec2p+
R23Ap*R23Ap/2*R22Ap/2*std::exp(-theQ2/8*R22Ap)*DDSec3p); // at i=0
DTot1 = 0.5*(R13Ap*R13Ap/2*R12Ap/2*DDSec1p-
2*R23Ap*R13Ap/2/R12ApdR22Ap*DDSec2p+
@@ -340,9 +382,9 @@ void G4DiffElasticHadrNucleus::
exp3p = exp1+R22Apd;
Din2 = Din2 + N2p*BinCoeff*
(R13Ap*R13Ap/2/exp1p*std::exp(-Q2/4/exp1p)*DDSec1p-
2*R13Ap*R23Ap/2/exp2p*std::exp(-Q2/4/exp2p)*DDSec2p+
R23Ap*R23Ap/2/exp3p*std::exp(-Q2/4/exp3p)*DDSec3p);
(R13Ap*R13Ap/2/exp1p*std::exp(-theQ2/4/exp1p)*DDSec1p-
2*R13Ap*R23Ap/2/exp2p*std::exp(-theQ2/4/exp2p)*DDSec2p+
R23Ap*R23Ap/2/exp3p*std::exp(-theQ2/4/exp3p)*DDSec3p);
DmedTot = DmedTot + N2p*BinCoeff*
(R13Ap*R13Ap/2/exp1p*DDSec1p-
@@ -355,7 +397,7 @@ void G4DiffElasticHadrNucleus::
Din1 = Din1+Din2*N1p*Mnoj[i]/(i+2)/(i+1)*std::cos(FiH*i);
DTot1 = DTot1+DmedTot*N1p*Mnoj[i]/(i+2)/(i+1)*std::cos(FiH*i);
if(std::abs(Din2*N1p/Din1) < 0.000001) break;
if(std::fabs(Din2*N1p/Din1) < 0.000001) break;
} // i
Din1 = -1*Din1*Nucleus*(Nucleus-1)
@@ -377,7 +419,7 @@ void G4DiffElasticHadrNucleus::
(ImElasticAmpl0+Din1)*
(ImElasticAmpl0+Din1))*
2.568/4/Pi1/Pi1
*MomentumCMN*MomentumCMN;
*momentumCMN*momentumCMN;
AIm = ImElasticAmpl0;
ARe = ReElasticAmpl0;
@@ -427,7 +469,7 @@ void G4DiffElasticHadrNucleus::
Dn = 0.42*std::pow(An,-0.26); // fm^-2
Bn = 8.0e-4*An*An;
Ct = An*Dn/3.1416/std::log(1+Bn);
Ct = An*Dn/pi/std::log(1+Bn);
En = std::exp(-Dn*b*b);
Tn = Ct*Bn*En/(1+Bn*En); // fm^-2
@@ -450,7 +492,7 @@ void G4DiffElasticHadrNucleus::
FunS = ImpactPar*ValS/HadrSlope;
if(Kind == 0) Thick[iInt] =
Thickness(Anucleus, ValS/std::sqrt(25.68))/25.68;
Thickness(Anucleus, ValS/FmToGeV)/Fm2ToGeV2;
I0bs = 0.0;
if(FunS > 320) continue;
@@ -470,13 +512,13 @@ void G4DiffElasticHadrNucleus::
G4double ValB;
G4int iInt;
G4double expB, IntegS, InExp;
G4double Sigm=HadrTot*2.568;
G4double Sigm=HadrTot/2/HadrSlope*MbToGeV2;
for(iInt=0; iInt<NpointsB; iInt++)
{
ValB = iInt*stepB;
IntegS = GetIntegrandS(Anucleus, ValB, iInt);
InExp = -Sigm/2/HadrSlope*IntegS;
InExp = -Sigm*IntegS;
expB = std::exp(InExp);
ReIntegrand[iInt] = (1.0-expB*std::cos(HadrReIm*InExp));
@@ -484,23 +526,16 @@ void G4DiffElasticHadrNucleus::
}
}
// #############################################
G4double G4DiffElasticHadrNucleus::
G4double G4DiffElasticHadrNucleus::
HadrNuclDifferCrSecT(const G4DynamicParticle * aHadron,
G4Nucleus * aNucleus,
G4double aQ2,
G4int Kind)
{
G4double J0qb, Re;
G4double HadrEnergy = aHadron->GetTotalEnergy()/1000; // GeV
G4int Nucleus = (G4int)aNucleus->GetN();
G4double MassH = aHadron->GetMass()/1000;
G4cout << "G4DiffElasticHadrNucleus:: HadrNuclDifferCrSec: "
<< aHadron->GetDefinition()->GetParticleName()
<< " code= " << aHadron->GetDefinition()->GetPDGEncoding()
<< " nuc= " << Nucleus
<< G4endl;
{
G4double J0qb, Re;
G4double energy = aHadron->GetTotalEnergy()/GeV; // GeV
G4int Nucleus = (G4int)aNucleus->GetN();
G4double MassH = aHadron->GetMass()/GeV;
if(Nucleus==2 || Nucleus==3)
G4Exception(" This nucleus is very light for this model !!!");
@@ -508,67 +543,58 @@ void G4DiffElasticHadrNucleus::
if(Nucleus>238)
G4Exception(" This nucleus is very heavy for this model !!!");
if(HadrEnergy-MassH < 1.0)
if(energy-MassH < 1.0)
G4Exception(" The hadron energy is very low for this model !!!");
G4HadronValues::GetHadronValues(aHadron);
G4HadronValues::GetHadronValues(aHadron);
G4double Q2 = aQ2/1000/1000; // GeV
G4double theQ2 = aQ2/GeV/GeV; // GeV
// G4double S, MassN, EcmH;
G4int kk;
G4double ValB;
G4double ReIntSumm=0.0, ImIntSumm=0.0;
G4double Mnojit = 0.0;
if(Kind == 0)
{
switch(Nucleus)
{
case(208) : r0 = 1.125;
r01 = 1.16*0.0;
break;
case(90) : r0 = 1.12;
r01 = 1.16*0.0;
break;
case(58) : r0 = 1.09;
r01 = 1.16*0.0;
break;
case(48) : r0 = 1.07;
r01 = 1.16*0.0;
break;
{
case(208) : r0 = 1.125;
r01 = 1.16*0.0;
break;
case(90) : r0 = 1.12;
r01 = 1.16*0.0;
break;
case(58) : r0 = 1.09;
r01 = 1.16*0.0;
break;
case(48) : r0 = 1.07;
r01 = 1.16*0.0;
break;
case(40) : r0 = 1.15;
r01 = 1.16*0.0;
break;
case(28) : r0 = 0.93;
r01 = 1.16*0.0;
break;
case(16) : r0 = 0.92;
r01 = 1.16*0.0;
break;
case(12) : r0 = 0.8;
r01 = 1.16*0.0;
break;
case(64) : r0 = 1.1;
r01 = 1.16*0.0;
break;
default : Re = std::pow(static_cast<double>(Nucleus), 0.3333);
r0 = 1.16*(1.0-1.16/Re/Re);
case(40) : r0 = 1.15;
r01 = 1.16*0.0;
break;
case(28) : r0 = 0.93;
r01 = 1.16*0.0;
break;
case(16) : r0 = 0.92;
r01 = 1.16*0.0;
break;
case(12) : r0 = 0.8;
r01 = 1.16*0.0;
break;
case(64) : r0 = 1.1;
r01 = 1.16*0.0;
break;
default : Re = std::pow(static_cast<double>(Nucleus), 0.3333);
r0 = 1.16*(1.0-1.16/Re/Re);
}
/*
// MassH = aHadron->GetMass()/1000;
MassN = Nucleus*0.938;
S = 2*MassN*HadrEnergy+MassN*MassN+MassH*MassH;
EcmH = (S-MassN*MassN+MassH*MassH)/2/std::sqrt(S);
MomentumCMN = std::sqrt(EcmH*EcmH-MassH*MassH);
*/
G4int kk;
G4double ValB;
G4double ReIntSumm=0.0, ImIntSumm=0.0, Section;
if(Kind == 0)
{
G4double S, MassN, EcmH;
MassH = aHadron->GetMass()/1000;
MassN = Nucleus*0.938;
S = 2*MassN*HadrEnergy+MassN*MassN+MassH*MassH;
EcmH = (S-MassN*MassN+MassH*MassH)/2/std::sqrt(S);
MomentumCMN = std::sqrt(EcmH*EcmH-MassH*MassH);
Mnojit = stepB/8.*
std::pow(HadrTot*2.568,2)*
(1+std::pow(HadrReIm,2))/2.56;
rAfm = r0*std::pow(static_cast<double>(Nucleus), 0.3333)*
(1-r01/std::pow(static_cast<double>(Nucleus),0.666));
@@ -577,40 +603,44 @@ void G4DiffElasticHadrNucleus::
GetIntegrandB(Nucleus);
InCohI = 0.0;
}
}
// if(Kind==0) InCohI = 0.0;
G4double Simps = 4;
for(kk=0; kk<NpointsB; kk++)
{
ValB = stepB*kk;
for(kk=0; kk<NpointsB; kk++)
{
ValB = stepB*kk;
if(Kind==0) InCohI += Thick[kk]*ValB*
std::exp(-HadrTot*2.568*Thick[kk])
*2.0*3.1416*stepB
/16/3.1416*std::pow(HadrTot*2.568,2)*
(1+std::pow(HadrReIm,2))/2.56;
if(Kind==0) InCohI += Thick[kk]*ValB*Simps*Mnojit*
std::exp(-HadrTot*2.568*Thick[kk]);
J0qb = MyJ0(std::sqrt(Q2)*ValB)*ValB;
ReIntSumm += J0qb*ReIntegrand[kk];
ImIntSumm += J0qb*ImIntegrand[kk];
}
InCoh = InCohI*
J0qb = MyJ0(std::sqrt(theQ2)*ValB)*ValB;
ReIntSumm += J0qb*ReIntegrand[kk];
ImIntSumm += J0qb*ImIntegrand[kk];
if(Simps>3) Simps = 2;
}
InCoh = InCohI*
// 2.0*3.1416*stepB
// /16/3.1416*std::pow(HadrTot*2.568,2)*
// (1+std::pow(HadrReIm,2))/2.568*
std::exp(-HadrSlope*Q2);
std::exp(-HadrSlope*theQ2)/3.;
Section = (ReIntSumm*ReIntSumm+ImIntSumm*ImIntSumm)
/2.0/3.1416*2.568*MomentumCMN*MomentumCMN
*stepB*stepB;
G4double MassN =
aNucleus->AtomicMass(aNucleus->GetN(),aNucleus->GetZ())/GeV;
G4double S = 2*MassN*energy+MassN*MassN+MassH*MassH;
G4double ecmH = (S-MassN*MassN+MassH*MassH)/2/std::sqrt(S);
G4double momentumCMN = std::sqrt(ecmH*ecmH-MassH*MassH);
G4double Section = (ReIntSumm*ReIntSumm+ImIntSumm*ImIntSumm)
/twopi*2.568*momentumCMN*momentumCMN*stepB*stepB/3.;
// Section = (ReIntSumm*ReIntSumm+ImIntSumm*ImIntSumm)
// /2.0/Pi1*2.568*MomentumCMN*MomentumCMN;
return Section;
}
return Section;
}
// =====================================================
void G4DiffElasticHadrNucleus::
GetKinematics(const G4DynamicParticle * aHadron)
@@ -626,11 +656,11 @@ void G4DiffElasticHadrNucleus::
IntConst = (1-Coeff1)/Slope;
ProtonM = 0.9383;
HadronE = aHadron->GetTotalEnergy()/1000; // GeV
ProtonM = proton_mass_c2/GeV;
HadronE = aHadron->GetTotalEnergy()/GeV; // GeV
HdrE = HadronE;
MomentumH = aHadron->GetTotalMomentum()/1000; // GeV
HadronM = aHadron->GetMass()/1000.0; // GeV
MomentumH = aHadron->GetTotalMomentum()/GeV; // GeV
HadronM = aHadron->GetMass()/GeV; // GeV
PM2 = ProtonM*ProtonM;
HM2 = HadronM*HadronM;
@@ -641,7 +671,7 @@ void G4DiffElasticHadrNucleus::
EcmH = (Sh+HM2-PM2)/2/SqrtS;
EcmP = (Sh-HM2+PM2)/2/SqrtS;
Kcm = sqrt(EcmH*EcmH-HM2);
Kcm = std::sqrt(EcmH*EcmH-HM2);
MaxT = 4*Kcm*Kcm;
BoundaryP[0]=9.0; BoundaryTG[0]=5.0;BoundaryTL[0]=MaxT/2.0;
@@ -670,19 +700,17 @@ void G4DiffElasticHadrNucleus::
}
// +++++++++++++++++++++++++++++++++++++++
G4double G4DiffElasticHadrNucleus::
HadronProtonDiffCrSec(G4double Q2)
HadronProtonDiffCrSec(G4double aQ2)
{
G4double dSigPodT;
// GetKinematic(aHadron);
dSigPodT = SigTot*SigTot*(1+ReOnIm*ReOnIm)*(
Coeff1*std::exp(-Slope1*sqrt(Q2))+
Coeff2*std::exp( Slope2*(ConstU+Q2))+
(1-Coeff1-Coeff0)*std::exp(-Slope*Q2)+
+Coeff0*std::exp(-Slope0*Q2)
// +0.1*(1-std::abs(CosTh))
)/16/3.1416*2.568;
Coeff1*std::exp(-Slope1*std::sqrt(aQ2))+
Coeff2*std::exp( Slope2*(ConstU+aQ2))+
(1-Coeff1-Coeff0)*std::exp(-Slope*aQ2)+
+Coeff0*std::exp(-Slope0*aQ2)
// +0.1*(1-std::fabs(CosTh))
)/16/pi*2.568;
return dSigPodT;
}
@@ -694,7 +722,7 @@ void G4DiffElasticHadrNucleus::
G4int iStep;
// HadrCode = aHadron->GetDefinition()->GetPDGEncoding();
HadrP = aHadron->GetTotalMomentum()/1000;
HadrP = aHadron->GetTotalMomentum()/GeV;
switch(HadrCode)
{
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,459 @@
//
// ********************************************************************
// * 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: G4HadronElastic.cc,v 1.19 2006/06/29 20:09:27 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// Physics model class G4HadronElastic (derived from G4LElastic)
//
//
// G4 Model: Low-energy Elastic scattering with 4-momentum balance
// F.W. Jones, TRIUMF, 04-JUN-96
// Uses G4ElasticHadrNucleusHE and G4VQCrossSection
//
//
// 25-JUN-98 FWJ: replaced missing Initialize for ParticleChange.
// 09-Set-05 V.Ivanchenko HARP version of the model: fix scattering
// on hydrogen, use relativistic Lorentz transformation
// 24-Nov-05 V.Ivanchenko sample cost in center of mass reference system
// 03-Dec-05 V.Ivanchenko add protection to initial momentum 20 MeV/c in
// center of mass system (before it was in lab system)
// below model is not valid
// 14-Dec-05 V.Ivanchenko change protection to cos(theta) < -1 and
// rename the class
// 13-Apr-06 V.Ivanchenko move to coherent_elastic subdirectory; remove
// 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
//
#include "G4HadronElastic.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4IonTable.hh"
#include "G4QElasticCrossSection.hh"
#include "G4VQCrossSection.hh"
#include "G4ElasticHadrNucleusHE.hh"
#include "Randomize.hh"
#include "G4Proton.hh"
#include "G4Neutron.hh"
#include "G4Deuteron.hh"
#include "G4Alpha.hh"
G4HadronElastic::G4HadronElastic(G4double elim, G4double plow, G4double ehigh)
: G4HadronicInteraction()
{
SetMinEnergy( 0.0*GeV );
SetMaxEnergy( DBL_MAX );
verboseLevel= 0;
plablow = plow;
ekinhigh = ehigh;
ekinlim = elim;
qCManager = G4QElasticCrossSection::GetPointer();
hElastic = new G4ElasticHadrNucleusHE();
theProton = G4Proton::Proton();
theNeutron = G4Neutron::Neutron();
theDeuteron = G4Deuteron::Deuteron();
theAlpha = G4Alpha::Alpha();
}
G4HadronElastic::~G4HadronElastic()
{
delete hElastic;
}
G4VQCrossSection* G4HadronElastic::GetCS()
{
return qCManager;
}
G4ElasticHadrNucleusHE* G4HadronElastic::GetHElastic()
{
return hElastic;
}
G4HadFinalState* G4HadronElastic::ApplyYourself(
const G4HadProjectile& aTrack, G4Nucleus& targetNucleus)
{
theParticleChange.Clear();
const G4HadProjectile* aParticle = &aTrack;
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 "
<< " ekin(MeV) = " << ekin/MeV << " "
<< aParticle->GetDefinition()->GetParticleName() << G4endl;
// Scattered particle referred to axis of incident particle
const G4ParticleDefinition* theParticle = aParticle->GetDefinition();
G4double m1 = theParticle->GetPDGMass();
G4int Z = static_cast<G4int>(zTarget);
G4int A = static_cast<G4int>(aTarget);
G4int N = A - Z;
G4int projPDG = theParticle->GetPDGEncoding();
if (verboseLevel>1)
G4cout << "G4HadronElastic for " << theParticle->GetParticleName()
<< " PDGcode= " << projPDG << " on nucleus Z= " << Z
<< " A= " << A << " N= " << N
<< G4endl;
G4ParticleDefinition * theDef = 0;
if(Z == 1 && A == 1) theDef = G4Proton::Proton();
else if (Z == 1 && A == 2) theDef = G4Deuteron::Deuteron();
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 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;
G4ThreeVector bst = lv.boostVector();
lv1.boost(-bst);
lv0.boost(-bst);
G4ThreeVector p1 = lv1.vect();
G4double ptot = p1.mag();
G4double tmax = 4.0*ptot*ptot;
G4double t = 0.0;
// 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;
}
// Sample t
if(gtype == fQElastic) {
if (verboseLevel >1)
G4cout << "G4HadronElastic: Z= " << Z << " N= "
<< N << " pdg= " << projPDG
<< " mom(GeV)= " << plab/GeV << " " << qCManager << G4endl;
G4double cs = qCManager->GetCrossSection(false,plab,Z,N,projPDG);
if(cs > 0.0) t = qCManager->GetExchangeT(Z,N,projPDG);
else gtype = fSWave;
}
if(gtype == fLElastic) {
t = GeV*GeV*SampleT(ptot,m1,m2,aTarget);
if(t > tmax) gtype = fSWave;
}
if(gtype == fHElastic) {
t = hElastic->SampleT(theParticle,plab,Z,A);
if(t > tmax) gtype = fSWave;
}
if(gtype == fSWave) t = G4UniformRand()*tmax;
if(verboseLevel>1)
G4cout <<"type= " << gtype <<" t= " << t << " tmax= " << tmax
<< " ptot= " << ptot << G4endl;
// Sampling in CM system
G4double phi = G4UniformRand()*twopi;
G4double cost = 1. - 2.0*t/tmax;
if(std::abs(cost) > 1.0) cost = -1.0 + 2.0*G4UniformRand();
G4double sint = std::sqrt((1.0-cost)*(1.0+cost));
if (verboseLevel>1)
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
<<G4endl;
if(eFinal < 0.0) {
G4cout << "G4HadronElastic WARNING ekin= " << eFinal
<< " after scattering of "
<< aParticle->GetDefinition()->GetParticleName()
<< " p(GeV/c)= " << plab
<< " on " << theDef->GetParticleName()
<< G4endl;
eFinal = 0.0;
}
theParticleChange.SetMomentumChange(nlv1.vect().unit());
theParticleChange.SetEnergyChange(eFinal);
G4double erec = nlv0.e() - m2;
if(erec > ekinlim) {
G4DynamicParticle * aSec = new G4DynamicParticle(theDef, nlv0);
theParticleChange.AddSecondary(aSec);
} else {
theParticleChange.SetLocalEnergyDeposit(erec);
}
return &theParticleChange;
}
G4double
G4HadronElastic::SampleT(G4double, G4double, G4double, G4double atno2)
{
// G4cout << "Entering elastic scattering 2"<<G4endl;
// Compute the direction of elastic scattering.
// It is planned to replace this code with a method based on
// parameterized functions and a Monte Carlo method to invert the CDF.
G4double ran = G4UniformRand();
G4double aa, bb, cc, dd, rr;
if (atno2 <= 62.) {
aa = std::pow(atno2, 1.63);
bb = 14.5*std::pow(atno2, 0.66);
cc = 1.4*std::pow(atno2, 0.33);
dd = 10.;
} else {
aa = std::pow(atno2, 1.33);
bb = 60.*std::pow(atno2, 0.33);
cc = 0.4*std::pow(atno2, 0.40);
dd = 10.;
}
aa = aa/bb;
cc = cc/dd;
rr = (aa + cc)*ran;
if (verboseLevel > 1) {
G4cout << "DoIt: aa,bb,cc,dd,rr" << G4endl;
G4cout << aa << " " << bb << " " << cc << " " << dd << " " << rr << G4endl;
}
G4double t1 = -std::log(ran)/bb;
G4double t2 = -std::log(ran)/dd;
if (verboseLevel > 1) {
G4cout << "t1,Fctcos " << t1 << " " << Fctcos(t1, aa, bb, cc, dd, rr) << G4endl;
G4cout << "t2,Fctcos " << t2 << " " << Fctcos(t2, aa, bb, cc, dd, rr) << G4endl;
}
G4double eps = 0.001;
G4int ind1 = 10;
G4double t = 0.0;
G4int ier1;
ier1 = Rtmi(&t, t1, t2, eps, ind1,
aa, bb, cc, dd, rr);
if (verboseLevel > 1) {
G4cout << "From Rtmi, ier1=" << ier1 << G4endl;
G4cout << "t, Fctcos " << t << " " << Fctcos(t, aa, bb, cc, dd, rr) << G4endl;
}
if (ier1 != 0) t = 0.25*(3.*t1 + t2);
if (verboseLevel > 1) {
G4cout << "t, Fctcos " << t << " " << Fctcos(t, aa, bb, cc, dd, rr) <<
G4endl;
}
return t;
}
// The following is a "translation" of a root-finding routine
// from GEANT3.21/GHEISHA. Some of the labelled block structure has
// been retained for clarity. This routine will not be needed after
// the planned revisions to DoIt().
G4int
G4HadronElastic::Rtmi(G4double* x, G4double xli, G4double xri, G4double eps,
G4int iend,
G4double aa, G4double bb, G4double cc, G4double dd,
G4double rr)
{
G4int ier = 0;
G4double xl = xli;
G4double xr = xri;
*x = xl;
G4double tol = *x;
G4double f = Fctcos(tol, aa, bb, cc, dd, rr);
if (f == 0.) return ier;
G4double fl, fr;
fl = f;
*x = xr;
tol = *x;
f = Fctcos(tol, aa, bb, cc, dd, rr);
if (f == 0.) return ier;
fr = f;
// Error return in case of wrong input data
if (fl*fr >= 0.) {
ier = 2;
return ier;
}
// Basic assumption fl*fr less than 0 is satisfied.
// Generate tolerance for function values.
G4int i = 0;
G4double tolf = 100.*eps;
// Start iteration loop
label4:
i++;
// Start bisection loop
for (G4int k = 1; k <= iend; k++) {
*x = 0.5*(xl + xr);
tol = *x;
f = Fctcos(tol, aa, bb, cc, dd, rr);
if (f == 0.) return 0;
if (f*fr < 0.) { // Interchange xl and xr in order to get the
tol = xl; // same Sign in f and fr
xl = xr;
xr = tol;
tol = fl;
fl = fr;
fr = tol;
}
tol = f - fl;
G4double a = f*tol;
a = a + a;
if (a < fr*(fr - fl) && i <= iend) goto label17;
xr = *x;
fr = f;
// Test on satisfactory accuracy in bisection loop
tol = eps;
a = std::abs(xr);
if (a > 1.) tol = tol*a;
if (std::abs(xr - xl) <= tol && std::abs(fr - fl) <= tolf) goto label14;
}
// End of bisection loop
// No convergence after iend iteration steps followed by iend
// successive steps of bisection or steadily increasing function
// values at right bounds. Error return.
ier = 1;
label14:
if (std::abs(fr) > std::abs(fl)) {
*x = xl;
f = fl;
}
return ier;
// Computation of iterated x-value by inverse parabolic interp
label17:
G4double a = fr - f;
G4double dx = (*x - xl)*fl*(1. + f*(a - tol)/(a*(fr - fl)))/tol;
G4double xm = *x;
G4double fm = f;
*x = xl - dx;
tol = *x;
f = Fctcos(tol, aa, bb, cc, dd, rr);
if (f == 0.) return ier;
// Test on satisfactory accuracy in iteration loop
tol = eps;
a = std::abs(*x);
if (a > 1) tol = tol*a;
if (std::abs(dx) <= tol && std::abs(f) <= tolf) return ier;
// Preparation of next bisection loop
if (f*fl < 0.) {
xr = *x;
fr = f;
}
else {
xl = *x;
fl = f;
xr = xm;
fr = fm;
}
goto label4;
}
// Test function for root-finder
G4double
G4HadronElastic::Fctcos(G4double t,
G4double aa, G4double bb, G4double cc, G4double dd,
G4double rr)
{
const G4double expxl = -82.;
const G4double expxu = 82.;
G4double test1 = -bb*t;
if (test1 > expxu) test1 = expxu;
if (test1 < expxl) test1 = expxl;
G4double test2 = -dd*t;
if (test2 > expxu) test2 = expxu;
if (test2 < expxl) test2 = expxl;
return aa*std::exp(test1) + cc*std::exp(test2) - rr;
}
void
G4HadronElastic::Defs1(G4double p, G4double px, G4double py, G4double pz,
G4double pxinc, G4double pyinc, G4double pzinc,
G4double* pxnew, G4double* pynew, G4double* pznew)
{
// Transform scattered particle to reflect direction of incident particle
G4double pt2 = pxinc*pxinc + pyinc*pyinc;
if (pt2 > 0.) {
G4double cost = pzinc/p;
G4double sint1 = std::sqrt(std::abs((1. - cost )*(1.+cost)));
G4double sint2 = std::sqrt(pt2)/p;
G4double sint = 0.5*(sint1 + sint2);
G4double ph = pi*0.5;
if (pyinc < 0.) ph = pi*1.5;
if (std::abs(pxinc) > 1.e-6) ph = std::atan2(pyinc, pxinc);
G4double cosp = std::cos(ph);
G4double sinp = std::sin(ph);
if (verboseLevel > 1) {
G4cout << "cost sint " << cost << " " << sint << G4endl;
G4cout << "cosp sinp " << cosp << " " << sinp << G4endl;
}
*pxnew = cost*cosp*px - sinp*py + sint*cosp*pz;
*pynew = cost*sinp*px + cosp*py + sint*sinp*pz;
*pznew = -sint*px +cost*pz;
}
else {
G4double cost=pzinc/p;
*pxnew = cost*px;
*pynew = py;
*pznew = cost*pz;
}
}
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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.14 2005/11/24 19:05:56 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4HadronValues.cc,v 1.16 2006/06/29 20:09:29 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
@@ -182,7 +185,7 @@ G4HadronValues::GetHadronValues(const G4DynamicParticle* aHadron)
case 2: // pi plus
if(HadrMoment>2.0)
HadrTot = 10.6+2.*log(HadrEnergy)+
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
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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.13 2005/11/23 10:34:03 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4IntegrHadrNucleus.cc,v 1.14 2006/06/29 20:09:31 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// IntegrHadrNucleus.cc
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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. *
// ********************************************************************
//
@@ -0,0 +1,321 @@
//
// ********************************************************************
// * 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: G4UHadronElasticProcess.cc,v 1.15 2006/06/29 20:09:37 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// 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
//
//
#include "G4UHadronElasticProcess.hh"
#include "globals.hh"
#include "G4CrossSectionDataStore.hh"
#include "G4HadronElasticDataSet.hh"
#include "G4VQCrossSection.hh"
#include "G4QElasticCrossSection.hh"
#include "G4QCHIPSWorld.hh"
#include "G4Element.hh"
#include "G4ElementVector.hh"
#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)
{
AddDataSet(new G4HadronElasticDataSet);
theProton = G4Proton::Proton();
theNeutron = G4Neutron::Neutron();
thEnergy = 1.*keV;
verboseLevel= 1;
qCManager = 0;
}
G4UHadronElasticProcess::~G4UHadronElasticProcess()
{
}
void G4UHadronElasticProcess::SetQElasticCrossSection(G4VQCrossSection* p)
{
qCManager = p;
}
void G4UHadronElasticProcess::
BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
{
if(first) {
first = false;
if(!qCManager) qCManager = G4QElasticCrossSection::GetPointer();
theParticle = &aParticleType;
pPDG = theParticle->GetPDGEncoding();
if(theParticle == theNeutron && flagHP)
AddDataSet(new G4NeutronHPElasticData());
store = G4HadronicProcess::GetCrossSectionDataStore();
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess for "
<< theParticle->GetParticleName()
<< G4endl;
}
store->BuildPhysicsTable(aParticleType);
}
G4double G4UHadronElasticProcess::GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* cond)
{
*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 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;
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess get mfp for "
<< theParticle->GetParticleName()
<< " p(GeV)= " << dp->GetTotalMomentum()/GeV
<< " in " << material->GetName()
<< G4endl;
for (G4int i=0; i<nelm; i++) {
const G4Element* elm = (*theElementVector)[i];
G4double x = GetMicroscopicCrossSection(dp, elm, temp);
cross += theAtomNumDensityVector[i]*x;
xsec[i] = cross;
}
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess cross(1/mm)= " << cross
<< " E(MeV)= " << dp->GetKineticEnergy()
<< " " << theParticle->GetParticleName()
<< " in " << material->GetName()
<< G4endl;
if(cross > DBL_MIN) x = 1./cross;
return x;
}
G4double G4UHadronElasticProcess::GetMicroscopicCrossSection(
const G4DynamicParticle* dp,
const G4Element* elm,
G4double temp)
{
// 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)) {
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;
}
}
} 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;
}
} else {
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess compute CHIPS CS for Z= 2, N=2 "
<< G4endl;
x = qCManager->GetCrossSection(false,momentum,2,2,pPDG);
}
} else {
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess compute GHAD CS for element "
<< elm->GetName()
<< G4endl;
x = store->GetCrossSection(dp, elm, temp);
}
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess cross(mb)= " << x/millibarn
<< " E(MeV)= " << dp->GetKineticEnergy()
<< " " << theParticle->GetParticleName()
<< " in Z= " << iz
<< G4endl;
return x;
}
G4VParticleChange* G4UHadronElasticProcess::PostStepDoIt(
const G4Track& track,
const G4Step& step)
{
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();
G4Material* material = track.GetMaterial();
// Select element
const G4ElementVector* theElementVector = material->GetElementVector();
G4Element* elm = (*theElementVector)[0];
G4int nelm = material->GetNumberOfElements() - 1;
if (nelm > 0) {
G4double x = G4UniformRand()*cross;
G4int i = -1;
do {i++;} while (x > xsec[i] && i < nelm);
elm = (*theElementVector)[i];
}
G4double Z = elm->GetZ();
G4double A = elm->GetN();
G4int iz = G4int(Z);
// Select isotope
G4IsotopeVector* isv = elm->GetIsotopeVector();
G4int ni = 0;
if(isv) ni = isv->size();
if(ni == 1) {
A = G4double(elm->GetIsotope(0)->GetN());
} else if(ni > 1) {
if(iz == 1 && theParticle == theProton) {
A = 1.;
if(G4UniformRand()*(xsecH[0] + xsec[1]) > xsec[0]) A = 2.;
} 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());
}
}
G4HadronicInteraction* hadi =
ChooseHadronicInteraction( kineticEnergy, material, elm);
// Initialize the hadronic projectile from the track
G4HadProjectile thePro(track);
if(verboseLevel>1)
G4cout << "G4UHadronElasticProcess::PostStepDoIt for "
<< theParticle->GetParticleName()
<< " Target Z= " << Z
<< " A= " << A << G4endl;
targetNucleus.SetParameters(A, Z);
aParticleChange.Initialize(track);
G4HadFinalState* result = hadi->ApplyYourself(thePro, targetNucleus);
if(verboseLevel>1)
G4cout << "Efin= " << result->GetEnergyChange()
<< " de= " << result->GetLocalEnergyDeposit()
<< " nsec= " << result->GetNumberOfSecondaries()
<< G4endl;
aParticleChange.ProposeEnergy(result->GetEnergyChange());
aParticleChange.ProposeMomentumDirection(result->GetMomentumChange());
if(result->GetNumberOfSecondaries() > 0) {
aParticleChange.SetNumberOfSecondaries(1);
G4DynamicParticle* p = result->GetSecondary(0)->GetParticle();
aParticleChange.AddSecondary(p);
} else {
aParticleChange.SetNumberOfSecondaries(0);
aParticleChange.ProposeLocalEnergyDeposit(result->GetLocalEnergyDeposit());
}
result->Clear();
return G4VDiscreteProcess::PostStepDoIt(track,step);
}
G4bool G4UHadronElasticProcess::
IsApplicable(const G4ParticleDefinition& aParticleType)
{
return (aParticleType == *(G4PionPlus::PionPlus()) ||
aParticleType == *(G4PionMinus::PionMinus()) ||
aParticleType == *(G4KaonPlus::KaonPlus()) ||
aParticleType == *(G4KaonZeroShort::KaonZeroShort()) ||
aParticleType == *(G4KaonZeroLong::KaonZeroLong()) ||
aParticleType == *(G4KaonMinus::KaonMinus()) ||
aParticleType == *(G4Proton::Proton()) ||
aParticleType == *(G4AntiProton::AntiProton()) ||
aParticleType == *(G4Neutron::Neutron()) ||
aParticleType == *(G4AntiNeutron::AntiNeutron()) ||
aParticleType == *(G4Lambda::Lambda()) ||
aParticleType == *(G4AntiLambda::AntiLambda()) ||
aParticleType == *(G4SigmaPlus::SigmaPlus()) ||
aParticleType == *(G4SigmaZero::SigmaZero()) ||
aParticleType == *(G4SigmaMinus::SigmaMinus()) ||
aParticleType == *(G4AntiSigmaPlus::AntiSigmaPlus()) ||
aParticleType == *(G4AntiSigmaZero::AntiSigmaZero()) ||
aParticleType == *(G4AntiSigmaMinus::AntiSigmaMinus()) ||
aParticleType == *(G4XiZero::XiZero()) ||
aParticleType == *(G4XiMinus::XiMinus()) ||
aParticleType == *(G4AntiXiZero::AntiXiZero()) ||
aParticleType == *(G4AntiXiMinus::AntiXiMinus()) ||
aParticleType == *(G4Deuteron::Deuteron()) ||
aParticleType == *(G4Triton::Triton()) ||
aParticleType == *(G4Alpha::Alpha()) ||
aParticleType == *(G4OmegaMinus::OmegaMinus()) ||
aParticleType == *(G4AntiOmegaMinus::AntiOmegaMinus()));
}
void G4UHadronElasticProcess::
DumpPhysicsTable(const G4ParticleDefinition& aParticleType)
{
store->DumpPhysicsTable(aParticleType);
}