Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4MCCIndexConversionTable.cc 70369 2013-05-29 14:59:24Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4MaterialCutsCouple.cc 70369 2013-05-29 14:59:24Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4PhysicsTableHelper.cc 70369 2013-05-29 14:59:24Z gcosmo $
//
//
// ------------------------------------------------------------
@@ -41,7 +41,7 @@
#include "G4PhysicsTableHelper.hh"
#include "G4ProductionCutsTable.hh"
G4int G4PhysicsTableHelper::verboseLevel = 1;
G4ThreadLocal G4int G4PhysicsTableHelper::verboseLevel = 1;
G4PhysicsTableHelper::G4PhysicsTableHelper()
{
@@ -227,5 +227,15 @@ void G4PhysicsTableHelper::SetPhysicsVector(G4PhysicsTable* physTable,
}
void G4PhysicsTableHelper::SetVerboseLevel(G4int value)
{
verboseLevel = value;
}
G4int G4PhysicsTableHelper::GetVerboseLevel()
{
return verboseLevel;
}
+21 -17
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ProductionCuts.cc 73044 2013-08-15 09:44:11Z gcosmo $
// GEANT4 tag $Name: geant4-09-04-ref-00 $
//
//
@@ -37,10 +37,10 @@
#include "G4ProductionCutsTable.hh"
#include <iomanip>
const G4ParticleDefinition* G4ProductionCuts::gammaDef = 0;
const G4ParticleDefinition* G4ProductionCuts::electDef = 0;
const G4ParticleDefinition* G4ProductionCuts::positDef = 0;
const G4ParticleDefinition* G4ProductionCuts::protonDef = 0;
G4ThreadLocal G4ParticleDefinition* G4ProductionCuts::gammaDef = 0;
G4ThreadLocal G4ParticleDefinition* G4ProductionCuts::electDef = 0;
G4ThreadLocal G4ParticleDefinition* G4ProductionCuts::positDef = 0;
G4ThreadLocal G4ParticleDefinition* G4ProductionCuts::protonDef = 0;
G4ProductionCuts::G4ProductionCuts() :
isModified(true)
@@ -51,7 +51,11 @@ G4ProductionCuts::G4ProductionCuts() :
}
G4ProductionCuts::G4ProductionCuts(const G4ProductionCuts& right)
: isModified(true)
{
for (G4int i=0; i< NumberOfG4CutIndex; i++) {
fRangeCuts.push_back(0.0);
}
*this = right;
}
@@ -87,10 +91,10 @@ G4int G4ProductionCuts::operator!=(const G4ProductionCuts &right) const
G4int G4ProductionCuts::GetIndex(const G4String& name)
{
static G4String gamma("gamma");
static G4String electron("e-");
static G4String positron("e+");
static G4String proton("proton");
static const G4String gamma ("gamma");
static const G4String electron("e-");
static const G4String positron("e+");
static const G4String proton("proton");
G4int index;
if ( name == gamma ) { index = 0; }
@@ -107,16 +111,16 @@ G4int G4ProductionCuts::GetIndex(const G4ParticleDefinition* ptcl)
{
if(!ptcl) return -1;
// In the first call, pointers are set
if(gammaDef==0 && ptcl->GetParticleName()=="gamma") { gammaDef = ptcl; }
if(electDef==0 && ptcl->GetParticleName()=="e-") { electDef = ptcl; }
if(positDef==0 && ptcl->GetParticleName()=="e+") { positDef = ptcl; }
if(protonDef==0 && ptcl->GetParticleName()=="proton") { protonDef = ptcl; }
if(gammaDef==0 && ptcl->GetParticleName()=="gamma") { gammaDef = (G4ParticleDefinition*) ptcl; }
if(electDef==0 && ptcl->GetParticleName()=="e-") { electDef = (G4ParticleDefinition*) ptcl; }
if(positDef==0 && ptcl->GetParticleName()=="e+") { positDef = (G4ParticleDefinition*) ptcl; }
if(protonDef==0 && ptcl->GetParticleName()=="proton") { protonDef = (G4ParticleDefinition*) ptcl; }
G4int index;
if(ptcl==gammaDef) { index = 0; }
else if(ptcl==electDef) { index = 1; }
else if(ptcl==positDef) { index = 2; }
else if(ptcl==protonDef) { index = 3; }
if(ptcl==(const G4ParticleDefinition*) gammaDef) { index = 0; }
else if(ptcl==(const G4ParticleDefinition*) electDef) { index = 1; }
else if(ptcl==(const G4ParticleDefinition*) positDef) { index = 2; }
else if(ptcl==(const G4ParticleDefinition*) protonDef) { index = 3; }
else { index = -1; }
return index;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ProductionCutsTable.cc 71792 2013-06-24 14:11:27Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -382,9 +382,9 @@ void G4ProductionCutsTable::DumpCouples() const
<< " used in the geometry : ";
if(aCouple->IsUsed()) G4cout << "Yes";
else G4cout << "No ";
G4cout << " recalculation needed : ";
if(aCouple->IsRecalcNeeded()) G4cout << "Yes";
else G4cout << "No ";
//// G4cout << " recalculation needed : ";
//// if(aCouple->IsRecalcNeeded()) G4cout << "Yes";
//// else G4cout << "No ";
G4cout << G4endl;
G4cout << " Material : " << aCouple->GetMaterial()->GetName() << G4endl;
G4cout << " Range cuts : "
@@ -394,14 +394,14 @@ void G4ProductionCutsTable::DumpCouples() const
<< " proton " << G4BestUnit(aCut->GetProductionCut("proton"),"Length")
<< G4endl;
G4cout << " Energy thresholds : " ;
if(aCouple->IsRecalcNeeded()) {
G4cout << " is not ready to print";
} else {
//// if(aCouple->IsRecalcNeeded()) {
//// G4cout << " is not ready to print";
//// } else {
G4cout << " gamma " << G4BestUnit((*(energyCutTable[0]))[aCouple->GetIndex()],"Energy")
<< " e- " << G4BestUnit((*(energyCutTable[1]))[aCouple->GetIndex()],"Energy")
<< " e+ " << G4BestUnit((*(energyCutTable[2]))[aCouple->GetIndex()],"Energy")
<< " proton " << G4BestUnit((*(energyCutTable[3]))[aCouple->GetIndex()],"Energy");
}
//// }
G4cout << G4endl;
if(aCouple->IsUsed()) {
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ProductionCutsTableMessenger.cc 70369 2013-05-29 14:59:24Z gcosmo $
//
//
//---------------------------------------------------------------
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4RToEConvForElectron.cc 70745 2013-06-05 10:54:00Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -42,7 +42,14 @@
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
G4RToEConvForElectron::G4RToEConvForElectron() : G4VRangeToEnergyConverter()
G4RToEConvForElectron::G4RToEConvForElectron()
: G4VRangeToEnergyConverter(),
Mass(0.0),
Z(-1.),
taul(0.0),
ionpot(0.0),
ionpotlog(-1.0e-10),
bremfactor(0.1)
{
theParticle = G4ParticleTable::GetParticleTable()->FindParticle("e-");
if (theParticle ==0) {
@@ -52,7 +59,9 @@ G4RToEConvForElectron::G4RToEConvForElectron() : G4VRangeToEnergyConverter()
G4cout << " Electron is not defined !!" << G4endl;
}
#endif
}
} else {
Mass = theParticle->GetPDGMass();
}
}
G4RToEConvForElectron::~G4RToEConvForElectron()
@@ -64,15 +73,10 @@ G4RToEConvForElectron::~G4RToEConvForElectron()
// ************************* ComputeLoss ********************************
// **********************************************************************
G4double G4RToEConvForElectron::ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy) const
G4double KineticEnergy)
{
static G4double Z;
static G4double taul, ionpot, ionpotlog;
const G4double cbr1=0.02, cbr2=-5.7e-5, cbr3=1., cbr4=0.072;
const G4double Tlow=10.*keV, Thigh=1.*GeV;
static G4double bremfactor= 0.1 ;
static G4double Mass= theParticle->GetPDGMass();
// calculate dE/dx for electrons
if( std::fabs(AtomicNumber-Z)>0.1 ) {
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4RToEConvForGamma.cc 70745 2013-06-05 10:54:00Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -41,7 +41,13 @@
#include "G4ios.hh"
#include "G4SystemOfUnits.hh"
G4RToEConvForGamma::G4RToEConvForGamma() : G4VRangeToEnergyConverter()
G4RToEConvForGamma::G4RToEConvForGamma()
: G4VRangeToEnergyConverter(),
Z(-1),
s200keV(0.), s1keV(0.),
tmin(0.), tlow(0.),
smin(0.), slow(0.),
cmin(0.), clow(0.), chigh(0.)
{
theParticle = G4ParticleTable::GetParticleTable()->FindParticle("gamma");
if (theParticle ==0) {
@@ -97,20 +103,15 @@ void G4RToEConvForGamma::BuildAbsorptionLengthVector(
// ********************** ComputeCrossSection ****************************
// ***********************************************************************
G4double G4RToEConvForGamma::ComputeCrossSection(G4double AtomicNumber,
G4double KineticEnergy) const
G4double KineticEnergy)
{
// Compute the "absorption" cross section of the photon "absorption"
// cross section means here the sum of the cross sections of the
// pair production, Compton scattering and photoelectric processes
static G4double Z;
const G4double t1keV = 1.*keV;
const G4double t200keV = 200.*keV;
const G4double t100MeV = 100.*MeV;
static G4double s200keV, s1keV;
static G4double tmin, tlow;
static G4double smin, slow;
static G4double cmin, clow, chigh;
// compute Z dependent quantities in the case of a new AtomicNumber
if(std::abs(AtomicNumber-Z)>0.1) {
Z = AtomicNumber;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4RToEConvForPositron.cc 70745 2013-06-05 10:54:00Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -42,7 +42,14 @@
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
G4RToEConvForPositron::G4RToEConvForPositron() : G4VRangeToEnergyConverter()
G4RToEConvForPositron::G4RToEConvForPositron()
: G4VRangeToEnergyConverter(),
Mass(0.0),
Z(-1.),
taul(0.0),
ionpot(0.0),
ionpotlog(-1.0e-10),
bremfactor(0.1)
{
theParticle = G4ParticleTable::GetParticleTable()->FindParticle("e+");
if (theParticle ==0) {
@@ -52,7 +59,9 @@ G4RToEConvForPositron::G4RToEConvForPositron() : G4VRangeToEnergyConverter()
G4cout << " Positron is not defined !!" << G4endl;
}
#endif
}
} else {
Mass = theParticle->GetPDGMass();
}
}
G4RToEConvForPositron::~G4RToEConvForPositron()
@@ -66,15 +75,11 @@ G4RToEConvForPositron::~G4RToEConvForPositron()
// ************************* ComputeLoss ********************************
// **********************************************************************
G4double G4RToEConvForPositron::ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy) const
G4double KineticEnergy)
{
static G4double Z;
static G4double taul, ionpot, ionpotlog;
const G4double cbr1=0.02, cbr2=-5.7e-5, cbr3=1., cbr4=0.072;
const G4double Tlow=10.*keV, Thigh=1.*GeV;
static G4double bremfactor = 0.1 ;
G4double Mass = theParticle->GetPDGMass();
// calculate dE/dx for electrons
if( std::fabs(AtomicNumber-Z)>0.1 ) {
Z = AtomicNumber;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4RToEConvForProton.cc 70745 2013-06-05 10:54:00Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -41,7 +41,13 @@
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
G4RToEConvForProton::G4RToEConvForProton() : G4VRangeToEnergyConverter()
G4RToEConvForProton::G4RToEConvForProton()
: G4VRangeToEnergyConverter(),
Mass(0.0),
Z(-1.),
tau0(0.0), taul(0.0), taum(0.0),
ionpot(0.0),
ca(0.0), cba(0.0), cc(0.0)
{
theParticle = G4ParticleTable::GetParticleTable()->FindParticle("proton");
if (theParticle ==0) {
@@ -51,6 +57,8 @@ G4RToEConvForProton::G4RToEConvForProton() : G4VRangeToEnergyConverter()
G4cout << " proton is not defined !!" << G4endl;
}
#endif
} else {
Mass = theParticle->GetPDGMass();
}
}
@@ -71,16 +79,10 @@ G4double G4RToEConvForProton::Convert(G4double rangeCut, const G4Material* )
// ************************* ComputeLoss ********************************
// **********************************************************************
G4double G4RToEConvForProton::ComputeLoss(G4double AtomicNumber,
G4double KineticEnergy) const
G4double KineticEnergy)
{
// calculate dE/dx
static G4double Z;
static G4double ionpot, tau0, taum, taul, ca, cba, cc;
G4double z2Particle = theParticle->GetPDGCharge()/eplus;
z2Particle *= z2Particle;
if (z2Particle < 0.1) return 0.0;
const G4double z2Particle = 1.0;
if( std::fabs(AtomicNumber-Z)>0.1 ){
// recalculate constants
@@ -90,13 +92,13 @@ G4double G4RToEConvForProton::ComputeLoss(G4double AtomicNumber,
taum = 0.035*Z13*MeV/proton_mass_c2;
taul = 2.*MeV/proton_mass_c2;
ionpot = 1.6e-5*MeV*std::exp(0.9*std::log(Z));
cc = (taul+1.)*(taul+1.)*std::log(2.*electron_mass_c2*taul*(taul+2.)/ionpot)/(taul*(taul+2.))-1.;
cc = (taul+1.)*(taul+1.)*std::log(2.*electron_mass_c2*taul*(taul+2.)/ionpot)/(taul*(taul+2.))-1.;
cc = 2.*twopi_mc2_rcl2*Z*cc*std::sqrt(taul);
ca = cc/((1.-0.5*std::sqrt(tau0/taum))*tau0);
cba = -0.5/std::sqrt(taum);
}
G4double tau = KineticEnergy/theParticle->GetPDGMass();
G4double tau = KineticEnergy/Mass;
G4double dEdx;
if ( tau <= tau0 ) {
dEdx = ca*(std::sqrt(tau)+cba*tau);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VRangeToEnergyConverter.cc 77079 2013-11-21 10:32:34Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -41,11 +41,8 @@
#include "G4ios.hh"
#include "G4SystemOfUnits.hh"
// energy range
G4double G4VRangeToEnergyConverter::LowestEnergy = 0.99e-3*MeV;
G4double G4VRangeToEnergyConverter::HighestEnergy = 100.0e6*MeV;
// max energy cut
G4double G4VRangeToEnergyConverter::MaxEnergyCut = 10.0*GeV;
G4VRangeToEnergyConverter::G4VRangeToEnergyConverter():
@@ -58,6 +55,11 @@ G4VRangeToEnergyConverter::G4VRangeToEnergyConverter():
G4VRangeToEnergyConverter::G4VRangeToEnergyConverter(const G4VRangeToEnergyConverter& right) : theParticle(right.theParticle), theLossTable(0), TotBin(right.TotBin)
{
fMaxEnergyCut = 0.;
if (theLossTable) {
theLossTable->clearAndDestroy();
delete theLossTable;
theLossTable=0;
}
*this = right;
}
@@ -70,6 +72,10 @@ G4VRangeToEnergyConverter & G4VRangeToEnergyConverter::operator=(const G4VRangeT
theLossTable=0;
}
LowestEnergy = right.LowestEnergy;
HighestEnergy = right.HighestEnergy;
MaxEnergyCut = right.MaxEnergyCut;
fMaxEnergyCut = right.fMaxEnergyCut;
NumberOfElements = right.NumberOfElements;
theParticle = right.theParticle;
verboseLevel = right.verboseLevel;
@@ -79,9 +85,8 @@ G4VRangeToEnergyConverter & G4VRangeToEnergyConverter::operator=(const G4VRangeT
theLossTable->reserve(G4Element::GetNumberOfElements());
// fill the loss table
for (size_t j=0; j<size_t(NumberOfElements); j++){
G4LossVector* aVector= new
G4LossVector(LowestEnergy, MaxEnergyCut, TotBin);
for (size_t i=0; i<size_t(TotBin); i++) {
G4LossVector* aVector = new G4LossVector(LowestEnergy, MaxEnergyCut, TotBin);
for (size_t i=0; i<=size_t(TotBin); i++) {
G4double Value = (*((*right.theLossTable)[j]))[i];
aVector->PutValue(i,Value);
}
@@ -101,7 +106,7 @@ G4VRangeToEnergyConverter & G4VRangeToEnergyConverter::operator=(const G4VRangeT
if (vector !=0 ) {
rangeVector = new G4RangeVector(LowestEnergy, MaxEnergyCut, TotBin);
fMaxEnergyCut = MaxEnergyCut;
for (size_t i=0; i<size_t(TotBin); i++) {
for (size_t i=0; i<=size_t(TotBin); i++) {
G4double Value = (*vector)[i];
rangeVector->PutValue(i,Value);
}
@@ -114,7 +119,7 @@ G4VRangeToEnergyConverter & G4VRangeToEnergyConverter::operator=(const G4VRangeT
G4VRangeToEnergyConverter::~G4VRangeToEnergyConverter()
{
Reset();
// Reset();
}
G4int G4VRangeToEnergyConverter::operator==(const G4VRangeToEnergyConverter &right) const
@@ -155,12 +160,12 @@ G4double G4VRangeToEnergyConverter::Convert(G4double rangeCut,
// Build range vector for every material, convert cut into energy-cut,
// fill theKineticEnergyCuts and delete the range vector
G4double tune = 0.025*mm*g/cm3 ,lowen = 30.*keV ;
static const G4double tune = 0.025*mm*g/cm3 ,lowen = 30.*keV ;
// check density
G4double density = material->GetDensity() ;
if(density <= 0.) {
#ifdef G4VERBOSE
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cout << "G4VRangeToEnergyConverter::Convert() ";
G4cout << material->GetName() << "has zero density "
@@ -301,9 +306,9 @@ void G4VRangeToEnergyConverter::BuildLossTable()
G4double Value;
G4LossVector* aVector= 0;
aVector= new G4LossVector(LowestEnergy, MaxEnergyCut, TotBin);
for (size_t i=0; i<size_t(TotBin); i++) {
for (size_t i=0; i<=size_t(TotBin); i++) {
Value = ComputeLoss( (*G4Element::GetElementTable())[j]->GetZ(),
aVector->GetLowEdgeEnergy(i)
aVector->Energy(i)
);
aVector->PutValue(i,Value);
}
@@ -325,7 +330,7 @@ void G4VRangeToEnergyConverter::BuildRangeVector(const G4Material* aMaterial,
// calculate parameters of the low energy part first
size_t i;
std::vector<G4double> lossV;
for ( size_t ib=0; ib<size_t(TotBin); ib++) {
for ( size_t ib=0; ib<=size_t(TotBin); ib++) {
G4double loss=0.;
for (i=0; i<size_t(NumEl); i++) {
G4int IndEl = (*elementVector)[i]->GetIndex();
@@ -341,7 +346,7 @@ void G4VRangeToEnergyConverter::BuildRangeVector(const G4Material* aMaterial,
G4double s0 = 0.;
G4double Value;
for ( i=0; i<size_t(TotBin); i++) {
for ( i=0; i<=size_t(TotBin); i++) {
G4double t = rangeVector->GetLowEdgeEnergy(i);
G4double q = t/lossV[i];
if (i==0) s0 += 0.5*q;
@@ -384,7 +389,7 @@ G4double G4VRangeToEnergyConverter::ConvertCutToKineticEnergy(
// scan range vector to find nearest bin
// ( suppose that r(Ti) > r(Tj) if Ti >Tj )
for (size_t ibin=0; ibin<size_t(TotBin); ibin++) {
for (size_t ibin=0; ibin<=size_t(TotBin); ibin++) {
G4double T=rangeVector->GetLowEdgeEnergy(ibin);
G4double r=(*rangeVector)[ibin];
if ( r>rmax ) rmax=r;