Import Geant4 11.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2022-12-09 14:43:28 +01:00
parent c07cea1fe0
commit 9f34590941
3810 changed files with 200490 additions and 182326 deletions
@@ -1,9 +1,67 @@
# Category hadr-cross History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2022-11-26 Gabriele Cosmo (hadr-cross-V11-00-15)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
## 2022-10-31 Vladimir Grichine (hadr-cross-V11-00-14)
- G4TauNeutrinoNucleusTotXsc - added for tau-neutrinos, based on energy scaled nu_mu XS
## 2022-10-25 Alberto Ribon (hadr-cross-V11-00-13)
- G4ComponentAntiNuclNuclearXS : Vladimir Uzhinsky's bug-fix and extension
of the GetTotalElementCrossSection and GetInelasticElementCrossSection
methods:
* A bug was causing undefined values for, respectively, the total and
inelastic cross-sections of anti-proton interactions with light target
nuclei (d, H3, He3 and He4).
* Extension for the simulation of a light anti-hypernucleus projectile
scattering on a target nucleus.
Note: most of the considered light anti-hypernuclei projectiles have
baryon number equal to -4 : it is assumed that their properties
are similar to anti-He4, therefore their total and inelastic
cross sections are set-up as for anti-He4 nuclear scattering.
These properties can be improved in the future if theoretical estimations
will be available.
## 2022-10-27 Vladimir Grichine (hadr-cross-V11-00-12)
- G4MuNeutrinoNucleusTotXsc - extension to tau-neutrinos, based on energy scaled nu_mu XS
## 2022-10-21 Vladimir Grichine (hadr-cross-V11-00-11)
- G4ComponentGGNuclNuclXsc - bug fixed pR not tR to be corrected
## 2022-10-12 Vladimir Grichine (hadr-cross-V11-00-10)
- G4ComponentGGNuclNuclXsc, G4ComponentGGHadronNuclXsc - extension to hyper-nuclei on hydrogen
## 2022-10-10 Vladimir Grichine (hadr-cross-V11-00-09)
- G4ComponentGGNuclNuclXsc - extension to hyper-nuclei
## 2022-09-29 Vladimir Ivanchenko (hadr-cross-V11-00-08)
- G4ParticleInelasticXS - fixed computation of isotope x-section #2498
## 2022-08-18 Vladimir Ivanchenko (hadr-cross-V11-00-07)
- G4CrossSectionDataStore - added extra public method needed
for G4NeutronGeneralProcess
- G4NeutronElasticXS, G4NeutronInelasticXS, G4NeutronCaptureXS -
code cleanup, use G4AutoLock
- G4NeutronInelasticXS - fixed computation of isotope x-section #2498
## 2022-08-13 Vladimir Ivanchenko (hadr-cross-V11-00-06)
- G4CrossSectionDataStore, G4NeutronElasticXS, G4NeutronInelasticXS -
added interfaces needed for G4NeutronGeneralProcess
## 2022-07-23 Vladimir Ivanchenko (hadr-cross-V11-00-05)
- G4VCrossSectionDataSet - added extra interfaces with G4ParticleDefinition*
and kinetic energy
- G4NeutronCaptureXS - implemented new interfaces
## 2022-07-19 Alberto Ribon (hadr-cross-V11-00-04)
- G4ComponentAntiNuclNuclearXS.cc : fixed Coverity report (added checks
against nullptr pointers).
## 2022-05-08 Vladimir Ivanchenko (hadr-cross-V11-00-03)
- G4CrossSectionDataStore, G4VCrossSectionDataSet - preparation
@@ -88,7 +88,7 @@ public:
// Glauber-Gribov cross section
void ComputeCrossSections(const G4ParticleDefinition* aParticle,
G4double kinEnergy, G4int Z, G4int A);
G4double kinEnergy, G4int Z, G4int A, G4int nL = 0);
// additional public methods
G4double GetProductionElementCrossSection(const G4ParticleDefinition* aParticle,
@@ -164,12 +164,13 @@ private:
const G4ParticleDefinition* theKMinus;
const G4ParticleDefinition* theK0S;
const G4ParticleDefinition* theK0L;
const G4ParticleDefinition* theLambda;
G4HadronNucleonXsc* hnXsc;
// Cache
const G4ParticleDefinition* fParticle;
G4int fZ, fA;
G4int fZ, fA, fL;
};
@@ -131,6 +131,7 @@ private:
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* theNeutron;
const G4ParticleDefinition* theLambda;
G4ComponentGGHadronNucleusXsc* fHadrNucl;
G4HadronNucleonXsc* fHNXsc;
@@ -94,10 +94,14 @@ public:
void PrintCrossSectionHtml(const G4VCrossSectionDataSet *cs) const;
void AddDataSet(G4VCrossSectionDataSet*);
void AddDataSet(G4VCrossSectionDataSet*, size_t);
void AddDataSet(G4VCrossSectionDataSet*, std::size_t);
inline const std::vector<G4VCrossSectionDataSet*>& GetDataSetList() const;
inline void SetVerboseLevel(G4int value);
// may be used by special processes
inline void SetForcedElement(const G4Element*);
G4CrossSectionDataStore & operator=
(const G4CrossSectionDataStore &right) = delete;
G4CrossSectionDataStore(const G4CrossSectionDataStore&) = delete;
@@ -113,6 +117,7 @@ private:
G4NistManager* nist;
const G4Material* currentMaterial = nullptr;
const G4ParticleDefinition* matParticle = nullptr;
const G4Element* forcedElement = nullptr;
G4double matKinEnergy = 0.0;
G4double matCrossSection = 0.0;
@@ -129,6 +134,17 @@ inline void G4CrossSectionDataStore::SetVerboseLevel(G4int value)
verboseLevel = value;
}
inline void G4CrossSectionDataStore::SetForcedElement(const G4Element* ptr)
{
forcedElement = ptr;
}
inline const std::vector<G4VCrossSectionDataSet*>&
G4CrossSectionDataStore::GetDataSetList() const
{
return dataSetList;
}
inline G4double
G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* dp,
const G4Material* mat)
@@ -28,7 +28,7 @@
//
// 14.08.17 V. Grichine
//
//
// 27.10.22 V. Grichine - extension to tau-neutrinos based on mu_nu XS energy scaled
#ifndef G4MuNeutrinoNucleusTotXsc_h
#define G4MuNeutrinoNucleusTotXsc_h
@@ -88,7 +88,7 @@ protected:
G4double fCutEnergy; // minimal recoil electron energy detected
G4double fBiasingFactor; // biasing xsc up
G4double fTotXsc, fCcTotRatio, fCcFactor, fNcFactor, fQEratio;
G4double fEmc;
G4int fIndex;
static const G4double fNuMuEnergy[50];
@@ -97,8 +97,8 @@ protected:
static const G4double fANuMuInXsc[50];
static const G4double fANuMuQeXsc[50];
G4ParticleDefinition* theMuonMinus;
G4ParticleDefinition* theMuonPlus;
// G4ParticleDefinition* theMuonMinus;
// G4ParticleDefinition* theMuonPlus;
};
#endif
@@ -47,7 +47,6 @@
#include "globals.hh"
#include "G4ElementData.hh"
#include "G4PhysicsVector.hh"
#include "G4Threading.hh"
#include <vector>
#include <iostream>
@@ -73,7 +72,19 @@ public:
G4double GetElementCrossSection(const G4DynamicParticle*,
G4int Z, const G4Material*) final;
G4double ComputeCrossSectionPerElement(G4double kinEnergy, G4double loge,
const G4ParticleDefinition*,
const G4Element*,
const G4Material*) final;
G4double ComputeIsoCrossSection(G4double kinEnergy, G4double loge,
const G4ParticleDefinition*,
G4int Z, G4int A,
const G4Isotope* iso,
const G4Element* elm,
const G4Material* mat) final;
G4double GetIsoCrossSection(const G4DynamicParticle*, G4int Z, G4int A,
const G4Isotope* iso,
const G4Element* elm,
@@ -86,6 +97,8 @@ public:
void CrossSectionDescription(std::ostream&) const final;
G4double ElementCrossSection(G4double kinEnergy, G4double loge, G4int Z);
G4double IsoCrossSection(G4double ekin, G4double logekin, G4int Z, G4int A);
G4NeutronCaptureXS & operator=(const G4NeutronCaptureXS &right) = delete;
@@ -114,10 +127,6 @@ private:
static const G4int MAXZCAPTURE = 93;
static G4ElementData* data;
static G4String gDataDirectory;
#ifdef G4MULTITHREADED
static G4Mutex neutronCaptureXSMutex;
#endif
};
inline
@@ -45,7 +45,6 @@
#include "G4VCrossSectionDataSet.hh"
#include "globals.hh"
#include "G4PhysicsVector.hh"
#include "G4Threading.hh"
#include <vector>
class G4DynamicParticle;
@@ -77,6 +76,18 @@ public:
const G4Element* elm,
const G4Material* mat) final;
G4double ComputeCrossSectionPerElement(G4double kinEnergy, G4double loge,
const G4ParticleDefinition*,
const G4Element*,
const G4Material*) final;
G4double ComputeIsoCrossSection(G4double kinEnergy, G4double loge,
const G4ParticleDefinition*,
G4int Z, G4int A,
const G4Isotope* iso,
const G4Element* elm,
const G4Material* mat) final;
const G4Isotope* SelectIsotope(const G4Element*,
G4double kinEnergy, G4double logE) final;
@@ -84,6 +95,8 @@ public:
void CrossSectionDescription(std::ostream&) const final;
G4double ElementCrossSection(G4double kinEnergy, G4double loge, G4int Z);
G4NeutronElasticXS & operator=(const G4NeutronElasticXS &right) = delete;
G4NeutronElasticXS(const G4NeutronElasticXS&) = delete;
@@ -106,10 +119,6 @@ private:
static G4PhysicsVector* data[MAXZEL];
static G4double coeff[MAXZEL];
static G4String gDataDirectory;
#ifdef G4MULTITHREADED
static G4Mutex neutronElasticXSMutex;
#endif
};
inline
@@ -45,7 +45,6 @@
#include "globals.hh"
#include "G4ElementData.hh"
#include "G4PhysicsVector.hh"
#include "G4Threading.hh"
#include <vector>
class G4DynamicParticle;
@@ -72,6 +71,18 @@ public:
G4double GetElementCrossSection(const G4DynamicParticle*,
G4int Z, const G4Material*) final;
G4double ComputeCrossSectionPerElement(G4double kinEnergy, G4double loge,
const G4ParticleDefinition*,
const G4Element*,
const G4Material*) final;
G4double ComputeIsoCrossSection(G4double kinEnergy, G4double loge,
const G4ParticleDefinition*,
G4int Z, G4int A,
const G4Isotope* iso,
const G4Element* elm,
const G4Material* mat) final;
G4double GetIsoCrossSection(const G4DynamicParticle*, G4int Z, G4int A,
const G4Isotope* iso,
const G4Element* elm,
@@ -84,6 +95,8 @@ public:
void CrossSectionDescription(std::ostream&) const final;
G4double ElementCrossSection(G4double kinEnergy, G4double loge, G4int Z);
G4double IsoCrossSection(G4double ekin, G4double logekin, G4int Z, G4int A);
G4NeutronInelasticXS & operator=(const G4NeutronInelasticXS &right) = delete;
@@ -107,16 +120,14 @@ private:
std::vector<G4double> temp;
G4bool isMaster = false;
G4double elimit;
G4bool isMaster = false;
static const G4int MAXZINEL = 93;
static G4ElementData* data;
static G4double coeff[MAXZINEL];
static G4String gDataDirectory;
#ifdef G4MULTITHREADED
static G4Mutex neutronInelasticXSMutex;
#endif
};
inline
@@ -46,7 +46,6 @@
#include "globals.hh"
#include "G4ElementData.hh"
#include "G4PhysicsVector.hh"
#include "G4Threading.hh"
#include <vector>
class G4DynamicParticle;
@@ -72,6 +71,18 @@ public:
G4double GetElementCrossSection(const G4DynamicParticle*, G4int Z,
const G4Material* mat = nullptr) final;
G4double ComputeCrossSectionPerElement(G4double kinEnergy, G4double loge,
const G4ParticleDefinition*,
const G4Element*,
const G4Material*) final;
G4double ComputeIsoCrossSection(G4double kinEnergy, G4double loge,
const G4ParticleDefinition*,
G4int Z, G4int A,
const G4Isotope* iso,
const G4Element* elm,
const G4Material* mat) final;
G4double GetIsoCrossSection(const G4DynamicParticle*, G4int Z, G4int A,
const G4Isotope* iso = nullptr,
const G4Element* elm = nullptr,
@@ -84,6 +95,8 @@ public:
void CrossSectionDescription(std::ostream&) const final;
G4double ElementCrossSection(G4double kinEnergy, G4double loge, G4int Z);
G4double IsoCrossSection(G4double ekin, G4double logE, G4int Z, G4int A);
G4ParticleInelasticXS & operator=
@@ -106,6 +119,7 @@ private:
const G4ParticleDefinition* particle;
std::vector<G4double> temp;
G4double elimit;
G4int index = 0;
G4bool isMaster = false;
@@ -114,10 +128,6 @@ private:
static G4ElementData* data[5];
static G4double coeff[MAXZINELP][5];
static G4String gDataDirectory[5];
#ifdef G4MULTITHREADED
static G4Mutex particleInelasticXSMutex;
#endif
};
inline
@@ -0,0 +1,104 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// The total muon (anti)neutrino-nucleus cross sections in the
// simplified form as A-multiplied nu_mu-nucleon cross-sections
//
// 14.08.17 V. Grichine
//
// 31.10.22 V. Grichine - extension to tau-neutrinos based on mu_nu XS energy scaled
#ifndef G4TauNeutrinoNucleusTotXsc_h
#define G4TauNeutrinoNucleusTotXsc_h
#include "globals.hh"
#include "G4VCrossSectionDataSet.hh"
class G4ParticleDefinition;
class G4TauNeutrinoNucleusTotXsc : public G4VCrossSectionDataSet
{
public:
G4TauNeutrinoNucleusTotXsc();
~G4TauNeutrinoNucleusTotXsc();
virtual
G4bool IsIsoApplicable(const G4DynamicParticle*, G4int Z, G4int A, const G4Element*, const G4Material*);
virtual
G4bool IsElementApplicable(const G4DynamicParticle*, G4int , const G4Material*){ return true; };
// virtual G4double GetElementCrossSection(const G4DynamicParticle*, G4int Z, const G4Material*);
virtual G4double GetElementCrossSection(const G4DynamicParticle* dynPart,
G4int Z,
const G4Material* mat);
virtual
G4double GetIsoCrossSection(const G4DynamicParticle* aPart, G4int Z, G4int A,
const G4Isotope*,
const G4Element*,
const G4Material*);
G4int GetEnergyIndex(G4double energy);
G4double GetNuMuTotCsXsc(G4int index, G4double energy, G4int Z, G4int A);
G4double GetANuMuTotCsXsc(G4int index, G4double energy, G4int Z, G4int A);
G4double GetNuMuTotCsArray(G4int index);
G4double GetANuMuTotCsArray(G4int index);
void SetCutEnergy(G4double ec){fCutEnergy=ec;};
G4double GetCutEnergy(){return fCutEnergy;};
void SetBiasingFactor(G4double bf){fBiasingFactor=bf;};
G4double GetBiasingFactor(){return fBiasingFactor;};
G4double GetTotXsc(){return fTotXsc;};
G4double GetCcTotRatio(){return fCcTotRatio;};
G4double GetQEratio(){return fQEratio;};
protected:
G4double fCofXsc; // 2*Gf*Gf*MeC2/pi
G4double fSin2tW; // sin^2theta_Weinberg
G4double fCofS, fCofL;
G4double fCutEnergy; // minimal recoil electron energy detected
G4double fBiasingFactor; // biasing xsc up
G4double fTotXsc, fCcTotRatio, fCcFactor, fNcFactor, fQEratio;
G4double fEmc, fEtc, fDtc;
G4int fIndex;
static const G4double fNuMuEnergy[50];
static const G4double fNuMuInXsc[50];
static const G4double fNuMuQeXsc[50];
static const G4double fANuMuInXsc[50];
static const G4double fANuMuQeXsc[50];
// G4ParticleDefinition* theMuonMinus;
// G4ParticleDefinition* theMuonPlus;
};
#endif
@@ -105,20 +105,35 @@ public: //with description
const G4Element*,
const G4Material* mat = nullptr);
// Implement this method for element-wise cross section
// Implement element cross section, IsApplicable does not checked.
// In the default implementation a sum of isotope cross sections is computed
virtual
G4double ComputeCrossSectionPerElement(G4double kinEnergy, G4double loge,
const G4ParticleDefinition*,
const G4Element*,
const G4Material* mat = nullptr);
// Implement these methods for element-wise cross section
virtual
G4double GetElementCrossSection(const G4DynamicParticle*, G4int Z,
const G4Material* mat = nullptr);
// Derived classes should implement this method if they provide isotope-wise
// cross sections. Default arguments G4Element and G4Material are needed to
// access low-energy neutron cross sections, but are not required for others.
// Derived classes should implement these methods if they provide isotope-wise
// cross sections. Extra arguments G4Isotope, G4Element, and G4Material are
// needed to access low-energy neutron cross sections, but not in other cases.
virtual
G4double GetIsoCrossSection(const G4DynamicParticle*, G4int Z, G4int A,
const G4Isotope* iso = nullptr,
const G4Element* elm = nullptr,
const G4Material* mat = nullptr);
virtual
G4double ComputeIsoCrossSection(G4double kinEnergy, G4double loge,
const G4ParticleDefinition*, G4int Z, G4int A,
const G4Isotope* iso = nullptr,
const G4Element* elm = nullptr,
const G4Material* mat = nullptr);
//=====================================================================
// Implement this method if needed
@@ -49,6 +49,7 @@ geant4_add_module(G4hadronic_xsect
G4IonsShenCrossSection.hh
G4IsotopeList.hh
G4KokoulinMuonNuclearXS.hh
G4MuNeutrinoNucleusTotXsc.hh
G4NeutrinoElectronCcXsc.hh
G4NeutrinoElectronNcXsc.hh
G4NeutrinoElectronTotXsc.hh
@@ -60,13 +61,13 @@ geant4_add_module(G4hadronic_xsect
G4ParticleInelasticXS.hh
G4PhotoNuclearCrossSection.hh
G4PiData.hh
G4TauNeutrinoNucleusTotXsc.hh
G4UPiNuclearCrossSection.hh
G4VComponentCrossSection.hh
G4VCrossSectionDataSet.hh
G4VCrossSectionRatio.hh
G4ZeroXS.hh
G4CrossSectionFactoryRegistry.hh
G4MuNeutrinoNucleusTotXsc.hh
SOURCES
G4BGGNucleonElasticXS.cc
G4BGGNucleonInelasticXS.cc
@@ -111,6 +112,7 @@ geant4_add_module(G4hadronic_xsect
G4HadronXSDataTable.cc
G4IonsShenCrossSection.cc
G4KokoulinMuonNuclearXS.cc
G4MuNeutrinoNucleusTotXsc.cc
G4NeutrinoElectronCcXsc.cc
G4NeutrinoElectronNcXsc.cc
G4NeutrinoElectronTotXsc.cc
@@ -122,13 +124,13 @@ geant4_add_module(G4hadronic_xsect
G4ParticleInelasticXS.cc
G4PhotoNuclearCrossSection.cc
G4PiData.cc
G4TauNeutrinoNucleusTotXsc.cc
G4UPiNuclearCrossSection.cc
G4VComponentCrossSection.cc
G4VCrossSectionDataSet.cc
G4VCrossSectionRatio.cc
G4ZeroXS.cc
G4CrossSectionFactoryRegistry.cc
G4MuNeutrinoNucleusTotXsc.cc)
G4CrossSectionFactoryRegistry.cc)
geant4_module_link_libraries(G4hadronic_xsect
PUBLIC
@@ -213,8 +213,8 @@ G4double G4ChipsAntiBaryonElasticXS::GetChipsCrossSection(G4double pMom, G4int t
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; i++) // Loop over proj/tgZ/tgN lines of DB
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; ++i) // Loop over proj/tgZ/tgN lines of DB
{ // The nucleus with projPDG is found in AMDB
if(colN[i]==tgN && colZ[i]==tgZ) // Isotope is foind in AMDB
{
@@ -75,11 +75,11 @@ G4ChipsAntiBaryonInelasticXS::G4ChipsAntiBaryonInelasticXS():G4VCrossSectionData
G4ChipsAntiBaryonInelasticXS::~G4ChipsAntiBaryonInelasticXS()
{
G4int lens=LEN->size();
for(G4int i=0; i<lens; ++i) delete[] (*LEN)[i];
std::size_t lens=LEN->size();
for(std::size_t i=0; i<lens; ++i) delete[] (*LEN)[i];
delete LEN;
G4int hens=HEN->size();
for(G4int i=0; i<hens; ++i) delete[] (*HEN)[i];
std::size_t hens=HEN->size();
for(std::size_t i=0; i<hens; ++i) delete[] (*HEN)[i];
delete HEN;
}
@@ -163,7 +163,7 @@ G4double G4ChipsAntiBaryonInelasticXS::GetChipsCrossSection(G4double pMom, G4int
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
j = 0; // A#0f records found in DB for this projectile
if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope
{
@@ -246,7 +246,7 @@ G4double G4ChipsAntiBaryonInelasticXS::CalculateCrossSection(G4int F, G4int I,
{
if(F<0) // This isotope was found in DAMDB =-----=> RETRIEVE
{
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync<=I) G4cerr<<"*!*G4QPiMinusNuclCS::CalcCrosSect:Sync="<<sync<<"<="<<I<<G4endl;
lastLEN=(*LEN)[I]; // Pointer to prepared LowEnergy cross sections
lastHEN=(*HEN)[I]; // Pointer to prepared High Energy cross sections
@@ -270,7 +270,7 @@ G4double G4ChipsAntiBaryonInelasticXS::CalculateCrossSection(G4int F, G4int I,
}
// --- End of possible separate function
// *** The synchronization check ***
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync!=I)
{
G4cerr<<"***G4QPiMinusNuclCS::CalcCrossSect: Sinc="<<sync<<"#"<<I<<", Z=" <<targZ
@@ -180,8 +180,8 @@ G4double G4ChipsHyperonElasticXS::GetChipsCrossSection(G4double pMom, G4int tgZ,
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; i++) // Loop over proj/tgZ/tgN lines of DB
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; ++i) // Loop over proj/tgZ/tgN lines of DB
{ // The nucleus with projPDG is found in AMDB
if(colN[i]==tgN && colZ[i]==tgZ) // Isotope is foind in AMDB
{
@@ -68,12 +68,12 @@ G4ChipsHyperonInelasticXS::G4ChipsHyperonInelasticXS():G4VCrossSectionDataSet(De
G4ChipsHyperonInelasticXS::~G4ChipsHyperonInelasticXS()
{
G4int lens=LEN->size();
for(G4int i=0; i<lens; ++i) delete[] (*LEN)[i];
std::size_t lens=LEN->size();
for(std::size_t i=0; i<lens; ++i) delete[] (*LEN)[i];
delete LEN;
G4int hens=HEN->size();
for(G4int i=0; i<hens; ++i) delete[] (*HEN)[i];
std::size_t hens=HEN->size();
for(std::size_t i=0; i<hens; ++i) delete[] (*HEN)[i];
delete HEN;
}
@@ -147,10 +147,10 @@ G4double G4ChipsHyperonInelasticXS::GetChipsCrossSection(G4double pMom, G4int tg
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
j = 0; // A#0f records found in DB for this projectile
if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope
if(lastI) for(G4int i=0; i<lastI; ++i) // AMDB exists, try to find the (Z,N) isotope
{
if(colN[i]==tgN && colZ[i]==tgZ) // Try the record "i" in the AMDB
{
@@ -233,7 +233,7 @@ G4double G4ChipsHyperonInelasticXS::CalculateCrossSection(G4int F, G4int I,
{
if(F<0) // This isotope was found in DAMDB =-----=> RETRIEVE
{
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync<=I) G4cerr<<"*!*G4QPiMinusNuclCS::CalcCrosSect:Sync="<<sync<<"<="<<I<<G4endl;
lastLEN=(*LEN)[I]; // Pointer to prepared LowEnergy cross sections
lastHEN=(*HEN)[I]; // Pointer to prepared High Energy cross sections
@@ -257,7 +257,7 @@ G4double G4ChipsHyperonInelasticXS::CalculateCrossSection(G4int F, G4int I,
}
// --- End of possible separate function
// *** The synchronization check ***
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync!=I)
{
G4cerr<<"***G4QHyperNuclCS::CalcCrossSect: Sinc="<<sync<<"#"<<I<<", Z=" <<targZ
@@ -195,8 +195,8 @@ G4double G4ChipsKaonMinusElasticXS::GetChipsCrossSection(G4double pMom, G4int tg
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; i++) // Loop over proj/tgZ/tgN lines of DB
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; ++i) // Loop over proj/tgZ/tgN lines of DB
{ // The nucleus with projPDG is found in AMDB
if(colN[i]==tgN && colZ[i]==tgZ) // Isotope is foind in AMDB
{
@@ -79,12 +79,12 @@ G4ChipsKaonMinusInelasticXS::G4ChipsKaonMinusInelasticXS():G4VCrossSectionDataSe
G4ChipsKaonMinusInelasticXS::~G4ChipsKaonMinusInelasticXS()
{
G4int lens=LEN->size();
for(G4int i=0; i<lens; ++i) delete[] (*LEN)[i];
std::size_t lens=LEN->size();
for(std::size_t i=0; i<lens; ++i) delete[] (*LEN)[i];
delete LEN;
G4int hens=HEN->size();
for(G4int i=0; i<hens; ++i) delete[] (*HEN)[i];
std::size_t hens=HEN->size();
for(std::size_t i=0; i<hens; ++i) delete[] (*HEN)[i];
delete HEN;
}
@@ -127,9 +127,9 @@ G4double G4ChipsKaonMinusInelasticXS::GetChipsCrossSection(G4double pMom, G4int
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
j = 0; // A#0f records found in DB for this projectile
if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope
if(lastI) for(G4int i=0; i<lastI; ++i) // AMDB exists, try to find the (Z,N) isotope
{
if(colN[i]==tgN && colZ[i]==tgZ) // Try the record "i" in the AMDB
{
@@ -200,7 +200,7 @@ G4double G4ChipsKaonMinusInelasticXS::CalculateCrossSection(G4int F, G4int I,
{
if(F<0) // This isotope was found in DAMDB =-----=> RETRIEVE
{
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync<=I) G4cerr<<"*!*G4QPiMinusNuclCS::CalcCrosSect:Sync="<<sync<<"<="<<I<<G4endl;
lastLEN=(*LEN)[I]; // Pointer to prepared LowEnergy cross sections
lastHEN=(*HEN)[I]; // Pointer to prepared High Energy cross sections
@@ -224,7 +224,7 @@ G4double G4ChipsKaonMinusInelasticXS::CalculateCrossSection(G4int F, G4int I,
}
// --- End of possible separate function
// *** The synchronization check ***
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync!=I)
{
G4cerr<<"***G4ChipsKaonMinusCS::CalcCrossSect: Sinc="<<sync<<"#"<<I<<", Z=" <<targZ
@@ -196,8 +196,8 @@ G4double G4ChipsKaonPlusElasticXS::GetChipsCrossSection(G4double pMom, G4int tgZ
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; i++) // Loop over proj/tgZ/tgN lines of DB
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; ++i) // Loop over proj/tgZ/tgN lines of DB
{ // The nucleus with projPDG is found in AMDB
if(colN[i]==tgN && colZ[i]==tgZ) // Isotope is foind in AMDB
{
@@ -95,12 +95,12 @@ G4ChipsKaonPlusInelasticXS::G4ChipsKaonPlusInelasticXS():G4VCrossSectionDataSet(
G4ChipsKaonPlusInelasticXS::~G4ChipsKaonPlusInelasticXS()
{
G4int lens=LEN->size();
for(G4int i=0; i<lens; ++i) delete[] (*LEN)[i];
std::size_t lens=LEN->size();
for(std::size_t i=0; i<lens; ++i) delete[] (*LEN)[i];
delete LEN;
G4int hens=HEN->size();
for(G4int i=0; i<hens; ++i) delete[] (*HEN)[i];
std::size_t hens=HEN->size();
for(std::size_t i=0; i<hens; ++i) delete[] (*HEN)[i];
delete HEN;
}
@@ -144,10 +144,10 @@ G4double G4ChipsKaonPlusInelasticXS::GetChipsCrossSection(G4double pMom, G4int t
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
j = 0; // A#0f records found in DB for this projectile
if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope
if(lastI) for(G4int i=0; i<lastI; ++i) // AMDB exists, try to find the (Z,N) isotope
{
if(colN[i]==tgN && colZ[i]==tgZ) // Try the record "i" in the AMDB
{
@@ -220,7 +220,7 @@ G4double G4ChipsKaonPlusInelasticXS::CalculateCrossSection(G4int F, G4int I,
{
if(F<0) // This isotope was found in DAMDB =-----=> RETRIEVE
{
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync<=I) G4cerr<<"*!*G4ChipsKPlusNuclCS::CalcCrosSect:Sync="<<sync<<"<="<<I<<G4endl;
lastLEN=(*LEN)[I]; // Pointer to prepared LowEnergy cross sections
lastHEN=(*HEN)[I]; // Pointer to prepared High Energy cross sections
@@ -244,7 +244,7 @@ G4double G4ChipsKaonPlusInelasticXS::CalculateCrossSection(G4int F, G4int I,
}
// --- End of possible separate function
// *** The synchronization check ***
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync!=I)
{
G4cerr<<"***G4ChipsKPlusNuclCS::CalcCrossSect: Sinc="<<sync<<"#"<<I<<", Z=" <<targZ
@@ -175,12 +175,12 @@ G4double G4ChipsNeutronElasticXS::GetChipsCrossSection(G4double pMom, G4int tgZ,
G4double pEn=pMom;
onlyCS=false;
G4bool in=false; // By default the isotope must be found in the AMDB
G4bool in=false; // By default the isotope must be found in the AMDB
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; i++) // Loop over proj/tgZ/tgN lines of DB
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; ++i) // Loop over proj/tgZ/tgN lines of DB
{ // The nucleus with projPDG is found in AMDB
if(colN[i]==tgN && colZ[i]==tgZ) // Isotope is foind in AMDB
{
@@ -70,11 +70,11 @@ G4ChipsNeutronInelasticXS::G4ChipsNeutronInelasticXS():G4VCrossSectionDataSet(De
G4ChipsNeutronInelasticXS::~G4ChipsNeutronInelasticXS()
{
G4int lens=LEN->size();
for(G4int i=0; i<lens; ++i) delete[] (*LEN)[i];
std::size_t lens=LEN->size();
for(std::size_t i=0; i<lens; ++i) delete[] (*LEN)[i];
delete LEN;
G4int hens=HEN->size();
for(G4int i=0; i<hens; ++i) delete[] (*HEN)[i];
std::size_t hens=HEN->size();
for(std::size_t i=0; i<hens; ++i) delete[] (*HEN)[i];
delete HEN;
}
@@ -118,9 +118,9 @@ G4double G4ChipsNeutronInelasticXS::GetChipsCrossSection(G4double pMom, G4int tg
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
j = 0; // A#0f records found in DB for this projectile
if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope
if(lastI) for(G4int i=0; i<lastI; ++i) // AMDB exists, try to find the (Z,N) isotope
{
if(colN[i]==tgN && colZ[i]==tgZ) // Try the record "i" in the AMDB
{
@@ -204,7 +204,7 @@ G4double G4ChipsNeutronInelasticXS::CalculateCrossSection(G4int F, G4int I,
{
if(F<0) // This isotope was found in DAMDB =-----=> RETRIEVE
{
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync<=I) G4cerr<<"*!*G4ChipsNetronNuclCS::CalcCrossSect:Sync="<<sync<<"<="<<I<<G4endl;
lastLEN=(*LEN)[I]; // Pointer to prepared LowEnergy cross sections
lastHEN=(*HEN)[I]; // Pointer to prepared High Energy cross sections
@@ -228,7 +228,7 @@ G4double G4ChipsNeutronInelasticXS::CalculateCrossSection(G4int F, G4int I,
}
// --- End of possible separate function
// *** The synchronization check ***
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync!=I)
{
G4cerr<<"***G4ChipsNetronNuclearCS::CalcCrossSect: Sync="<<sync<<"#"<<I<<", Z=" <<targZ
@@ -174,8 +174,8 @@ G4double G4ChipsPionMinusElasticXS::GetChipsCrossSection(G4double pMom, G4int tg
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; i++) // Loop over proj/tgZ/tgN lines of DB
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; ++i) // Loop over proj/tgZ/tgN lines of DB
{ // The nucleus with projPDG is found in AMDB
if(colN[i]==tgN && colZ[i]==tgZ) // Isotope is foind in AMDB
{
@@ -69,11 +69,11 @@ G4ChipsPionMinusInelasticXS::G4ChipsPionMinusInelasticXS():G4VCrossSectionDataSe
G4ChipsPionMinusInelasticXS::~G4ChipsPionMinusInelasticXS()
{
G4int lens=LEN->size();
for(G4int i=0; i<lens; ++i) delete[] (*LEN)[i];
std::size_t lens=LEN->size();
for(std::size_t i=0; i<lens; ++i) delete[] (*LEN)[i];
delete LEN;
G4int hens=HEN->size();
for(G4int i=0; i<hens; ++i) delete[] (*HEN)[i];
std::size_t hens=HEN->size();
for(std::size_t i=0; i<hens; ++i) delete[] (*HEN)[i];
delete HEN;
}
@@ -116,9 +116,9 @@ G4double G4ChipsPionMinusInelasticXS::GetChipsCrossSection(G4double pMom, G4int
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
j = 0; // A#0f records found in DB for this projectile
if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope
if(lastI) for(G4int i=0; i<lastI; ++i) // AMDB exists, try to find the (Z,N) isotope
{
if(colN[i]==tgN && colZ[i]==tgZ) // Try the record "i" in the AMDB
{
@@ -199,7 +199,7 @@ G4double G4ChipsPionMinusInelasticXS::CalculateCrossSection(G4int F, G4int I,
{
if(F<0) // This isotope was found in DAMDB =-----=> RETRIEVE
{
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync<=I) G4cerr<<"*!*G4ChipsPiMinusNuclCS::CalcCrosSect:Sync="<<sync<<"<="<<I<<G4endl;
lastLEN=(*LEN)[I]; // Pointer to prepared LowEnergy cross sections
lastHEN=(*HEN)[I]; // Pointer to prepared High Energy cross sections
@@ -223,7 +223,7 @@ G4double G4ChipsPionMinusInelasticXS::CalculateCrossSection(G4int F, G4int I,
}
// --- End of possible separate function
// *** The synchronization check ***
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync!=I)
{
G4cerr<<"***G4ChipsPiMinusNuclCS::CalcCrossSect: Sinc="<<sync<<"#"<<I<<", Z=" <<targZ
@@ -151,10 +151,9 @@ G4bool G4ChipsPionPlusElasticXS::IsIsoApplicable(const G4DynamicParticle*, G4int
// The main member function giving the collision cross section (P is in IU, CS is in mb)
// Make pMom in independent units ! (Now it is MeV)
G4double G4ChipsPionPlusElasticXS::GetIsoCrossSection(const G4DynamicParticle* Pt, G4int tgZ, G4int A,
const G4Isotope*,
const G4Element*,
const G4Material*)
const G4Isotope*,
const G4Element*,
const G4Material*)
{
G4double pMom=Pt->GetTotalMomentum();
G4int tgN = A - tgZ;
@@ -172,8 +171,8 @@ G4double G4ChipsPionPlusElasticXS::GetChipsCrossSection(G4double pMom, G4int tgZ
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; i++) // Loop over proj/tgZ/tgN lines of DB
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; ++i) // Loop over proj/tgZ/tgN lines of DB
{ // The nucleus with projPDG is found in AMDB
if(colN[i]==tgN && colZ[i]==tgZ) // Isotope is foind in AMDB
{
@@ -70,11 +70,11 @@ G4ChipsPionPlusInelasticXS::G4ChipsPionPlusInelasticXS():G4VCrossSectionDataSet(
G4ChipsPionPlusInelasticXS::~G4ChipsPionPlusInelasticXS()
{
G4int lens=LEN->size();
for(G4int i=0; i<lens; ++i) delete[] (*LEN)[i];
std::size_t lens=LEN->size();
for(std::size_t i=0; i<lens; ++i) delete[] (*LEN)[i];
delete LEN;
G4int hens=HEN->size();
for(G4int i=0; i<hens; ++i) delete[] (*HEN)[i];
std::size_t hens=HEN->size();
for(std::size_t i=0; i<hens; ++i) delete[] (*HEN)[i];
delete HEN;
}
@@ -118,9 +118,9 @@ G4double G4ChipsPionPlusInelasticXS::GetChipsCrossSection(G4double pMom, G4int t
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
j = 0; // A#0f records found in DB for this projectile
if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope
if(lastI) for(G4int i=0; i<lastI; ++i) // AMDB exists, try to find the (Z,N) isotope
{
if(colN[i]==tgN && colZ[i]==tgZ) // Try the record "i" in the AMDB
{
@@ -201,7 +201,7 @@ G4double G4ChipsPionPlusInelasticXS::CalculateCrossSection(G4int F, G4int I,
{
if(F<0) // This isotope was found in DAMDB =-----=> RETRIEVE
{
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync<=I) G4cerr<<"*!*G4ChipsPiMinusNuclCS::CalcCrosSect:Sync="<<sync<<"<="<<I<<G4endl;
lastLEN=(*LEN)[I]; // Pointer to prepared LowEnergy cross sections
lastHEN=(*HEN)[I]; // Pointer to prepared High Energy cross sections
@@ -225,7 +225,7 @@ G4double G4ChipsPionPlusInelasticXS::CalculateCrossSection(G4int F, G4int I,
}
// --- End of possible separate function
// *** The synchronization check ***
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync!=I)
{
G4cerr<<"***G4ChipsPiMinusNuclCS::CalcCrossSect: Sinc="<<sync<<"#"<<I<<", Z=" <<targZ
@@ -183,8 +183,8 @@ G4double G4ChipsProtonElasticXS::GetChipsCrossSection(G4double pMom, G4int tgZ,
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; i++) // Loop over proj/tgZ/tgN lines of DB
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
if(lastI) for(G4int i=0; i<lastI; ++i) // Loop over proj/tgZ/tgN lines of DB
{ // The nucleus with projPDG is found in AMDB
if(colN[i]==tgN && colZ[i]==tgZ) // Isotope is foind in AMDB
{
@@ -72,11 +72,11 @@ G4ChipsProtonInelasticXS::G4ChipsProtonInelasticXS():G4VCrossSectionDataSet(Defa
G4ChipsProtonInelasticXS::~G4ChipsProtonInelasticXS()
{
G4int lens=LEN->size();
for(G4int i=0; i<lens; ++i) delete[] (*LEN)[i];
std::size_t lens=LEN->size();
for(std::size_t i=0; i<lens; ++i) delete[] (*LEN)[i];
delete LEN;
G4int hens=HEN->size();
for(G4int i=0; i<hens; ++i) delete[] (*HEN)[i];
std::size_t hens=HEN->size();
for(std::size_t i=0; i<hens; ++i) delete[] (*HEN)[i];
delete HEN;
}
@@ -100,9 +100,9 @@ G4bool G4ChipsProtonInelasticXS::IsIsoApplicable(const G4DynamicParticle*, G4int
// The main member function giving the collision cross section (P is in IU, CS is in mb)
// Make pMom in independent units ! (Now it is MeV)
G4double G4ChipsProtonInelasticXS::GetIsoCrossSection(const G4DynamicParticle* Pt, G4int tgZ, G4int A,
const G4Isotope*,
const G4Element*,
const G4Material*)
const G4Isotope*,
const G4Element*,
const G4Material*)
{
G4double pMom=Pt->GetTotalMomentum();
G4int tgN = A - tgZ;
@@ -120,9 +120,9 @@ G4double G4ChipsProtonInelasticXS::GetChipsCrossSection(G4double pMom, G4int tgZ
lastP = 0.; // New momentum history (nothing to compare with)
lastN = tgN; // The last N of the calculated nucleus
lastZ = tgZ; // The last Z of the calculated nucleus
lastI = colN.size(); // Size of the Associative Memory DB in the heap
lastI = (G4int)colN.size(); // Size of the Associative Memory DB in the heap
j = 0; // A#0f records found in DB for this projectile
if(lastI) for(G4int i=0; i<lastI; i++) // AMDB exists, try to find the (Z,N) isotope
if(lastI) for(G4int i=0; i<lastI; ++i) // AMDB exists, try to find the (Z,N) isotope
{
if(colN[i]==tgN && colZ[i]==tgZ) // Try the record "i" in the AMDB
{
@@ -203,7 +203,7 @@ G4double G4ChipsProtonInelasticXS::CalculateCrossSection(G4int F, G4int I,
{
if(F<0) // This isotope was found in DAMDB =-----=> RETRIEVE
{
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync<=I) G4cout<<"*!*G4QProtonNuclCS::CalcCrossSect:Sync="<<sync<<"<="<<I<<G4endl;
lastLEN=(*LEN)[I]; // Pointer to prepared LowEnergy cross sections
lastHEN=(*HEN)[I]; // Pointer to prepared High Energy cross sections
@@ -214,20 +214,20 @@ G4double G4ChipsProtonInelasticXS::CalculateCrossSection(G4int F, G4int I,
lastHEN = new G4double[nH]; // Allocate memory for the new HEN cross sections
// --- Instead of making a separate function ---
G4double P=THmiG; // Table threshold in GeV/c
for(G4int k=0; k<nL; k++)
for(G4int k=0; k<nL; ++k)
{
lastLEN[k] = CrossSectionLin(targZ, targN, P);
P+=dPG;
}
G4double lP=milPG;
for(G4int n=0; n<nH; n++)
for(G4int n=0; n<nH; ++n)
{
lastHEN[n] = CrossSectionLog(targZ, targN, lP);
lP+=dlP;
}
// --- End of possible separate function
// *** The synchronization check ***
G4int sync=LEN->size();
G4int sync=(G4int)LEN->size();
if(sync!=I)
{
G4cout<<"***G4ChipsProtonNuclCS::CalcCrossSect: Sinc="<<sync<<"#"<<I<<", Z=" <<targZ
@@ -82,6 +82,14 @@ G4ComponentAntiNuclNuclearXS::~G4ComponentAntiNuclNuclearXS()
G4double G4ComponentAntiNuclNuclearXS::GetTotalElementCrossSection
(const G4ParticleDefinition* aParticle, G4double kinEnergy, G4int Z, G4double A)
{
if ( aParticle == nullptr ) {
G4ExceptionDescription ed;
ed << "anti-nucleus with nullptr particle definition: " << aParticle << G4endl;
G4Exception( "G4ComponentAntiNuclNuclearXS::GetTotalElementCrossSection",
"antiNuclNuclearXS001", JustWarning, ed );
return 0.0;
}
const G4ParticleDefinition* theParticle = aParticle;
G4double sigmaTotal = GetAntiHadronNucleonTotCrSc(theParticle,kinEnergy);
@@ -95,36 +103,40 @@ G4double G4ComponentAntiNuclNuclearXS::GetTotalElementCrossSection
else if ( theParticle == theAAlpha ) { i=4; }
else {};
if ( i < 0 ) {
if ( i < 0 && ( ! theParticle->IsAntiHypernucleus() ) ) {
G4ExceptionDescription ed;
ed << "Unknown anti-nucleus : "
<< ( theParticle != nullptr ? theParticle->GetParticleName() : "nullptr" ) << G4endl
ed << "Unknown anti-nucleus : " << theParticle->GetParticleName() << G4endl
<< "Target (Z, A)=(" << Z << "," << A << ")" << G4endl;
G4Exception( "G4ComponentAntiNuclNuclearXS::GetTotalElementCrossSection",
"antiNuclNuclearXS001", JustWarning, ed );
"antiNuclNuclearXS002", JustWarning, ed );
}
if ( Z == 1 && A == 1 ) { j=0; }
else if ( Z == 1 && A == 2 ) { j=1; }
else if ( Z == 1 && A == 3 ) { j=2; }
else if ( Z == 2 && A == 3 ) { j=3; }
else if ( Z == 2 && A == 4 ) { j=4; }
G4int intA = static_cast<G4int>( A );
if ( Z == 1 && intA == 1 ) { j=0; }
else if ( Z == 1 && intA == 2 ) { j=1; }
else if ( Z == 1 && intA == 3 ) { j=2; }
else if ( Z == 2 && intA == 3 ) { j=3; }
else if ( Z == 2 && intA == 4 ) { j=4; }
else {}
if ( i < 0 && j >= 0 ) { fRadiusEff = ReffTot[4][j]; } // Treat all anti-hypernuclei as anti-alpha
if ( i == 0 && j == 0 ) return sigmaTotal * millibarn; // Pbar/Nbar + P
if ( i > 0 && j >= 0 ) { fRadiusEff = ReffTot[i][j]; } // Light anti-nuclei + Light nuclei
if ( i >= 0 && j >= 0 ) { fRadiusEff = ReffTot[i][j]; } // Light anti-nuclei + Light nuclei
if ( j < 0 ) {
if ( i == 0 ) { fRadiusEff = 1.34 * theG4Pow->powA(A, 0.23) // Anti-proton/Anti-neutron + Nucleus
+ 1.35 / theG4Pow->A13(A); }
else if ( i == 1 ) { fRadiusEff = 1.46 * theG4Pow->powA(A, 0.21) // Anti-deuteron + Nucleus
+ 1.45 / theG4Pow->A13(A); }
else if ( i == 2 ) { fRadiusEff = 1.40 * theG4Pow->powA(A, 0.21) // Anti-Tritium + Nucleus
+ 1.63 / theG4Pow->A13(A); }
else if ( i == 3 ) { fRadiusEff = 1.40 * theG4Pow->powA(A, 0.21) // Anti-He3 + Nucleus
+ 1.63 / theG4Pow->A13(A); }
else if ( i == 4 ) { fRadiusEff = 1.35 * theG4Pow->powA(A, 0.21) // Anti-Tritium + Nucleus
+ 1.10 / theG4Pow->A13(A); }
if ( i == 0 ) { fRadiusEff = 1.34 * theG4Pow->powZ(intA, 0.23) // Anti-proton/Anti-neutron + Nucleus
+ 1.35 / theG4Pow->Z13(intA); }
else if ( i == 1 ) { fRadiusEff = 1.46 * theG4Pow->powZ(intA, 0.21) // Anti-deuteron + Nucleus
+ 1.45 / theG4Pow->Z13(intA); }
else if ( i == 2 ) { fRadiusEff = 1.40 * theG4Pow->powZ(intA, 0.21) // Anti-tritium + Nucleus
+ 1.63 / theG4Pow->Z13(intA); }
else if ( i == 3 ) { fRadiusEff = 1.40 * theG4Pow->powZ(intA, 0.21) // Anti-He3 + Nucleus
+ 1.63 / theG4Pow->Z13(intA); }
else if ( i == 4 ) { fRadiusEff = 1.35 * theG4Pow->powZ(intA, 0.21) // Anti-alpha + Nucleus
+ 1.10 / theG4Pow->Z13(intA); }
else if ( i < 0 ) { fRadiusEff = 1.35 * theG4Pow->powZ(intA, 0.21) // Anti-hypernucleus + Nucleus
+ 1.10 / theG4Pow->Z13(intA); } // is treated as Anti-alpha + Nucleus
else {}
}
@@ -155,6 +167,14 @@ G4double G4ComponentAntiNuclNuclearXS::GetTotalIsotopeCrossSection
G4double G4ComponentAntiNuclNuclearXS::GetInelasticElementCrossSection
(const G4ParticleDefinition* aParticle, G4double kinEnergy, G4int Z, G4double A)
{
if ( aParticle == nullptr ) {
G4ExceptionDescription ed;
ed << "anti-nucleus with nullptr particle definition: " << aParticle << G4endl;
G4Exception( "G4ComponentAntiNuclNuclearXS::GetInelasticElementCrossSection",
"antiNuclNuclearXS003", JustWarning, ed );
return 0.0;
}
const G4ParticleDefinition* theParticle = aParticle;
G4double sigmaTotal = GetAntiHadronNucleonTotCrSc(theParticle,kinEnergy);
G4double sigmaElastic = GetAntiHadronNucleonElCrSc(theParticle,kinEnergy);
@@ -169,36 +189,40 @@ G4double G4ComponentAntiNuclNuclearXS::GetInelasticElementCrossSection
else if ( theParticle == theAAlpha ) { i=4; }
else {};
if ( i < 0 ) {
if ( i < 0 && ( ! theParticle->IsAntiHypernucleus() ) ) {
G4ExceptionDescription ed;
ed << "Unknown anti-nucleus : "
<< ( theParticle != nullptr ? theParticle->GetParticleName() : "nullptr" ) << G4endl
ed << "Unknown anti-nucleus : " << theParticle->GetParticleName() << G4endl
<< "Target (Z, A)=(" << Z << "," << A << ")" << G4endl;
G4Exception( "G4ComponentAntiNuclNuclearXS::GetInelasticElementCrossSection",
"antiNuclNuclearXS002", JustWarning, ed );
"antiNuclNuclearXS004", JustWarning, ed );
}
if ( Z == 1 && A == 1 ) { j=0; }
else if ( Z == 1 && A == 2 ) { j=1; }
else if ( Z == 1 && A == 3 ) { j=2; }
else if ( Z == 2 && A == 3 ) { j=3; }
else if ( Z == 2 && A == 4 ) { j=4; }
G4int intA = static_cast<G4int>( A );
if ( Z == 1 && intA == 1 ) { j=0; }
else if ( Z == 1 && intA == 2 ) { j=1; }
else if ( Z == 1 && intA == 3 ) { j=2; }
else if ( Z == 2 && intA == 3 ) { j=3; }
else if ( Z == 2 && intA == 4 ) { j=4; }
else {}
if ( i < 0 && j >= 0 ) { fRadiusEff = ReffInel[4][j]; } // Treat all anti-hypernuclei as anti-alpha
if ( i == 0 && j == 0 ) return (sigmaTotal - sigmaElastic) * millibarn; // Pbar/Nbar + P
if ( i > 0 && j >= 0 ) { fRadiusEff = ReffInel[i][j]; } // Light anti-nuclei + Light nuclei
if ( i >= 0 && j >= 0 ) { fRadiusEff = ReffInel[i][j]; } // Light anti-nuclei + Light nuclei
if ( j < 0) {
if ( i == 0 ) { fRadiusEff = 1.31*theG4Pow->powA(A, 0.22) // Anti-proton/Anti-neutron + Nucleus
+ 0.90/theG4Pow->A13(A); }
else if ( i == 1 ) { fRadiusEff = 1.38*theG4Pow->powA(A, 0.21) // Anti-deuteron + Nucleus
+ 1.55/theG4Pow->A13(A); }
else if ( i == 2 ) { fRadiusEff = 1.34*theG4Pow->powA(A, 0.21) // Anti-Tritium + Nucleus
+ 1.51/theG4Pow->A13(A); }
else if ( i == 3 ) { fRadiusEff = 1.34*theG4Pow->powA(A, 0.21) // Anti-He3 + Nucleus
+ 1.51/theG4Pow->A13(A); }
else if ( i == 4 ) { fRadiusEff = 1.30*theG4Pow->powA(A, 0.21) // Anti-Tritium + Nucleus
+ 1.05/theG4Pow->A13(A); }
if ( i == 0 ) { fRadiusEff = 1.31*theG4Pow->powZ(intA, 0.22) // Anti-proton/Anti-neutron + Nucleus
+ 0.90/theG4Pow->Z13(intA); }
else if ( i == 1 ) { fRadiusEff = 1.38*theG4Pow->powZ(intA, 0.21) // Anti-deuteron + Nucleus
+ 1.55/theG4Pow->Z13(intA); }
else if ( i == 2 ) { fRadiusEff = 1.34*theG4Pow->powZ(intA, 0.21) // Anti-tritium + Nucleus
+ 1.51/theG4Pow->Z13(intA); }
else if ( i == 3 ) { fRadiusEff = 1.34*theG4Pow->powZ(intA, 0.21) // Anti-He3 + Nucleus
+ 1.51/theG4Pow->Z13(intA); }
else if ( i == 4 ) { fRadiusEff = 1.30*theG4Pow->powZ(intA, 0.21) // Anti-alpha + Nucleus
+ 1.05/theG4Pow->Z13(intA); }
else if ( i < 0 ) { fRadiusEff = 1.30*theG4Pow->powZ(intA,0.21) // Anti-hypernucleus + Nucleus
+ 1.05/theG4Pow->Z13(intA); } // is treated as Anti-alpha + Nucleus
else {}
}
@@ -42,6 +42,8 @@
#include "G4DynamicParticle.hh"
#include "G4HadronNucleonXsc.hh"
#include "G4Log.hh"
#include "G4Lambda.hh"
#include "G4Pow.hh"
#include "G4NuclearRadii.hh"
//////////////////////////////////////////////////////////////////////////////
@@ -51,7 +53,7 @@ G4ComponentGGHadronNucleusXsc::G4ComponentGGHadronNucleusXsc()
: G4VComponentCrossSection(Default_Name()),
fTotalXsc(0.0),fElasticXsc(0.0),fInelasticXsc(0.0),fProductionXsc(0.0),
fDiffractionXsc(0.0),fAxsc2piR2(0.0),fModelInLog(0.0),fEnergy(0.0),
fParticle(nullptr),fZ(0),fA(0)
fParticle(nullptr),fZ(0),fA(0), fL(0)
{
theGamma = G4Gamma::Gamma();
theProton = G4Proton::Proton();
@@ -64,7 +66,8 @@ G4ComponentGGHadronNucleusXsc::G4ComponentGGHadronNucleusXsc()
theKMinus = G4KaonMinus::KaonMinus();
theK0S = G4KaonZeroShort::KaonZeroShort();
theK0L = G4KaonZeroLong::KaonZeroLong();
theLambda = G4Lambda::Lambda();
hnXsc = new G4HadronNucleonXsc();
}
@@ -178,16 +181,17 @@ G4double G4ComponentGGHadronNucleusXsc::GetProductionIsotopeCrossSection(
void G4ComponentGGHadronNucleusXsc::ComputeCrossSections(
const G4ParticleDefinition* aParticle,
G4double kinEnergy, G4int Z, G4int A)
G4double kinEnergy, G4int Z, G4int A, G4int nL)
{
// check cache
if(aParticle == fParticle && fZ == Z && fA == A && kinEnergy == fEnergy)
if(aParticle == fParticle && fZ == Z && fA == A && fL == nL && kinEnergy == fEnergy)
{ return; }
fParticle = aParticle;
fZ = Z;
fA = A;
fL = nL;
fEnergy = kinEnergy;
G4Pow* pG4Pow=G4Pow::GetInstance();
//
G4double cofInelastic = 2.4;
static const G4double cofTotal = 2.0;
@@ -220,6 +224,14 @@ void G4ComponentGGHadronNucleusXsc::ComputeCrossSections(
hnInXsc = hnXsc->GetInelasticHadronNucleonXsc();
}
R = G4NuclearRadii::RadiusHNGG(A);
if( nL > 0 ) {
G4double mp = theProton->GetPDGMass();
G4double ml = theLambda->GetPDGMass();
G4double kinCof = ml/mp; // moving hyperon - rest nucleon
G4double cHN(0.88);
sigma += nL*hnXsc->HadronNucleonXsc(theLambda, theProton, kinEnergy*kinCof);
R *= std::sqrt( pG4Pow->Z23( A - nL ) + cHN*pG4Pow->Z23( nL ) )/pG4Pow->Z13(A);
}
}
G4double nucleusSquare = cofTotal*pi*R*R; // basically 2piRR
@@ -37,6 +37,7 @@
#include "G4HadronNucleonXsc.hh"
#include "G4ComponentGGHadronNucleusXsc.hh"
#include "G4NuclearRadii.hh"
#include "G4Pow.hh"
static const G4double inve = 1./CLHEP::eplus;
@@ -47,6 +48,7 @@ G4ComponentGGNuclNuclXsc::G4ComponentGGNuclNuclXsc()
{
theProton = G4Proton::Proton();
theNeutron = G4Neutron::Neutron();
theLambda = G4Lambda::Lambda();
fHNXsc = new G4HadronNucleonXsc();
fHadrNucl = new G4ComponentGGHadronNucleusXsc();
}
@@ -169,14 +171,18 @@ void G4ComponentGGNuclNuclXsc::ComputeCrossSections(
fZ = Z;
fA = A;
fEnergy = kinEnergy;
G4Pow* pG4Pow=G4Pow::GetInstance();
G4int pZ = G4lrint(aParticle->GetPDGCharge()*inve);
G4int pA = aParticle->GetBaryonNumber();
G4int pL = aParticle->GetNumberOfLambdasInHypernucleus();
G4bool pHN = aParticle->IsHypernucleus();
G4double cHN(0.88);
// hydrogen
if(1 == Z && 1 == A) {
G4double e = kinEnergy*CLHEP::proton_mass_c2/aParticle->GetPDGMass();
fHadrNucl->ComputeCrossSections(theProton, e, pZ, pA);
fHadrNucl->ComputeCrossSections( theProton, e, pZ, pA, pL );
fTotalXsc = fHadrNucl->GetTotalGlauberGribovXsc();
fElasticXsc = fHadrNucl->GetElasticGlauberGribovXsc();
fInelasticXsc = fHadrNucl->GetInelasticGlauberGribovXsc();
@@ -193,13 +199,16 @@ void G4ComponentGGNuclNuclXsc::ComputeCrossSections(
G4int tN = A - Z;
G4double tR = G4NuclearRadii::Radius(Z, A);
G4double pR = G4NuclearRadii::Radius(pZ, pA);
G4double pR = G4NuclearRadii::Radius(pZ, 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);
if ( cB > 0. )
{
G4double sigma = (pZ*Z+pN*tN)*fHNXsc->HadronNucleonXscNS(theProton, theProton, pTkin);
if(pHN) sigma += pL*A*fHNXsc->HadronNucleonXsc(theLambda, theProton, pTkin);
G4double ppInXsc = fHNXsc->GetInelasticHadronNucleonXsc();
sigma += (pZ*tN+pN*Z)*fHNXsc->HadronNucleonXscNS(theNeutron, theProton, pTkin);
@@ -73,12 +73,12 @@ G4CrossSectionDataStore::ComputeCrossSection(const G4DynamicParticle* dp,
matKinEnergy = dp->GetKineticEnergy();
matCrossSection = 0.0;
size_t nElements = mat->GetNumberOfElements();
std::size_t nElements = mat->GetNumberOfElements();
const G4double* nAtomsPerVolume = mat->GetVecNbOfAtomsPerVolume();
if(xsecelm.size() < nElements) { xsecelm.resize(nElements); }
for(size_t i=0; i<nElements; ++i) {
for(G4int i=0; i<(G4int)nElements; ++i) {
G4double xs =
nAtomsPerVolume[i]*GetCrossSection(dp, mat->GetElement(i), mat);
matCrossSection += std::max(xs, 0.0);
@@ -105,7 +105,7 @@ G4double G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* dp,
}
// isotope wise cross section
size_t nIso = elm->GetNumberOfIsotopes();
G4int nIso = (G4int)elm->GetNumberOfIsotopes();
// user-defined isotope abundances
const G4double* abundVector = elm->GetRelativeAbundanceVector();
@@ -113,7 +113,7 @@ G4double G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* dp,
G4double sigma = 0.0;
// isotope and element wise cross sections
for(size_t j = 0; j < nIso; ++j)
for(G4int j = 0; j < nIso; ++j)
{
const G4Isotope* iso = elm->GetIsotope(j);
sigma += abundVector[j] *
@@ -193,15 +193,16 @@ G4CrossSectionDataStore::SampleZandA(const G4DynamicParticle* dp,
const G4Material* mat,
G4Nucleus& target)
{
size_t nElements = mat->GetNumberOfElements();
if(nullptr != forcedElement) { return forcedElement; }
std::size_t nElements = mat->GetNumberOfElements();
const G4Element* anElement = mat->GetElement(0);
// select element from a compound
if(1 < nElements) {
G4double cross = matCrossSection*G4UniformRand();
for(size_t i=0; i<nElements; ++i) {
for(G4int i=0; i<(G4int)nElements; ++i) {
if(cross <= xsecelm[i]) {
anElement = mat->GetElement(i);
anElement = mat->GetElement(i);
break;
}
}
@@ -217,7 +218,7 @@ G4CrossSectionDataStore::SampleZandA(const G4DynamicParticle* dp,
// element-wise cross section
// isotope cross section is not computed
//----------------------------------------------------------------
size_t nIso = anElement->GetNumberOfIsotopes();
std::size_t nIso = anElement->GetNumberOfIsotopes();
iso = anElement->GetIsotope(0);
// more than 1 isotope
@@ -232,7 +233,7 @@ G4CrossSectionDataStore::SampleZandA(const G4DynamicParticle* dp,
// isotope-wise cross section
// isotope cross section is computed
//----------------------------------------------------------------
size_t nIso = anElement->GetNumberOfIsotopes();
std::size_t nIso = anElement->GetNumberOfIsotopes();
iso = anElement->GetIsotope(0);
// more than 1 isotope
@@ -241,8 +242,8 @@ G4CrossSectionDataStore::SampleZandA(const G4DynamicParticle* dp,
if(xseciso.size() < nIso) { xseciso.resize(nIso); }
G4double cross = 0.0;
size_t j;
for (j = 0; j<nIso; ++j) {
G4int j;
for (j = 0; j<(G4int)nIso; ++j) {
G4double xsec = 0.0;
if(abundVector[j] > 0.0) {
iso = anElement->GetIsotope(j);
@@ -253,7 +254,7 @@ G4CrossSectionDataStore::SampleZandA(const G4DynamicParticle* dp,
xseciso[j] = cross;
}
cross *= G4UniformRand();
for (j = 0; j<nIso; ++j) {
for (j = 0; j<(G4int)nIso; ++j) {
if(cross <= xseciso[j]) {
iso = anElement->GetIsotope(j);
break;
@@ -283,12 +284,12 @@ G4CrossSectionDataStore::BuildPhysicsTable(const G4ParticleDefinition& part)
dataSetList[i]->BuildPhysicsTable(part);
}
const G4MaterialTable* theMatTable = G4Material::GetMaterialTable();
size_t nelm = 0;
size_t niso = 0;
std::size_t nelm = 0;
std::size_t niso = 0;
for(auto mat : *theMatTable) {
size_t nElements = mat->GetNumberOfElements();
std::size_t nElements = mat->GetNumberOfElements();
nelm = std::max(nelm, nElements);
for(size_t j=0; j<nElements; ++j) {
for(G4int j=0; j<(G4int)nElements; ++j) {
niso = std::max(niso, mat->GetElement(j)->GetNumberOfIsotopes());
}
}
@@ -406,7 +407,7 @@ void G4CrossSectionDataStore::AddDataSet(G4VCrossSectionDataSet* p)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4CrossSectionDataStore::AddDataSet(G4VCrossSectionDataSet* p, size_t i)
void G4CrossSectionDataStore::AddDataSet(G4VCrossSectionDataSet* p, std::size_t i)
{
if(p->ForAllAtomsAndEnergies()) {
dataSetList.clear();
@@ -235,7 +235,7 @@ G4double G4GammaNuclearXS::GetIsoCrossSection(
const G4Isotope* G4GammaNuclearXS::SelectIsotope(
const G4Element* anElement, G4double kinEnergy, G4double)
{
size_t nIso = anElement->GetNumberOfIsotopes();
std::size_t nIso = anElement->GetNumberOfIsotopes();
const G4Isotope* iso = anElement->GetIsotope(0);
if(1 == nIso) { return iso; }
@@ -243,12 +243,12 @@ const G4Isotope* G4GammaNuclearXS::SelectIsotope(
const G4double* abundVector = anElement->GetRelativeAbundanceVector();
G4double q = G4UniformRand();
G4double sum = 0.0;
size_t j;
G4int j;
G4int Z = anElement->GetZasInt();
// condition to use only isotope abundance
if(amax[Z] == amin[Z] || kinEnergy > rTransitionBound || Z >= MAXZGAMMAXS ) {
for (j=0; j<nIso; ++j) {
for (j=0; j<(G4int)nIso; ++j) {
sum += abundVector[j];
if(q <= sum) {
iso = anElement->GetIsotope(j);
@@ -258,10 +258,10 @@ const G4Isotope* G4GammaNuclearXS::SelectIsotope(
return iso;
}
// use isotope cross sections
size_t nn = temp.size();
std::size_t nn = temp.size();
if(nn < nIso) { temp.resize(nIso, 0.); }
for (j=0; j<nIso; ++j) {
for (j=0; j<(G4int)nIso; ++j) {
//G4cout << j << "-th isotope " << (*isoVector)[j]->GetN()
// << " abund= " << abundVector[j] << G4endl;
sum += abundVector[j]*
@@ -269,7 +269,7 @@ const G4Isotope* G4GammaNuclearXS::SelectIsotope(
temp[j] = sum;
}
sum *= q;
for (j = 0; j<nIso; ++j) {
for (j = 0; j<(G4int)nIso; ++j) {
if(temp[j] >= sum) {
iso = anElement->GetIsotope(j);
break;
@@ -321,9 +321,9 @@ G4GammaNuclearXS::BuildPhysicsTable(const G4ParticleDefinition& p)
}
// prepare isotope selection
size_t nIso = temp.size();
std::size_t nIso = temp.size();
for ( auto & elm : *table ) {
size_t n = elm->GetNumberOfIsotopes();
std::size_t n = elm->GetNumberOfIsotopes();
if(n > nIso) { nIso = n; }
}
temp.resize(nIso, 0.0);
@@ -380,7 +380,7 @@ void G4GammaNuclearXS::Initialise(G4int Z)
G4DynamicParticle theGamma(gamma, G4ThreeVector(1,0,0), rTransitionBound);
xs150[Z] = ggXsection->GetElementCrossSection(&theGamma, Z, 0);
if(amax[Z] > amin[Z]) {
size_t nmax = (size_t)(amax[Z]-amin[Z]+1);
G4int nmax = amax[Z]-amin[Z]+1;
data->InitialiseForComponent(Z, nmax);
for(G4int A=amin[Z]; A<=amax[Z]; ++A) {
std::ostringstream ost1;
@@ -54,15 +54,15 @@ G4HadElementSelector::G4HadElementSelector(G4DynamicParticle* dp,
G4int bins, G4double emin,
G4double emax, G4bool)
{
G4int n = mat->GetNumberOfElements();
nElmMinusOne = n - 1;
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(G4int i=1; i<n; ++i) {
for(std::size_t i=1; i<n; ++i) {
xSections[i] = new G4PhysicsVector(*first);
}
std::vector<G4double> temp;
@@ -71,12 +71,12 @@ G4HadElementSelector::G4HadElementSelector(G4DynamicParticle* dp,
G4double cross = 0.0;
G4double e = first->Energy(j);
dp->SetKineticEnergy(e);
for(G4int i=0; i<n; ++i) {
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(G4int i=0; i<n; ++i) {
for(std::size_t i=0; i<n; ++i) {
G4double y = (i<n-1) ? temp[i]*fact : 1.0;
xSections[i]->PutValue(j, y);
}
@@ -110,7 +110,7 @@ void G4HadronXSDataTable::Initialise(G4DynamicParticle* dp,
G4int bins, G4double emin, G4double emax,
G4bool spline)
{
size_t nn = G4Material::GetNumberOfMaterials();
std::size_t nn = G4Material::GetNumberOfMaterials();
if(nn > nMaterials) {
if(0 == nMaterials) {
xsData.reserve(nn);
@@ -119,7 +119,7 @@ void G4HadronXSDataTable::Initialise(G4DynamicParticle* dp,
G4PhysicsLogVector* first = nullptr;
G4int sbins = std::max(10, bins/5);
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
for(size_t i=nMaterials; i<nn; ++i) {
for(std::size_t i=nMaterials; i<nn; ++i) {
const G4Material* mat = (*mtable)[i];
G4PhysicsVector* v = nullptr;
G4HadElementSelector* es = nullptr;
@@ -151,7 +151,7 @@ void G4HadronXSDataTable::Initialise(G4DynamicParticle* dp,
G4HadronXSDataTable::~G4HadronXSDataTable()
{
for(size_t i=0; i<nMaterials; ++i) {
for(std::size_t i=0; i<nMaterials; ++i) {
delete xsData[i];
delete elmSelectors[i];
}
@@ -109,11 +109,11 @@ void G4KokoulinMuonNuclearXS::BuildCrossSectionTable()
G4double energy, A, Value;
G4int Z;
G4int nEl = G4Element::GetNumberOfElements();
std::size_t nEl = G4Element::GetNumberOfElements();
const G4ElementTable* theElementTable = G4Element::GetElementTable();
G4NistManager* nistManager = G4NistManager::Instance();
for (G4int j = 0; j < nEl; j++) {
for (std::size_t j = 0; j < nEl; ++j) {
Z = G4lrint((*theElementTable)[j]->GetZ());
//AR-24Apr2018 Switch to treat transuranic elements as uranium
@@ -65,7 +65,7 @@ G4MuNeutrinoNucleusTotXsc::G4MuNeutrinoNucleusTotXsc()
fCutEnergy = 0.; // default value
fBiasingFactor = 1.; // default as physics
fEmc = 0.2*GeV;
fIndex = 50;
fTotXsc = 0.;
@@ -73,8 +73,8 @@ G4MuNeutrinoNucleusTotXsc::G4MuNeutrinoNucleusTotXsc()
fCcFactor = fNcFactor = 1.;
fQEratio = 0.5; // mean in the 1 GeV range
theMuonMinus = G4MuonMinus::MuonMinus();
theMuonPlus = G4MuonPlus::MuonPlus();
// theMuonMinus = G4MuonMinus::MuonMinus();
// theMuonPlus = G4MuonPlus::MuonPlus();
}
G4MuNeutrinoNucleusTotXsc::~G4MuNeutrinoNucleusTotXsc()
@@ -87,8 +87,9 @@ G4MuNeutrinoNucleusTotXsc::IsIsoApplicable( const G4DynamicParticle* aPart, G4in
{
G4bool result = false;
G4String pName = aPart->GetDefinition()->GetParticleName();
if( pName == "nu_mu" || pName == "anti_nu_mu" )
G4double tKin = aPart->GetKineticEnergy();
if( ( pName == "nu_mu" || pName == "anti_nu_mu") && tKin >= fEmc )
{
result = true;
}
@@ -166,14 +167,14 @@ G4double G4MuNeutrinoNucleusTotXsc::GetIsoCrossSection(const G4DynamicParticle*
ccanuXsc = GetANuMuTotCsXsc(index, energy, Z, A);
ccanuXsc *= fCcFactor;
if( pName == "nu_mu")
if( pName == "nu_mu" )
{
ncXsc = fCofL*ccnuXsc + fCofS*ccanuXsc;
ncXsc *= fNcFactor/fCcFactor;
totXsc = ccnuXsc + ncXsc;
if( totXsc > 0.) fCcTotRatio = ccnuXsc/totXsc;
}
else if( pName == "anti_nu_mu")
else if( pName == "anti_nu_mu" )
{
ncXsc = fCofL*ccanuXsc + fCofS*ccnuXsc;
ncXsc *= fNcFactor/fCcFactor;
@@ -224,7 +225,8 @@ G4double G4MuNeutrinoNucleusTotXsc::GetNuMuTotCsXsc(G4int index, G4double energy
G4int nn = aa - zz;
if(nn < 1) nn = 0;
if( index <= 0 || energy < theMuonMinus->GetPDGMass() ) xsc = aa*fNuMuInXsc[0] + nn*fNuMuQeXsc[0];
// if( index <= 0 || energy < theMuonMinus->GetPDGMass() ) xsc = aa*fNuMuInXsc[0] + nn*fNuMuQeXsc[0];
if( index <= 0 || energy < fEmc ) xsc = aa*fNuMuInXsc[0] + nn*fNuMuQeXsc[0];
else if (index >= fIndex) xsc = aa*fNuMuInXsc[fIndex-1] + nn*fNuMuQeXsc[fIndex-1];
else
{
@@ -259,7 +261,8 @@ G4double G4MuNeutrinoNucleusTotXsc::GetANuMuTotCsXsc(G4int index, G4double energ
{
G4double xsc(0.), qexsc(0.), inxsc(0.);
if( index <= 0 || energy < theMuonPlus->GetPDGMass() ) xsc = aa*fANuMuInXsc[0] + zz*fANuMuQeXsc[0];
// if( index <= 0 || energy < theMuonPlus->GetPDGMass() ) xsc = aa*fANuMuInXsc[0] + zz*fANuMuQeXsc[0];
if( index <= 0 || energy < fEmc ) xsc = aa*fANuMuInXsc[0] + zz*fANuMuQeXsc[0];
else if (index >= fIndex) xsc = aa*fANuMuInXsc[fIndex-1] + zz*fANuMuQeXsc[fIndex-1];
else
{
@@ -293,7 +296,7 @@ G4double G4MuNeutrinoNucleusTotXsc::GetANuMuTotCsXsc(G4int index, G4double energ
G4double G4MuNeutrinoNucleusTotXsc::GetNuMuTotCsArray( G4int index)
{
if( index >= 0 && index < fIndex) return fNuMuInXsc[index] + fNuMuInXsc[index];
if( index >= 0 && index < fIndex) return fNuMuInXsc[index] + fNuMuQeXsc[index];
else
{
G4cout<<"Improper index of fNuMuTotXsc array"<<G4endl;
@@ -47,14 +47,16 @@
#include "G4ElementTable.hh"
#include "G4IsotopeList.hh"
#include "Randomize.hh"
#include "G4Log.hh"
#include "G4Log.hh"
#include "G4AutoLock.hh"
G4ElementData* G4NeutronCaptureXS::data = nullptr;
G4String G4NeutronCaptureXS::gDataDirectory = "";
#ifdef G4MULTITHREADED
G4Mutex G4NeutronCaptureXS::neutronCaptureXSMutex = G4MUTEX_INITIALIZER;
#endif
namespace
{
G4Mutex neutronCaptureXSMutex = G4MUTEX_INITIALIZER;
}
G4NeutronCaptureXS::G4NeutronCaptureXS()
: G4VCrossSectionDataSet(Default_Name()),
@@ -99,21 +101,35 @@ G4NeutronCaptureXS::IsIsoApplicable(const G4DynamicParticle*,
G4double
G4NeutronCaptureXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
G4int ZZ, const G4Material*)
G4int Z, const G4Material*)
{
G4double xs = 0.0;
G4double ekin = aParticle->GetKineticEnergy();
if(ekin > emax) { return xs; }
if(ekin < emax) { xs = ElementCrossSection(ekin, aParticle->GetLogKineticEnergy(), Z); }
return xs;
}
G4double
G4NeutronCaptureXS::ComputeCrossSectionPerElement(G4double ekin, G4double loge,
const G4ParticleDefinition*,
const G4Element* elm,
const G4Material*)
{
G4double xs = 0.0;
if(ekin < emax) { xs = ElementCrossSection(ekin, loge, elm->GetZasInt()); }
return xs;
}
G4double
G4NeutronCaptureXS::ElementCrossSection(G4double ekin, G4double loge, G4int ZZ)
{
G4int Z = std::min(ZZ, MAXZCAPTURE-1);
G4double logEkin = aParticle->GetLogKineticEnergy();
G4double logEkin = loge;
if(ekin < elimit) { ekin = elimit; logEkin = logElimit; }
auto pv = GetPhysicsVector(Z);
if(pv == nullptr) { return xs; }
const G4double e1 = pv->Energy(1);
xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin)
G4double xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin)
: (*pv)[1]*std::sqrt(e1/ekin);
#ifdef G4VERBOSE
@@ -125,6 +141,16 @@ G4NeutronCaptureXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
return xs;
}
G4double
G4NeutronCaptureXS::ComputeIsoCrossSection(G4double ekin, G4double loge,
const G4ParticleDefinition*,
G4int Z, G4int A,
const G4Isotope*, const G4Element*,
const G4Material*)
{
return IsoCrossSection(ekin, loge, Z, A);
}
G4double
G4NeutronCaptureXS::GetIsoCrossSection(const G4DynamicParticle* aParticle,
G4int Z, G4int A,
@@ -187,7 +213,7 @@ const G4Isotope*
G4NeutronCaptureXS::SelectIsotope(const G4Element* anElement,
G4double kinEnergy, G4double logE)
{
size_t nIso = anElement->GetNumberOfIsotopes();
G4int nIso = (G4int)anElement->GetNumberOfIsotopes();
const G4Isotope* iso = anElement->GetIsotope(0);
//G4cout << "SelectIsotope NIso= " << nIso << G4endl;
@@ -201,7 +227,7 @@ G4NeutronCaptureXS::SelectIsotope(const G4Element* anElement,
G4double sum = 0.0;
// is there isotope wise cross section?
size_t j;
G4int j;
if(amax[Z] == amin[Z] || Z >= MAXZCAPTURE) {
for (j = 0; j<nIso; ++j) {
sum += abundVector[j];
@@ -212,7 +238,7 @@ G4NeutronCaptureXS::SelectIsotope(const G4Element* anElement,
}
return iso;
}
size_t nn = temp.size();
G4int nn = (G4int)temp.size();
if(nn < nIso) { temp.resize(nIso, 0.); }
for (j=0; j<nIso; ++j) {
@@ -247,18 +273,14 @@ G4NeutronCaptureXS::BuildPhysicsTable(const G4ParticleDefinition& p)
}
if(nullptr == data) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&neutronCaptureXSMutex);
G4AutoLock l(&neutronCaptureXSMutex);
if(nullptr == data) {
#endif
isMaster = true;
data = new G4ElementData();
data->SetName("NeutronCapture");
FindDirectoryPath();
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&neutronCaptureXSMutex);
#endif
l.unlock();
}
// it is possible re-initialisation for the second run
@@ -272,9 +294,9 @@ G4NeutronCaptureXS::BuildPhysicsTable(const G4ParticleDefinition& p)
}
}
// prepare isotope selection
size_t nIso = temp.size();
std::size_t nIso = temp.size();
for ( auto & elm : *table ) {
size_t n = elm->GetNumberOfIsotopes();
std::size_t n = elm->GetNumberOfIsotopes();
if(n > nIso) { nIso = n; }
}
temp.resize(nIso, 0.0);
@@ -301,15 +323,9 @@ const G4String& G4NeutronCaptureXS::FindDirectoryPath()
void G4NeutronCaptureXS::InitialiseOnFly(G4int Z)
{
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&neutronCaptureXSMutex);
if(nullptr == data->GetElementData(Z)) {
#endif
Initialise(Z);
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&neutronCaptureXSMutex);
#endif
G4AutoLock l(&neutronCaptureXSMutex);
if(nullptr == data->GetElementData(Z)) { Initialise(Z); }
l.unlock();
}
void G4NeutronCaptureXS::Initialise(G4int Z)
@@ -47,6 +47,7 @@
#include "Randomize.hh"
#include "G4SystemOfUnits.hh"
#include "G4IsotopeList.hh"
#include "G4AutoLock.hh"
#include <fstream>
#include <sstream>
@@ -55,9 +56,10 @@ G4PhysicsVector* G4NeutronElasticXS::data[] = {nullptr};
G4double G4NeutronElasticXS::coeff[] = {0.0};
G4String G4NeutronElasticXS::gDataDirectory = "";
#ifdef G4MULTITHREADED
G4Mutex G4NeutronElasticXS::neutronElasticXSMutex = G4MUTEX_INITIALIZER;
#endif
namespace
{
G4Mutex nElasticXSMutex = G4MUTEX_INITIALIZER;
}
G4NeutronElasticXS::G4NeutronElasticXS()
: G4VCrossSectionDataSet(Default_Name()),
@@ -108,26 +110,28 @@ G4bool G4NeutronElasticXS::IsIsoApplicable(const G4DynamicParticle*,
G4double
G4NeutronElasticXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
G4int ZZ, const G4Material*)
G4int Z, const G4Material*)
{
G4double xs = 0.0;
G4double ekin = aParticle->GetKineticEnergy();
return ElementCrossSection(aParticle->GetKineticEnergy(), aParticle->GetLogKineticEnergy(), Z);
}
G4int Z = (ZZ >= MAXZEL) ? MAXZEL - 1 : ZZ;
G4double
G4NeutronElasticXS::ComputeCrossSectionPerElement(G4double ekin, G4double loge,
const G4ParticleDefinition*,
const G4Element* elm,
const G4Material*)
{
return ElementCrossSection(ekin, loge, elm->GetZasInt());
}
G4double G4NeutronElasticXS::ElementCrossSection(G4double ekin, G4double loge, G4int ZZ)
{
G4int Z = (ZZ >= MAXZEL) ? MAXZEL - 1 : ZZ;
auto pv = GetPhysicsVector(Z);
if(pv == nullptr) { return xs; }
// G4cout << "G4NeutronElasticXS::GetCrossSection e= " << ekin
// << " Z= " << Z << G4endl;
if(ekin <= pv->Energy(1)) {
xs = (*pv)[1];
} else if(ekin <= pv->GetMaxEnergy()) {
xs = pv->LogVectorValue(ekin, aParticle->GetLogKineticEnergy());
} else {
xs = coeff[Z]*ggXsection->GetElasticElementCrossSection(neutron,
ekin, Z, aeff[Z]);
}
G4double xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, loge)
: coeff[Z]*ggXsection->GetElasticElementCrossSection(neutron, ekin,
Z, aeff[Z]);
#ifdef G4VERBOSE
if(verboseLevel > 1) {
@@ -139,19 +143,31 @@ G4NeutronElasticXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
return xs;
}
G4double G4NeutronElasticXS::GetIsoCrossSection(
const G4DynamicParticle* aParticle,
G4int Z, G4int A,
const G4Isotope*, const G4Element*,
const G4Material* mat)
G4double
G4NeutronElasticXS::ComputeIsoCrossSection(G4double ekin, G4double loge,
const G4ParticleDefinition*,
G4int Z, G4int A,
const G4Isotope*, const G4Element*,
const G4Material*)
{
return GetElementCrossSection(aParticle, Z, mat) * A/aeff[Z];
}
return ElementCrossSection(ekin, loge, Z)*A/aeff[Z];
}
G4double
G4NeutronElasticXS::GetIsoCrossSection(const G4DynamicParticle* aParticle,
G4int Z, G4int A,
const G4Isotope*, const G4Element*,
const G4Material*)
{
return ElementCrossSection(aParticle->GetKineticEnergy(),
aParticle->GetLogKineticEnergy(), Z)*A/aeff[Z];
}
const G4Isotope* G4NeutronElasticXS::SelectIsotope(
const G4Element* anElement, G4double, G4double)
{
size_t nIso = anElement->GetNumberOfIsotopes();
G4int nIso = (G4int)anElement->GetNumberOfIsotopes();
const G4Isotope* iso = anElement->GetIsotope(0);
//G4cout << "SelectIsotope NIso= " << nIso << G4endl;
@@ -160,10 +176,9 @@ const G4Isotope* G4NeutronElasticXS::SelectIsotope(
const G4double* abundVector = anElement->GetRelativeAbundanceVector();
G4double q = G4UniformRand();
G4double sum = 0.0;
size_t j;
// isotope wise cross section not used
for (j=0; j<nIso; ++j) {
for (G4int j=0; j<nIso; ++j) {
sum += abundVector[j];
if(q <= sum) {
iso = anElement->GetIsotope(j);
@@ -189,17 +204,13 @@ G4NeutronElasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
return;
}
if(0. == coeff[0]) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&neutronElasticXSMutex);
G4AutoLock l(&nElasticXSMutex);
if(0. == coeff[0]) {
#endif
coeff[0] = 1.0;
isMaster = true;
FindDirectoryPath();
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&neutronElasticXSMutex);
#endif
l.unlock();
}
// it is possible re-initialisation for the second run
@@ -235,15 +246,11 @@ const G4String& G4NeutronElasticXS::FindDirectoryPath()
void G4NeutronElasticXS::InitialiseOnFly(G4int Z)
{
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&neutronElasticXSMutex);
if(data[Z] == nullptr) {
#endif
Initialise(Z);
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&neutronElasticXSMutex);
#endif
if(nullptr == data[Z]) {
G4AutoLock l(&nElasticXSMutex);
if(nullptr == data[Z]) { Initialise(Z); }
l.unlock();
}
}
void G4NeutronElasticXS::Initialise(G4int Z)
@@ -45,6 +45,7 @@
#include "Randomize.hh"
#include "G4SystemOfUnits.hh"
#include "G4IsotopeList.hh"
#include "G4AutoLock.hh"
#include <fstream>
#include <sstream>
@@ -53,13 +54,15 @@ G4double G4NeutronInelasticXS::coeff[] = {1.0};
G4ElementData* G4NeutronInelasticXS::data = nullptr;
G4String G4NeutronInelasticXS::gDataDirectory = "";
#ifdef G4MULTITHREADED
G4Mutex G4NeutronInelasticXS::neutronInelasticXSMutex = G4MUTEX_INITIALIZER;
#endif
namespace
{
G4Mutex nInelasticXSMutex = G4MUTEX_INITIALIZER;
}
G4NeutronInelasticXS::G4NeutronInelasticXS()
: G4VCrossSectionDataSet(Default_Name()),
neutron(G4Neutron::Neutron())
neutron(G4Neutron::Neutron()),
elimit(20*CLHEP::MeV)
{
verboseLevel = 0;
if(verboseLevel > 0){
@@ -100,26 +103,30 @@ G4NeutronInelasticXS::IsIsoApplicable(const G4DynamicParticle*,
return true;
}
G4double G4NeutronInelasticXS::GetElementCrossSection(
const G4DynamicParticle* aParticle,
G4int ZZ, const G4Material*)
G4double
G4NeutronInelasticXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
G4int Z, const G4Material*)
{
G4double xs = 0.0;
G4double ekin = aParticle->GetKineticEnergy();
return ElementCrossSection(aParticle->GetKineticEnergy(), aParticle->GetLogKineticEnergy(), Z);
}
G4double
G4NeutronInelasticXS::ComputeCrossSectionPerElement(G4double ekin, G4double loge,
const G4ParticleDefinition*,
const G4Element* elm,
const G4Material*)
{
return ElementCrossSection(ekin, loge, elm->GetZasInt());
}
G4double G4NeutronInelasticXS::ElementCrossSection(G4double ekin, G4double loge, G4int ZZ)
{
G4int Z = (ZZ >= MAXZINEL) ? MAXZINEL - 1 : ZZ;
auto pv = GetPhysicsVector(Z);
if(pv == nullptr) { return xs; }
// G4cout << "G4NeutronInelasticXS::GetCrossSection e= " << ekin
// << " Z= " << Z << G4endl;
if(ekin <= pv->GetMaxEnergy()) {
xs = pv->LogVectorValue(ekin, aParticle->GetLogKineticEnergy());
} else {
xs = coeff[Z]*ggXsection->GetInelasticElementCrossSection(neutron,
ekin, Z, aeff[Z]);
}
G4double xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, loge)
: coeff[Z]*ggXsection->GetInelasticElementCrossSection(neutron, ekin,
Z, aeff[Z]);
#ifdef G4VERBOSE
if(verboseLevel > 1) {
@@ -131,22 +138,32 @@ G4double G4NeutronInelasticXS::GetElementCrossSection(
return xs;
}
G4double G4NeutronInelasticXS::GetIsoCrossSection(
const G4DynamicParticle* aParticle,
G4int Z, G4int A,
const G4Isotope*, const G4Element*,
const G4Material*)
G4double
G4NeutronInelasticXS::ComputeIsoCrossSection(G4double ekin, G4double loge,
const G4ParticleDefinition*,
G4int Z, G4int A,
const G4Isotope*, const G4Element*,
const G4Material*)
{
return IsoCrossSection(aParticle->GetKineticEnergy(),
aParticle->GetLogKineticEnergy(), Z, A);
return IsoCrossSection(ekin, loge, Z, A);
}
G4double
G4double
G4NeutronInelasticXS::GetIsoCrossSection(const G4DynamicParticle* aParticle,
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,
G4int ZZ, G4int A)
{
G4double xs = 0.0;
G4int Z = (ZZ >= MAXZINEL) ? MAXZINEL - 1 : ZZ;
G4int Z = (ZZ >= MAXZINEL) ? MAXZINEL - 1 : ZZ;
/*
G4cout << "IsoCrossSection Z= " << Z << " A= " << A
@@ -154,13 +171,11 @@ G4NeutronInelasticXS::IsoCrossSection(G4double ekin, G4double logekin,
<< " E(MeV)= " << ekin << G4endl;
*/
auto pv = GetPhysicsVector(Z);
if(pv == nullptr) { return xs; }
// compute isotope cross section if applicable
const G4double emax = pv->GetMaxEnergy();
if(ekin <= emax && amin[Z] < amax[Z] && A >= amin[Z] && A <= amax[Z]) {
if(ekin <= elimit && amin[Z] < amax[Z] && A >= amin[Z] && A <= amax[Z]) {
auto pviso = data->GetComponentDataByIndex(Z, A - amin[Z]);
if(pviso) {
if(nullptr != pviso) {
xs = pviso->LogVectorValue(ekin, logekin);
#ifdef G4VERBOSE
if(verboseLevel > 1) {
@@ -174,13 +189,10 @@ G4NeutronInelasticXS::IsoCrossSection(G4double ekin, G4double logekin,
}
}
// use element x-section
if(ekin <= emax) {
xs = pv->LogVectorValue(ekin, logekin);
} else {
xs = coeff[Z]*ggXsection->GetInelasticElementCrossSection(neutron,
ekin, Z, aeff[Z]);
}
// use element x-section
xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, logekin)
: coeff[Z]*ggXsection->GetInelasticElementCrossSection(neutron, ekin,
Z, aeff[Z]);
xs *= A/aeff[Z];
#ifdef G4VERBOSE
if(verboseLevel > 1) {
@@ -195,7 +207,7 @@ G4NeutronInelasticXS::IsoCrossSection(G4double ekin, G4double logekin,
const G4Isotope* G4NeutronInelasticXS::SelectIsotope(
const G4Element* anElement, G4double kinEnergy, G4double logE)
{
size_t nIso = anElement->GetNumberOfIsotopes();
G4int nIso = (G4int)anElement->GetNumberOfIsotopes();
const G4Isotope* iso = anElement->GetIsotope(0);
//G4cout << "SelectIsotope NIso= " << nIso << G4endl;
@@ -208,7 +220,7 @@ const G4Isotope* G4NeutronInelasticXS::SelectIsotope(
const G4double* abundVector = anElement->GetRelativeAbundanceVector();
G4double q = G4UniformRand();
G4double sum = 0.0;
size_t j;
G4int j;
// isotope wise cross section not available
if(amax[Z] == amin[Z] || Z >= MAXZINEL) {
@@ -223,7 +235,7 @@ const G4Isotope* G4NeutronInelasticXS::SelectIsotope(
}
// use isotope cross sections
size_t nn = temp.size();
G4int nn = (G4int)temp.size();
if(nn < nIso) { temp.resize(nIso, 0.); }
for (j=0; j<nIso; ++j) {
@@ -260,18 +272,14 @@ G4NeutronInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
}
if(nullptr == data) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&neutronInelasticXSMutex);
G4AutoLock l(&nInelasticXSMutex);
if(nullptr == data) {
#endif
isMaster = true;
data = new G4ElementData();
data->SetName("NeutronInelastic");
FindDirectoryPath();
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&neutronInelasticXSMutex);
#endif
l.unlock();
}
// it is possible re-initialisation for the new run
@@ -284,9 +292,9 @@ G4NeutronInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
}
}
// prepare isotope selection
size_t nIso = temp.size();
std::size_t nIso = temp.size();
for ( auto & elm : *table ) {
size_t n = elm->GetNumberOfIsotopes();
std::size_t n = elm->GetNumberOfIsotopes();
if(n > nIso) { nIso = n; }
}
temp.resize(nIso, 0.0);
@@ -313,15 +321,11 @@ const G4String& G4NeutronInelasticXS::FindDirectoryPath()
void G4NeutronInelasticXS::InitialiseOnFly(G4int Z)
{
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&neutronInelasticXSMutex);
if(nullptr == data->GetElementData(Z)) {
#endif
Initialise(Z);
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&neutronInelasticXSMutex);
#endif
if(nullptr == data->GetElementData(Z)) {
G4AutoLock l(&nInelasticXSMutex);
if(nullptr == data->GetElementData(Z)) { Initialise(Z); }
l.unlock();
}
}
void G4NeutronInelasticXS::Initialise(G4int Z)
@@ -333,11 +337,11 @@ void G4NeutronInelasticXS::Initialise(G4int Z)
ost << FindDirectoryPath() << Z;
G4PhysicsVector* v = RetrieveVector(ost, true);
data->InitialiseForElement(Z, v);
/*
G4cout << "G4NeutronInelasticXS::Initialise for Z= " << Z
<< " A= " << Amean << " Amin= " << amin[Z]
<< " Amax= " << amax[Z] << G4endl;
*/
if(verboseLevel > 1) {
G4cout << "G4NeutronInelasticXS::Initialise for Z= " << Z
<< " A= " << aeff[Z] << " Amin= " << amin[Z]
<< " Amax= " << amax[Z] << G4endl;
}
// upload isotope data
if(amin[Z] < amax[Z]) {
G4int nmax = amax[Z] - amin[Z] + 1;
@@ -50,6 +50,7 @@
#include "G4SystemOfUnits.hh"
#include "G4IsotopeList.hh"
#include "G4HadronicParameters.hh"
#include "G4AutoLock.hh"
#include <fstream>
#include <sstream>
@@ -58,13 +59,15 @@ G4ElementData* G4ParticleInelasticXS::data[] = {nullptr};
G4double G4ParticleInelasticXS::coeff[MAXZINELP][5] = {{1.0}, {1.0}, {1.0}, {1.0}, {1.0}};
G4String G4ParticleInelasticXS::gDataDirectory[] = {""};
#ifdef G4MULTITHREADED
G4Mutex G4ParticleInelasticXS::particleInelasticXSMutex = G4MUTEX_INITIALIZER;
#endif
namespace
{
G4Mutex pInelasticXSMutex = G4MUTEX_INITIALIZER;
}
G4ParticleInelasticXS::G4ParticleInelasticXS(const G4ParticleDefinition* part)
: G4VCrossSectionDataSet("G4ParticleInelasticXS"),
particle(part)
particle(part),
elimit(20*CLHEP::MeV)
{
if(nullptr == part) {
G4Exception("G4ParticleInelasticXS::G4ParticleInelasticXS(..)","had015",
@@ -133,26 +136,30 @@ G4ParticleInelasticXS::IsIsoApplicable(const G4DynamicParticle*,
return true;
}
G4double G4ParticleInelasticXS::GetElementCrossSection(
const G4DynamicParticle* aParticle,
G4int ZZ, const G4Material*)
G4double
G4ParticleInelasticXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
G4int Z, const G4Material*)
{
G4double xs = 0.0;
G4double ekin = aParticle->GetKineticEnergy();
return ElementCrossSection(aParticle->GetKineticEnergy(), aParticle->GetLogKineticEnergy(), Z);
}
G4double
G4ParticleInelasticXS::ComputeCrossSectionPerElement(G4double ekin, G4double loge,
const G4ParticleDefinition*,
const G4Element* elm,
const G4Material*)
{
return ElementCrossSection(ekin, loge, elm->GetZasInt());
}
G4double G4ParticleInelasticXS::ElementCrossSection(G4double ekin, G4double loge, G4int ZZ)
{
G4int Z = (ZZ >= MAXZINELP) ? MAXZINELP - 1 : ZZ;
auto pv = GetPhysicsVector(Z);
if(nullptr == pv) { return xs; }
// G4cout << "G4ParticleInelasticXS::GetCrossSection e= " << ekin
// << " Z= " << Z << G4endl;
if(ekin <= pv->GetMaxEnergy()) {
xs = pv->LogVectorValue(ekin, aParticle->GetLogKineticEnergy());
} else {
xs = coeff[Z][index]*highEnergyXsection->GetInelasticElementCrossSection(particle,
G4double xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, loge)
: coeff[Z][index]*highEnergyXsection->GetInelasticElementCrossSection(particle,
ekin, Z, aeff[Z]);
}
#ifdef G4VERBOSE
if(verboseLevel > 1) {
@@ -165,13 +172,22 @@ G4double G4ParticleInelasticXS::GetElementCrossSection(
return xs;
}
G4double G4ParticleInelasticXS::GetIsoCrossSection(
const G4DynamicParticle* aParticle,
G4int Z, G4int A,
const G4Isotope*, const G4Element*, const G4Material*)
G4double
G4ParticleInelasticXS::ComputeIsoCrossSection(G4double ekin, G4double loge,
const G4ParticleDefinition*,
G4int Z, G4int A, const G4Isotope*,
const G4Element*, const G4Material*)
{
return IsoCrossSection(ekin, loge, Z, A);
}
G4double
G4ParticleInelasticXS::GetIsoCrossSection(const G4DynamicParticle* aParticle,
G4int Z, G4int A, const G4Isotope*,
const G4Element*, const G4Material*)
{
return IsoCrossSection(aParticle->GetKineticEnergy(),
aParticle->GetLogKineticEnergy(),Z, A);
aParticle->GetLogKineticEnergy(), Z, A);
}
G4double
@@ -180,18 +196,10 @@ G4ParticleInelasticXS::IsoCrossSection(G4double ekin, G4double logE,
{
G4double xs = 0.0;
G4int Z = (ZZ >= MAXZINELP) ? MAXZINELP - 1 : ZZ;
/*
G4cout << "G4ParticleInelasticXS: IsoCrossSection Z= "
<< Z << " A= " << A
<< " Amin= " << amin[Z] << " Amax= " << amax[Z]
<< " E(MeV)= " << ekin << G4endl;
*/
auto pv = GetPhysicsVector(Z);
if(pv == nullptr) { return xs; }
// compute isotope cross section if applicable
const G4double emax = pv->GetMaxEnergy();
if(ekin <= emax && amin[Z] < amax[Z] && A >= amin[Z] && A <= amax[Z]) {
if(ekin <= elimit && amin[Z] < amax[Z] && A >= amin[Z] && A <= amax[Z]) {
auto pviso = data[index]->GetComponentDataByIndex(Z, A - amin[Z]);
if(pviso != nullptr) {
xs = pviso->LogVectorValue(ekin, logE);
@@ -208,13 +216,10 @@ G4ParticleInelasticXS::IsoCrossSection(G4double ekin, G4double logE,
}
}
// use element x-section
if(ekin <= emax) {
xs = pv->LogVectorValue(ekin, logE);
} else {
xs = coeff[Z][index] *
xs = (ekin <= pv->GetMaxEnergy()) ? pv->LogVectorValue(ekin, logE)
: coeff[Z][index] *
highEnergyXsection->GetInelasticElementCrossSection(particle,
ekin, Z, aeff[Z]);
}
xs *= A/aeff[Z];
#ifdef G4VERBOSE
if(verboseLevel > 1) {
@@ -231,20 +236,18 @@ G4ParticleInelasticXS::IsoCrossSection(G4double ekin, G4double logE,
const G4Isotope* G4ParticleInelasticXS::SelectIsotope(
const G4Element* anElement, G4double kinEnergy, G4double logE)
{
size_t nIso = anElement->GetNumberOfIsotopes();
G4int nIso = (G4int)anElement->GetNumberOfIsotopes();
const G4Isotope* iso = anElement->GetIsotope(0);
//G4cout << "SelectIsotope NIso= " << nIso << G4endl;
if(1 == nIso) { return iso; }
// more than 1 isotope
G4int Z = anElement->GetZasInt();
//G4cout << "SelectIsotope Z= " << Z << G4endl;
const G4double* abundVector = anElement->GetRelativeAbundanceVector();
G4double q = G4UniformRand();
G4double sum = 0.0;
size_t j;
G4int j;
// isotope wise cross section not available
if(amax[Z] == amin[Z] || Z >= MAXZINELP) {
@@ -258,12 +261,10 @@ const G4Isotope* G4ParticleInelasticXS::SelectIsotope(
return iso;
}
size_t nn = temp.size();
G4int nn = (G4int)temp.size();
if(nn < nIso) { temp.resize(nIso, 0.); }
for (j=0; j<nIso; ++j) {
//G4cout << j << "-th isotope " << (*isoVector)[j]->GetN()
// << " abund= " << abundVector[j] << G4endl;
sum += abundVector[j]*IsoCrossSection(kinEnergy, logE, Z,
anElement->GetIsotope(j)->GetN());
temp[j] = sum;
@@ -298,18 +299,14 @@ G4ParticleInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
SetMaxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy() * fact);
if(data[index] == nullptr) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&particleInelasticXSMutex);
G4AutoLock l(&pInelasticXSMutex);
if(data[index] == nullptr) {
#endif
isMaster = true;
data[index] = new G4ElementData();
data[index]->SetName(particle->GetParticleName() + "Inelastic");
FindDirectoryPath();
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&particleInelasticXSMutex);
#endif
l.unlock();
}
// it is possible re-initialisation for the new run
@@ -323,9 +320,9 @@ G4ParticleInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
}
}
// prepare isotope selection
size_t nIso = temp.size();
std::size_t nIso = temp.size();
for ( auto & elm : *table ) {
size_t n = elm->GetNumberOfIsotopes();
std::size_t n = elm->GetNumberOfIsotopes();
if(n > nIso) { nIso = n; }
}
temp.resize(nIso, 0.0);
@@ -352,15 +349,13 @@ const G4String& G4ParticleInelasticXS::FindDirectoryPath()
void G4ParticleInelasticXS::InitialiseOnFly(G4int Z)
{
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&particleInelasticXSMutex);
if(nullptr == data[index]->GetElementData(Z)) {
#endif
Initialise(Z);
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&particleInelasticXSMutex);
#endif
if(nullptr == data[index]->GetElementData(Z)) {
G4AutoLock l(&pInelasticXSMutex);
if(nullptr == data[index]->GetElementData(Z)) {
Initialise(Z);
}
l.unlock();
}
}
void G4ParticleInelasticXS::Initialise(G4int Z)
@@ -372,13 +367,7 @@ void G4ParticleInelasticXS::Initialise(G4int Z)
ost << FindDirectoryPath() << Z ;
G4PhysicsVector* v = RetrieveVector(ost, true);
data[index]->InitialiseForElement(Z, v);
/*
G4cout << "G4ParticleInelasticXS::Initialise for Z= " << Z
<< " idx= " << index
<< " Amin= " << amin[Z]
<< " Amax= " << amax[Z]
<< " " << FindDirectoryPath() << G4endl;
*/
// upload isotope data
if(amin[Z] < amax[Z]) {
G4int nmax = amax[Z] - amin[Z] + 1;
@@ -389,10 +378,6 @@ void G4ParticleInelasticXS::Initialise(G4int Z)
ost1 << FindDirectoryPath() << Z << "_" << A;
G4PhysicsVector* v1 = RetrieveVector(ost1, false);
data[index]->AddComponent(Z, A, v1);
/*
G4cout << " Isotope x-section Z= " << Z << " A= " << A
<< " v1= " << v1 << G4endl;
*/
}
}
// smooth transition
@@ -401,10 +386,6 @@ void G4ParticleInelasticXS::Initialise(G4int Z)
G4double sig2 = highEnergyXsection->GetInelasticElementCrossSection(
particle, ehigh, Z, aeff[Z]);
coeff[Z][index] = (sig2 > 0.) ? sig1/sig2 : 1.0;
/*
G4cout << "G4ParticleInelasticXS: index= " << index
<< " Z= " << Z << " coeff= " << coeff[Z][index] << G4endl;
*/
}
G4PhysicsVector*
@@ -0,0 +1,408 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "G4TauNeutrinoNucleusTotXsc.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleTable.hh"
#include "G4IonTable.hh"
#include "G4HadTmpUtil.hh"
#include "G4NistManager.hh"
#include "G4Material.hh"
#include "G4Element.hh"
#include "G4Isotope.hh"
#include "G4ElementVector.hh"
#include "G4MuonMinus.hh"
#include "G4MuonPlus.hh"
using namespace std;
using namespace CLHEP;
G4TauNeutrinoNucleusTotXsc::G4TauNeutrinoNucleusTotXsc()
: G4VCrossSectionDataSet("NuMuNuclTotXsc")
{
fCofXsc = 1.e-38*cm2/GeV;
// G4cout<<"fCofXsc = "<<fCofXsc*GeV/cm2<<" cm2/GeV"<<G4endl;
// PDG2016: sin^2 theta Weinberg
fSin2tW = 0.23129; // 0.2312;
// 9 <-> 6, 5/9 or 5/6 ?
fCofS = 5.*fSin2tW*fSin2tW/9.;
fCofL = 1. - fSin2tW + fCofS;
// G4cout<<"fCosL = "<<fCofL<<", fCofS = "<<fCofS<<G4endl;
fCutEnergy = 0.; // default value
fBiasingFactor = 1.; // default as physics
fEmc = 0.2*GeV;
G4double mt = 1.77686*GeV;
G4double mnp = 0.5*(proton_mass_c2+neutron_mass_c2);
fEtc = mt + 0.5*mt*mt/mnp;
fDtc = fEtc - fEmc;
fIndex = 50;
fTotXsc = 0.;
fCcTotRatio = 0.75; // from nc/cc~0.33 ratio
fCcFactor = fNcFactor = 1.;
fQEratio = 0.5; // mean in the 1 GeV range
// theMuonMinus = G4MuonMinus::MuonMinus();
// theMuonPlus = G4MuonPlus::MuonPlus();
}
G4TauNeutrinoNucleusTotXsc::~G4TauNeutrinoNucleusTotXsc()
{}
//////////////////////////////////////////////////////
G4bool
G4TauNeutrinoNucleusTotXsc::IsIsoApplicable( const G4DynamicParticle* aPart, G4int, G4int, const G4Element*, const G4Material*)
{
G4bool result = false;
G4String pName = aPart->GetDefinition()->GetParticleName();
G4double tKin = aPart->GetKineticEnergy();
if( ( pName == "nu_tau" || pName == "anti_nu_tau") && tKin >= fEtc )
{
result = true;
}
return result;
}
//////////////////////////////////////
G4double G4TauNeutrinoNucleusTotXsc::GetElementCrossSection(const G4DynamicParticle* part,
G4int Z, const G4Material* mat )
{
G4int Zi(0);
size_t i(0), j(0);
const G4ElementVector* theElementVector = mat->GetElementVector();
for ( i = 0; i < theElementVector->size(); ++i )
{
Zi = (*theElementVector)[i]->GetZasInt();
if( Zi == Z ) break;
}
const G4Element* elm = (*theElementVector)[i];
size_t nIso = elm->GetNumberOfIsotopes();
G4double fact = 0.0;
G4double xsec = 0.0;
const G4Isotope* iso = nullptr;
const G4IsotopeVector* isoVector = elm->GetIsotopeVector();
const G4double* abundVector = elm->GetRelativeAbundanceVector();
for (j = 0; j<nIso; ++j)
{
iso = (*isoVector)[j];
G4int A = iso->GetN();
if( abundVector[j] > 0.0 && IsIsoApplicable(part, Z, A, elm, mat) )
{
fact += abundVector[j];
xsec += abundVector[j]*GetIsoCrossSection( part, Z, A, iso, elm, mat);
}
}
if( fact > 0.0) { xsec /= fact; }
return xsec;
}
////////////////////////////////////////////////////
//
//
G4double G4TauNeutrinoNucleusTotXsc::GetIsoCrossSection(const G4DynamicParticle* aPart, G4int Z, G4int A,
const G4Isotope*, const G4Element*, const G4Material* )
{
fCcFactor = fNcFactor = 1.;
fCcTotRatio = 0.25;
G4double ccnuXsc, ccanuXsc, ncXsc, totXsc(0.);
G4double energy = aPart->GetTotalEnergy();
G4String pName = aPart->GetDefinition()->GetParticleName();
if( pName == "nu_tau" || pName == "ant_nu_tau" ) energy -= fDtc; // scaling energy for tau-neutrinos
G4int index = GetEnergyIndex(energy);
if( index >= fIndex )
{
G4double pm = proton_mass_c2;
G4double s2 = 2.*energy*pm+pm*pm;
G4double aa = 1.;
G4double bb = 1.085;
G4double mw = 80.385*GeV;
fCcFactor = bb/(1.+ aa*s2/mw/mw);
G4double mz = 91.1876*GeV;
fNcFactor = bb/(1.+ aa*s2/mz/mz);
}
ccnuXsc = GetNuMuTotCsXsc(index, energy, Z, A);
ccnuXsc *= fCcFactor;
ccanuXsc = GetANuMuTotCsXsc(index, energy, Z, A);
ccanuXsc *= fCcFactor;
if( pName == "nu_tau")
{
ncXsc = fCofL*ccnuXsc + fCofS*ccanuXsc;
ncXsc *= fNcFactor/fCcFactor;
totXsc = ccnuXsc + ncXsc;
if( totXsc > 0.) fCcTotRatio = ccnuXsc/totXsc;
}
else if( pName == "anti_nu_tau")
{
ncXsc = fCofL*ccanuXsc + fCofS*ccnuXsc;
ncXsc *= fNcFactor/fCcFactor;
totXsc = ccanuXsc + ncXsc;
if( totXsc > 0.) fCcTotRatio = ccanuXsc/totXsc;
}
else return totXsc;
totXsc *= fCofXsc;
totXsc *= energy;
// totXsc *= A; // incoherent sum over all isotope nucleons
totXsc *= fBiasingFactor; // biasing up, if set >1
fTotXsc = totXsc;
return totXsc;
}
/////////////////////////////////////////////////////
//
// Return index of nu/anu energy array corresponding to the neutrino energy
G4int G4TauNeutrinoNucleusTotXsc::GetEnergyIndex(G4double energy)
{
G4int i, eIndex = 0;
for( i = 0; i < fIndex; i++)
{
if( energy <= fNuMuEnergy[i]*GeV )
{
eIndex = i;
break;
}
}
if( i >= fIndex ) eIndex = i;
// G4cout<<"eIndex = "<<eIndex<<G4endl;
return eIndex;
}
/////////////////////////////////////////////////////
//
// nu_mu xsc for index-1, index linear over energy
G4double G4TauNeutrinoNucleusTotXsc::GetNuMuTotCsXsc(G4int index, G4double energy, G4int zz, G4int aa)
{
G4double xsc(0.), qexsc(0.), inxsc(0.);
G4int nn = aa - zz;
if(nn < 1) nn = 0;
// if( index <= 0 || energy < theMuonMinus->GetPDGMass() ) xsc = aa*fNuMuInXsc[0] + nn*fNuMuQeXsc[0];
if( index <= 0 || energy < fEmc ) xsc = aa*fNuMuInXsc[0] + nn*fNuMuQeXsc[0];
else if (index >= fIndex) xsc = aa*fNuMuInXsc[fIndex-1] + nn*fNuMuQeXsc[fIndex-1];
else
{
G4double x1 = fNuMuEnergy[index-1]*GeV;
G4double x2 = fNuMuEnergy[index]*GeV;
G4double y1 = fNuMuInXsc[index-1];
G4double y2 = fNuMuInXsc[index];
G4double z1 = fNuMuQeXsc[index-1];
G4double z2 = fNuMuQeXsc[index];
if(x1 >= x2) return aa*fNuMuInXsc[index] + nn*fNuMuQeXsc[index];
else
{
G4double angle = (y2-y1)/(x2-x1);
inxsc = y1 + (energy-x1)*angle;
angle = (z2-z1)/(x2-x1);
qexsc = z1 + (energy-x1)*angle;
qexsc *= nn;
xsc = inxsc*aa + qexsc;
if( xsc > 0.) fQEratio = qexsc/xsc;
}
}
return xsc;
}
/////////////////////////////////////////////////////
//
// anu_mu xsc for index-1, index linear over energy
G4double G4TauNeutrinoNucleusTotXsc::GetANuMuTotCsXsc(G4int index, G4double energy, G4int zz, G4int aa)
{
G4double xsc(0.), qexsc(0.), inxsc(0.);
// if( index <= 0 || energy < theMuonPlus->GetPDGMass() ) xsc = aa*fANuMuInXsc[0] + zz*fANuMuQeXsc[0];
if( index <= 0 || energy < fEmc ) xsc = aa*fANuMuInXsc[0] + zz*fANuMuQeXsc[0];
else if (index >= fIndex) xsc = aa*fANuMuInXsc[fIndex-1] + zz*fANuMuQeXsc[fIndex-1];
else
{
G4double x1 = fNuMuEnergy[index-1]*GeV;
G4double x2 = fNuMuEnergy[index]*GeV;
G4double y1 = fANuMuInXsc[index-1];
G4double y2 = fANuMuInXsc[index];
G4double z1 = fANuMuQeXsc[index-1];
G4double z2 = fANuMuQeXsc[index];
if( x1 >= x2 ) return aa*fANuMuInXsc[index] + zz*fANuMuQeXsc[index];
else
{
G4double angle = (y2-y1)/(x2-x1);
inxsc = y1 + (energy-x1)*angle;
angle = (z2-z1)/(x2-x1);
qexsc = z1 + (energy-x1)*angle;
qexsc *= zz;
xsc = inxsc*aa + qexsc;
if( xsc > 0.) fQEratio = qexsc/xsc;
}
}
return xsc;
}
////////////////////////////////////////////////////////
//
// return fNuMuTotXsc[index] if the index is in the array range
G4double G4TauNeutrinoNucleusTotXsc::GetNuMuTotCsArray( G4int index)
{
if( index >= 0 && index < fIndex) return fNuMuInXsc[index] + fNuMuQeXsc[index];
else
{
G4cout<<"Improper index of fNuMuTotXsc array"<<G4endl;
return 0.;
}
}
////////////////////////////////////////////////////////
//
// return fANuMuTotXsc[index] if the index is in the array range
G4double G4TauNeutrinoNucleusTotXsc::GetANuMuTotCsArray( G4int index)
{
if( index >= 0 && index < fIndex) return fANuMuInXsc[index] + fANuMuQeXsc[index];
else
{
G4cout<<"Improper index of fANuMuTotXsc array"<<G4endl;
return 0.;
}
}
///////////////////////////////////////////////////////
//
// E_nu in GeV, ( Eth = 111.603 MeV, EthW = 330.994 MeV)
const G4double G4TauNeutrinoNucleusTotXsc::fNuMuEnergy[50] =
{
0.12, 0.141136, 0.165996, 0.195233, 0.229621,
0.270066, 0.317634, 0.373581, 0.439382, 0.516773,
0.607795, 0.714849, 0.84076, 0.988848, 1.16302,
1.36787, 1.6088, 1.89217, 2.22545, 2.61743,
3.07845, 3.62068, 4.25841, 5.00847, 5.89065,
6.9282, 8.14851, 9.58376, 11.2718, 13.2572,
15.5922, 18.3386, 21.5687, 25.3677, 29.8359,
35.0911, 41.2719, 48.5413, 57.0912, 67.147,
78.974, 92.8842, 109.244, 128.486, 151.117,
177.735, 209.04, 245.86, 289.164, 340.097 };
////////////////////////////////////////////////////
//
// XS/E arrays in 10^-38cm2/GeV
const G4double G4TauNeutrinoNucleusTotXsc::fNuMuInXsc[50] =
{
0, 0, 0, 0, 0,
0, 0, 0.0166853, 0.0649693, 0.132346,
0.209102, 0.286795, 0.3595, 0.423961, 0.479009,
0.524797, 0.562165, 0.592225, 0.61612, 0.63491,
0.649524, 0.660751, 0.669245, 0.675546, 0.680092,
0.683247, 0.685307, 0.686521, 0.687093, 0.687184,
0.686919, 0.686384, 0.685631, 0.684689, 0.68357,
0.682275, 0.680806, 0.67917, 0.677376, 0.675442,
0.673387, 0.671229, 0.668985, 0.666665, 0.664272,
0.661804, 0.65925, 0.656593, 0.65381, 0.650871 };
const G4double G4TauNeutrinoNucleusTotXsc::fNuMuQeXsc[50] =
{
0.20787, 0.411055, 0.570762, 0.705379, 0.814702,
0.89543, 0.944299, 0.959743, 0.942906, 0.897917,
0.831331, 0.750948, 0.66443, 0.578191, 0.496828,
0.423071, 0.358103, 0.302016, 0.254241, 0.213889,
0.179971, 0.151527, 0.12769, 0.107706, 0.0909373,
0.0768491, 0.0649975, 0.0550143, 0.0465948, 0.0394861,
0.0334782, 0.0283964, 0.0240945, 0.0204506, 0.0173623,
0.0147437, 0.0125223, 0.0106374, 0.00903737, 0.00767892,
0.00652531, 0.00554547, 0.0047131, 0.0040059, 0.003405,
0.00289436, 0.00246039, 0.00209155, 0.00177804, 0.00151152 };
//////////////////////////////////////////////////////////////////
const G4double G4TauNeutrinoNucleusTotXsc::fANuMuInXsc[50] =
{
0, 0, 0, 0, 0,
0, 0, 0.00437363, 0.0161485, 0.0333162,
0.0557621, 0.0814548, 0.108838, 0.136598, 0.163526,
0.188908, 0.212041, 0.232727, 0.250872, 0.26631,
0.279467, 0.290341, 0.299177, 0.306299, 0.311864,
0.316108, 0.319378, 0.321892, 0.323583, 0.324909,
0.325841, 0.326568, 0.327111, 0.327623, 0.32798,
0.328412, 0.328704, 0.328988, 0.329326, 0.329559,
0.329791, 0.330051, 0.330327, 0.33057, 0.330834,
0.331115, 0.331416, 0.331678, 0.33192, 0.332124 };
//////////////////////////////////////////////////////////////////
const G4double G4TauNeutrinoNucleusTotXsc::fANuMuQeXsc[50] =
{
0.0770264, 0.138754, 0.177006, 0.202417, 0.21804,
0.225742, 0.227151, 0.223805, 0.21709, 0.208137,
0.197763, 0.186496, 0.174651, 0.162429, 0.14999,
0.137498, 0.125127, 0.113057, 0.101455, 0.0904642,
0.0801914, 0.0707075, 0.0620483, 0.0542192, 0.0472011,
0.0409571, 0.0354377, 0.0305862, 0.0263422, 0.0226451,
0.0194358, 0.0166585, 0.0142613, 0.0121968, 0.0104221,
0.00889912, 0.00759389, 0.00647662, 0.00552119, 0.00470487,
0.00400791, 0.00341322, 0.00290607, 0.00247377, 0.0021054,
0.00179162, 0.00152441, 0.00129691, 0.00110323, 0.000938345 };
////////////////////
@@ -91,14 +91,14 @@ G4VCrossSectionDataSet::ComputeCrossSection(const G4DynamicParticle* part,
// isotope-wise cross section making sum over available
// isotope cross sections, which may be incomplete, so
// the result is corrected
size_t nIso = elm->GetNumberOfIsotopes();
std::size_t nIso = elm->GetNumberOfIsotopes();
G4double fact = 0.0;
G4double xsec = 0.0;
// user-defined isotope abundances
const G4IsotopeVector* isoVector = elm->GetIsotopeVector();
const G4double* abundVector = elm->GetRelativeAbundanceVector();
for (size_t j=0; j<nIso; ++j) {
for (std::size_t j=0; j<nIso; ++j) {
const G4Isotope* iso = (*isoVector)[j];
G4int A = iso->GetN();
if(abundVector[j] > 0.0 && IsIsoApplicable(part, Z, A, elm, mat)) {
@@ -109,6 +109,26 @@ G4VCrossSectionDataSet::ComputeCrossSection(const G4DynamicParticle* part,
return (fact > 0.0) ? xsec/fact : 0.0;
}
G4double
G4VCrossSectionDataSet::ComputeCrossSectionPerElement(
G4double kinEnergy, G4double loge,
const G4ParticleDefinition* pd,
const G4Element* elm, const G4Material* mat)
{
G4int Z = elm->GetZasInt();
std::size_t nIso = elm->GetNumberOfIsotopes();
G4double xsec = 0.0;
const G4IsotopeVector* isoVector = elm->GetIsotopeVector();
const G4double* abundVector = elm->GetRelativeAbundanceVector();
for (std::size_t j=0; j<nIso; ++j) {
const G4Isotope* iso = (*isoVector)[j];
G4int A = iso->GetN();
xsec += abundVector[j]*
ComputeIsoCrossSection(kinEnergy, loge, pd, Z, A, iso, elm, mat);
}
return xsec;
}
G4double
G4VCrossSectionDataSet::GetElementCrossSection(const G4DynamicParticle* dynPart,
G4int Z,
@@ -118,7 +138,7 @@ G4VCrossSectionDataSet::GetElementCrossSection(const G4DynamicParticle* dynPart,
ed << "GetElementCrossSection is not implemented in <" << name << ">\n"
<< "Particle: " << dynPart->GetDefinition()->GetParticleName()
<< " Ekin(MeV)= " << dynPart->GetKineticEnergy()/MeV;
if(mat) { ed << " material: " << mat->GetName(); }
if(nullptr != mat) { ed << " material: " << mat->GetName(); }
ed << " target Z= " << Z << G4endl;
G4Exception("G4VCrossSectionDataSet::GetElementCrossSection", "had001",
FatalException, ed);
@@ -136,8 +156,28 @@ G4VCrossSectionDataSet::GetIsoCrossSection(const G4DynamicParticle* dynPart,
ed << "GetIsoCrossSection is not implemented in <" << name << ">\n"
<< "Particle: " << dynPart->GetDefinition()->GetParticleName()
<< " Ekin(MeV)= " << dynPart->GetKineticEnergy()/MeV;
if(mat) { ed << " material: " << mat->GetName(); }
if(elm) { ed << " element: " << elm->GetName(); }
if(nullptr != mat) { ed << " material: " << mat->GetName(); }
if(nullptr != elm) { ed << " element: " << elm->GetName(); }
ed << " target Z= " << Z << " A= " << A << G4endl;
G4Exception("G4VCrossSectionDataSet::GetIsoCrossSection", "had001",
FatalException, ed);
return 0.0;
}
G4double
G4VCrossSectionDataSet::ComputeIsoCrossSection(G4double kinEnergy, G4double,
const G4ParticleDefinition* pd,
G4int Z, G4int A,
const G4Isotope*,
const G4Element* elm,
const G4Material* mat)
{
G4ExceptionDescription ed;
ed << "GetIsoCrossSection is not implemented in <" << name << ">\n"
<< "Particle: " << pd->GetParticleName()
<< " Ekin(MeV)= " << kinEnergy/CLHEP::MeV;
if(nullptr != mat) { ed << " material: " << mat->GetName(); }
if(nullptr != elm) { ed << " element: " << elm->GetName(); }
ed << " target Z= " << Z << " A= " << A << G4endl;
G4Exception("G4VCrossSectionDataSet::GetIsoCrossSection", "had001",
FatalException, ed);
@@ -148,7 +188,7 @@ const G4Isotope*
G4VCrossSectionDataSet::SelectIsotope(const G4Element* anElement,
G4double, G4double)
{
size_t nIso = anElement->GetNumberOfIsotopes();
G4int nIso = (G4int)anElement->GetNumberOfIsotopes();
const G4Isotope* iso = anElement->GetIsotope(0);
// more than 1 isotope
@@ -156,7 +196,7 @@ G4VCrossSectionDataSet::SelectIsotope(const G4Element* anElement,
const G4double* abundVector = anElement->GetRelativeAbundanceVector();
G4double sum = 0.0;
G4double q = G4UniformRand();
for (size_t j=0; j<nIso; ++j) {
for (G4int j=0; j<nIso; ++j) {
sum += abundVector[j];
if(q <= sum) {
iso = anElement->GetIsotope(j);