Import Geant4 10.7.1 source tree
This commit is contained in:
@@ -14,6 +14,32 @@ code and to keep track of all tags.
|
||||
* Please list in reverse chronological order (last date on top)
|
||||
---------------------------------------------------------------
|
||||
|
||||
17 December 2020 - Vladimir Ivanchenko (hadr-cross-V10-06-18)
|
||||
- G4GammaNuclearXS - fixed duplicated name of static variable
|
||||
- G4ParticleInelasticXS, G4NeutronCaptureXS, G4NeutronElasticXS,
|
||||
G4NeutronInelasticXS - make MAXZ variable static class member
|
||||
|
||||
16 December 2020 - Guilherme Amadio
|
||||
- Drop cache for per-element G4CrossSectionDataStore::GetCrossSection(),
|
||||
since the cache is never used in practice. This method is always called
|
||||
by G4CrossSectionDataStore::ComputeCrossSection() inside a for loop in
|
||||
which the element changes for each iteration, which ensures the cache
|
||||
is always missed. Note that material, particle, and energy are still
|
||||
cached by G4CrossSectionDataStore::ComputeCrossSection(), and that cache
|
||||
hit rate has been measured to be about 6.9% for a full CMS ttbar event
|
||||
simulation at 14 TeV. The condition to check for the cache in that case
|
||||
has been optimized to minimize unnecessary checks by reordering checked
|
||||
conditions from most to least discriminant.
|
||||
|
||||
11 December 2020 - Vladimir Ivanchenko
|
||||
- G4VCrossSectionRatio - use inheritance from G4VCrossSectionDataSet
|
||||
in order to guarantee deletion of object end of run
|
||||
|
||||
06 December 2020 - Vladimir Ivanchenko
|
||||
- G4ParticleInelasticXS, G4CrossSectionInelastic, G4CrossSectionElastic
|
||||
extended maximum energy range for ion cross sections (QBBC and other
|
||||
Physics Lists has the same high energy limits)
|
||||
|
||||
24 November 2020 - A. Ribon (hadr-cross-V10-06-17)
|
||||
- G4EMDissociationCrossSection : apply fixes suggested by Laurie Nevay and
|
||||
Andrey Abramov (bug report #2254) to avoid numerical crashes for ions
|
||||
|
||||
@@ -122,12 +122,6 @@ private:
|
||||
G4double matKinEnergy;
|
||||
G4double matCrossSection;
|
||||
|
||||
const G4Material* elmMaterial;
|
||||
const G4Element* currentElement;
|
||||
const G4ParticleDefinition* elmParticle;
|
||||
G4double elmKinEnergy;
|
||||
G4double elmCrossSection;
|
||||
|
||||
G4int nDataSetList;
|
||||
G4int verboseLevel;
|
||||
//Fast path: caching
|
||||
|
||||
@@ -48,8 +48,6 @@
|
||||
#include "G4Threading.hh"
|
||||
#include <vector>
|
||||
|
||||
const G4int MAXZEL = 93;
|
||||
|
||||
class G4DynamicParticle;
|
||||
class G4ParticleDefinition;
|
||||
class G4Element;
|
||||
@@ -101,8 +99,9 @@ private:
|
||||
G4VCrossSectionDataSet* ggXsection;
|
||||
const G4ParticleDefinition* gamma;
|
||||
|
||||
static G4PhysicsVector* data[MAXZEL];
|
||||
static G4double coeff[MAXZEL];
|
||||
static const G4int MAXZGAMMAN = 93;
|
||||
static G4PhysicsVector* data[MAXZGAMMAN];
|
||||
static G4double coeff[MAXZGAMMAN];
|
||||
static G4String gDataDirectory;
|
||||
|
||||
G4bool isMaster;
|
||||
|
||||
@@ -51,8 +51,6 @@
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
const G4int MAXZCAPTURE = 93;
|
||||
|
||||
class G4DynamicParticle;
|
||||
class G4ParticleDefinition;
|
||||
class G4Element;
|
||||
@@ -113,6 +111,7 @@ private:
|
||||
|
||||
G4bool isMaster;
|
||||
|
||||
static const G4int MAXZCAPTURE = 93;
|
||||
static G4ElementData* data;
|
||||
static G4String gDataDirectory;
|
||||
|
||||
|
||||
@@ -48,8 +48,6 @@
|
||||
#include "G4Threading.hh"
|
||||
#include <vector>
|
||||
|
||||
const G4int MAXZEL = 93;
|
||||
|
||||
class G4DynamicParticle;
|
||||
class G4ParticleDefinition;
|
||||
class G4Element;
|
||||
@@ -102,6 +100,7 @@ private:
|
||||
G4VComponentCrossSection* ggXsection;
|
||||
const G4ParticleDefinition* neutron;
|
||||
|
||||
static const G4int MAXZEL = 93;
|
||||
static G4PhysicsVector* data[MAXZEL];
|
||||
static G4double coeff[MAXZEL];
|
||||
static G4String gDataDirectory;
|
||||
|
||||
@@ -48,8 +48,6 @@
|
||||
#include "G4Threading.hh"
|
||||
#include <vector>
|
||||
|
||||
const G4int MAXZINEL = 93;
|
||||
|
||||
class G4DynamicParticle;
|
||||
class G4ParticleDefinition;
|
||||
class G4Element;
|
||||
@@ -111,6 +109,7 @@ private:
|
||||
|
||||
G4bool isMaster;
|
||||
|
||||
static const G4int MAXZINEL = 93;
|
||||
static G4ElementData* data;
|
||||
static G4double coeff[MAXZINEL];
|
||||
static G4String gDataDirectory;
|
||||
|
||||
@@ -49,8 +49,6 @@
|
||||
#include "G4Threading.hh"
|
||||
#include <vector>
|
||||
|
||||
const G4int MAXZINELP = 93;
|
||||
|
||||
class G4DynamicParticle;
|
||||
class G4ParticleDefinition;
|
||||
class G4Element;
|
||||
@@ -113,6 +111,7 @@ private:
|
||||
G4int index;
|
||||
G4bool isMaster;
|
||||
|
||||
static const G4int MAXZINELP = 93;
|
||||
static G4ElementData* data[5];
|
||||
static G4double coeff[MAXZINELP][5];
|
||||
static G4String gDataDirectory[5];
|
||||
|
||||
@@ -143,8 +143,6 @@ public: //with description
|
||||
|
||||
virtual void CrossSectionDescription(std::ostream&) const;
|
||||
|
||||
public: // Without Description
|
||||
|
||||
virtual G4int GetVerboseLevel() const;
|
||||
|
||||
virtual void SetVerboseLevel(G4int value);
|
||||
@@ -163,12 +161,14 @@ public: // Without Description
|
||||
|
||||
inline const G4String& GetName() const;
|
||||
|
||||
inline void SetName(const G4String& nam);
|
||||
|
||||
protected:
|
||||
|
||||
inline void SetName(const G4String&);
|
||||
|
||||
G4int verboseLevel;
|
||||
|
||||
G4String name;
|
||||
|
||||
private:
|
||||
|
||||
G4VCrossSectionDataSet & operator=(const G4VCrossSectionDataSet &right);
|
||||
@@ -181,7 +181,6 @@ private:
|
||||
|
||||
G4bool isForAllAtomsAndEnergies;
|
||||
|
||||
G4String name;
|
||||
};
|
||||
|
||||
inline G4double
|
||||
|
||||
@@ -45,60 +45,28 @@
|
||||
#ifndef G4VCrossSectionRatio_h
|
||||
#define G4VCrossSectionRatio_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VCrossSectionDataSet.hh"
|
||||
|
||||
class G4ParticleDefinition;
|
||||
|
||||
class G4VCrossSectionRatio
|
||||
class G4VCrossSectionRatio : G4VCrossSectionDataSet
|
||||
{
|
||||
public:
|
||||
|
||||
G4VCrossSectionRatio(const G4String& nam = "", G4int verb = 0);
|
||||
G4VCrossSectionRatio(const G4String& nam = "XSRatio", G4int verb = 0);
|
||||
|
||||
virtual ~G4VCrossSectionRatio();
|
||||
~G4VCrossSectionRatio() override;
|
||||
|
||||
virtual
|
||||
G4double ComputeRatio(const G4ParticleDefinition*,
|
||||
G4double kinEnergy,
|
||||
G4int /*Z*/, G4int /*A*/) = 0;
|
||||
|
||||
virtual
|
||||
void BuildPhysicsTable(const G4ParticleDefinition&);
|
||||
|
||||
virtual
|
||||
void DumpPhysicsTable(const G4ParticleDefinition&);
|
||||
|
||||
virtual
|
||||
void Description() const;
|
||||
|
||||
inline void SetVerboseLevel(G4int value);
|
||||
|
||||
inline G4int GetVerboseLevel() const;
|
||||
|
||||
inline const G4String& GetName() const;
|
||||
|
||||
private:
|
||||
|
||||
G4VCrossSectionRatio & operator=(const G4VCrossSectionRatio &right);
|
||||
G4VCrossSectionRatio(const G4VCrossSectionRatio&);
|
||||
|
||||
G4int verboseLevel;
|
||||
const G4String name;
|
||||
};
|
||||
|
||||
inline void G4VCrossSectionRatio::SetVerboseLevel(G4int value)
|
||||
{
|
||||
verboseLevel = value;
|
||||
}
|
||||
|
||||
inline G4int G4VCrossSectionRatio::GetVerboseLevel() const
|
||||
{
|
||||
return verboseLevel;
|
||||
}
|
||||
|
||||
inline const G4String& G4VCrossSectionRatio::GetName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -57,16 +57,19 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
G4CrossSectionDataStore::G4CrossSectionDataStore() :
|
||||
nDataSetList(0), verboseLevel(0),fastPathFlags(),fastPathParams(),
|
||||
counters(),fastPathCache()
|
||||
{
|
||||
nist = G4NistManager::Instance();
|
||||
currentMaterial = elmMaterial = nullptr;
|
||||
currentElement = nullptr; //ALB 14-Aug-2012 Coverity fix.
|
||||
matParticle = elmParticle = nullptr;
|
||||
matKinEnergy = elmKinEnergy = matCrossSection = elmCrossSection = 0.0;
|
||||
}
|
||||
G4CrossSectionDataStore::G4CrossSectionDataStore()
|
||||
: nist(G4NistManager::Instance())
|
||||
, currentMaterial(nullptr)
|
||||
, matParticle(nullptr)
|
||||
, matKinEnergy(0.0)
|
||||
, matCrossSection(0.0)
|
||||
, nDataSetList(0)
|
||||
, verboseLevel(0)
|
||||
, fastPathFlags()
|
||||
, fastPathParams()
|
||||
, counters()
|
||||
, fastPathCache()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
@@ -268,10 +271,10 @@ G4double
|
||||
G4CrossSectionDataStore::ComputeCrossSection(const G4DynamicParticle* part,
|
||||
const G4Material* mat)
|
||||
{
|
||||
if(mat == currentMaterial && part->GetDefinition() == matParticle
|
||||
&& part->GetKineticEnergy() == matKinEnergy) {
|
||||
if(part->GetKineticEnergy() == matKinEnergy && mat == currentMaterial &&
|
||||
part->GetDefinition() == matParticle)
|
||||
return matCrossSection;
|
||||
}
|
||||
|
||||
currentMaterial = mat;
|
||||
matParticle = part->GetDefinition();
|
||||
matKinEnergy = part->GetKineticEnergy();
|
||||
@@ -292,58 +295,36 @@ G4CrossSectionDataStore::ComputeCrossSection(const G4DynamicParticle* part,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
G4double
|
||||
G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* part,
|
||||
const G4Element* elm,
|
||||
const G4Material* mat)
|
||||
G4double G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* part,
|
||||
const G4Element* elm,
|
||||
const G4Material* mat)
|
||||
{
|
||||
if(mat == elmMaterial && elm == currentElement &&
|
||||
part->GetDefinition() == elmParticle &&
|
||||
part->GetKineticEnergy() == elmKinEnergy)
|
||||
{ return elmCrossSection; }
|
||||
|
||||
elmMaterial = mat;
|
||||
currentElement = elm;
|
||||
elmParticle = part->GetDefinition();
|
||||
elmKinEnergy = part->GetKineticEnergy();
|
||||
elmCrossSection = 0.0;
|
||||
|
||||
G4int i = nDataSetList-1;
|
||||
G4int i = nDataSetList - 1;
|
||||
G4int Z = elm->GetZasInt();
|
||||
if (elm->GetNaturalAbundanceFlag() &&
|
||||
dataSetList[i]->IsElementApplicable(part, Z, mat)) {
|
||||
|
||||
if(elm->GetNaturalAbundanceFlag() &&
|
||||
dataSetList[i]->IsElementApplicable(part, Z, mat))
|
||||
{
|
||||
// element wise cross section
|
||||
elmCrossSection = dataSetList[i]->GetElementCrossSection(part, Z, mat);
|
||||
|
||||
//G4cout << "Element wise " << elmParticle->GetParticleName()
|
||||
// << " xsec(barn)= " << elmCrossSection/barn
|
||||
// << " E(MeV)= " << elmKinEnergy/MeV
|
||||
// << " Z= " << Z << " AbundFlag= " << elm->GetNaturalAbandancesFlag()
|
||||
// <<G4endl;
|
||||
|
||||
} else {
|
||||
// isotope wise cross section
|
||||
size_t nIso = elm->GetNumberOfIsotopes();
|
||||
|
||||
// user-defined isotope abundances
|
||||
const G4double* abundVector = elm->GetRelativeAbundanceVector();
|
||||
|
||||
for (size_t j=0; j<nIso; ++j) {
|
||||
if(abundVector[j] > 0.0) {
|
||||
const G4Isotope* iso = elm->GetIsotope(j);
|
||||
elmCrossSection += abundVector[j]*
|
||||
GetIsoCrossSection(part, Z, iso->GetN(), iso, elm, mat, i);
|
||||
//G4cout << "Isotope wise " << elmParticle->GetParticleName()
|
||||
// << " xsec(barn)= " << elmCrossSection/barn
|
||||
// << " E(MeV)= " << elmKinEnergy/MeV
|
||||
// << " Z= " << Z << " A= " << iso->GetN() << " j= " << j << G4endl;
|
||||
}
|
||||
}
|
||||
return dataSetList[i]->GetElementCrossSection(part, Z, mat);
|
||||
}
|
||||
//G4cout << " E(MeV)= " << elmKinEnergy/MeV
|
||||
// << "xsec(barn)= " << elmCrossSection/barn <<G4endl;
|
||||
return elmCrossSection;
|
||||
|
||||
// isotope wise cross section
|
||||
size_t nIso = elm->GetNumberOfIsotopes();
|
||||
|
||||
// user-defined isotope abundances
|
||||
const G4double* abundVector = elm->GetRelativeAbundanceVector();
|
||||
|
||||
G4double sigma = 0.0;
|
||||
|
||||
for(size_t j = 0; j < nIso; ++j)
|
||||
{
|
||||
const G4Isotope* iso = elm->GetIsotope(j);
|
||||
sigma += abundVector[j] *
|
||||
GetIsoCrossSection(part, Z, iso->GetN(), iso, elm, mat, i);
|
||||
}
|
||||
|
||||
return sigma;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
|
||||
@@ -91,8 +91,9 @@ void G4CrossSectionElastic::BuildPhysicsTable(const G4ParticleDefinition& p)
|
||||
// often shared between the different types of ions (d, t, He3, alpha, and
|
||||
// genericIon) therefore we scale by Zmax - which is safely larger than the
|
||||
// number of nucleons of the heaviest nuclides.
|
||||
SetMaxKinEnergy( G4HadronicParameters::Instance()->GetMaxEnergy() *
|
||||
( std::abs( p.GetBaryonNumber() ) > 1 ? Zmax : 1 ) );
|
||||
G4int fact = (std::abs(p.GetBaryonNumber()) > 1 ||
|
||||
p.GetParticleName() == "GenericIon") ? Zmax : 1;
|
||||
SetMaxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy() * fact);
|
||||
}
|
||||
|
||||
void G4CrossSectionElastic::DumpPhysicsTable(const G4ParticleDefinition& p)
|
||||
|
||||
@@ -91,8 +91,9 @@ void G4CrossSectionInelastic::BuildPhysicsTable(const G4ParticleDefinition& p)
|
||||
// often shared between the different types of ions (d, t, He3, alpha, and
|
||||
// genericIon) therefore we scale by Zmax - which is safely larger than the
|
||||
// number of nucleons of the heaviest nuclides.
|
||||
SetMaxKinEnergy( G4HadronicParameters::Instance()->GetMaxEnergy() *
|
||||
( std::abs( p.GetBaryonNumber() ) > 1 ? Zmax : 1 ) );
|
||||
G4int fact = (std::abs(p.GetBaryonNumber()) > 1 ||
|
||||
p.GetParticleName() == "GenericIon") ? Zmax : 1;
|
||||
SetMaxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy() * fact);
|
||||
}
|
||||
|
||||
void G4CrossSectionInelastic::DumpPhysicsTable(const G4ParticleDefinition& p)
|
||||
|
||||
@@ -73,7 +73,7 @@ G4GammaNuclearXS::G4GammaNuclearXS()
|
||||
// verboseLevel = 0;
|
||||
if(verboseLevel > 0){
|
||||
G4cout << "G4GammaNuclearXS::G4GammaNuclearXS Initialise for Z < "
|
||||
<< MAXZEL << G4endl;
|
||||
<< MAXZGAMMAN << G4endl;
|
||||
}
|
||||
ggXsection = G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet("PhotoNuclearXS");
|
||||
if(ggXsection == nullptr) ggXsection = new G4PhotoNuclearCrossSection();
|
||||
@@ -83,7 +83,7 @@ G4GammaNuclearXS::G4GammaNuclearXS()
|
||||
G4GammaNuclearXS::~G4GammaNuclearXS()
|
||||
{
|
||||
if(isMaster) {
|
||||
for(G4int i=0; i<MAXZEL; ++i) {
|
||||
for(G4int i=0; i<MAXZGAMMAN; ++i) {
|
||||
delete data[i];
|
||||
data[i] = nullptr;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ G4GammaNuclearXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
|
||||
G4double xs = 0.0;
|
||||
G4double ekin = aParticle->GetKineticEnergy();
|
||||
|
||||
G4int Z = (ZZ >= MAXZEL) ? MAXZEL - 1 : ZZ;
|
||||
G4int Z = (ZZ >= MAXZGAMMAN) ? MAXZGAMMAN - 1 : ZZ;
|
||||
|
||||
auto pv = GetPhysicsVector(Z);
|
||||
if(pv == nullptr) { return xs; }
|
||||
@@ -217,7 +217,7 @@ G4GammaNuclearXS::BuildPhysicsTable(const G4ParticleDefinition& p)
|
||||
auto elmVec = mat->GetElementVector();
|
||||
size_t numOfElem = mat->GetNumberOfElements();
|
||||
for (size_t ie = 0; ie < numOfElem; ++ie) {
|
||||
G4int Z = std::max(1,std::min(((*elmVec)[ie])->GetZasInt(), MAXZEL-1));
|
||||
G4int Z = std::max(1,std::min(((*elmVec)[ie])->GetZasInt(), MAXZGAMMAN-1));
|
||||
if(data[Z] == nullptr) { Initialise(Z); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "Randomize.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4IsotopeList.hh"
|
||||
#include "G4HadronicParameters.hh"
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
@@ -297,6 +298,9 @@ G4ParticleInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
|
||||
return;
|
||||
}
|
||||
|
||||
G4int fact = (p.GetParticleName() == "proton") ? 1 : 256;
|
||||
SetMaxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy() * fact);
|
||||
|
||||
if(data[index] == nullptr) {
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MUTEXLOCK(&particleInelasticXSMutex);
|
||||
|
||||
@@ -47,9 +47,9 @@
|
||||
#include "G4HadronicParameters.hh"
|
||||
|
||||
G4VCrossSectionDataSet::G4VCrossSectionDataSet(const G4String& nam) :
|
||||
verboseLevel(0),minKinEnergy(0.0),
|
||||
verboseLevel(0),name(nam),minKinEnergy(0.0),
|
||||
maxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy()),
|
||||
isForAllAtomsAndEnergies(false),name(nam)
|
||||
isForAllAtomsAndEnergies(false)
|
||||
{
|
||||
registry = G4CrossSectionDataSetRegistry::Instance();
|
||||
registry->Register(this);
|
||||
|
||||
@@ -37,23 +37,13 @@
|
||||
//
|
||||
|
||||
#include "G4VCrossSectionRatio.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
G4VCrossSectionRatio::G4VCrossSectionRatio(const G4String& nam, G4int verb)
|
||||
: verboseLevel(verb),name(nam)
|
||||
{}
|
||||
: G4VCrossSectionDataSet(nam)
|
||||
{
|
||||
SetVerboseLevel(verb);
|
||||
}
|
||||
|
||||
G4VCrossSectionRatio::~G4VCrossSectionRatio()
|
||||
{}
|
||||
|
||||
void
|
||||
G4VCrossSectionRatio::Description() const
|
||||
{}
|
||||
|
||||
void
|
||||
G4VCrossSectionRatio::BuildPhysicsTable(const G4ParticleDefinition&)
|
||||
{}
|
||||
|
||||
void
|
||||
G4VCrossSectionRatio::DumpPhysicsTable(const G4ParticleDefinition&)
|
||||
{}
|
||||
|
||||
Reference in New Issue
Block a user