Import Geant4 11.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2024-06-28 13:08:51 +02:00
parent f7b23877ed
commit e58e650b32
5232 changed files with 239416 additions and 244360 deletions
@@ -6,7 +6,46 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-12-09 Vladimir Ivanchenko (hadr-cross-V11-01-17)
## 2024-06-18 Vladimir Ivanchenko (hadr-cross-V11-02-06)
- G4BGGNucleonInelasticXS - fixed proton x-section below 14 MeV
## 2024-03-12 Gabriele Cosmo (hadr-cross-V11-02-05)
- In G4NeutronInelasticXS::SelectIsotope(), fixed compilation warnings for
implicit type conversions detected with macOS/XCode.
## 2024-03-09 Vladimir Ivanchenko (hadr-cross-V11-02-04)
- G4ComponentGGNuclNuclXsc - removed debug printout, added check of G4VERBOSE
- G4BGGPionElasticXS, G4BGGNucleonInelasticXS, G4BGGNucleonElasticXS - added
check of G4VERBOSE compilation flag
- G4vCrossSectionDataSet - cosmetic change
## 2024-03-07 Vladimir Ivanchenko (hadr-cross-V11-02-03)
- G4HadronXSDataTable - make this class to be a singleton for registration
and destruction of sttic objects with cross section data, data are deleted
only end of run
- G4BGGNucleonElasticXS, G4BGGNucleonInelasticXS, G4BGGPionElasticXS,
G4BGGPionInelasticXS, G4ComponentBarNucleonNucleusXsc,
G4UPiNuclearCrossSection, G4HadronNucleonXsc, G4CrossSectionDataSetRegistry
- code clean-up: removed "isMaster" checks, removed mutex locks,
removed unused variables and format the code
## 2024-03-05 Vladimir Ivanchenko (hadr-cross-V11-02-02)
- G4BGGNucleonElasticXS, G4BGGNucleonInelasticXS, G4NeutronInelasticXS,
G4ComponentBarNucleonNucleusXsc, G4ComponentGGNuclNuclXsc, G4PiData,
G4NucleonNuclearCrossSection - general clean-up of proton and neutron
cross sections: removed unused methods, removed not needed mutex locks,
improved printouts, cross sections outside data tables are equal to
low or high edge of a table (not zero).
## 2024-02-22 Vladimir Ivanchenko (hadr-cross-V11-02-01)
- G4NeutronCapture - lowest energy limit is set to 10^-5 eV, below this
energy no computations to avoid numerical problems, improved comments to
the code
- G4NeutronInelastic - implement 1/v cross section dependence below low-energy
limit of a cross section vector if cross section does not start from null
- G4IsotopeList.hh - moved to util sublibrary
## 2023-12-09 Vladimir Ivanchenko (hadr-cross-V11-02-00)
- G4KokoulinMuonNuclearXS - use faster interface to G4PhysicsVector
- G4ElectroNuclearCrossSection - added low-energy limit 100 MeV for x-section
@@ -51,7 +51,6 @@
#include "globals.hh"
#include "G4VCrossSectionDataSet.hh"
#include "G4ParticleDefinition.hh"
#include "G4Threading.hh"
class G4ComponentGGHadronNucleusXsc;
class G4NucleonNuclearCrossSection;
@@ -64,7 +63,7 @@ class G4BGGNucleonElasticXS final : public G4VCrossSectionDataSet
{
public:
explicit G4BGGNucleonElasticXS (const G4ParticleDefinition*);
explicit G4BGGNucleonElasticXS(const G4ParticleDefinition*);
~G4BGGNucleonElasticXS() final;
@@ -87,13 +86,16 @@ public:
void CrossSectionDescription(std::ostream&) const final;
G4BGGNucleonElasticXS & operator=
(const G4BGGNucleonElasticXS &right) = delete;
G4BGGNucleonElasticXS(const G4BGGNucleonElasticXS&) = delete;
private:
void Initialise();
G4double CoulombFactor(G4double kinEnergy, G4int Z);
G4BGGNucleonElasticXS & operator=(const G4BGGNucleonElasticXS &right);
G4BGGNucleonElasticXS(const G4BGGNucleonElasticXS&);
G4double fGlauberEnergy;
G4double fLowEnergy;
@@ -103,16 +105,11 @@ private:
static G4double theCoulombFacN[93];
static G4int theA[93];
const G4ParticleDefinition* theProton;
G4ComponentGGHadronNucleusXsc* fGlauber;
G4NucleonNuclearCrossSection* fNucleon;
G4HadronNucleonXsc* fHadron;
G4bool isProton;
G4bool isMaster;
#ifdef G4MULTITHREADED
static G4Mutex nucleonElasticXSMutex;
#endif
const G4ParticleDefinition* theProton;
G4ComponentGGHadronNucleusXsc* fGlauber;
G4NucleonNuclearCrossSection* fNucleon;
G4HadronNucleonXsc* fHadron;
G4bool isProton;
};
#endif
@@ -51,7 +51,6 @@
#include "globals.hh"
#include "G4VCrossSectionDataSet.hh"
#include "G4ParticleDefinition.hh"
#include "G4Threading.hh"
class G4ComponentGGHadronNucleusXsc;
class G4NucleonNuclearCrossSection;
@@ -87,13 +86,16 @@ public:
void CrossSectionDescription(std::ostream&) const override;
G4BGGNucleonInelasticXS & operator=
(const G4BGGNucleonInelasticXS &right) = delete;
G4BGGNucleonInelasticXS(const G4BGGNucleonInelasticXS&) = delete;
private:
void Initialise();
G4double CoulombFactor(G4double kinEnergy, G4int Z);
G4BGGNucleonInelasticXS & operator=(const G4BGGNucleonInelasticXS &right);
G4BGGNucleonInelasticXS(const G4BGGNucleonInelasticXS&);
G4double fGlauberEnergy;
G4double fLowEnergy;
@@ -103,17 +105,12 @@ private:
static G4double theCoulombFacN[93];
static G4int theA[93];
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* theProton;
G4ComponentGGHadronNucleusXsc* fGlauber;
G4NucleonNuclearCrossSection* fNucleon;
G4HadronNucleonXsc* fHadron;
G4bool isProton;
G4bool isMaster;
#ifdef G4MULTITHREADED
static G4Mutex nucleonInelasticXSMutex;
#endif
G4ComponentGGHadronNucleusXsc* fGlauber;
G4NucleonNuclearCrossSection* fNucleon;
G4HadronNucleonXsc* fHadron;
G4bool isProton;
};
#endif
@@ -51,7 +51,6 @@
#include "globals.hh"
#include "G4VCrossSectionDataSet.hh"
#include "G4ParticleDefinition.hh"
#include "G4Threading.hh"
class G4ComponentGGHadronNucleusXsc;
class G4UPiNuclearCrossSection;
@@ -88,15 +87,17 @@ public:
void CrossSectionDescription(std::ostream&) const final;
G4BGGPionElasticXS & operator=(const G4BGGPionElasticXS &right) = delete;
G4BGGPionElasticXS(const G4BGGPionElasticXS&) = delete;
private:
void Initialise();
G4double CoulombFactorPiPlus(G4double kinEnergy, G4int Z);
G4double FactorPiMinus(G4double kinEnergy);
G4BGGPionElasticXS & operator=(const G4BGGPionElasticXS &right);
G4BGGPionElasticXS(const G4BGGPionElasticXS&);
G4double fGlauberEnergy;
G4double fLowEnergy;
G4double fLowestEnergy;
@@ -105,22 +106,17 @@ private:
static G4double theCoulombFacPiPlus[93];
static G4double theGlauberFacPiMinus[93];
static G4double theCoulombFacPiMinus[93];
static G4int theA[93];
static G4int theA[93];
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* thePiPlus;
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* thePiPlus;
G4Pow* fG4pow;
G4Pow* fG4pow;
G4ComponentGGHadronNucleusXsc* fGlauber;
G4UPiNuclearCrossSection* fPion;
G4HadronNucleonXsc* fHadron;
G4bool isPiplus;
G4bool isMaster;
#ifdef G4MULTITHREADED
static G4Mutex pionElasticXSMutex;
#endif
G4ComponentGGHadronNucleusXsc* fGlauber;
G4UPiNuclearCrossSection* fPion;
G4HadronNucleonXsc* fHadron;
G4bool isPiplus;
};
#endif
@@ -89,15 +89,17 @@ public:
void CrossSectionDescription(std::ostream&) const final;
G4BGGPionInelasticXS & operator=(const G4BGGPionInelasticXS &right) = delete;
G4BGGPionInelasticXS(const G4BGGPionInelasticXS&) = delete;
private:
void Initialise();
G4double CoulombFactorPiPlus(G4double kinEnergy, G4int Z);
G4double FactorPiMinus(G4double kinEnergy);
G4BGGPionInelasticXS & operator=(const G4BGGPionInelasticXS &right);
G4BGGPionInelasticXS(const G4BGGPionInelasticXS&);
G4double fGlauberEnergy;
G4double fLowEnergy;
G4double fLowestEnergy;
@@ -106,23 +108,17 @@ private:
static G4double theGlauberFacPiMinus[93];
static G4double theLowEPiPlus[93];
static G4double theLowEPiMinus[93];
static G4int theA[93];
static G4int theA[93];
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* thePiPlus;
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* thePiPlus;
G4Pow* fG4pow;
G4Pow* fG4pow;
G4ComponentGGHadronNucleusXsc* fGlauber;
G4UPiNuclearCrossSection* fPion;
G4HadronNucleonXsc* fHadron;
G4bool isPiplus;
G4bool isMaster;
#ifdef G4MULTITHREADED
static G4Mutex pionInelasticXSMutex;
#endif
G4UPiNuclearCrossSection* fPion;
G4HadronNucleonXsc* fHadron;
G4bool isPiplus;
};
#endif
@@ -43,7 +43,6 @@
#include "globals.hh"
#include "G4PiData.hh"
#include "G4Threading.hh"
#include <vector>
class G4ComponentBarNucleonNucleusXsc : public G4VComponentCrossSection
@@ -51,8 +50,8 @@ class G4ComponentBarNucleonNucleusXsc : public G4VComponentCrossSection
public:
explicit G4ComponentBarNucleonNucleusXsc();
~G4ComponentBarNucleonNucleusXsc() override;
G4ComponentBarNucleonNucleusXsc();
~G4ComponentBarNucleonNucleusXsc() override = default;
G4double GetTotalIsotopeCrossSection(const G4ParticleDefinition* aParticle,
G4double kinEnergy,
@@ -81,8 +80,6 @@ public:
void ComputeCrossSections(const G4ParticleDefinition* aParticle,
G4double kinEnergy, G4int Z);
void BuildPhysicsTable(const G4ParticleDefinition&) final;
void Description(std::ostream&) const final;
inline G4double GetElementCrossSection(const G4DynamicParticle* aParticle, G4int Z);
@@ -91,7 +88,11 @@ public:
inline G4double GetTotalXsc() { return fTotalXsc; };
inline G4double GetElasticXsc() { return fElasticXsc; };
inline G4double GetInelasticXsc() { return fInelasticXsc; };
G4ComponentBarNucleonNucleusXsc& operator=
(const G4ComponentBarNucleonNucleusXsc &right) = delete;
G4ComponentBarNucleonNucleusXsc(const G4ComponentBarNucleonNucleusXsc&) = delete;
private:
G4double Interpolate(G4int Z1, G4int Z2, G4int Z, G4double x1, G4double x2) const;
@@ -99,35 +100,26 @@ private:
void LoadData();
// cross sections
G4double fTotalXsc;
G4double fInelasticXsc;
G4double fElasticXsc;
G4double fTotalXsc{0.0};
G4double fInelasticXsc{0.0};
G4double fElasticXsc{0.0};
// particles
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* theNeutron;
G4bool isMaster;
static G4double theA[93];
static G4double A75[93];
static const G4int NZ = 17;
static G4int theZ[NZ];
static std::vector<G4PiData*>* thePData;
static std::vector<G4PiData*>* theNData;
#ifdef G4MULTITHREADED
static G4Mutex barNNXSMutex;
#endif
};
inline
G4double G4ComponentBarNucleonNucleusXsc::GetElementCrossSection(
const G4DynamicParticle* dp, G4int Z)
{
ComputeCrossSections(dp->GetDefinition(), dp->GetKineticEnergy(),Z);
ComputeCrossSections(dp->GetDefinition(), dp->GetKineticEnergy(), Z);
return fInelasticXsc;
}
@@ -135,7 +127,7 @@ inline
G4double G4ComponentBarNucleonNucleusXsc::GetElasticCrossSection(
const G4DynamicParticle* dp, G4int Z)
{
ComputeCrossSections(dp->GetDefinition(), dp->GetKineticEnergy(),Z);
ComputeCrossSections(dp->GetDefinition(), dp->GetKineticEnergy(), Z);
return fElasticXsc;
}
@@ -53,8 +53,8 @@ class G4ComponentGGNuclNuclXsc : public G4VComponentCrossSection
{
public:
G4ComponentGGNuclNuclXsc ();
virtual ~G4ComponentGGNuclNuclXsc ();
G4ComponentGGNuclNuclXsc();
~G4ComponentGGNuclNuclXsc() override;
// virtual interface methods
G4double GetTotalElementCrossSection(const G4ParticleDefinition* aParticle,
@@ -91,10 +91,6 @@ public:
void Description(std::ostream&) const final;
// Extra methods
// inline G4double GetElementCrossSection(const G4DynamicParticle*,
// G4int Z, const G4Material*);
inline G4double GetZandACrossSection(const G4DynamicParticle*,
G4int Z, G4int A);
@@ -109,6 +105,7 @@ public:
G4double GetRatioSD(const G4DynamicParticle*, G4double At, G4double Zt);
G4double GetRatioQE(const G4DynamicParticle*, G4double At, G4double Zt);
// main access methods
inline G4double GetElasticGlauberGribov(const G4DynamicParticle*,G4int Z, G4int A);
inline G4double GetInelasticGlauberGribov(const G4DynamicParticle*,G4int Z, G4int A);
@@ -118,16 +115,23 @@ public:
inline G4double GetProductionGlauberGribovXsc() const { return fProductionXsc; };
inline G4double GetDiffractionGlauberGribovXsc() const { return fDiffractionXsc; };
G4ComponentGGNuclNuclXsc& operator=
(const G4ComponentGGNuclNuclXsc &right) = delete;
G4ComponentGGNuclNuclXsc(const G4ComponentGGNuclNuclXsc&) = delete;
private:
// Glauber-Gribov cross section
void ComputeCrossSections(const G4ParticleDefinition* aParticle,
G4double kinEnergy, G4int Z, G4int A);
G4double fTotalXsc, fElasticXsc, fInelasticXsc;
G4double fProductionXsc, fDiffractionXsc;
G4double fTotalXsc{0.0};
G4double fElasticXsc{0.0};
G4double fInelasticXsc{0.0};
G4double fProductionXsc{0.0};
G4double fDiffractionXsc{0.0};
// Cache
G4double fEnergy;
G4double fEnergy{0.0};
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* theNeutron;
@@ -137,8 +141,9 @@ private:
G4HadronNucleonXsc* fHNXsc;
// Cache
const G4ParticleDefinition* fParticle;
G4int fZ, fA;
const G4ParticleDefinition* fParticle{nullptr};
G4int fZ{0};
G4int fA{0};
};
inline G4double
@@ -157,16 +162,6 @@ G4ComponentGGNuclNuclXsc::GetInelasticGlauberGribov(const G4DynamicParticle* dp,
return fInelasticXsc;
}
/*
inline G4double
G4ComponentGGNuclNuclXsc::GetElementCrossSection(const G4DynamicParticle* dp,
G4int Z, const G4Material*)
{
G4int A = G4lrint(fNist->GetAtomicMassAmu(Z));
ComputeCrossSections(dp->GetDefinition(), dp->GetKineticEnergy(), Z, A);
return fInelasticXsc;
}
*/
inline G4double
G4ComponentGGNuclNuclXsc::GetZandACrossSection(const G4DynamicParticle* dp,
G4int Z, G4int A)
@@ -81,18 +81,21 @@ public:
void Clean();
//clean the store
G4VCrossSectionDataSet* GetCrossSectionDataSet(const G4String& name,
G4bool warning=false);
G4VCrossSectionDataSet* GetCrossSectionDataSet(const G4String& name, G4bool warning=false);
G4VComponentCrossSection* GetComponentCrossSection(const G4String& name);
G4CrossSectionDataSetRegistry(G4CrossSectionDataSetRegistry&) = delete;
G4CrossSectionDataSetRegistry& operator=
(const G4CrossSectionDataSetRegistry &right) = delete;
private:
G4CrossSectionDataSetRegistry();
static G4ThreadLocal G4CrossSectionDataSetRegistry* instance;
std::vector <G4VCrossSectionDataSet*> xSections;
std::vector <G4VCrossSectionDataSet*> xSections;
std::vector <G4VComponentCrossSection*> xComponents;
};
@@ -52,9 +52,9 @@ class G4HadronNucleonXsc
{
public:
explicit G4HadronNucleonXsc ();
~G4HadronNucleonXsc ();
G4HadronNucleonXsc();
~G4HadronNucleonXsc() = default;
// Xsc parametrisations return total x-section
G4double HadronNucleonXsc(const G4ParticleDefinition* theParticle,
const G4ParticleDefinition* nucleon, G4double ekin);
@@ -133,7 +133,9 @@ private:
inline G4double CalculateEcmValue(G4double ekin1, G4double mass1, G4double mass2)
{ return std::sqrt(CalcMandelstamS(ekin1, mass1, mass2)); };
G4double fTotalXsc, fElasticXsc, fInelasticXsc;
G4double fTotalXsc{0.0};
G4double fElasticXsc{0.0};
G4double fInelasticXsc{0.0};
G4Pow* g4calc;
const G4ParticleDefinition* theProton;
@@ -28,111 +28,54 @@
//
// GEANT4 Class file
//
// Description: Data structure for cross sections per materials
// Description: Data structure for registration of static cross sections components
//
// Author: V.Ivanchenko 31.05.2018
// Author: V.Ivanchenko 31.05.2018
//
// Modifications:
// 07.03.2024 V.Ivanchenko updated signature - now it is a store without any access
// to stored objects
//
//----------------------------------------------------------------------------
//
#ifndef HadronXSDataTable_h
#define HadronXSDataTable_h 1
#ifndef G4HadronXSDataTable_h
#define G4HadronXSDataTable_h 1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "globals.hh"
#include "G4Element.hh"
#include "G4ElementVector.hh"
#include "G4PhysicsVector.hh"
#include "Randomize.hh"
#include "G4PhysicsTable.hh"
#include "G4PiData.hh"
#include <vector>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4Material;
class G4DynamicParticle;
class G4CrossSectionDataStore;
class G4HadElementSelector
{
public:
G4HadElementSelector(G4DynamicParticle*, G4CrossSectionDataStore*,
const G4Material*, G4int bins,
G4double emin, G4double emax, G4bool spline);
~G4HadElementSelector();
void Dump();
inline const G4Element* SelectRandomAtom(G4double e) const
{
const G4Element* element = (*theElementVector)[nElmMinusOne];
if (nElmMinusOne > 0) {
G4double x = G4UniformRand();
for(G4int i=0; i<nElmMinusOne; ++i) {
if (x <= xSections[i]->Value(e)) {
element = (*theElementVector)[i];
break;
}
}
}
return element;
}
private:
G4HadElementSelector(G4HadElementSelector &) = delete;
G4HadElementSelector& operator=(const G4HadElementSelector &right) = delete;
G4int nElmMinusOne;
const G4ElementVector* theElementVector;
std::vector<G4PhysicsVector*> xSections;
};
class G4HadronXSDataTable
{
public:
explicit G4HadronXSDataTable();
static G4HadronXSDataTable* Instance();
~G4HadronXSDataTable();
void Initialise(G4DynamicParticle*, G4CrossSectionDataStore*,
G4int bins, G4double emin, G4double emax,
G4bool spline);
void AddPiData(std::vector<G4PiData*>* ptr);
inline const G4PhysicsVector* HasData(size_t idx) const
{
return xsData[idx];
};
void AddTable(G4PhysicsTable* ptr);
inline G4double GetCrossSection(G4double e, size_t idx) const
{
return xsData[idx]->Value(e);
};
inline const G4Element* SelectRandomAtom(G4double e, size_t idx) const
{
return elmSelectors[idx]->SelectRandomAtom(e);
};
void Dump();
// Assignment operator and copy constructor
G4HadronXSDataTable & operator=(const G4HadronXSDataTable &right) = delete;
G4HadronXSDataTable(const G4HadronXSDataTable&) = delete;
private:
// Assignment operator and copy constructor
G4HadronXSDataTable & operator=
(const G4HadronXSDataTable &right) = delete;
G4HadronXSDataTable(const G4HadronXSDataTable&) = delete;
std::vector<G4PhysicsVector*> xsData;
std::vector<G4HadElementSelector*> elmSelectors;
G4HadronXSDataTable();
size_t nMaterials;
static G4HadronXSDataTable* sInstance;
std::vector<G4PiData*> fPiData;
std::vector<G4PhysicsTable*> fTable;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,98 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4IsotopeList
//
// Author V. Ivantchenko, 22 October 2020
//
#ifndef G4IsotopeList_h
#define G4IsotopeList_h 1
static const G4int amin[] = {
0,
1, 3, 6, 9, 10, 12, 14, 16, 19, 20, //1-10
22, 24, 26, 27, 31, 32, 35, 36, 39, 40, //11-20
44, 44, 48, 50, 52, 54, 56, 56, 63, 64, //21-30
67, 70, 71, 74, 77, 78, 85, 83, 87, 88, //31-40
91, 92, 96, 96, 99, 102, 106, 106, 113, 112, //41-50
121, 120, 126, 123, 133, 130, 137, 136, 141, 142, //51-60
145, 144, 151, 148, 158, 156, 163, 162, 169, 168, //61-70
173, 174, 179, 180, 185, 184, 190, 190, 197, 196, //71-80
202, 204, 208, 208, 210, 222, 223, 223, 225, 227, //81-90
231, 232, 235, 236, 241, 240, 247, 249, 253, 255};//91-100
static const G4int amax[] = {
0,
3, 4, 7, 9, 11, 14, 15, 18, 19, 22, //1-10
23, 27, 27, 32, 33, 36, 37, 41, 41, 48, //11-20
48, 50, 51, 54, 55, 60, 62, 66, 67, 70, //21-30
71, 76, 77, 82, 82, 86, 88, 90, 91, 96, //31-40
95, 100, 99, 106, 105, 110, 111, 116, 115, 126, //41-50
127, 132, 135, 136, 137, 140, 140, 144, 143, 150, //51-60
151, 154, 157, 161, 160, 165, 166, 172, 171, 176, //61-70
177, 182, 182, 188, 188, 193, 193, 198, 197, 204, //71-80
205, 208, 210, 209, 210, 222, 223, 226, 227, 234, //81-90
233, 241, 239, 246, 244, 250, 250, 254, 255, 255};//91-100
static const G4double aeff[] = {
0.,
1.00794, 4.00264, 6.94003, 9.01218, 10.811, 12.0107, 14.0068, 15.9994, 18.9984, 20.18, //1-10
22.9898, 24.305, 26.9815, 28.0854, 30.9738, 32.0661, 35.4526, 39.9477, 39.0983, 40.078, //11-20
44.9559, 47.8667, 50.9415, 51.9961, 54.938, 55.8451, 58.9332, 58.6933, 63.5456, 65.3955, //21-30
69.7231, 72.6128, 74.9216, 78.9594, 79.9035, 83.7993, 85.4677, 87.6166, 88.9058, 91.2236, //31-40
92.9064, 95.9313, 97.9072, 101.065, 102.906, 106.415, 107.868, 112.411, 114.818, 118.71, //41-50
121.76, 127.603, 126.904, 131.292, 132.905, 137.327, 138.905, 140.115, 140.908, 144.236, //51-60
144.913, 150.366, 151.964, 157.252, 158.925, 162.497, 164.93, 167.256, 168.934, 173.038, //61-70
174.967, 178.485, 180.948, 183.842, 186.207, 190.225, 192.216, 195.078, 196.967, 200.599, //71-80
204.383, 207.217, 208.98, 208.982, 209.987, 222.018, 223.02, 226.025, 227.028, 232.038, //81-90
231.036, 238.029, 237.048, 244.064, 243.061, 247.07, 247.07, 251.08, 252.083, 257.095}; //91-100
static const G4String elementName[] = {
"",
"Hydrogen", "Helium", "Lithium", "Berylium", "Boron", "Carbon",
"Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium",
"Aluminum", "Silicon", "Phosphorous", "Sulfur", "Chlorine", "Argon",
"Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium",
"Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc",
"Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton",
"Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum",
"Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium",
"Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon",
"Cesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium",
"Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium",
"Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium",
"Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinium",
"Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium",
"Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium",
"Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium",
"Berkelium", "Californium", "Einsteinium", "Fermium"};
#endif
@@ -124,7 +124,6 @@ private:
G4bool isInitializer{false};
static const G4int MAXZCAPTURE = 93;
static G4ElementData* data;
static G4String gDataDirectory;
};
@@ -121,6 +121,8 @@ private:
std::vector<G4double> temp;
G4double elimit;
G4double lowElimit;
G4double loglowElimit;
G4bool isInitializer{false};
@@ -134,7 +136,7 @@ inline
const G4PhysicsVector* G4NeutronInelasticXS::GetPhysicsVector(G4int Z)
{
const G4PhysicsVector* pv = data->GetElementData(Z);
if(pv == nullptr) {
if (pv == nullptr) {
InitialiseOnFly(Z);
pv = data->GetElementData(Z);
}
@@ -29,7 +29,8 @@
// Preprint JINR P2-89-770, p. 12, Dubna 1989 (scanned version from KEK)
// Based on G. Folger version of G4PiNuclearCrossSection class
//
// Modified: V.Ivanchenko
// Modified:
// 05.03.2024 V.Ivanchenko removed obsolete methods and calls
//
#ifndef G4NucleonNuclearCrossSection_h
@@ -46,28 +47,33 @@ class G4NucleonNuclearCrossSection : public G4VCrossSectionDataSet
{
public:
explicit G4NucleonNuclearCrossSection();
~G4NucleonNuclearCrossSection() override;
G4NucleonNuclearCrossSection();
~G4NucleonNuclearCrossSection() override = default;
static const char* Default_Name() {return "BarashenkovNucleonXS";}
static const char* Default_Name() { return "BarashenkovNucleonXS"; }
G4bool IsElementApplicable(const G4DynamicParticle* aParticle,
G4int Z, const G4Material* mat) final;
// return inelastic x-section
G4double GetElementCrossSection(const G4DynamicParticle* aParticle,
G4int Z, const G4Material* mat=nullptr) final;
void BuildPhysicsTable(const G4ParticleDefinition&) final;
void CrossSectionDescription(std::ostream&) const final;
inline G4double GetElasticCrossSection(const G4DynamicParticle* aParticle,
// return elastic x-section
inline G4double GetElasticCrossSection(const G4DynamicParticle* aParticle,
G4int Z);
inline G4double GetTotalXsc() { return fTotalXsc; };
// access methods should be called after ComputeCrossSection(...)
inline G4double GetTotalXsc() { return fTotalXsc; };
inline G4double GetInelasticXsc() { return fInelasticXsc; };
inline G4double GetElasticXsc() { return fElasticXsc; };
G4NucleonNuclearCrossSection& operator=
(const G4NucleonNuclearCrossSection &right) = delete;
G4NucleonNuclearCrossSection(const G4NucleonNuclearCrossSection&) = delete;
private:
void ComputeCrossSections(const G4ParticleDefinition*,
@@ -75,13 +81,9 @@ private:
G4ComponentBarNucleonNucleusXsc* fBarash;
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* theNeutron;
G4double fTotalXsc;
G4double fInelasticXsc;
G4double fElasticXsc;
G4double fTotalXsc{0.0};
G4double fInelasticXsc{0.0};
G4double fElasticXsc{0.0};
};
inline
@@ -24,6 +24,15 @@
// ********************************************************************
//
// by J.P Wellisch, Sun Sep 15 2002.
//
// Revision by V.Ivanchenko 04.03.2024
//
// This code keep data for proton and neutron Barashenkov evaluation
// for the total and reaction (inelastic) cross sections.
// The elastic cross section is a difference sigma(el) = sigma(total) - sigma(inel).
// The low-energy limit 14 MeV, high energy limit 1 TeV. Below energy limit
// the cross sections at 14 MeV is used, above maximum energy a cross section
// at 1 TeV is given.
#ifndef G4PiData_h
#define G4PiData_h
@@ -40,12 +49,20 @@ class G4PiData : public std::vector<std::pair<G4double, std::pair<G4double, G4do
~G4PiData() = default;
G4bool AppliesTo(G4double kineticEnergy);
G4double ReactionXSection(G4double kineticEnergy);
G4double ElasticXSection(G4double kineticEnergy);
G4double TotalXSection(G4double kineticEnergy);
G4PiData& operator = (const G4PiData &right) = delete;
G4PiData(const G4PiData&) = delete;
private:
G4double fMinE{0.0};
G4double fTot0{0.0};
G4double fInel0{0.0};
G4double fMaxE{0.0};
G4double fTot1{0.0};
G4double fInel1{0.0};
};
#endif
@@ -38,7 +38,6 @@
#include "G4DynamicParticle.hh"
#include "G4ParticleDefinition.hh"
#include "globals.hh"
#include "G4Threading.hh"
class G4PhysicsTable;
@@ -48,7 +47,7 @@ public:
explicit G4UPiNuclearCrossSection();
~G4UPiNuclearCrossSection() override;
~G4UPiNuclearCrossSection() override = default;
G4bool IsElementApplicable(const G4DynamicParticle* aParticle,
G4int Z, const G4Material*) final;
@@ -92,15 +91,10 @@ private:
static G4PhysicsTable* piMinusElastic;
static G4PhysicsTable* piMinusInelastic;
G4double aPower;
G4double aPower{0.75};
G4double elow;
G4bool isMaster;
G4bool spline;
#ifdef G4MULTITHREADED
static G4Mutex pionUXSMutex;
#endif
G4bool spline{false};
};
inline G4double
@@ -178,7 +178,7 @@ public: //with description
protected:
G4int verboseLevel;
G4int verboseLevel{0};
G4String name;
@@ -186,10 +186,10 @@ private:
G4CrossSectionDataSetRegistry* registry;
G4double minKinEnergy;
G4double minKinEnergy{0.0};
G4double maxKinEnergy;
G4bool isForAllAtomsAndEnergies;
G4bool isForAllAtomsAndEnergies{false};
};
@@ -48,7 +48,6 @@ geant4_add_module(G4hadronic_xsect
G4HadronNucleonXsc.hh
G4HadronXSDataTable.hh
G4IonsShenCrossSection.hh
G4IsotopeList.hh
G4KokoulinMuonNuclearXS.hh
G4MuNeutrinoNucleusTotXsc.hh
G4NeutrinoElectronCcXsc.hh
@@ -54,11 +54,7 @@ G4double G4BGGNucleonElasticXS::theGlauberFacP[93] = {0.0};
G4double G4BGGNucleonElasticXS::theCoulombFacP[93] = {0.0};
G4double G4BGGNucleonElasticXS::theGlauberFacN[93] = {0.0};
G4double G4BGGNucleonElasticXS::theCoulombFacN[93] = {0.0};
G4int G4BGGNucleonElasticXS::theA[93] = {0};
#ifdef G4MULTITHREADED
G4Mutex G4BGGNucleonElasticXS::nucleonElasticXSMutex = G4MUTEX_INITIALIZER;
#endif
G4int G4BGGNucleonElasticXS::theA[93] = {0};
G4BGGNucleonElasticXS::G4BGGNucleonElasticXS(const G4ParticleDefinition* p)
: G4VCrossSectionDataSet("BarashenkovGlauberGribov")
@@ -66,14 +62,15 @@ G4BGGNucleonElasticXS::G4BGGNucleonElasticXS(const G4ParticleDefinition* p)
verboseLevel = 0;
fGlauberEnergy = 91.*GeV;
fLowEnergy = 14.0*MeV;
fNucleon = nullptr;
fGlauber = nullptr;
fHadron = nullptr;
fNucleon = new G4NucleonNuclearCrossSection();
fGlauber = new G4ComponentGGHadronNucleusXsc();
fHadron = new G4HadronNucleonXsc();
theProton= G4Proton::Proton();
theProton = G4Proton::Proton();
isProton = (theProton == p);
isMaster = false;
SetForAllAtomsAndEnergies(true);
if (0 == theA[0]) { Initialise(); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -126,7 +123,8 @@ G4BGGNucleonElasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
cross = fNucleon->GetElasticCrossSection(dp, Z);
}
}
if(verboseLevel > 1) {
#ifdef G4VERBOSE
if (verboseLevel > 1) {
G4cout << "G4BGGNucleonElasticXS::GetElementCrossSection for "
<< dp->GetDefinition()->GetParticleName()
<< " Ekin(GeV)= " << dp->GetKineticEnergy()/CLHEP::GeV
@@ -134,6 +132,7 @@ G4BGGNucleonElasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
<< " XS(b)= " << cross/barn
<< G4endl;
}
#endif
return cross;
}
@@ -141,7 +140,7 @@ G4BGGNucleonElasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
G4double
G4BGGNucleonElasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
G4int Z, G4int A,
G4int, G4int A,
const G4Isotope*,
const G4Element*,
const G4Material*)
@@ -151,14 +150,16 @@ G4BGGNucleonElasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
dp->GetKineticEnergy());
G4double cross = A*fHadron->GetElasticHadronNucleonXsc();
if(verboseLevel > 1) {
#ifdef G4VERBOSE
if (verboseLevel > 1) {
G4cout << "G4BGGNucleonElasticXS::GetIsoCrossSection for "
<< dp->GetDefinition()->GetParticleName()
<< " Ekin(GeV)= " << dp->GetKineticEnergy()/CLHEP::GeV
<< " in nucleus Z= " << Z << " A= " << A
<< " in nucleus Z=1 A=" << A
<< " XS(b)= " << cross/barn
<< G4endl;
}
#endif
return cross;
}
@@ -166,7 +167,6 @@ G4BGGNucleonElasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
void G4BGGNucleonElasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
{
if(nullptr != fNucleon) { return; }
if(&p == theProton || &p == G4Neutron::Neutron()) {
isProton = (theProton == &p);
@@ -176,83 +176,59 @@ void G4BGGNucleonElasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
<< p.GetParticleName() << G4endl;
G4Exception("G4BGGNucleonElasticXS::BuildPhysicsTable", "had001",
FatalException, ed);
return;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4BGGNucleonElasticXS::Initialise()
{
theA[0] = theA[1] = 1;
G4ThreeVector mom(0.0,0.0,1.0);
G4DynamicParticle dp(theProton, mom, fGlauberEnergy);
G4NistManager* nist = G4NistManager::Instance();
G4double csup, csdn;
for (G4int iz=2; iz<93; ++iz) {
G4int A = G4lrint(nist->GetAtomicMassAmu(iz));
theA[iz] = A;
csup = fGlauber->GetElasticGlauberGribov(&dp, iz, A);
csdn = fNucleon->GetElasticCrossSection(&dp, iz);
theGlauberFacP[iz] = csdn/csup;
}
fNucleon = new G4NucleonNuclearCrossSection();
fGlauber = new G4ComponentGGHadronNucleusXsc();
fHadron = new G4HadronNucleonXsc();
dp.SetDefinition(G4Neutron::Neutron());
for (G4int iz=2; iz<93; ++iz) {
csup = fGlauber->GetElasticGlauberGribov(&dp, iz, theA[iz]);
csdn = fNucleon->GetElasticCrossSection(&dp, iz);
theGlauberFacN[iz] = csdn/csup;
fNucleon->BuildPhysicsTable(p);
if(0 == theA[0]) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&nucleonElasticXSMutex);
if(0 == theA[0]) {
#endif
isMaster = true;
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&nucleonElasticXSMutex);
#endif
} else {
return;
if (verboseLevel > 1) {
G4cout << "G4BGGNucleonElasticXS::Initialise Z=" << iz << " A=" << theA[iz]
<< " GFactorP=" << theGlauberFacP[iz]
<< " GFactorN=" << theGlauberFacN[iz] << G4endl;
}
}
if(isMaster && 0 == theA[0]) {
theA[0] = theA[1] = 1;
G4ThreeVector mom(0.0,0.0,1.0);
G4DynamicParticle dp(theProton, mom, fGlauberEnergy);
G4NistManager* nist = G4NistManager::Instance();
G4double csup, csdn;
if(verboseLevel > 0) {
G4cout << "### G4BGGNucleonElasticXS::Initialise for "
<< p.GetParticleName() << G4endl;
}
for(G4int iz=2; iz<93; ++iz) {
G4int A = G4lrint(nist->GetAtomicMassAmu(iz));
theA[iz] = A;
csup = fGlauber->GetElasticGlauberGribov(&dp, iz, A);
csdn = fNucleon->GetElasticCrossSection(&dp, iz);
theGlauberFacP[iz] = csdn/csup;
}
dp.SetDefinition(G4Neutron::Neutron());
for(G4int iz=2; iz<93; ++iz) {
csup = fGlauber->GetElasticGlauberGribov(&dp, iz, theA[iz]);
csdn = fNucleon->GetElasticCrossSection(&dp, iz);
theGlauberFacN[iz] = csdn/csup;
if(verboseLevel > 0) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " GFactorP= " << theGlauberFacP[iz]
<< " GFactorN= " << theGlauberFacN[iz] << G4endl;
}
}
theCoulombFacP[0] = theCoulombFacP[1] =
theCoulombFacP[0] = theCoulombFacP[1] =
theCoulombFacN[0] = theCoulombFacN[1] = 1.0;
dp.SetDefinition(theProton);
dp.SetKineticEnergy(fLowEnergy);
for(G4int iz=2; iz<93; ++iz) {
theCoulombFacP[iz] = fNucleon->GetElasticCrossSection(&dp, iz)
/CoulombFactor(fLowEnergy, iz);
}
dp.SetDefinition(G4Neutron::Neutron());
for(G4int iz=2; iz<93; ++iz) {
theCoulombFacN[iz] = fNucleon->GetElasticCrossSection(&dp, iz)
/CoulombFactor(fLowEnergy, iz);
dp.SetDefinition(theProton);
dp.SetKineticEnergy(fLowEnergy);
for (G4int iz=2; iz<93; ++iz) {
theCoulombFacP[iz] = fNucleon->GetElasticCrossSection(&dp, iz)
/CoulombFactor(fLowEnergy, iz);
}
dp.SetDefinition(G4Neutron::Neutron());
for(G4int iz=2; iz<93; ++iz) {
theCoulombFacN[iz] = fNucleon->GetElasticCrossSection(&dp, iz)
/CoulombFactor(fLowEnergy, iz);
if(verboseLevel > 0) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " CFactorP= " << theCoulombFacP[iz]
<< " CFactorN= " << theCoulombFacN[iz] << G4endl;
}
if (verboseLevel > 1) {
G4cout << "G4BGGNucleonElasticXS::Initialise Z=" << iz << " A=" << theA[iz]
<< " CFactorP=" << theCoulombFacP[iz]
<< " CFactorN=" << theCoulombFacN[iz] << G4endl;
}
}
}
@@ -261,11 +237,8 @@ void G4BGGNucleonElasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
G4double G4BGGNucleonElasticXS::CoulombFactor(G4double kinEnergy, G4int Z)
{
G4double res= 1.0;
if(isProton) {
res = G4NuclearRadii::CoulombFactor(Z, theA[Z], theProton, kinEnergy);
}
return res;
return (isProton) ?
G4NuclearRadii::CoulombFactor(Z, theA[Z], theProton, kinEnergy) : 1.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -55,37 +55,35 @@
#include "G4Exp.hh"
#include "G4NuclearRadii.hh"
#include "G4CrossSectionDataSetRegistry.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4double llog10 = G4Log(10.);
namespace
{
const G4double llog10 = G4Log(10.);
}
G4double G4BGGNucleonInelasticXS::theGlauberFacP[93] = {0.0};
G4double G4BGGNucleonInelasticXS::theCoulombFacP[93] = {0.0};
G4double G4BGGNucleonInelasticXS::theGlauberFacN[93] = {0.0};
G4double G4BGGNucleonInelasticXS::theCoulombFacN[93] = {0.0};
G4int G4BGGNucleonInelasticXS::theA[93] = {0};
#ifdef G4MULTITHREADED
G4Mutex G4BGGNucleonInelasticXS::nucleonInelasticXSMutex = G4MUTEX_INITIALIZER;
#endif
G4int G4BGGNucleonInelasticXS::theA[93] = {0};
G4BGGNucleonInelasticXS::G4BGGNucleonInelasticXS(const G4ParticleDefinition* p)
: G4VCrossSectionDataSet("BarashenkovGlauberGribov")
{
verboseLevel = 0;
fGlauberEnergy = 91.*GeV;
fLowEnergy = 14.*MeV;
fGlauberEnergy = 91.*CLHEP::GeV;
fLowEnergy = 14.*CLHEP::MeV;
fNucleon = nullptr;
fGlauber = nullptr;
fHadron = nullptr;
fNucleon = new G4NucleonNuclearCrossSection();
fGlauber = new G4ComponentGGHadronNucleusXsc();
fHadron = new G4HadronNucleonXsc();
theProton= G4Proton::Proton();
isProton = (theProton == p);
isMaster = false;
SetForAllAtomsAndEnergies(true);
if (0 == theA[0]) { Initialise(); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -122,21 +120,22 @@ G4BGGNucleonInelasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
G4double cross = 0.0;
G4double ekin = dp->GetKineticEnergy();
G4int Z = std::min(ZZ, 92);
if(1 == Z) {
if (1 == Z) {
cross = 1.0115*GetIsoCrossSection(dp,1,1);
} else {
if(ekin <= fLowEnergy) {
cross = (isProton) ? theCoulombFacP[Z] : theCoulombFacN[Z];
cross *= CoulombFactor(ekin, Z);
} else if(ekin > fGlauberEnergy) {
cross = (isProton) ? theGlauberFacP[Z] : theGlauberFacN[Z];
cross *= fGlauber->GetInelasticGlauberGribov(dp, Z, theA[Z]);
if (ekin <= fLowEnergy) {
cross = CoulombFactor(ekin, Z);
cross *= (isProton) ? theCoulombFacP[Z] : theCoulombFacN[Z];
} else if (ekin > fGlauberEnergy) {
cross = fGlauber->GetInelasticGlauberGribov(dp, Z, theA[Z]);
cross *= (isProton) ? theGlauberFacP[Z] : theGlauberFacN[Z];
} else {
cross = fNucleon->GetElementCrossSection(dp, Z);
}
}
if(verboseLevel > 1) {
#ifdef G4VERBOSE
if (verboseLevel > 1) {
G4cout << "G4BGGNucleonInelasticXS::GetCrossSection for "
<< dp->GetDefinition()->GetParticleName()
<< " Ekin(GeV)= " << dp->GetKineticEnergy()/CLHEP::GeV
@@ -144,6 +143,7 @@ G4BGGNucleonInelasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
<< " XS(b)= " << cross/barn
<< G4endl;
}
#endif
return cross;
}
@@ -151,7 +151,7 @@ G4BGGNucleonInelasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
G4double
G4BGGNucleonInelasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
G4int Z, G4int A,
G4int, G4int A,
const G4Isotope*,
const G4Element*,
const G4Material*)
@@ -161,14 +161,16 @@ G4BGGNucleonInelasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
dp->GetKineticEnergy());
G4double cross = A*fHadron->GetInelasticHadronNucleonXsc();
#ifdef G4VERBOSE
if(verboseLevel > 1) {
G4cout << "G4BGGNucleonInelasticXS::GetIsoCrossSection for "
<< dp->GetDefinition()->GetParticleName()
<< " Ekin(GeV)= " << dp->GetKineticEnergy()/CLHEP::GeV
<< " in nucleus Z= " << Z << " A= " << theA[Z]
<< " in nucleus Z=1 A=" << A
<< " XS(b)= " << cross/barn
<< G4endl;
}
#endif
return cross;
}
@@ -176,7 +178,6 @@ G4BGGNucleonInelasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
void G4BGGNucleonInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
{
if(nullptr != fNucleon) { return; }
if(&p == theProton || &p == G4Neutron::Neutron()) {
isProton = (theProton == &p);
} else {
@@ -187,79 +188,58 @@ void G4BGGNucleonInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
FatalException, ed);
return;
}
}
fNucleon = new G4NucleonNuclearCrossSection();
fGlauber = new G4ComponentGGHadronNucleusXsc();
fHadron = new G4HadronNucleonXsc();
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
fNucleon->BuildPhysicsTable(p);
void G4BGGNucleonInelasticXS::Initialise()
{
theA[0] = theA[1] = 1;
G4ThreeVector mom(0.0,0.0,1.0);
G4DynamicParticle dp(theProton, mom, fGlauberEnergy);
if(0 == theA[0]) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&nucleonInelasticXSMutex);
if(0 == theA[0]) {
#endif
isMaster = true;
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&nucleonInelasticXSMutex);
#endif
} else {
return;
G4NistManager* nist = G4NistManager::Instance();
G4double csup, csdn;
for (G4int iz=2; iz<93; ++iz) {
G4int A = G4lrint(nist->GetAtomicMassAmu(iz));
theA[iz] = A;
csup = fGlauber->GetInelasticGlauberGribov(&dp, iz, A);
csdn = fNucleon->GetElementCrossSection(&dp, iz);
theGlauberFacP[iz] = csdn/csup;
}
if(isMaster && 0 == theA[0]) {
dp.SetDefinition(G4Neutron::Neutron());
for (G4int iz=2; iz<93; ++iz) {
csup = fGlauber->GetInelasticGlauberGribov(&dp, iz, theA[iz]);
csdn = fNucleon->GetElementCrossSection(&dp, iz);
theGlauberFacN[iz] = csdn/csup;
theA[0] = theA[1] = 1;
G4ThreeVector mom(0.0,0.0,1.0);
G4DynamicParticle dp(theProton, mom, fGlauberEnergy);
G4NistManager* nist = G4NistManager::Instance();
G4double csup, csdn;
if(verboseLevel > 0) {
G4cout << "### G4BGGNucleonInelasticXS::Initialise for "
<< p.GetParticleName() << G4endl;
if(verboseLevel > 1) {
G4cout << "G4BGGNucleonInelasticXS::Initialise Z= " << iz << " A= " << theA[iz]
<< " GFactorP= " << theGlauberFacP[iz]
<< " GFactorN= " << theGlauberFacN[iz] << G4endl;
}
for(G4int iz=2; iz<93; ++iz) {
}
G4int A = G4lrint(nist->GetAtomicMassAmu(iz));
theA[iz] = A;
theCoulombFacP[1] = theCoulombFacN[1] = 1.0;
dp.SetDefinition(theProton);
dp.SetKineticEnergy(fLowEnergy);
for (G4int iz=2; iz<93; ++iz) {
theCoulombFacP[iz] = fNucleon->GetElementCrossSection(&dp, iz)
/CoulombFactor(fLowEnergy, iz);
}
dp.SetDefinition(G4Neutron::Neutron());
for (G4int iz=2; iz<93; ++iz) {
theCoulombFacN[iz] = fNucleon->GetElementCrossSection(&dp, iz)
/CoulombFactor(fLowEnergy, iz);
csup = fGlauber->GetInelasticGlauberGribov(&dp, iz, A);
csdn = fNucleon->GetElementCrossSection(&dp, iz);
theGlauberFacP[iz] = csdn/csup;
}
dp.SetDefinition(G4Neutron::Neutron());
for(G4int iz=2; iz<93; ++iz) {
csup = fGlauber->GetInelasticGlauberGribov(&dp, iz, theA[iz]);
csdn = fNucleon->GetElementCrossSection(&dp, iz);
theGlauberFacN[iz] = csdn/csup;
if(verboseLevel > 0) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " GFactorP= " << theGlauberFacP[iz]
<< " GFactorN= " << theGlauberFacN[iz] << G4endl;
}
}
theCoulombFacP[1] = theCoulombFacN[1] = 1.0;
dp.SetDefinition(theProton);
dp.SetKineticEnergy(fLowEnergy);
for(G4int iz=2; iz<93; ++iz) {
theCoulombFacP[iz] = fNucleon->GetElementCrossSection(&dp, iz)
/CoulombFactor(fLowEnergy, iz);
}
dp.SetDefinition(G4Neutron::Neutron());
for(G4int iz=2; iz<93; ++iz) {
theCoulombFacN[iz] = fNucleon->GetElementCrossSection(&dp, iz)
/CoulombFactor(fLowEnergy, iz);
if(verboseLevel > 0) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " CFactorP= " << theCoulombFacP[iz]
<< " CFactorN= " << theCoulombFacN[iz] << G4endl;
}
if (verboseLevel > 1) {
G4cout << "G4BGGNucleonInelasticXS::Initialise Z= " << iz << " A= " << theA[iz]
<< " CFactorP= " << theCoulombFacP[iz]
<< " CFactorN= " << theCoulombFacN[iz] << G4endl;
}
}
}
@@ -277,7 +257,7 @@ G4double G4BGGNucleonInelasticXS::CoulombFactor(G4double kinEnergy, G4int Z)
if(isProton) {
res = G4NuclearRadii::CoulombFactor(Z, theA[Z], theProton, kinEnergy);
res = G4NuclearRadii::CoulombFactor(Z, aa, theProton, kinEnergy);
// from G4ProtonInelasticCrossSection
if(res > 0.0) {
@@ -300,7 +280,7 @@ G4double G4BGGNucleonInelasticXS::CoulombFactor(G4double kinEnergy, G4int Z)
G4double firstexp = G4Exp(-p4*(elog + p5));
G4double secondexp = G4Exp(-p6*(elog + p7));
res = (1.+p3*firstexp/(1. + firstexp))/(1. + secondexp);
res = (1. + p3*firstexp/(1. + firstexp))/(1. + secondexp);
}
return res;
}
@@ -57,11 +57,7 @@ G4double G4BGGPionElasticXS::theGlauberFacPiPlus[93] = {0.0};
G4double G4BGGPionElasticXS::theCoulombFacPiPlus[93] = {0.0};
G4double G4BGGPionElasticXS::theGlauberFacPiMinus[93] = {0.0};
G4double G4BGGPionElasticXS::theCoulombFacPiMinus[93] = {0.0};
G4int G4BGGPionElasticXS::theA[93] = {0};
#ifdef G4MULTITHREADED
G4Mutex G4BGGPionElasticXS::pionElasticXSMutex = G4MUTEX_INITIALIZER;
#endif
G4int G4BGGPionElasticXS::theA[93] = {0};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -69,23 +65,24 @@ G4BGGPionElasticXS::G4BGGPionElasticXS(const G4ParticleDefinition* p)
: G4VCrossSectionDataSet("BarashenkovGlauberGribov")
{
verboseLevel = 0;
fGlauberEnergy = 91.*GeV;
fLowEnergy = 20.*MeV;
fLowestEnergy = 1.*MeV;
fGlauberEnergy = 91.*CLHEP::GeV;
fLowEnergy = 20.*CLHEP::MeV;
fLowestEnergy = 1.*CLHEP::MeV;
SetMinKinEnergy(0.0);
SetMaxKinEnergy( G4HadronicParameters::Instance()->GetMaxEnergy() );
fPion = nullptr;
fGlauber = nullptr;
fHadron = nullptr;
fPion = new G4UPiNuclearCrossSection();
fGlauber = new G4ComponentGGHadronNucleusXsc();
fHadron = new G4HadronNucleonXsc();
fG4pow = G4Pow::GetInstance();
fG4pow = G4Pow::GetInstance();
theProton= G4Proton::Proton();
thePiPlus= G4PionPlus::PionPlus();
theProton = G4Proton::Proton();
thePiPlus = G4PionPlus::PionPlus();
isPiplus = (p == thePiPlus);
isMaster = false;
SetForAllAtomsAndEnergies(true);
if (0 == theA[0]) { Initialise(); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -136,6 +133,7 @@ G4BGGPionElasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
cross = fPion->GetElasticCrossSection(dp, Z, theA[Z]);
}
}
#ifdef G4VERBOSE
if(verboseLevel > 1) {
G4cout << "G4BGGPionElasticXS::GetElementCrossSection for "
<< dp->GetDefinition()->GetParticleName()
@@ -144,12 +142,15 @@ G4BGGPionElasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
<< " XS(b)= " << cross/barn
<< G4endl;
}
#endif
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double
G4BGGPionElasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
G4int Z, G4int A,
G4int, G4int A,
const G4Isotope*,
const G4Element*,
const G4Material*)
@@ -159,14 +160,16 @@ G4BGGPionElasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
dp->GetKineticEnergy());
G4double cross = A*fHadron->GetElasticHadronNucleonXsc();
#ifdef G4VERBOSE
if(verboseLevel > 1) {
G4cout << "G4BGGPionElasticXS::GetIsoCrossSection for "
<< dp->GetDefinition()->GetParticleName()
<< " Ekin(GeV)= " << dp->GetKineticEnergy()
<< " in nucleus Z= " << Z << " A= " << A
<< " in nucleus Z=1 A=" << A
<< " XS(b)= " << cross/barn
<< G4endl;
}
#endif
return cross;
}
@@ -174,7 +177,6 @@ G4BGGPionElasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
void G4BGGPionElasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
{
if(fPion) { return; }
if(verboseLevel > 1) {
G4cout << "G4BGGPionElasticXS::BuildPhysicsTable for "
<< p.GetParticleName() << G4endl;
@@ -187,80 +189,61 @@ void G4BGGPionElasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
<< p.GetParticleName() << G4endl;
G4Exception("G4BGGPionElasticXS::BuildPhysicsTable", "had001",
FatalException, ed);
return;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4BGGPionElasticXS::Initialise()
{
theA[0] = theA[1] = 1;
G4ThreeVector mom(0.0,0.0,1.0);
G4DynamicParticle dp(thePiPlus, mom, fGlauberEnergy);
G4NistManager* nist = G4NistManager::Instance();
G4double csup, csdn;
for (G4int iz=2; iz<93; ++iz) {
G4int A = G4lrint(nist->GetAtomicMassAmu(iz));
theA[iz] = A;
csup = fGlauber->GetElasticGlauberGribov(&dp, iz, A);
csdn = fPion->GetElasticCrossSection(&dp, iz, A);
theGlauberFacPiPlus[iz] = csdn/csup;
}
fPion = new G4UPiNuclearCrossSection();
fGlauber = new G4ComponentGGHadronNucleusXsc();
fHadron = new G4HadronNucleonXsc();
dp.SetDefinition(G4PionMinus::PionMinus());
for (G4int iz=2; iz<93; ++iz) {
csup = fGlauber->GetElasticGlauberGribov(&dp, iz, theA[iz]);
csdn = fPion->GetElasticCrossSection(&dp, iz, theA[iz]);
theGlauberFacPiMinus[iz] = csdn/csup;
fPion->BuildPhysicsTable(p);
if(0 == theA[0]) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&pionElasticXSMutex);
if(0 == theA[0]) {
#endif
isMaster = true;
#ifdef G4MULTITHREADED
if (verboseLevel > 1) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " factorPiPlus= " << theGlauberFacPiPlus[iz]
<< " factorPiMinus= " << theGlauberFacPiMinus[iz]
<< G4endl;
}
G4MUTEXUNLOCK(&pionElasticXSMutex);
#endif
} else {
return;
}
theCoulombFacPiPlus[1] = 1.0;
theCoulombFacPiMinus[1]= 1.0;
dp.SetKineticEnergy(fLowEnergy);
dp.SetDefinition(thePiPlus);
for (G4int iz=2; iz<93; ++iz) {
theCoulombFacPiPlus[iz] = fPion->GetElasticCrossSection(&dp, iz, theA[iz])
/CoulombFactorPiPlus(fLowEnergy, iz);
}
dp.SetDefinition(G4PionMinus::PionMinus());
for(G4int iz=2; iz<93; ++iz) {
theCoulombFacPiMinus[iz] = fPion->GetElasticCrossSection(&dp, iz, theA[iz])
/FactorPiMinus(fLowEnergy);
if(isMaster && 0 == theA[0]) {
theA[0] = theA[1] = 1;
G4ThreeVector mom(0.0,0.0,1.0);
G4DynamicParticle dp(thePiPlus, mom, fGlauberEnergy);
G4NistManager* nist = G4NistManager::Instance();
G4double csup, csdn;
for(G4int iz=2; iz<93; ++iz) {
G4int A = G4lrint(nist->GetAtomicMassAmu(iz));
theA[iz] = A;
csup = fGlauber->GetElasticGlauberGribov(&dp, iz, A);
csdn = fPion->GetElasticCrossSection(&dp, iz, A);
theGlauberFacPiPlus[iz] = csdn/csup;
}
dp.SetDefinition(G4PionMinus::PionMinus());
for(G4int iz=2; iz<93; ++iz) {
csup = fGlauber->GetElasticGlauberGribov(&dp, iz, theA[iz]);
csdn = fPion->GetElasticCrossSection(&dp, iz, theA[iz]);
theGlauberFacPiMinus[iz] = csdn/csup;
if(verboseLevel > 0) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " factorPiPlus= " << theGlauberFacPiPlus[iz]
<< " factorPiMinus= " << theGlauberFacPiMinus[iz]
<< G4endl;
}
}
theCoulombFacPiPlus[1] = 1.0;
theCoulombFacPiMinus[1]= 1.0;
dp.SetKineticEnergy(fLowEnergy);
dp.SetDefinition(thePiPlus);
for(G4int iz=2; iz<93; ++iz) {
theCoulombFacPiPlus[iz] = fPion->GetElasticCrossSection(&dp, iz, theA[iz])
/CoulombFactorPiPlus(fLowEnergy, iz);
}
dp.SetDefinition(G4PionMinus::PionMinus());
for(G4int iz=2; iz<93; ++iz) {
theCoulombFacPiMinus[iz] = fPion->GetElasticCrossSection(&dp, iz, theA[iz])
/FactorPiMinus(fLowEnergy);
if(verboseLevel > 0) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " CoulombFactorPiPlus= " << theCoulombFacPiPlus[iz]
<< " CoulombFactorPiMinus= " << theCoulombFacPiMinus[iz]
<< G4endl;
}
if(verboseLevel > 1) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " CoulombFactorPiPlus= " << theCoulombFacPiPlus[iz]
<< " CoulombFactorPiMinus= " << theCoulombFacPiMinus[iz]
<< G4endl;
}
}
}
@@ -50,7 +50,6 @@
#include "G4PionMinus.hh"
#include "G4NistManager.hh"
#include "G4Pow.hh"
#include "G4HadronicParameters.hh"
G4double G4BGGPionInelasticXS::theGlauberFacPiPlus[93] = {0.0};
@@ -59,31 +58,28 @@ G4double G4BGGPionInelasticXS::theLowEPiPlus[93] = {0.0};
G4double G4BGGPionInelasticXS::theLowEPiMinus[93] = {0.0};
G4int G4BGGPionInelasticXS::theA[93] = {0};
#ifdef G4MULTITHREADED
G4Mutex G4BGGPionInelasticXS::pionInelasticXSMutex = G4MUTEX_INITIALIZER;
#endif
G4BGGPionInelasticXS::G4BGGPionInelasticXS(const G4ParticleDefinition* p)
: G4VCrossSectionDataSet("BarashenkovGlauberGribov")
{
verboseLevel = 0;
fGlauberEnergy = 91.*CLHEP::GeV;
fLowEnergy = 20.*CLHEP::MeV;
fLowestEnergy = 1.*CLHEP::MeV;
fGlauberEnergy = 91.*CLHEP::GeV;
fLowEnergy = 20.*CLHEP::MeV;
fLowestEnergy = 1.*CLHEP::MeV;
SetMinKinEnergy(0.0);
SetMaxKinEnergy( G4HadronicParameters::Instance()->GetMaxEnergy() );
fPion = nullptr;
fGlauber = nullptr;
fHadron = nullptr;
fPion = new G4UPiNuclearCrossSection();
fGlauber = new G4ComponentGGHadronNucleusXsc();
fHadron = new G4HadronNucleonXsc();
fG4pow = G4Pow::GetInstance();
theProton = G4Proton::Proton();
thePiPlus = G4PionPlus::PionPlus();
isPiplus = (p == thePiPlus);
isMaster = false;
isPiplus = (p == thePiPlus);
SetForAllAtomsAndEnergies(true);
if (0 == theA[0]) { Initialise(); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -135,6 +131,7 @@ G4BGGPionInelasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
} else {
cross = fPion->GetInelasticCrossSection(dp, Z, theA[Z]);
}
#ifdef G4VERBOSE
if(verboseLevel > 1) {
G4cout << "G4BGGPionInelasticXS::GetCrossSection for "
<< dp->GetDefinition()->GetParticleName()
@@ -143,6 +140,7 @@ G4BGGPionInelasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
<< " XS(b)= " << cross/barn
<< G4endl;
}
#endif
return cross;
}
@@ -150,7 +148,7 @@ G4BGGPionInelasticXS::GetElementCrossSection(const G4DynamicParticle* dp,
G4double
G4BGGPionInelasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
G4int Z, G4int A,
G4int, G4int A,
const G4Isotope*,
const G4Element*,
const G4Material*)
@@ -160,14 +158,16 @@ G4BGGPionInelasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
dp->GetKineticEnergy());
G4double cross = A*fHadron->GetInelasticHadronNucleonXsc();
#ifdef G4VERBOSE
if(verboseLevel > 1) {
G4cout << "G4BGGPionInelasticXS::GetCrossSection for "
<< dp->GetDefinition()->GetParticleName()
<< " Ekin(GeV)= " << dp->GetKineticEnergy()
<< " in nucleus Z= " << Z << " A= " << A
<< " in nucleus Z=1 A=" << A
<< " XS(b)= " << cross/barn
<< G4endl;
}
#endif
return cross;
}
@@ -175,7 +175,6 @@ G4BGGPionInelasticXS::GetIsoCrossSection(const G4DynamicParticle* dp,
void G4BGGPionInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
{
if(fPion) { return; }
if(verboseLevel > 1) {
G4cout << "G4BGGPionInelasticXS::BuildPhysicsTable for "
<< p.GetParticleName() << G4endl;
@@ -188,86 +187,61 @@ void G4BGGPionInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
<< p.GetParticleName() << G4endl;
G4Exception("G4BGGPionInelasticXS::BuildPhysicsTable", "had001",
FatalException, ed);
return;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4BGGPionInelasticXS::Initialise()
{
theA[0] = theA[1] = 1;
G4ThreeVector mom(0.0,0.0,1.0);
G4DynamicParticle dp(thePiPlus, mom, fGlauberEnergy);
G4NistManager* nist = G4NistManager::Instance();
G4double csup, csdn;
for (G4int iz=2; iz<93; ++iz) {
G4int A = G4lrint(nist->GetAtomicMassAmu(iz));
theA[iz] = A;
csup = fGlauber->GetInelasticGlauberGribov(&dp, iz, A);
csdn = fPion->GetInelasticCrossSection(&dp, iz, A);
theGlauberFacPiPlus[iz] = csdn/csup;
}
fPion = new G4UPiNuclearCrossSection();
fGlauber = new G4ComponentGGHadronNucleusXsc();
fHadron = new G4HadronNucleonXsc();
dp.SetDefinition(G4PionMinus::PionMinus());
for (G4int iz=2; iz<93; ++iz) {
csup = fGlauber->GetInelasticGlauberGribov(&dp, iz, theA[iz]);
csdn = fPion->GetInelasticCrossSection(&dp, iz, theA[iz]);
theGlauberFacPiMinus[iz] = csdn/csup;
fPion->BuildPhysicsTable(p);
if(0 == theA[0]) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&pionInelasticXSMutex);
if(0 == theA[0]) {
#endif
isMaster = true;
#ifdef G4MULTITHREADED
if(verboseLevel > 1) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " factorPiPlus= " << theGlauberFacPiPlus[iz]
<< " factorPiMinus= " << theGlauberFacPiMinus[iz]
<< G4endl;
}
G4MUTEXUNLOCK(&pionInelasticXSMutex);
#endif
} else {
return;
}
if(isMaster && 0 == theA[0]) {
theLowEPiPlus[1] = theLowEPiMinus[1]= 1.0;
dp.SetDefinition(thePiPlus);
dp.SetKineticEnergy(fLowEnergy);
for (G4int iz=2; iz<93; ++iz) {
theLowEPiPlus[iz] = fPion->GetInelasticCrossSection(&dp, iz, theA[iz])
/CoulombFactorPiPlus(fLowEnergy, iz);
}
theA[0] = theA[1] = 1;
G4ThreeVector mom(0.0,0.0,1.0);
G4DynamicParticle dp(thePiPlus, mom, fGlauberEnergy);
G4NistManager* nist = G4NistManager::Instance();
G4double csup, csdn;
if(verboseLevel > 0) {
G4cout << "### G4BGGPionInelasticXS::Initialise for "
<< p.GetParticleName()
<< " isPiplus: " << isPiplus
<< G4endl;
}
for(G4int iz=2; iz<93; ++iz) {
G4int A = G4lrint(nist->GetAtomicMassAmu(iz));
theA[iz] = A;
csup = fGlauber->GetInelasticGlauberGribov(&dp, iz, A);
csdn = fPion->GetInelasticCrossSection(&dp, iz, A);
theGlauberFacPiPlus[iz] = csdn/csup;
}
dp.SetDefinition(G4PionMinus::PionMinus());
for(G4int iz=2; iz<93; ++iz) {
csup = fGlauber->GetInelasticGlauberGribov(&dp, iz, theA[iz]);
csdn = fPion->GetInelasticCrossSection(&dp, iz, theA[iz]);
theGlauberFacPiMinus[iz] = csdn/csup;
if(verboseLevel > 0) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " factorPiPlus= " << theGlauberFacPiPlus[iz]
<< " factorPiMinus= " << theGlauberFacPiMinus[iz]
<< G4endl;
}
}
theLowEPiPlus[1] = theLowEPiMinus[1]= 1.0;
dp.SetDefinition(thePiPlus);
dp.SetKineticEnergy(fLowEnergy);
for(G4int iz=2; iz<93; ++iz) {
theLowEPiPlus[iz] = fPion->GetInelasticCrossSection(&dp, iz, theA[iz])
/CoulombFactorPiPlus(fLowEnergy, iz);
}
dp.SetDefinition(G4PionMinus::PionMinus());
for(G4int iz=2; iz<93; ++iz) {
theLowEPiMinus[iz] = fPion->GetInelasticCrossSection(&dp, iz, theA[iz])
/FactorPiMinus(fLowEnergy);
dp.SetDefinition(G4PionMinus::PionMinus());
for (G4int iz=2; iz<93; ++iz) {
theLowEPiMinus[iz] = fPion->GetInelasticCrossSection(&dp, iz, theA[iz])
/FactorPiMinus(fLowEnergy);
if(verboseLevel > 0) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " LowEtorPiPlus= " << theLowEPiPlus[iz]
<< " LowEtorPiMinus= " << theLowEPiMinus[iz]
<< G4endl;
}
if (verboseLevel > 1) {
G4cout << "Z= " << iz << " A= " << theA[iz]
<< " LowEtorPiPlus= " << theLowEPiPlus[iz]
<< " LowEtorPiMinus= " << theLowEPiMinus[iz]
<< G4endl;
}
}
}
@@ -38,42 +38,24 @@
#include "G4Proton.hh"
#include "G4Pow.hh"
#include "G4BarashenkovData.hh"
#include "G4NistManager.hh"
#include "G4IsotopeList.hh"
#include "G4HadronXSDataTable.hh"
///////////////////////////////////////////////////////////////////////////////
G4double G4ComponentBarNucleonNucleusXsc::theA[93] = {0.0};
G4double G4ComponentBarNucleonNucleusXsc::A75[93] = {0.0};
G4double G4ComponentBarNucleonNucleusXsc::A75[93] = {0.0};
G4int G4ComponentBarNucleonNucleusXsc::theZ[] =
{2,4,6,7,8,11,13,14,20,26,29,42,48,50,74,82,92};
std::vector<G4PiData*>* G4ComponentBarNucleonNucleusXsc::thePData = nullptr;
std::vector<G4PiData*>* G4ComponentBarNucleonNucleusXsc::theNData = nullptr;
#ifdef G4MULTITHREADED
G4Mutex G4ComponentBarNucleonNucleusXsc::barNNXSMutex = G4MUTEX_INITIALIZER;
#endif
G4ComponentBarNucleonNucleusXsc::G4ComponentBarNucleonNucleusXsc()
: G4VComponentCrossSection("BarashenkovNucleonNucleusXsc"),
fTotalXsc(0.0), fInelasticXsc(0.0), fElasticXsc(0.0), isMaster(false)
: G4VComponentCrossSection("BarashenkovNucleonNucleusXsc")
{
theNeutron = G4Neutron::Neutron();
theProton = G4Proton::Proton();
}
///////////////////////////////////////////////////////////////////////////////
G4ComponentBarNucleonNucleusXsc::~G4ComponentBarNucleonNucleusXsc()
{
if(isMaster && nullptr != thePData) {
for(G4int i=0; i<NZ; ++i) {
delete (*thePData)[i];
delete (*theNData)[i];
}
delete thePData;
delete theNData;
thePData = nullptr;
theNData = nullptr;
if (nullptr == thePData) {
LoadData();
}
}
@@ -176,8 +158,8 @@ Interpolate(G4int Z1, G4int Z2, G4int Z, G4double x1, G4double x2) const
// for tabulated data, cross section scales with A^(2/3)
G4double r1 = x1* A75[Z] / A75[Z1];
G4double r2 = x2* A75[Z] / A75[Z2];
G4double alp1 = (theA[Z] - theA[Z1]);
G4double alp2 = (theA[Z2] - theA[Z]);
G4double alp1 = (aeff[Z] - aeff[Z1]);
G4double alp2 = (aeff[Z2] - aeff[Z]);
G4double result = (r1*alp2 + r2*alp1)/(alp1 + alp2);
// G4cout << "x1/2, z1/2 z" <<x1<<" "<<x2<<" "<<Z1<<" "<<Z2<<" "<<Z<<G4endl;
// G4cout << "res1/2 " << r1 <<" " << r2 <<" " << result<< G4endl;
@@ -198,31 +180,15 @@ void G4ComponentBarNucleonNucleusXsc::Description(std::ostream& outFile) const
/////////////////////////////////////////////////////////////////////////////
void
G4ComponentBarNucleonNucleusXsc::BuildPhysicsTable(const G4ParticleDefinition&)
{
if(nullptr != theNData) { return; }
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&barNNXSMutex);
if(!theNData) {
#endif
isMaster = true;
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&barNNXSMutex);
#endif
if(isMaster) { LoadData(); }
}
/////////////////////////////////////////////////////////////////////////////
void G4ComponentBarNucleonNucleusXsc::LoadData()
{
theNData = new std::vector<G4PiData*>;
thePData = new std::vector<G4PiData*>;
theNData->resize(NZ, nullptr);
thePData->resize(NZ, nullptr);
auto ptr = G4HadronXSDataTable::Instance();
ptr->AddPiData(theNData);
ptr->AddPiData(thePData);
// He, Be, C
(*theNData)[0] = new G4PiData(he_m_t, he_m_in, e1, 44);
@@ -281,12 +247,10 @@ void G4ComponentBarNucleonNucleusXsc::LoadData()
(*theNData)[16] = new G4PiData(u_m_t, u_m_in, e6, 46);
(*thePData)[16] = new G4PiData(u_m_t, u_p_in, e6, 46);
G4NistManager* nist = G4NistManager::Instance();
A75[0] = theA[0] = 1.0;
A75[0] = 1.0;
G4Pow* g4pow = G4Pow::GetInstance();
for(G4int i=1; i<93; ++i) {
theA[i] = nist->GetAtomicMassAmu(i);
A75[i] = g4pow->A23(theA[i]); // interpolate by square ~ A^(2/3)
A75[i] = g4pow->A23(aeff[i]); // interpolate by square ~ A^(2/3)
}
}
@@ -39,12 +39,13 @@
#include "G4NuclearRadii.hh"
#include "G4Pow.hh"
static const G4double inve = 1./CLHEP::eplus;
namespace
{
const G4double inve = 1./CLHEP::eplus;
}
G4ComponentGGNuclNuclXsc::G4ComponentGGNuclNuclXsc()
: G4VComponentCrossSection("Glauber-Gribov Nucl-nucl"),
fTotalXsc(0.0), fElasticXsc(0.0), fInelasticXsc(0.0), fProductionXsc(0.0),
fDiffractionXsc(0.0), fEnergy(0.0), fParticle(nullptr), fZ(0), fA(0)
: G4VComponentCrossSection("Glauber-Gribov Nucl-nucl")
{
theProton = G4Proton::Proton();
theNeutron = G4Neutron::Neutron();
@@ -171,7 +172,7 @@ void G4ComponentGGNuclNuclXsc::ComputeCrossSections(
fZ = Z;
fA = A;
fEnergy = kinEnergy;
G4Pow* pG4Pow=G4Pow::GetInstance();
G4Pow* pG4Pow = G4Pow::GetInstance();
G4int pZ = G4lrint(aParticle->GetPDGCharge()*inve);
G4int pA = aParticle->GetBaryonNumber();
@@ -201,7 +202,8 @@ void G4ComponentGGNuclNuclXsc::ComputeCrossSections(
G4double tR = G4NuclearRadii::Radius(Z, A);
G4double pR = G4NuclearRadii::Radius(pZ, pA);
if(pHN) pR *= std::sqrt( pG4Pow->Z23( pA - pL ) + cHN*pG4Pow->Z23( pL ) )/pG4Pow->Z13(pA);
if(pHN)
pR *= std::sqrt( pG4Pow->Z23( pA - pL ) + cHN*pG4Pow->Z23( pL ) )/pG4Pow->Z13(pA);
G4double cB = ComputeCoulombBarier(aParticle, kinEnergy, Z, A, pR, tR);
@@ -214,10 +216,6 @@ void G4ComponentGGNuclNuclXsc::ComputeCrossSections(
sigma += (pZ*tN+pN*Z)*fHNXsc->HadronNucleonXscNS(theNeutron, theProton, pTkin);
G4double npInXsc = fHNXsc->GetInelasticHadronNucleonXsc();
// G4cout<<"ppInXsc = "<<ppInXsc/millibarn<<"; npInXsc = "<<npInXsc/millibarn<<G4endl;
// G4cout<<"npTotXsc = "<<fHNXsc->GetTotalHadronNucleonXsc()/millibarn<<"; npElXsc = "
// <<fHNXsc->GetElasticHadronNucleonXsc()/millibarn<<G4endl;
G4double nucleusSquare = cofTotal*CLHEP::pi*( pR*pR + tR*tR ); // basically 2piRR
G4double ratio= sigma/nucleusSquare;
@@ -234,11 +232,7 @@ void G4ComponentGGNuclNuclXsc::ComputeCrossSections(
}
else
{
fInelasticXsc = 0.;
fTotalXsc = 0.;
fElasticXsc = 0.;
fProductionXsc = 0.;
fDiffractionXsc= 0.;
fInelasticXsc = fTotalXsc = fElasticXsc = fProductionXsc = fDiffractionXsc = 0.;
}
}
@@ -256,14 +250,21 @@ G4double G4ComponentGGNuclNuclXsc::ComputeCoulombBarier(
G4double totEcm = std::sqrt(pM*pM + tM*tM + 2.*pElab*tM);
G4double totTcm = totEcm - pM -tM;
static const G4double qfact = CLHEP::fine_structure_const*CLHEP::hbarc;
G4double bC = qfact*pZ*Z*0.5/(pR + tR);
// 0.5 defines shape of Cross section correction
// at cB = totTcm it become zero
static const G4double qfact = 0.5*CLHEP::elm_coupling;
G4double bC = qfact*pZ*Z/(pR + tR);
G4double ratio = (totTcm <= bC ) ? 0. : 1. - bC/totTcm;
// G4cout<<"G4ComponentGGNuclNuclXsc::ComputeCoulombBarier= "<<ratio
// <<"; pTkin(GeV)= " <<pTkin/GeV<<";
// " pPlab = "<<pPlab/GeV<<"; bC = "<<bC/GeV<<"; pTcm = "
// <<pTcm/GeV<<G4endl;
G4double ratio = (totTcm <= bC) ? 0. : 1. - bC/totTcm;
#ifdef G4VERBOSE
if (GetVerboseLevel() > 1) {
G4cout << "G4ComponentGGNuclNuclXsc::ComputeCoulombBarier(..)=" <<ratio
<< "; pTkin(GeV)=" << pTkin/CLHEP::MeV
<< " totTcm= " << totTcm/CLHEP::MeV<< "; bC=" << bC/CLHEP::MeV
<< G4endl;
}
#endif
return ratio;
}
@@ -87,22 +87,18 @@ G4CrossSectionDataSetRegistry::~G4CrossSectionDataSetRegistry()
void G4CrossSectionDataSetRegistry::Clean()
{
size_t n = xSections.size();
for (size_t i=0; i<n; ++i) {
std::size_t n = xSections.size();
for (std::size_t i=0; i<n; ++i) {
G4VCrossSectionDataSet* p = xSections[i];
if(p) {
//std::cout << "Clean x-section #" << i << std::endl;
//std::cout << " " << p->GetName() << std::endl;
if(nullptr != p) {
delete p;
xSections[i] = nullptr;
}
}
n = xComponents.size();
for (size_t i=0; i<n; ++i) {
G4VComponentCrossSection* p = xComponents[i];
if(p) {
//std::cout << "Clean component #" << i << std::endl;
//std::cout << " " << p->GetName() << std::endl;
for (std::size_t i=0; i<n; ++i) {
auto p = xComponents[i];
if(nullptr != p) {
delete p;
xComponents[i] = nullptr;
}
@@ -112,22 +108,18 @@ void G4CrossSectionDataSetRegistry::Clean()
void G4CrossSectionDataSetRegistry::Register(G4VCrossSectionDataSet* p)
{
if(nullptr == p) { return; }
for (auto xsec : xSections) {
for (auto & xsec : xSections) {
if(xsec == p) { return; }
}
//G4cout << "Register x-section #" << xSections.size()
// << " " << p->GetName() << " " << p << G4endl;
xSections.push_back(p);
}
void G4CrossSectionDataSetRegistry::DeRegister(G4VCrossSectionDataSet* p)
{
if(nullptr == p) { return; }
size_t n = xSections.size();
for (size_t i=0; i<n; ++i) {
std::size_t n = xSections.size();
for (std::size_t i=0; i<n; ++i) {
if(xSections[i] == p) {
//std::cout << "DeRegister x-section #" << i
// << " " << p->GetName() << " " << p << std::endl;
xSections[i] = nullptr;
return;
}
@@ -136,23 +128,19 @@ void G4CrossSectionDataSetRegistry::DeRegister(G4VCrossSectionDataSet* p)
void G4CrossSectionDataSetRegistry::Register(G4VComponentCrossSection* p)
{
if(!p) { return; }
for (auto xsec : xComponents) {
if(nullptr == p) { return; }
for (auto & xsec : xComponents) {
if(xsec == p) { return; }
}
//G4cout << "Register component #" << xComponents.size()
//<< " " << p->GetName() << G4endl;
xComponents.push_back(p);
}
void G4CrossSectionDataSetRegistry::DeRegister(G4VComponentCrossSection* p)
{
if(!p) { return; }
size_t n = xComponents.size();
for (size_t i=0; i<n; ++i) {
if(nullptr == p) { return; }
std::size_t n = xComponents.size();
for (std::size_t i=0; i<n; ++i) {
if(xComponents[i] == p) {
//std::cout << "DeRegister component #" << i << std::endl;
//std::cout << " " << p->GetName() << std::endl;
xComponents[i] = nullptr;
return;
}
@@ -162,12 +150,10 @@ void G4CrossSectionDataSetRegistry::DeRegister(G4VComponentCrossSection* p)
void
G4CrossSectionDataSetRegistry::DeleteComponent(G4VComponentCrossSection* p)
{
if(!p) { return; }
size_t n = xComponents.size();
for (size_t i=0; i<n; ++i) {
if(nullptr == p) { return; }
std::size_t n = xComponents.size();
for (std::size_t i=0; i<n; ++i) {
if(xComponents[i] == p) {
//std::cout << "Delete component #" << i << std::endl;
//std::cout << " " << p->GetName() << std::endl;
delete p;
return;
}
@@ -178,8 +164,8 @@ G4VCrossSectionDataSet*
G4CrossSectionDataSetRegistry::GetCrossSectionDataSet(const G4String& name,
G4bool warning)
{
for (auto xsec : xSections) {
if(xsec && xsec->GetName() == name) { return xsec; }
for (auto & xsec : xSections) {
if(nullptr != xsec && xsec->GetName() == name) { return xsec; }
}
// check if factory exists...
//
@@ -199,8 +185,8 @@ G4CrossSectionDataSetRegistry::GetCrossSectionDataSet(const G4String& name,
G4VComponentCrossSection*
G4CrossSectionDataSetRegistry::GetComponentCrossSection(const G4String& name)
{
for (auto xsec : xComponents) {
if(xsec && xsec->GetName() == name) { return xsec; }
for (auto & xsec : xComponents) {
if(nullptr != xsec && xsec->GetName() == name) { return xsec; }
}
G4VComponentCrossSection* ptr = nullptr;
return ptr;
@@ -49,25 +49,28 @@
#include "G4KaonZeroShort.hh"
#include "G4KaonZeroLong.hh"
static const G4double invGeV = 1.0/CLHEP::GeV;
static const G4double invGeV2 = 1.0/(CLHEP::GeV*CLHEP::GeV);
// PDG fit constants
static const G4double minLogP = 3.5; // min of (lnP-minLogP)^2
static const G4double cofLogE = .0557; // elastic (lnP-minLogP)^2
static const G4double cofLogT = .3; // total (lnP-minLogP)^2
static const G4double pMin = .1; // fast LE calculation
static const G4double pMax = 1000.; // fast HE calculation
static const G4double ekinmin = 0.1*CLHEP::MeV; // protection against zero ekin
static const G4double ekinmaxQB = 100*CLHEP::MeV; // max kinetic energy for Coulomb barrier
namespace
{
const G4double invGeV = 1.0/CLHEP::GeV;
const G4double invGeV2 = 1.0/(CLHEP::GeV*CLHEP::GeV);
// PDG fit constants
const G4double minLogP = 3.5; // min of (lnP-minLogP)^2
const G4double cofLogE = .0557; // elastic (lnP-minLogP)^2
const G4double cofLogT = .3; // total (lnP-minLogP)^2
const G4double pMin = .1; // fast LE calculation
const G4double pMax = 1000.; // fast HE calculation
const G4double ekinmin = 0.1*CLHEP::MeV; // protection against zero ekin
const G4double ekinmaxQB = 100*CLHEP::MeV; // max kinetic energy for Coulomb barrier
}
G4HadronNucleonXsc::G4HadronNucleonXsc()
: fTotalXsc(0.0), fElasticXsc(0.0), fInelasticXsc(0.0)
{
// basic hadrons
theProton = G4Proton::Proton();
theNeutron = G4Neutron::Neutron();
thePiPlus = G4PionPlus::PionPlus();
// strange
// basic strange mesons
theKPlus = G4KaonPlus::KaonPlus();
theKMinus = G4KaonMinus::KaonMinus();
theK0S = G4KaonZeroShort::KaonZeroShort();
@@ -76,9 +79,6 @@ G4HadronNucleonXsc::G4HadronNucleonXsc()
g4calc = G4Pow::GetInstance();
}
G4HadronNucleonXsc::~G4HadronNucleonXsc()
{}
void G4HadronNucleonXsc::CrossSectionDescription(std::ostream& outFile) const
{
outFile << "G4HadronNucleonXsc calculates the total, inelastic and elastic\n"
@@ -28,7 +28,7 @@
//
// GEANT4 Class file
//
// Description: Data structure for cross sections per materials
// Description: Data structure for registration of static cross sections components
//
// Author: V.Ivanchenko 31.05.2018
//
@@ -40,126 +40,62 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4HadronXSDataTable.hh"
#include "G4PhysicsLogVector.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4DynamicParticle.hh"
#include "G4CrossSectionDataStore.hh"
G4HadronXSDataTable* G4HadronXSDataTable::sInstance = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4HadElementSelector::G4HadElementSelector(G4DynamicParticle* dp,
G4CrossSectionDataStore* xs,
const G4Material* mat,
G4int bins, G4double emin,
G4double emax, G4bool)
{
std::size_t n = mat->GetNumberOfElements();
nElmMinusOne = G4int(n - 1);
theElementVector = mat->GetElementVector();
if(nElmMinusOne > 0) {
G4PhysicsVector* first = nullptr;
xSections.resize(n, first);
first = new G4PhysicsLogVector(emin,emax,bins,false);
xSections[0] = first;
for(std::size_t i=1; i<n; ++i) {
xSections[i] = new G4PhysicsVector(*first);
}
std::vector<G4double> temp;
temp.resize(n, 0.0);
for(G4int j=0; j<=bins; ++j) {
G4double cross = 0.0;
G4double e = first->Energy(j);
dp->SetKineticEnergy(e);
for(std::size_t i=0; i<n; ++i) {
cross += xs->GetCrossSection(dp, (*theElementVector)[i], mat);
temp[i] = cross;
}
G4double fact = (cross > 0.0) ? 1.0/cross : 0.0;
for(std::size_t i=0; i<n; ++i) {
G4double y = (i<n-1) ? temp[i]*fact : 1.0;
xSections[i]->PutValue(j, y);
}
}
G4HadronXSDataTable* G4HadronXSDataTable::Instance() {
if ( sInstance == nullptr ) {
static G4HadronXSDataTable theObject;
sInstance = &theObject;
}
return sInstance;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4HadElementSelector::~G4HadElementSelector()
{
if(nElmMinusOne > 0) {
for(G4int i=0; i<=nElmMinusOne; ++i) { delete xSections[i]; }
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4HadElementSelector::Dump()
G4HadronXSDataTable::G4HadronXSDataTable()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4HadronXSDataTable::G4HadronXSDataTable() : nMaterials(0)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4HadronXSDataTable::Initialise(G4DynamicParticle* dp,
G4CrossSectionDataStore* xs,
G4int bins, G4double emin, G4double emax,
G4bool spline)
{
std::size_t nn = G4Material::GetNumberOfMaterials();
if(nn > nMaterials) {
if(0 == nMaterials) {
xsData.reserve(nn);
elmSelectors.reserve(nn);
}
G4PhysicsLogVector* first = nullptr;
G4int sbins = std::max(10, bins/5);
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
for(std::size_t i=nMaterials; i<nn; ++i) {
const G4Material* mat = (*mtable)[i];
G4PhysicsVector* v = nullptr;
G4HadElementSelector* es = nullptr;
// create real vector only for complex materials
if(mat->GetNumberOfElements() > 1) {
if(nullptr == first) {
first = new G4PhysicsLogVector(emin, emax, bins, spline);
v = first;
} else {
v = new G4PhysicsVector(*first);
}
for(G4int j=0; j<=bins; ++j) {
G4double e = first->Energy(j);
dp->SetKineticEnergy(e);
G4double cros = xs->ComputeCrossSection(dp, mat);
v->PutValue(j, cros);
}
if(spline) v->FillSecondDerivatives();
elmSelectors[i] = new G4HadElementSelector(dp, xs, mat, sbins, emin, emax, spline);
}
xsData.push_back(v);
elmSelectors.push_back(es);
}
nMaterials = nn;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4HadronXSDataTable::~G4HadronXSDataTable()
{
for(std::size_t i=0; i<nMaterials; ++i) {
delete xsData[i];
delete elmSelectors[i];
for (auto & ptr : fPiData) {
delete ptr;
}
for (auto & ptr : fTable) {
ptr->clearAndDestroy();
delete ptr;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4HadronXSDataTable::Dump()
{}
void G4HadronXSDataTable::AddPiData(std::vector<G4PiData*>* ptr)
{
if (nullptr == ptr || ptr->empty()) { return; }
for (auto & p : *ptr) {
G4bool ok = true;
for (auto & d : fPiData) {
if (p == d) {
ok = false;
break;
}
}
if (ok) { fPiData.push_back(p); }
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4HadronXSDataTable::AddTable(G4PhysicsTable* ptr)
{
if (nullptr != ptr) {
for (auto & p : fTable) { if (p == ptr) { return; } }
fTable.push_back(ptr);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -60,11 +60,12 @@ static std::once_flag applyOnce;
namespace
{
G4Mutex neutronCaptureXSMutex = G4MUTEX_INITIALIZER;
const G4int MAXZCAPTURE = 92;
}
G4NeutronCaptureXS::G4NeutronCaptureXS()
: G4VCrossSectionDataSet(Default_Name()),
emax(20*CLHEP::MeV), elimit(1.0e-10*CLHEP::eV)
emax(20*CLHEP::MeV), elimit(1.0e-5*CLHEP::eV)
{
verboseLevel = 0;
if (verboseLevel > 0) {
@@ -73,7 +74,7 @@ G4NeutronCaptureXS::G4NeutronCaptureXS()
}
logElimit = G4Log(elimit);
if (nullptr == data) {
data = new G4ElementData(MAXZCAPTURE);
data = new G4ElementData(MAXZCAPTURE+1);
data->SetName("nCapture");
FindDirectoryPath();
}
@@ -130,16 +131,20 @@ G4NeutronCaptureXS::ComputeCrossSectionPerElement(G4double ekin, G4double loge,
}
G4double
G4NeutronCaptureXS::ElementCrossSection(G4double ekin, G4double loge, G4int ZZ)
G4NeutronCaptureXS::ElementCrossSection(G4double eKin, G4double logE, G4int ZZ)
{
G4int Z = std::min(ZZ, MAXZCAPTURE-1);
G4double logEkin = loge;
if (ekin < elimit) { ekin = elimit; logEkin = logElimit; }
G4int Z = std::min(ZZ, MAXZCAPTURE);
G4double ekin = eKin;
G4double logEkin = logE;
if (ekin < elimit) {
ekin = elimit;
logEkin = logElimit;
}
auto pv = GetPhysicsVector(Z);
const G4double e1 = pv->Energy(1);
G4double xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin)
: (*pv)[1]*std::sqrt(e1/ekin);
const G4double e0 = pv->Energy(0);
G4double xs = (ekin >= e0) ? pv->LogVectorValue(ekin, logEkin)
: (*pv)[0]*std::sqrt(e0/ekin);
#ifdef G4VERBOSE
if (verboseLevel > 1){
@@ -177,7 +182,7 @@ G4double G4NeutronCaptureXS::IsoCrossSection(G4double eKin, G4double logE,
G4double xs = 0.0;
if (eKin > emax) { return xs; }
G4int Z = std::min(ZZ, MAXZCAPTURE-1);
G4int Z = std::min(ZZ, MAXZCAPTURE);
G4double ekin = eKin;
G4double logEkin = logE;
if (ekin < elimit) {
@@ -188,12 +193,13 @@ G4double G4NeutronCaptureXS::IsoCrossSection(G4double eKin, G4double logE,
auto pv = GetPhysicsVector(Z);
if (pv == nullptr) { return xs; }
// use isotope x-section if possible
if (data->GetNumberOfComponents(Z) > 0) {
G4PhysicsVector* pviso = data->GetComponentDataByID(Z, A);
if(pviso != nullptr) {
const G4double e1 = pviso->Energy(1);
xs = (ekin >= e1) ? pviso->LogVectorValue(ekin, logEkin)
: (*pviso)[1]*std::sqrt(e1/ekin);
const G4double e0 = pviso->Energy(0);
xs = (ekin >= e0) ? pviso->LogVectorValue(ekin, logEkin)
: (*pviso)[0]*std::sqrt(e0/ekin);
#ifdef G4VERBOSE
if(verboseLevel > 0) {
G4cout << "G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV
@@ -205,9 +211,9 @@ G4double G4NeutronCaptureXS::IsoCrossSection(G4double eKin, G4double logE,
}
}
// isotope data are not available or applicable
const G4double e1 = pv->Energy(1);
xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin)
: (*pv)[1]*std::sqrt(e1/ekin);
const G4double e0 = pv->Energy(0);
xs = (ekin >= e0) ? pv->LogVectorValue(ekin, logEkin)
: (*pv)[0]*std::sqrt(e0/ekin);
#ifdef G4VERBOSE
if (verboseLevel > 0) {
G4cout << "G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV
@@ -238,7 +244,7 @@ G4NeutronCaptureXS::SelectIsotope(const G4Element* anElement,
// is there isotope wise cross section?
G4int j;
if (Z >= MAXZCAPTURE || 0 == data->GetNumberOfComponents(Z)) {
if (Z > MAXZCAPTURE || 0 == data->GetNumberOfComponents(Z)) {
for (j = 0; j<nIso; ++j) {
sum += abundVector[j];
if(q <= sum) {
@@ -292,7 +298,7 @@ G4NeutronCaptureXS::BuildPhysicsTable(const G4ParticleDefinition& p)
G4AutoLock l(&neutronCaptureXSMutex);
// Access to elements
for ( auto const & elm : *table ) {
G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZCAPTURE-1) );
G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZCAPTURE) );
if ( nullptr == data->GetElementData(Z) ) { Initialise(Z); }
}
l.unlock();
@@ -67,13 +67,15 @@ namespace
G4NeutronInelasticXS::G4NeutronInelasticXS()
: G4VCrossSectionDataSet(Default_Name()),
neutron(G4Neutron::Neutron()),
elimit(20*CLHEP::MeV)
elimit(20*CLHEP::MeV),
lowElimit(1.0e-5*CLHEP::eV)
{
verboseLevel = 0;
if (verboseLevel > 0){
G4cout << "G4NeutronInelasticXS::G4NeutronInelasticXS Initialise for Z < "
<< MAXZINEL << G4endl;
<< MAXZINEL << G4endl;
}
loglowElimit = G4Log(lowElimit);
if (nullptr == data) {
data = new G4ElementData(MAXZINEL);
data->SetName("nInelastic");
@@ -83,6 +85,7 @@ G4NeutronInelasticXS::G4NeutronInelasticXS()
G4CrossSectionDataSetRegistry::Instance()->GetComponentCrossSection("Glauber-Gribov");
if(ggXsection == nullptr)
ggXsection = new G4ComponentGGHadronNucleusXsc();
SetForAllAtomsAndEnergies(true);
}
@@ -97,22 +100,22 @@ void G4NeutronInelasticXS::CrossSectionDescription(std::ostream& outFile) const
G4bool
G4NeutronInelasticXS::IsElementApplicable(const G4DynamicParticle*,
G4int, const G4Material*)
G4int, const G4Material*)
{
return true;
}
G4bool
G4NeutronInelasticXS::IsIsoApplicable(const G4DynamicParticle*,
G4int, G4int,
const G4Element*, const G4Material*)
G4int, G4int,
const G4Element*, const G4Material*)
{
return true;
}
G4double
G4NeutronInelasticXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
G4int Z, const G4Material*)
G4int Z, const G4Material*)
{
return ElementCrossSection(aParticle->GetKineticEnergy(),
aParticle->GetLogKineticEnergy(), Z);
@@ -120,29 +123,44 @@ G4NeutronInelasticXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
G4double
G4NeutronInelasticXS::ComputeCrossSectionPerElement(G4double ekin, G4double loge,
const G4ParticleDefinition*,
const G4Element* elm,
const G4Material*)
const G4ParticleDefinition*,
const G4Element* elm,
const G4Material*)
{
return ElementCrossSection(ekin, loge, elm->GetZasInt());
}
G4double
G4NeutronInelasticXS::ElementCrossSection(G4double ekin, G4double loge, G4int ZZ)
G4NeutronInelasticXS::ElementCrossSection(G4double eKin, G4double logE, G4int ZZ)
{
G4int Z = (ZZ >= MAXZINEL) ? MAXZINEL - 1 : ZZ;
G4int Z = std::min(ZZ, MAXZINEL-1);
G4double ekin = eKin;
G4double loge = logE;
if (ekin < lowElimit) {
ekin = lowElimit;
loge = loglowElimit;
}
// pv should exist
auto pv = GetPhysicsVector(Z);
G4double xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, loge)
: coeff[Z]*ggXsection->GetInelasticElementCrossSection(neutron, ekin,
Z, aeff[Z]);
const G4double e0 = pv->Energy(0);
G4double xs;
if (ekin < e0) {
xs = (*pv)[0];
if (xs > 0.0) { xs *= std::sqrt(e0/ekin); }
} else if (ekin <= pv->GetMaxEnergy()) {
xs = pv->LogVectorValue(ekin, loge);
} else {
xs = coeff[Z]*ggXsection->GetInelasticElementCrossSection(neutron, ekin,
Z, aeff[Z]);
}
#ifdef G4VERBOSE
if(verboseLevel > 1) {
G4cout << "G4NeutronInelasticXS::ElementCrossSection Z= " << Z
<< " Ekin(MeV)= " << ekin/CLHEP::MeV
<< ", ElmXSinel(b)= " << xs/CLHEP::barn
<< G4endl;
<< ", ElmXSinel(b)= " << xs/CLHEP::barn
<< G4endl;
}
#endif
return xs;
@@ -150,51 +168,62 @@ G4NeutronInelasticXS::ElementCrossSection(G4double ekin, G4double loge, G4int ZZ
G4double
G4NeutronInelasticXS::ComputeIsoCrossSection(G4double ekin, G4double loge,
const G4ParticleDefinition*,
G4int Z, G4int A,
const G4Isotope*, const G4Element*,
const G4Material*)
const G4ParticleDefinition*,
G4int Z, G4int A,
const G4Isotope*, const G4Element*,
const G4Material*)
{
return IsoCrossSection(ekin, loge, Z, A);
}
G4double
G4NeutronInelasticXS::GetIsoCrossSection(const G4DynamicParticle* aParticle,
G4int Z, G4int A,
const G4Isotope*, const G4Element*,
const G4Material*)
G4int Z, G4int A,
const G4Isotope*, const G4Element*,
const G4Material*)
{
return IsoCrossSection(aParticle->GetKineticEnergy(),
aParticle->GetLogKineticEnergy(), Z, A);
}
G4double
G4NeutronInelasticXS::IsoCrossSection(G4double ekin, G4double logekin,
G4NeutronInelasticXS::IsoCrossSection(G4double eKin, G4double logE,
G4int ZZ, G4int A)
{
G4double xs = 0.0;
G4int Z = (ZZ >= MAXZINEL) ? MAXZINEL - 1 : ZZ;
G4int Z = std::min(ZZ, MAXZINEL-1);
G4double ekin = eKin;
G4double loge = logE;
if (ekin < lowElimit) {
ekin = lowElimit;
loge = loglowElimit;
}
auto pv = GetPhysicsVector(Z);
/*
G4cout << "G4NeutronInelasticXS::IsoCrossSection Z= "
<< Z << " A= " << A << G4endl;
G4cout << " Amin= " << amin[Z] << " Amax= " << amax[Z]
<< " E(MeV)= " << ekin << " Ncomp="
<< data->GetNumberOfComponents(Z) << G4endl;
<< data->GetNumberOfComponents(Z) << G4endl;
*/
// compute isotope cross section if applicable
// use isotope cross section if applicable
if (ekin <= elimit && data->GetNumberOfComponents(Z) > 0) {
auto pviso = data->GetComponentDataByID(Z, A);
if (nullptr != pviso) {
xs = pviso->LogVectorValue(ekin, logekin);
const G4double e0 = pviso->Energy(0);
if (ekin >= e0) {
xs = pviso->LogVectorValue(ekin, loge);
} else {
xs = (*pviso)[0];
if (xs > 0.0) { xs *= std::sqrt(e0/ekin); }
}
#ifdef G4VERBOSE
if(verboseLevel > 1) {
G4cout << "G4NeutronInelasticXS::IsoXS: Ekin(MeV)= "
G4cout << "G4NeutronInelasticXS::IsoXS: Ekin(MeV)= "
<< ekin/CLHEP::MeV
<< " xs(b)= " << xs/CLHEP::barn
<< " Z= " << Z << " A= " << A << G4endl;
<< " xs(b)= " << xs/CLHEP::barn
<< " Z= " << Z << " A= " << A << G4endl;
}
#endif
return xs;
@@ -202,15 +231,24 @@ G4NeutronInelasticXS::IsoCrossSection(G4double ekin, G4double logekin,
}
// use element x-section
xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, logekin)
: coeff[Z]*ggXsection->GetInelasticElementCrossSection(neutron, ekin,
Z, aeff[Z]);
auto pv = GetPhysicsVector(Z);
const G4double e0 = pv->Energy(0);
if (ekin < e0) {
xs = (*pv)[0];
if (xs > 0.0) { xs *= std::sqrt(e0/ekin); }
} else if (ekin <= pv->GetMaxEnergy()) {
xs = pv->LogVectorValue(ekin, loge);
} else {
xs = coeff[Z]*ggXsection->GetInelasticElementCrossSection(neutron, ekin,
Z, aeff[Z]);
}
xs *= A/aeff[Z];
#ifdef G4VERBOSE
if(verboseLevel > 1) {
G4cout << "G4NeutronInelasticXS::IsoXS: Z= " << Z << " A= " << A
<< " Ekin(MeV)= " << ekin/CLHEP::MeV
<< ", ElmXS(b)= " << xs/CLHEP::barn << G4endl;
<< " Ekin(MeV)= " << ekin/CLHEP::MeV
<< ", ElmXS(b)= " << xs/CLHEP::barn << G4endl;
}
#endif
return xs;
@@ -219,7 +257,7 @@ G4NeutronInelasticXS::IsoCrossSection(G4double ekin, G4double logekin,
const G4Isotope* G4NeutronInelasticXS::SelectIsotope(
const G4Element* anElement, G4double kinEnergy, G4double logE)
{
G4int nIso = (G4int)anElement->GetNumberOfIsotopes();
std::size_t nIso = anElement->GetNumberOfIsotopes();
const G4Isotope* iso = anElement->GetIsotope(0);
if(1 == nIso) { return iso; }
@@ -230,35 +268,35 @@ const G4Isotope* G4NeutronInelasticXS::SelectIsotope(
const G4double* abundVector = anElement->GetRelativeAbundanceVector();
G4double q = G4UniformRand();
G4double sum = 0.0;
G4int j;
std::size_t j;
// isotope wise cross section not available
if (Z >= MAXZINEL || 0 == data->GetNumberOfComponents(Z)) {
for (j=0; j<nIso; ++j) {
sum += abundVector[j];
if(q <= sum) {
iso = anElement->GetIsotope(j);
break;
iso = anElement->GetIsotope((G4int)j);
break;
}
}
return iso;
}
// use isotope cross sections
G4int nn = (G4int)temp.size();
auto nn = temp.size();
if(nn < nIso) { temp.resize(nIso, 0.); }
for (j=0; j<nIso; ++j) {
// G4cout << j << "-th isotope " << anElement->GetIsotope(j)->GetN()
// << " abund= " << abundVector[j] << G4endl;
sum += abundVector[j]*IsoCrossSection(kinEnergy, logE, Z,
anElement->GetIsotope(j)->GetN());
anElement->GetIsotope((G4int)j)->GetN());
temp[j] = sum;
}
sum *= q;
for (j = 0; j<nIso; ++j) {
if (temp[j] >= sum) {
iso = anElement->GetIsotope(j);
iso = anElement->GetIsotope((G4int)j);
break;
}
}
@@ -270,14 +308,14 @@ G4NeutronInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
{
if (verboseLevel > 0) {
G4cout << "G4NeutronInelasticXS::BuildPhysicsTable for "
<< p.GetParticleName() << G4endl;
<< p.GetParticleName() << G4endl;
}
if (p.GetParticleName() != "neutron") {
G4ExceptionDescription ed;
ed << p.GetParticleName() << " is a wrong particle type -"
<< " only neutron is allowed";
G4Exception("G4NeutronInelasticXS::BuildPhysicsTable(..)","had012",
FatalException, ed, "");
FatalException, ed, "");
return;
}
// it is possible re-initialisation for the new run
@@ -334,8 +372,8 @@ void G4NeutronInelasticXS::Initialise(G4int Z)
data->InitialiseForElement(Z, v);
if (verboseLevel > 1) {
G4cout << "G4NeutronInelasticXS::Initialise for Z= " << Z
<< " A= " << aeff[Z] << " Amin= " << amin[Z]
<< " Amax= " << amax[Z] << G4endl;
<< " A= " << aeff[Z] << " Amin= " << amin[Z]
<< " Amax= " << amax[Z] << G4endl;
}
// upload isotope data
G4bool noComp = true;
@@ -346,12 +384,12 @@ void G4NeutronInelasticXS::Initialise(G4int Z)
ost1 << gDataDirectory << Z << "_" << A;
G4PhysicsVector* v1 = RetrieveVector(ost1, false);
if (nullptr != v1) {
if (noComp) {
G4int nmax = amax[Z] - A + 1;
data->InitialiseForComponent(Z, nmax);
noComp = false;
}
data->AddComponent(Z, A, v1);
if (noComp) {
G4int nmax = amax[Z] - A + 1;
data->InitialiseForComponent(Z, nmax);
noComp = false;
}
data->AddComponent(Z, A, v1);
}
}
}
@@ -362,7 +400,7 @@ void G4NeutronInelasticXS::Initialise(G4int Z)
G4double sig1 = (*v)[v->GetVectorLength()-1];
G4double ehigh= v->GetMaxEnergy();
G4double sig2 = ggXsection->GetInelasticElementCrossSection(neutron,
ehigh, Z, aeff[Z]);
ehigh, Z, aeff[Z]);
coeff[Z] = (sig2 > 0.) ? sig1/sig2 : 1.0;
}
@@ -375,23 +413,23 @@ G4NeutronInelasticXS::RetrieveVector(std::ostringstream& ost, G4bool warn)
if(warn) {
G4ExceptionDescription ed;
ed << "Data file <" << ost.str().c_str()
<< "> is not opened!";
<< "> is not opened!";
G4Exception("G4NeutronInelasticXS::RetrieveVector(..)","had014",
FatalException, ed, "Check G4PARTICLEXSDATA");
FatalException, ed, "Check G4PARTICLEXSDATA");
}
} else {
if(verboseLevel > 1) {
G4cout << "File " << ost.str()
<< " is opened by G4NeutronInelasticXS" << G4endl;
<< " is opened by G4NeutronInelasticXS" << G4endl;
}
// retrieve data from DB
v = new G4PhysicsLogVector();
if(!v->Retrieve(filein, true)) {
G4ExceptionDescription ed;
ed << "Data file <" << ost.str().c_str()
<< "> is not retrieved!";
<< "> is not retrieved!";
G4Exception("G4NeutronInelasticXS::RetrieveVector(..)","had015",
FatalException, ed, "Check G4PARTICLEXSDATA");
FatalException, ed, "Check G4PARTICLEXSDATA");
}
}
return v;
@@ -35,27 +35,16 @@
#include "G4NucleonNuclearCrossSection.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleDefinition.hh"
#include "G4Neutron.hh"
#include "G4Proton.hh"
#include "G4ComponentBarNucleonNucleusXsc.hh"
///////////////////////////////////////////////////////////////////////////////
G4NucleonNuclearCrossSection::G4NucleonNuclearCrossSection()
: G4VCrossSectionDataSet(Default_Name()),
fTotalXsc(0.0), fInelasticXsc(0.0), fElasticXsc(0.0)
: G4VCrossSectionDataSet(Default_Name())
{
theNeutron = G4Neutron::Neutron();
theProton = G4Proton::Proton();
fBarash = new G4ComponentBarNucleonNucleusXsc();
}
///////////////////////////////////////////////////////////////////////////////
//
G4NucleonNuclearCrossSection::~G4NucleonNuclearCrossSection()
{}
////////////////////////////////////////////////////////////////////////////
G4bool G4NucleonNuclearCrossSection::IsElementApplicable(
@@ -87,13 +76,6 @@ void G4NucleonNuclearCrossSection::ComputeCrossSections(
////////////////////////////////////////////////////////////////////////////
void G4NucleonNuclearCrossSection::BuildPhysicsTable(const G4ParticleDefinition& part)
{
fBarash->BuildPhysicsTable(part);
}
////////////////////////////////////////////////////////////////////////////
void
G4NucleonNuclearCrossSection::CrossSectionDescription(std::ostream& outFile) const
{
@@ -35,9 +35,7 @@
G4PiData::G4PiData(const G4double * aT, const G4double * aIn,
const G4double * anE, G4int nP)
{
G4int i=0;
for( i = 0; i < nP; i++ )
for(G4int i = 0; i < nP; ++i )
{
std::pair<G4double, G4double> x;
x.first=aT[i]*millibarn;
@@ -46,23 +44,27 @@ G4PiData::G4PiData(const G4double * aT, const G4double * aIn,
aP.first=anE[i]*GeV;
aP.second=x;
push_back(aP);
if (i == 0) {
fMinE = aP.first;
fTot0 = x.first;
fInel0 = x.second;
} else if (i+1 == nP) {
fMaxE = aP.first;
fTot1 = x.first;
fInel1 = x.second;
}
}
}
////////////////////////////////////////////////////////////////////////
G4bool G4PiData::AppliesTo(G4double kineticEnergy)
{
return (kineticEnergy<=back().first);
}
//////////////////////////////////////////////////////////////////////////
G4double G4PiData::ReactionXSection(G4double kineticEnergy)
{
G4double result = 0;
if (kineticEnergy <= fMinE) { return fInel0; }
if (kineticEnergy >= fMaxE) { return fInel1; }
G4PiData::iterator it=begin();
while(it!=end()&&kineticEnergy>(*it).first) {it++;} /* Loop checking, 08.01.2016, W. Pokorski */
while(it!=end()&&kineticEnergy>(*it).first) {++it;} /* Loop checking, 08.01.2016, W. Pokorski */
if(it==end())
{
G4ExceptionDescription ed;
@@ -76,15 +78,16 @@ G4double G4PiData::ReactionXSection(G4double kineticEnergy)
x1=(*(it-1)).second.second;
e2=(*(it)).first;
x2=(*(it)).second.second;
result = std::max(0., x1 + (kineticEnergy-e1)*(x2-x1)/(e2-e1));
return result;
return std::max(0., x1 + (kineticEnergy-e1)*(x2-x1)/(e2-e1));
}
////////////////////////////////////////////////////////////////////////////
G4double G4PiData::ElasticXSection(G4double kineticEnergy)
{
G4double result = 0;
if (kineticEnergy <= fMinE) { return fTot0 - fInel0; }
if (kineticEnergy >= fMaxE) { return fTot1 - fInel1; }
G4PiData::iterator it=begin();
while(it!=end()&&kineticEnergy>(*it).first) {it++;} /* Loop checking, 08.01.2016, W. Pokorski */
if(it==end())
@@ -100,15 +103,16 @@ G4double G4PiData::ElasticXSection(G4double kineticEnergy)
x1=(*(it-1)).second.first - (*(it-1)).second.second;
e2=(*(it)).first;
x2=(*(it)).second.first - (*(it)).second.second;
result = std::max(0., x1 + (kineticEnergy-e1)*(x2-x1)/(e2-e1));
return result;
return std::max(0., x1 + (kineticEnergy-e1)*(x2-x1)/(e2-e1));
}
////////////////////////////////////////////////////////////////////////////
G4double G4PiData::TotalXSection(G4double kineticEnergy)
{
G4double result = 0;
if (kineticEnergy <= fMinE) { return fTot0; }
if (kineticEnergy >= fMaxE) { return fTot1; }
G4PiData::iterator it=begin();
while(it!=end()&&kineticEnergy>(*it).first) {it++;} /* Loop checking, 08.01.2016, W. Pokorski */
if(it==end())
@@ -124,6 +128,5 @@ G4double G4PiData::TotalXSection(G4double kineticEnergy)
x1=(*(it-1)).second.first;
e2=(*(it)).first;
x2=(*(it)).second.first;
result = std::max(0., x1 + (kineticEnergy-e1)*(x2-x1)/(e2-e1));
return result;
return std::max(0., x1 + (kineticEnergy-e1)*(x2-x1)/(e2-e1));
}
@@ -42,6 +42,7 @@
#include "G4PionPlus.hh"
#include "G4PhysicsTable.hh"
#include "G4NistManager.hh"
#include "G4HadronXSDataTable.hh"
G4int G4UPiNuclearCrossSection::theZ[NZ] =
{2,4,6,7,8,11,13,20,26,29,42,48,50,74,82,92};
@@ -54,47 +55,14 @@ G4PhysicsTable* G4UPiNuclearCrossSection::piPlusInelastic = nullptr;
G4PhysicsTable* G4UPiNuclearCrossSection::piMinusElastic = nullptr;
G4PhysicsTable* G4UPiNuclearCrossSection::piMinusInelastic = nullptr;
#ifdef G4MULTITHREADED
G4Mutex G4UPiNuclearCrossSection::pionUXSMutex = G4MUTEX_INITIALIZER;
#endif
G4UPiNuclearCrossSection::G4UPiNuclearCrossSection()
: G4VCrossSectionDataSet("G4UPiNuclearCrossSection")
{
isMaster = false;
spline = false;
piPlus = G4PionPlus::PionPlus();
piPlus = G4PionPlus::PionPlus();
piMinus = G4PionMinus::PionMinus();
elow = 20.0*CLHEP::MeV;
aPower = 0.75;
elow = 20.0*CLHEP::MeV;
}
G4UPiNuclearCrossSection::~G4UPiNuclearCrossSection()
{
if(isMaster) {
if(piPlusElastic) {
piPlusElastic->clearAndDestroy();
delete piPlusElastic;
piPlusElastic = nullptr;
}
if(piPlusInelastic) {
piPlusInelastic->clearAndDestroy();
delete piPlusInelastic;
piPlusInelastic = nullptr;
}
if(piMinusElastic) {
piMinusElastic->clearAndDestroy();
delete piMinusElastic;
piMinusElastic = nullptr;
}
if(piMinusInelastic) {
piMinusInelastic->clearAndDestroy();
delete piMinusInelastic;
piMinusInelastic = nullptr;
}
}
if (idxZ[0] == 0) { LoadData(); }
}
G4bool
@@ -111,7 +79,7 @@ G4double G4UPiNuclearCrossSection::Interpolate(
G4double ekin = std::max(e, elow);
G4int iz = std::min(Z, 92);
G4int idx = idxZ[iz];
size_t jdx = (size_t)(std::max(ekin - elow, 0.0)*0.06);
std::size_t jdx = (std::size_t)(std::max(ekin - elow, 0.0)*0.06);
//G4cout << "Interpolate: Z= " << iz << " A= " << A << " idx= " << idx
// << " jdx= " << jdx << " Ekin= " << ekin << G4endl;
if(idx < 0 || 2 == iz) {
@@ -138,15 +106,15 @@ void G4UPiNuclearCrossSection::AddDataSet(const G4String& p,
{
G4PhysicsFreeVector* pvin = new G4PhysicsFreeVector(n,e[0]*GeV,e[n-1]*GeV,spline);
G4PhysicsFreeVector* pvel = new G4PhysicsFreeVector(n,e[0]*GeV,e[n-1]*GeV,spline);
for(G4int i=0; i<n; ++i) {
pvin->PutValues(i,e[i]*GeV,in[i]*millibarn);
pvel->PutValues(i,e[i]*GeV,std::max(0.0,(tot[i]-in[i])*millibarn));
for (G4int i=0; i<n; ++i) {
pvin->PutValues(i, e[i]*CLHEP::GeV, in[i]*CLHEP::millibarn);
pvel->PutValues(i, e[i]*CLHEP::GeV, std::max(0.0,(tot[i]-in[i])*CLHEP::millibarn));
}
if(spline) {
if (spline) {
pvin->FillSecondDerivatives();
pvel->FillSecondDerivatives();
}
if(p == "pi+") {
if (p == "pi+") {
piPlusInelastic->push_back(pvin);
piPlusElastic->push_back(pvel);
} else {
@@ -172,39 +140,26 @@ void G4UPiNuclearCrossSection::DumpPhysicsTable(const G4ParticleDefinition& p)
void G4UPiNuclearCrossSection::BuildPhysicsTable(const G4ParticleDefinition& p)
{
//G4cout << "G4UPiNuclearCrossSection::BuildPhysicsTable for "
// << p.GetParticleName() << " " << piPlusElastic << G4endl;
if(piPlusElastic) { return; }
if(&p != piPlus && &p != piMinus) {
G4ExceptionDescription ed;
ed << "This cross section is applicable only to pions and not to "
<< p.GetParticleName() << G4endl;
G4Exception("G4UPiNuclearCrossSection::BuildPhysicsTable", "had001",
FatalException, ed);
return;
}
}
if(!piPlusElastic) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&pionUXSMutex);
if(!piPlusElastic) {
#endif
isMaster = true;
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&pionUXSMutex);
#endif
}
if(!isMaster) { return; }
void G4UPiNuclearCrossSection::LoadData()
{
idxZ[0] = 1;
idxZ[1] = idxZ[2] = 0;
G4NistManager* nist = G4NistManager::Instance();
G4Pow* g4pow = G4Pow::GetInstance();
for(G4int i=0; i<NZ; ++i) {
theA[i] = nist->GetAtomicMassAmu(theZ[i]);
}
for(G4int i=1; i<93; ++i) {
APower[i] = g4pow->powA(nist->GetAtomicMassAmu(i),aPower);
APower[i] = g4pow->powA(nist->GetAtomicMassAmu(i), aPower);
}
G4int idx = 1;
for(G4int i=3; i<93; ++i) {
@@ -220,13 +175,12 @@ void G4UPiNuclearCrossSection::BuildPhysicsTable(const G4ParticleDefinition& p)
piPlusInelastic = new G4PhysicsTable();
piMinusElastic = new G4PhysicsTable();
piMinusInelastic = new G4PhysicsTable();
auto ptr = G4HadronXSDataTable::Instance();
ptr->AddTable(piPlusElastic);
ptr->AddTable(piPlusInelastic);
ptr->AddTable(piMinusElastic);
ptr->AddTable(piMinusInelastic);
LoadData();
//G4cout << "### Initialisation done " << G4endl;
}
void G4UPiNuclearCrossSection::LoadData()
{
static const G4double e1[38] = {
0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.13, 0.14, 0.15, 0.16,
0.17, 0.18, 0.19, 0.2, 0.22,0.24, 0.26, 0.28, 0.3, 0.35,
@@ -47,9 +47,8 @@
#include "G4HadronicParameters.hh"
G4VCrossSectionDataSet::G4VCrossSectionDataSet(const G4String& nam) :
verboseLevel(0),name(nam),minKinEnergy(0.0),
maxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy()),
isForAllAtomsAndEnergies(false)
name(nam),
maxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy())
{
registry = G4CrossSectionDataSetRegistry::Instance();
registry->Register(this);