Import Geant4 11.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2025-12-05 08:54:02 +01:00
parent a499fb82e9
commit b4a16de652
6484 changed files with 232674 additions and 221097 deletions
@@ -1,111 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara
#ifndef G4Solver_h
#define G4Solver_h 1
#include "globals.hh"
#include <cmath>
#define DefaultTolerance 5.0e-14
template <class Function> class G4Solver
{
public:
enum {DefaultMaxIter = 100};
// default constructor
G4Solver() : MaxIter(DefaultMaxIter), tolerance(DefaultTolerance),
a(0.0), b(0.0), root(0.0) {};
G4Solver(const G4int iterations, const G4double tol) :
MaxIter(iterations), tolerance(tol),
a(0.0), b(0.0), root(0.0) {};
// copy constructor
G4Solver(const G4Solver & right);
// destructor
~G4Solver() {};
// operators
G4Solver & operator=(const G4Solver & right);
G4bool operator==(const G4Solver & right) const;
G4bool operator!=(const G4Solver & right) const;
G4int GetMaxIterations(void) const {return MaxIter;}
void SetMaxIterations(const G4int iterations) {MaxIter=iterations;}
G4double GetTolerance(void) const {return tolerance;}
void SetTolerance(const G4double epsilon) {tolerance = epsilon;}
G4double GetIntervalLowerLimit(void) const {return a;}
G4double GetIntervalUpperLimit(void) const {return b;}
void SetIntervalLimits(const G4double Limit1, const G4double Limit2);
G4double GetRoot(void) const {return root;}
// Calculates the root by the Bisection method
G4bool Bisection(Function & theFunction);
// Calculates the root by the Regula-Falsi method
G4bool RegulaFalsi(Function & theFunction);
// Calculates the root by the Brent's method
G4bool Brent(Function & theFunction);
// Calculates the root by the Inverse Parabolic Interpolation method
// due to Jack Crenshaw
G4bool Crenshaw(Function & theFunction);
private:
// Maximum number of iterations
G4int MaxIter;
//
G4double tolerance;
// interval limits [a,b] which should bracket the root
G4double a;
G4double b;
// The root
G4double root;
};
#include "G4Solver.icc"
#endif
@@ -1,352 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
template <class Function>
G4bool G4Solver<Function>::Bisection(Function & theFunction)
{
// Check the interval before start
if (a > b || std::abs(a-b) <= tolerance)
{
G4cerr << "G4Solver::Bisection: The interval must be properly set." << G4endl;
return false;
}
G4double fa = theFunction(a);
G4double fb = theFunction(b);
if (fa*fb > 0.0)
{
G4cerr << "G4Solver::Bisection: The interval must include a root." << G4endl;
return false;
}
G4double eps=tolerance*(b-a);
// Finding the root
for (G4int i = 0; i < MaxIter; i++)
{
G4double c = (a+b)/2.0;
if ((b-a) < eps)
{
root = c;
return true;
}
G4double fc = theFunction(c);
if (fc == 0.0)
{
root = c;
return true;
}
if (fa*fc < 0.0)
{
a=c;
fa=fc;
}
else
{
b=c;
fb=fc;
}
}
G4cerr << "G4Solver::Bisection: Exceeded maximum number of iterations without convergence." << G4endl;
return false;
}
template <class Function>
G4bool G4Solver<Function>::RegulaFalsi(Function & theFunction)
{
// Check the interval before start
if (a > b || std::abs(a-b) <= tolerance)
{
G4cerr << "G4Solver::RegulaFalsi: The interval must be properly set." << G4endl;
return false;
}
G4double fa = theFunction(a);
G4double fb = theFunction(b);
if (fa*fb > 0.0)
{
G4cerr << "G4Solver::RegulaFalsi: The interval must include a root." << G4endl;
return false;
}
G4double eps=tolerance*(b-a);
// Finding the root
for (G4int i = 0; i < MaxIter; i++)
{
G4double c = (a*fb-b*fa)/(fb-fa);
G4double delta = std::min(std::abs(c-a),std::abs(b-c));
if (delta < eps)
{
root = c;
return true;
}
G4double fc = theFunction(c);
if (fc == 0.0)
{
root = c;
return true;
}
if (fa*fc < 0.0)
{
b=c;
fb=fc;
}
else
{
a=c;
fa=fc;
}
}
G4cerr << "G4Solver::Bisection: Exceeded maximum number of iterations without convergence." << G4endl;
return false;
}
template <class Function>
G4bool G4Solver<Function>::Brent(Function & theFunction)
{
const G4double precision = 3.0e-8;
// Check the interval before start
if (a > b || std::abs(a-b) <= tolerance)
{
G4cerr << "G4Solver::Brent: The interval must be properly set." << G4endl;
return false;
}
G4double fa = theFunction(a);
G4double fb = theFunction(b);
if (fa*fb > 0.0)
{
G4cerr << "G4Solver::Brent: The interval must include a root." << G4endl;
return false;
}
G4double c = b;
G4double fc = fb;
G4double d = 0.0;
G4double e = 0.0;
for (G4int i=0; i < MaxIter; i++)
{
// Rename a,b,c and adjust bounding interval d
if (fb*fc > 0.0)
{
c = a;
fc = fa;
d = b - a;
e = d;
}
if (std::abs(fc) < std::abs(fb))
{
a = b;
b = c;
c = a;
fa = fb;
fb = fc;
fc = fa;
}
G4double Tol1 = 2.0*precision*std::abs(b) + 0.5*tolerance;
G4double xm = 0.5*(c-b);
if (std::abs(xm) <= Tol1 || fb == 0.0)
{
root = b;
return true;
}
// Inverse quadratic interpolation
if (std::abs(e) >= Tol1 && std::abs(fa) > std::abs(fb))
{
G4double ss = fb/fa;
G4double p = 0.0;
G4double q = 0.0;
if (a == c)
{
p = 2.0*xm*ss;
q = 1.0 - ss;
}
else
{
q = fa/fc;
G4double r = fb/fc;
p = ss*(2.0*xm*q*(q-r)-(b-a)*(r-1.0));
q = (q-1.0)*(r-1.0)*(ss-1.0);
}
// Check bounds
if (p > 0.0) q = -q;
p = std::abs(p);
G4double min1 = 3.0*xm*q-std::abs(Tol1*q);
G4double min2 = std::abs(e*q);
if (2.0*p < std::min(min1,min2))
{
// Interpolation
e = d;
d = p/q;
}
else
{
// Bisection
d = xm;
e = d;
}
}
else
{
// Bounds decreasing too slowly, use bisection
d = xm;
e = d;
}
// Move last guess to a
a = b;
fa = fb;
if (std::abs(d) > Tol1) b += d;
else
{
if (xm >= 0.0) b += std::abs(Tol1);
else b -= std::abs(Tol1);
}
fb = theFunction(b);
}
G4cerr << "G4Solver::Brent: Number of iterations exceeded." << G4endl;
return false;
}
template <class Function>
G4bool G4Solver<Function>::Crenshaw(Function & theFunction)
{
// Check the interval before start
if (a > b || std::abs(a-b) <= tolerance)
{
G4cerr << "G4Solver::Crenshaw: The interval must be properly set." << G4endl;
return false;
}
G4double fa = theFunction(a);
if (fa == 0.0)
{
root = a;
return true;
}
G4double Mlast = a;
G4double fb = theFunction(b);
if (fb == 0.0)
{
root = b;
return true;
}
if (fa*fb > 0.0)
{
G4cerr << "G4Solver::Crenshaw: The interval must include a root." << G4endl;
return false;
}
for (G4int i=0; i < MaxIter; i++)
{
G4double c = 0.5 * (b + a);
G4double fc = theFunction(c);
if (fc == 0.0 || std::abs(c - a) < tolerance)
{
root = c;
return true;
}
if (fc * fa > 0.0)
{
G4double tmp = a;
a = b;
b = tmp;
tmp = fa;
fa = fb;
fb = tmp;
}
G4double fc0 = fc - fa;
G4double fb1 = fb - fc;
G4double fb0 = fb - fa;
if (fb * fb0 < 2.0 * fc * fc0)
{
b = c;
fb = fc;
}
else
{
G4double B = (c - a) / fc0;
G4double C = (fc0 - fb1) / (fb1 * fb0);
G4double M = a - B * fa * (1.0 - C * fc);
G4double fM = theFunction(M);
if (fM == 0.0 || std::abs(M - Mlast) < tolerance)
{
root = M;
return true;
}
Mlast = M;
if (fM * fa < 0.0)
{
b = M;
fb = fM;
}
else
{
a = M;
fa = fM;
b = c;
fb = fc;
}
}
}
return false;
}
template <class Function>
void G4Solver<Function>::SetIntervalLimits(const G4double Limit1, const G4double Limit2)
{
if (std::abs(Limit1-Limit2) <= tolerance)
{
G4cerr << "G4Solver::SetIntervalLimits: Interval must be wider than tolerance." << G4endl;
return;
}
if (Limit1 < Limit2)
{
a = Limit1;
b = Limit2;
}
else
{
a = Limit2;
b = Limit1;
}
return;
}
@@ -23,8 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara
@@ -38,52 +36,35 @@
#include "G4StatMFMacroCanonical.hh"
#include "G4StatMFChannel.hh"
#include "G4Fragment.hh"
#include "G4ParticleTable.hh"
#include "G4IonTable.hh"
#include "Randomize.hh"
class G4StatMF : public G4VMultiFragmentation
{
public:
G4StatMF();
~G4StatMF();
G4StatMF();
~G4StatMF() override;
// Copy constructor
G4StatMF(const G4StatMF & right) = delete;
G4FragmentVector* BreakItUp(const G4Fragment &theNucleus) override;
// Operators
G4StatMF & operator=(const G4StatMF & right) = delete;
G4bool operator==(const G4StatMF & right) = delete;
G4bool operator!=(const G4StatMF & right) = delete;
G4FragmentVector* BreakItUp(const G4Fragment &theNucleus) override;
G4StatMF(const G4StatMF & right) = delete;
G4StatMF & operator=(const G4StatMF & right) = delete;
G4bool operator==(const G4StatMF & right) = delete;
G4bool operator!=(const G4StatMF & right) = delete;
private:
// This finds temperature of breaking channel.
G4bool FindTemperatureOfBreakingChannel(const G4Fragment & theFragment,
const G4StatMFChannel * aChannel,
G4double & Temperature);
// This finds temperature of breaking channel.
G4bool FindTemperatureOfBreakingChannel(const G4Fragment & theFragment,
const G4StatMFChannel * aChannel,
G4double & Temperature);
G4double CalcEnergy(G4int A, G4int Z,
const G4StatMFChannel * aChannel,
G4double T);
G4double CalcEnergy(G4int A, G4int Z, const G4StatMFChannel* aChannel,
G4double T);
G4VStatMFEnsemble* _theEnsemble = nullptr;
G4int _secID = -1; // Creator model ID for the secondaries created by this model
G4StatMFMicroCanonical* theMicrocanonicalEnsemble{nullptr};
G4StatMFMacroCanonical* theMacrocanonicalEnsemble{nullptr};
G4VStatMFEnsemble* fEnsemble{nullptr};
};
#endif
@@ -88,8 +88,8 @@ private:
void FragmentsMomenta(G4int NF, G4int idx, G4double T);
// Rotates a 3-vector P to close momentum triangle Pa + V + P = 0
G4ThreeVector RotateMomentum(G4ThreeVector Pa, G4ThreeVector V,
G4ThreeVector P);
G4ThreeVector RotateMomentum(G4ThreeVector& Pa, G4ThreeVector& V,
G4ThreeVector& P);
private:
@@ -23,10 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara
//
// Modification: 13.08.2025 V.Ivanchenko rewrite
#ifndef G4StatMFMacroCanonical_h
#define G4StatMFMacroCanonical_h 1
@@ -50,73 +50,43 @@ class G4StatMFMacroCanonical : public G4VStatMFEnsemble {
public:
// G4StatMFMacroCanonical class must be initialized with a G4Fragment.
G4StatMFMacroCanonical(G4Fragment const & theFragment);
G4StatMFMacroCanonical();
// destructor
~G4StatMFMacroCanonical();
~G4StatMFMacroCanonical() override;
private:
// default constructor
G4StatMFMacroCanonical() {};
// Initialise for a given G4Fragment
void Initialise(const G4Fragment& theFragment) override;
// Choice of the channel
G4StatMFChannel* ChooseAandZ(const G4Fragment &theFragment) override;
// copy constructor
G4StatMFMacroCanonical(const G4StatMFMacroCanonical &) : G4VStatMFEnsemble() {};
// operators
G4StatMFMacroCanonical & operator=(const G4StatMFMacroCanonical & right);
G4bool operator==(const G4StatMFMacroCanonical & right) const;
G4bool operator!=(const G4StatMFMacroCanonical & right) const;
public:
// Choice of fragment atomic numbers and charges.
G4StatMFChannel * ChooseAandZ(const G4Fragment &theFragment);
G4StatMFMacroCanonical(const G4StatMFMacroCanonical&) = delete;
G4StatMFMacroCanonical& operator=(const G4StatMFMacroCanonical& right) = delete;
G4bool operator==(const G4StatMFMacroCanonical& right) const = delete;
G4bool operator!=(const G4StatMFMacroCanonical& right) const = delete;
private:
// Initailization method
void Initialize(const G4Fragment & theFragment);
//
void CalculateTemperature(const G4Fragment & theFragment);
// Determines fragments multiplicities and compute total fragment multiplicity
G4double ChooseA(G4int A, std::vector<G4int> & ANumbers);
// Determines fragments multiplicities and compute total fragment multiplicity
G4double ChooseA(G4int A, std::vector<G4int>& ANumbers);
// Samples charges of fragments
G4StatMFChannel * ChooseZ(G4int & Z,
std::vector<G4int> & FragmentsA);
// Samples charges of fragments
G4StatMFChannel* ChooseZ(G4int Z, std::vector<G4int>& FragmentsA);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Chemical Potential \mu
G4double _ChemPotentialMu;
// Chemical Potential \nu
G4double _ChemPotentialNu;
// Parameter Kappa
G4double _Kappa;
// Clusters
std::vector<G4VStatMFMacroCluster*> _theClusters;
struct DeleteFragment
{
template<typename T>
void operator()(const T* ptr) const
{
delete ptr;
}
};
G4StatMFMacroTemperature* theTemp{nullptr};
// Chemical Potential \mu
G4double fChemPotentialMu{0.0};
// Chemical Potential \nu
G4double fChemPotentialNu{0.0};
// Parameter Kappa
G4double fKappa{0.0};
// Clusters
std::vector<G4VStatMFMacroCluster*> fClusters;
std::vector<G4double> fAcumMultiplicity;
};
#endif
@@ -23,93 +23,63 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara
//
// Modification: 13.08.2025 V.Ivanchenko rewrite
#ifndef G4StatMFMacroChemicalPotential_h
#define G4StatMFMacroChemicalPotential_h 1
#include <vector>
#include "G4StatMFParameters.hh"
#include "G4VStatMFMacroCluster.hh"
#include "G4StatMFMacroMultiplicity.hh"
#include "G4Solver.hh"
#include "G4FunctionSolver.hh"
class G4StatMFMacroMultiplicity;
class G4StatMFMacroChemicalPotential {
public:
G4StatMFMacroChemicalPotential(const G4double anA, const G4double aZ,
const G4double kappa,
const G4double temp,
std::vector<G4VStatMFMacroCluster*> * ClusterVector) :
theA(anA),
theZ(aZ),
_Kappa(kappa),
_MeanMultiplicity(0.0),
_MeanTemperature(temp),
_ChemPotentialMu(0.0),
_ChemPotentialNu(0.0),
_theClusters(ClusterVector)
{};
~G4StatMFMacroChemicalPotential() {};
G4double operator()(const G4double nu)
{ return (theZ - this->CalcMeanZ(nu))/theZ; }
G4StatMFMacroChemicalPotential();
private:
// Default constructor
G4StatMFMacroChemicalPotential() {};
~G4StatMFMacroChemicalPotential();
// copy constructor
G4StatMFMacroChemicalPotential(const G4StatMFMacroChemicalPotential &) {};
void Initialise(const G4int anA, const G4int aZ,
const G4double kappa, const G4double temp,
std::vector<G4VStatMFMacroCluster*>* cVector);
G4double Function(G4double nu)
{ return (theZ - CalcMeanZ(nu)); }
// operators
G4StatMFMacroChemicalPotential & operator=(const G4StatMFMacroChemicalPotential & right);
G4bool operator==(const G4StatMFMacroChemicalPotential & right) const;
G4bool operator!=(const G4StatMFMacroChemicalPotential & right) const;
G4double CalcChemicalPotentialNu();
public:
G4double GetMeanMultiplicity() const {return fMeanMultiplicity;}
G4double GetChemicalPotentialMu() const {return fChemPotentialMu;}
G4double GetChemicalPotentialNu() const {return fChemPotentialNu;}
G4double GetMeanMultiplicity(void) const {return _MeanMultiplicity;}
G4double GetChemicalPotentialMu(void) const {return _ChemPotentialMu;}
G4double GetChemicalPotentialNu(void) const {return _ChemPotentialNu;}
G4double CalcChemicalPotentialNu(void);
G4StatMFMacroChemicalPotential(const G4StatMFMacroChemicalPotential &) = delete;
G4StatMFMacroChemicalPotential& operator=
(const G4StatMFMacroChemicalPotential & right) = delete;
G4bool operator==(const G4StatMFMacroChemicalPotential & right) const = delete;
G4bool operator!=(const G4StatMFMacroChemicalPotential & right) const = delete;
private:
G4double CalcMeanZ(const G4double nu);
G4double CalcMeanZ(const G4double nu);
void CalcChemicalPotentialMu(const G4double nu);
void CalcChemicalPotentialMu(const G4double nu);
private:
G4double theA;
G4double theZ;
G4double _Kappa;
G4double _MeanMultiplicity;
G4double _MeanTemperature;
G4FunctionSolver<G4StatMFMacroChemicalPotential>* fSolver;
G4StatMFMacroMultiplicity* theMultip;
G4int theA{0};
G4int theZ{0};
G4double fKappa{0.0};
G4double fMeanTemperature{0.0};
G4double fMeanMultiplicity{0.0};
G4double fChemPotentialMu{0.0};
G4double fChemPotentialNu{0.0};
G4double _ChemPotentialMu;
G4double _ChemPotentialNu;
std::vector<G4VStatMFMacroCluster*> * _theClusters;
std::vector<G4VStatMFMacroCluster*>* fClusters{nullptr};
};
#endif
@@ -23,86 +23,61 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara
//
// Modification: 13.08.2025 V.Ivanchenko rewrite
#ifndef G4StatMFMacroMultiplicity_h
#define G4StatMFMacroMultiplicity_h 1
#include <vector>
#include "G4StatMFParameters.hh"
#include "globals.hh"
#include "G4VStatMFMacroCluster.hh"
#include "G4Solver.hh"
#include "G4FunctionSolver.hh"
class G4StatMFMacroMultiplicity {
public:
G4StatMFMacroMultiplicity(const G4double anA,
const G4double kappa,
const G4double temp,
const G4double nu,
std::vector<G4VStatMFMacroCluster*> * ClusterVector) :
theA(anA),
_Kappa(kappa),
_MeanMultiplicity(0.0),
_MeanTemperature(temp),
_ChemPotentialMu(0.0),
_ChemPotentialNu(nu),
_theClusters(ClusterVector)
{};
~G4StatMFMacroMultiplicity() {};
G4double operator()(const G4double mu)
{ return (theA - this->CalcMeanA(mu))/theA; }
G4StatMFMacroMultiplicity();
private:
// Default constructor
G4StatMFMacroMultiplicity() {};
~G4StatMFMacroMultiplicity();
// copy constructor
G4StatMFMacroMultiplicity(const G4StatMFMacroMultiplicity &) {};
void Initialise(const G4int anA, const G4double kappa,
const G4double temp, const G4double nu,
std::vector<G4VStatMFMacroCluster*>* cVector);
G4double Function(G4double mu)
{ return (theA - CalcMeanA(mu)); };
// operators
G4StatMFMacroMultiplicity & operator=(const G4StatMFMacroMultiplicity & right);
G4bool operator==(const G4StatMFMacroMultiplicity & right) const;
G4bool operator!=(const G4StatMFMacroMultiplicity & right) const;
G4double CalcChemicalPotentialMu();
public:
G4double GetMeanMultiplicity() const { return fMeanMultiplicity; }
G4double GetMeanMultiplicity(void) const {return _MeanMultiplicity;}
G4double GetChemicalPotentialMu(void) const {return _ChemPotentialMu;}
G4double GetChemicalPotentialMu() const { return fChemPotentialMu; }
G4double CalcChemicalPotentialMu(void);
G4StatMFMacroMultiplicity(const G4StatMFMacroMultiplicity&) = delete;
G4StatMFMacroMultiplicity& operator=
(const G4StatMFMacroMultiplicity& right) = delete;
G4bool operator==(const G4StatMFMacroMultiplicity& right) const = delete;
G4bool operator!=(const G4StatMFMacroMultiplicity& right) const = delete;
private:
G4double CalcMeanA(const G4double mu);
G4double CalcMeanA(const G4double mu);
private:
G4double theA;
G4double _Kappa;
G4double _MeanMultiplicity;
G4double _MeanTemperature;
G4double _ChemPotentialMu;
G4double _ChemPotentialNu;
std::vector<G4VStatMFMacroCluster*> * _theClusters;
G4int A{0};
G4double theA{0};
G4double fKappa{0.0};
G4double fMeanTemperature{0.0};
G4double fChemPotentialNu{0.0};
G4double fMeanMultiplicity{0.0};
G4double fChemPotentialMu{0.0};
std::vector<G4VStatMFMacroCluster*>* fClusters{nullptr};
G4FunctionSolver<G4StatMFMacroMultiplicity>* fSolver;
};
#endif
@@ -23,93 +23,77 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara
//
// Modification: 13.08.2025 V.Ivanchenko rewrite
#ifndef G4StatMFMacroTemperature_h
#define G4StatMFMacroTemperature_h 1
#include "G4StatMFParameters.hh"
#include <vector>
#include "globals.hh"
#include "G4VStatMFMacroCluster.hh"
#include "G4StatMFMacroChemicalPotential.hh"
#include "G4Solver.hh"
#include "G4FunctionSolver.hh"
class G4StatMFMacroChemicalPotential;
class G4StatMFMacroTemperature {
public:
G4StatMFMacroTemperature(const G4double anA, const G4double aZ,
const G4double ExEnergy, const G4double FreeE0,
const G4double kappa,
std::vector<G4VStatMFMacroCluster*> * ClusterVector);
G4StatMFMacroTemperature();
~G4StatMFMacroTemperature();
void Initialise(const G4int anA, const G4int aZ,
const G4double ExEnergy, const G4double FreeE0,
const G4double kappa,
std::vector<G4VStatMFMacroCluster*>* ClusterVector);
~G4StatMFMacroTemperature();
G4double operator()(const G4double T)
{ return (_ExEnergy - this->FragsExcitEnergy(T))/_ExEnergy; }
G4double Function(G4double T)
{ return (fExEnergy - FragsExcitEnergy(T)); }
private:
// copy constructor
G4StatMFMacroTemperature(const G4StatMFMacroTemperature&) = delete;
G4StatMFMacroTemperature& operator=
(const G4StatMFMacroTemperature& right) = delete;
G4bool operator==(const G4StatMFMacroTemperature& right) const = delete;
G4bool operator!=(const G4StatMFMacroTemperature& right) const = delete;
// Default constructor
G4StatMFMacroTemperature();
// copy constructor
G4StatMFMacroTemperature(const G4StatMFMacroTemperature &) {};
// operators
G4StatMFMacroTemperature & operator=(const G4StatMFMacroTemperature & right);
G4bool operator==(const G4StatMFMacroTemperature & right) const;
G4bool operator!=(const G4StatMFMacroTemperature & right) const;
public:
inline G4double GetMeanMultiplicity(void) const {return _MeanMultiplicity;}
G4double GetMeanMultiplicity(void) const {return fMeanMultiplicity;}
inline G4double GetChemicalPotentialMu(void) const {return _ChemPotentialMu;}
G4double GetChemicalPotentialMu(void) const {return fChemPotentialMu;}
inline G4double GetChemicalPotentialNu(void) const {return _ChemPotentialNu;}
G4double GetChemicalPotentialNu(void) const {return fChemPotentialNu;}
inline G4double GetTemperature(void) const {return _MeanTemperature;}
G4double GetTemperature(void) const {return fMeanTemperature;}
inline G4double GetEntropy(void) const {return _MeanEntropy;}
G4double GetEntropy(void) const {return fMeanEntropy;}
G4double CalcTemperature(void);
G4double CalcTemperature(void);
private:
G4double FragsExcitEnergy(const G4double T);
G4double FragsExcitEnergy(const G4double T);
void CalcChemicalPotentialNu(const G4double T);
void CalcChemicalPotentialNu(const G4double T);
private:
G4FunctionSolver<G4StatMFMacroTemperature>* fSolver;
G4StatMFMacroChemicalPotential* theChemPot;
G4double theA;
G4double theZ;
G4double _ExEnergy;
G4int theA{0};
G4int theZ{0};
G4double fExEnergy{0.0};
G4double fFreeInternalE0{0.0};
G4double fKappa{0.0};
G4double fMeanMultiplicity{0.0};
G4double fMeanTemperature{0.0};
G4double fChemPotentialMu{0.0};
G4double fChemPotentialNu{0.0};
G4double fMeanEntropy{0.0};
G4double _FreeInternalE0;
G4double _Kappa;
G4double _MeanMultiplicity;
G4double _MeanTemperature;
G4double _ChemPotentialMu;
G4double _ChemPotentialNu;
G4double _MeanEntropy;
std::vector<G4VStatMFMacroCluster*> * _theClusters;
std::vector<G4VStatMFMacroCluster*>* fClusters{nullptr};
};
#endif
@@ -23,16 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara
//
// Modification: 13.08.2025 V.Ivanchenko rewrite
#ifndef G4StatMFMicroCanonical_h
#define G4StatMFMicroCanonical_h 1
#include <vector>
#include "globals.hh"
#include "G4VStatMFEnsemble.hh"
#include "G4StatMFMicroPartition.hh"
#include "G4StatMFMicroManager.hh"
@@ -40,74 +41,57 @@
#include "G4StatMFChannel.hh"
#include "G4Fragment.hh"
#include "Randomize.hh"
#include "G4VStatMFMacroCluster.hh"
#include "G4FunctionSolver.hh"
class G4Pow;
class G4StatMFMicroCanonical : public G4VStatMFEnsemble {
public:
// G4StatMFMicroCanonical class must be initialized with a G4Fragment.
G4StatMFMicroCanonical(const G4Fragment & theFragment);
G4StatMFMicroCanonical();
// destructor
~G4StatMFMicroCanonical();
~G4StatMFMicroCanonical() override;
private:
// default constructor
G4StatMFMicroCanonical() {};
// Initialise for a given G4Fragment
void Initialise(const G4Fragment& theFragment) override;
// Choice of the channel
G4StatMFChannel* ChooseAandZ(const G4Fragment &theFragment) override;
// copy constructor
G4StatMFMicroCanonical(const G4StatMFMicroCanonical &right);
G4double Function(G4double T)
{ return (fExEnergy + pFreeInternalE0 - CalcFreeInternalEnergy(T)); }
// operators
G4StatMFMicroCanonical & operator=(const G4StatMFMicroCanonical & right);
G4bool operator==(const G4StatMFMicroCanonical & right) const;
G4bool operator!=(const G4StatMFMicroCanonical & right) const;
public:
// Choice of fragment atomic numbers and charges.
G4StatMFChannel * ChooseAandZ(const G4Fragment & theFragment);
enum {MaxAllowedMultiplicity = 4};
// copy constructor
G4StatMFMicroCanonical(const G4StatMFMicroCanonical& right) = delete;
G4StatMFMicroCanonical& operator=(const G4StatMFMicroCanonical& right) = delete;
G4bool operator==(const G4StatMFMicroCanonical& right) const = delete;
G4bool operator!=(const G4StatMFMicroCanonical& right) const = delete;
private:
// Initailization method
void Initialize(const G4Fragment & theFragment);
// Calculate Entropy of Compound Nucleus
G4double CalcEntropyOfCompoundNucleus(G4double& T);
// Calculate Entropy of Compound Nucleus
G4double CalcEntropyOfCompoundNucleus(const G4Fragment & theFragment, G4double & TConf);
G4double CalcFreeInternalEnergy(G4double T);
G4double CalcFreeInternalEnergy(const G4Fragment & theFragment, G4double T);
G4double CalcInvLevelDensity(G4int anA);
G4int Z{0};
G4int A{0};
// Data members
private:
// This is a vector of partitions managers for partitions of different
// multiplicities:
std::vector<G4StatMFMicroManager*> _ThePartitionManagerVector;
// Statistical weight of compound nucleus
G4double _WCompoundNucleus;
// Statistical weight of compound nucleus
G4double fWCompoundNucleus{0.0};
G4double fExEnergy{0.0};
struct DeleteFragment
{
template<typename T>
void operator()(const T* ptr) const
{
delete ptr;
}
};
G4double A13{0.0};
G4double fInvLevelDensity{1.0};
G4double fSymmetryTerm{1.0};
G4double fCoulombTerm{0.0};
G4Pow* g4calc;
G4FunctionSolver<G4StatMFMicroCanonical>* fSolver;
// This is a vector of partitions provided different multiplicities
std::vector<G4StatMFMicroManager*> fPartitionManagerVector;
};
@@ -44,85 +44,48 @@ class G4StatMFMicroManager {
public:
// G4StatMFMicroManager class must be initialized with a G4Fragment, multiplicity,
// free internal energy and the entropy of the compund nucleus.
G4StatMFMicroManager(const G4Fragment & theFragment, G4int multiplicity,
G4double FreeIntE, G4double SCompNuc);
// G4StatMFMicroManager class must be initialized with a G4Fragment, multiplicity,
// free internal energy and the entropy of the compund nucleus.
G4StatMFMicroManager(const G4Fragment& theFragment, G4int multiplicity,
G4double FreeIntE, G4double SCompNuc);
// destructor
~G4StatMFMicroManager();
~G4StatMFMicroManager();
private:
// default constructor
G4StatMFMicroManager() {};
// copy constructor
G4StatMFMicroManager(const G4StatMFMicroManager& right) = delete;
G4StatMFMicroManager & operator=(const G4StatMFMicroManager& right) = delete;
G4bool operator==(const G4StatMFMicroManager & right) const = delete;
G4bool operator!=(const G4StatMFMicroManager & right) const = delete;
// copy constructor
G4StatMFMicroManager(const G4StatMFMicroManager &right);
// operators
G4StatMFMicroManager & operator=(const G4StatMFMicroManager & right);
public:
G4bool operator==(const G4StatMFMicroManager & right) const;
G4bool operator!=(const G4StatMFMicroManager & right) const;
public:
// Choice of fragment atomic numbers and charges.
G4StatMFChannel * ChooseChannel(G4int A0, G4int Z0, G4double MeanT);
// Choice of fragment atomic numbers and charges.
G4StatMFChannel* ChooseChannel(G4int A0, G4int Z0, G4double MeanT);
G4double GetProbability(void) const {return _WW;}
G4double GetProbability(void) const {return _WW;}
void Normalize(G4double Norm);
void Normalize(G4double Norm);
G4double GetMeanMultiplicity(void) const {return _MeanMultiplicity; }
G4double GetMeanMultiplicity(void) const {return _MeanMultiplicity; }
G4double GetMeanTemperature(void) const {return _MeanTemperature; }
G4double GetMeanTemperature(void) const {return _MeanTemperature; }
G4double GetMeanEntropy(void) const {return _MeanEntropy; }
G4double GetMeanEntropy(void) const {return _MeanEntropy; }
private:
// Initailization method
void Initialize(const G4Fragment & theFragment, G4int m,
G4double FreeIntE, G4double SCompNuc);
// Initailization method
void Initialize(const G4Fragment & theFragment, G4int m,
G4double FreeIntE, G4double SCompNuc);
G4bool MakePartition(G4int k, G4int * ANumbers);
G4bool MakePartition(G4int k, G4int* ANumbers);
// Partitions vector
std::vector<G4StatMFMicroPartition*> _Partition;
// Data members
private:
// Partitions vector
std::vector<G4StatMFMicroPartition*> _Partition;
// Statistical weight
G4double _WW;
G4double _Normalization;
G4double _MeanMultiplicity;
G4double _MeanTemperature;
G4double _MeanEntropy;
struct DeleteFragment
{
template<typename T>
void operator()(const T* ptr) const
{
delete ptr;
}
};
G4double _WW;
G4double _Normalization;
G4double _MeanMultiplicity;
G4double _MeanTemperature;
G4double _MeanEntropy;
};
#endif
@@ -23,11 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara
// 13.08.2025 V.Ivanchenko rewrite
#ifndef G4VStatMFEnsemble_h
#define G4VStatMFEnsemble_h 1
@@ -38,50 +36,36 @@
class G4VStatMFEnsemble {
public:
// Default Constructor
G4VStatMFEnsemble() :
__FreeInternalE0(0.0),
__MeanTemperature(0.0),
__MeanEntropy(0.0),
__MeanMultiplicity(0.0)
{};
G4VStatMFEnsemble() = default;
virtual ~G4VStatMFEnsemble() = default;
// Destructor
virtual ~G4VStatMFEnsemble() {};
virtual void Initialise(const G4Fragment& aFragment) = 0;
private:
// Copy constructor
G4VStatMFEnsemble(const G4VStatMFEnsemble & right);
// operators
G4VStatMFEnsemble & operator=(const G4VStatMFEnsemble & right);
G4bool operator==(const G4VStatMFEnsemble & right) const;
G4bool operator!=(const G4VStatMFEnsemble & right) const;
public:
virtual G4StatMFChannel * ChooseAandZ(const G4Fragment & aFragment) = 0;
virtual G4StatMFChannel* ChooseAandZ(const G4Fragment& aFragment) = 0;
G4double GetMeanMultiplicity(void) const {return __MeanMultiplicity;}
G4double GetMeanMultiplicity() const { return pMeanMultiplicity; }
G4double GetMeanTemperature(void) const {return __MeanTemperature;}
G4double GetMeanTemperature() const { return pMeanTemperature; }
G4VStatMFEnsemble(const G4VStatMFEnsemble & right) = delete;
G4VStatMFEnsemble & operator=(const G4VStatMFEnsemble & right) = delete;
G4bool operator==(const G4VStatMFEnsemble & right) const = delete;
G4bool operator!=(const G4VStatMFEnsemble & right) const = delete;
protected:
// Free internal energy at temperature T = 0
G4double __FreeInternalE0;
// Free internal energy at temperature T = 0
G4double pFreeInternalE0{0.0};
// Mean temperature
G4double pMeanTemperature{0.0};
// Mean temperature
G4double __MeanTemperature;
// Mean Entropy
G4double pMeanEntropy{0.0};
// Mean Entropy
G4double __MeanEntropy;
// Mean Multiplicity
G4double __MeanMultiplicity;
// Mean Multiplicity
G4double pMeanMultiplicity{0.0};
};
#endif