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
@@ -0,0 +1,119 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// G4ExtendedPhysicsVector
//
// Class description:
//
// A data scructure which includes G4PhysicsVector and also data on
// partial x-sections
//
// Author: V.Ivanchenko 09.09.2025
//
// --------------------------------------------------------------------
#ifndef G4ExtendedPhysicsVector_hh
#define G4ExtendedPhysicsVector_hh 1
#include <vector>
#include "globals.hh"
#include "G4PhysicsVector.hh"
class G4ExtendedPhysicsVector
{
public:
explicit G4ExtendedPhysicsVector(G4PhysicsVector*, G4int nxsec = 0);
virtual ~G4ExtendedPhysicsVector();
// Copy constructor and assignment operator
G4ExtendedPhysicsVector(const G4ExtendedPhysicsVector&) = default;
G4ExtendedPhysicsVector& operator=(const G4ExtendedPhysicsVector&) = default;
// not used operators
G4ExtendedPhysicsVector(const G4ExtendedPhysicsVector&&) = delete;
G4ExtendedPhysicsVector& operator=(const G4ExtendedPhysicsVector&&) = delete;
G4bool operator==(const G4ExtendedPhysicsVector& right) const = delete;
// get G4PhysicsVector with total cross section
inline const G4PhysicsVector* GetPhysicsVector() const;
// Get the value from the total x-section using interpolation defined
// in the G4PhysicsVector object. Consumer code gets changed
// index and may reuse it for the next call to save CPU for bin location.
inline G4double Value(const G4double energy, std::size_t& lastidx) const;
// Get the cross-section/energy-loss value corresponding to the
// given energy using log-log interpolation. Consumer code gets changed
// index and may reuse it for the next call to save CPU for bin location.
// Spline is not used in this method.
G4double LogLogValue(const G4double energy, std::size_t& lastidx) const;
// This method may be applied only once.
// Force length of data using std::vector::resize() with the
// the default value 0; partial cross section vector is resized
// only if the number of partial x-sections is above zero.
void SetDataLength(G4int dlength);
// Filled partial cross sections by energy index (0 <= idx < numberOfNodes)
// It is assumed that the array y does not have negative values.
void PutPartialXSData(const std::size_t idx, const G4double* y);
// Sample partial reaction channel for given energy, rand - uniform
// random number, lastidx is the cache allowing to reduce CPU for energy
// bin location. Data are stored as float but computations are in double.
G4int SampleReactionChannel(const G4double energy, const G4double rand,
std::size_t& lastidx) const;
// randomly select partial cross section using Log-Log interpolation
G4int SampleReactionChannelLogLog(const G4double energy, const G4double rand,
std::size_t& lastidx) const;
// Print data
void DumpValues(G4double unitE = 1.0, G4double unitV = 1.0) const;
private:
G4int verboseLevel = 0;
G4int nPartialXS = 0;
std::size_t idxmax = 0;
std::size_t numberOfNodes = 0;
// The partial cumulative x-sections normalized to the sum
std::vector<std::vector<G4float>* >* dataPartialXS = nullptr;
G4PhysicsVector* totalData = nullptr;
};
inline const G4PhysicsVector* G4ExtendedPhysicsVector::GetPhysicsVector() const
{
return totalData;
}
inline G4double G4ExtendedPhysicsVector::Value(const G4double e, std::size_t& idx) const
{
return totalData->Value(e, idx);
}
#endif
@@ -88,17 +88,10 @@ public:
void InsertValues(const G4double energy, const G4double value);
void EnableLogBinSearch(const G4int n = 1);
// Obsolete method
inline void PutValue(const std::size_t index,
const G4double e, const G4double value);
void PutValue(const std::size_t index, const G4double e, const G4double value);
};
inline void G4PhysicsFreeVector::PutValue(const std::size_t index,
const G4double e,
const G4double value)
{
PutValues(index, e, value);
}
#endif
@@ -97,6 +97,9 @@ public:
inline G4double LogFreeVectorValue(const G4double energy,
const G4double theLogEnergy) const;
// Internal method to define bin location
inline G4bool CheckIndex(const G4double energy, std::size_t& lastidx) const;
// Returns the value for the specified index of the dataVector
// The boundary check will not be done
inline G4double operator[](const std::size_t index) const;
@@ -146,7 +149,8 @@ public:
inline G4double FindLinearEnergy(const G4double rand) const;
// Find low edge index of a bin for given energy.
// Min value 0, max value idxmax.
// Min value 0, max value idxmax. This method is obsolete and will
// be removed with the next major release.
std::size_t FindBin(const G4double energy, std::size_t idx) const;
// Scale all values of the vector by factorV, energies by vectorE.
@@ -165,6 +169,12 @@ public:
const G4double dir1 = 0.0,
const G4double dir2 = 0.0);
// This method may be applied only once.
// Force length of data using std::vector::resize() with the
// the default value 0; partial cross section vector is resized
// only if the number of partial x-sections is above zero.
void SetDataLength(G4int dlength);
// This method can be applied if both energy and data values
// grow monotonically, for example, if in this vector a
// cumulative probability density function is stored.
@@ -188,16 +198,16 @@ protected:
private:
// Internal methods for computing of spline coeffitients
void ComputeSecDerivative0();
void ComputeSecDerivative1();
void ComputeSecDerivative2(const G4double firstPointDerivative,
const G4double endPointDerivative);
// Internal methods for computing of spline coeffitients
// Linear or spline interpolation.
inline G4double Interpolation(const std::size_t idx,
const G4double energy) const;
// Assuming (edgeMin <= energy <= edgeMax).
inline std::size_t LogBin(const G4double energy, const G4double loge) const;
inline std::size_t BinaryBin(const G4double energy) const;
@@ -201,29 +201,40 @@ inline std::size_t G4PhysicsVector::GetBin(const G4double e) const
}
// ---------------------------------------------------------------
inline G4double
G4PhysicsVector::Value(const G4double e, std::size_t& idx) const
inline G4bool
G4PhysicsVector::CheckIndex(const G4double e, std::size_t& idx) const
{
G4double res;
G4bool interpolation = false;
if (idx + 1 < numberOfNodes &&
e >= binVector[idx] && e <= binVector[idx+1])
{
res = Interpolation(idx, e);
}
interpolation = true;
}
else if (e > edgeMin && e < edgeMax)
{
idx = GetBin(e);
res = Interpolation(idx, e);
}
interpolation = true;
}
else if(e <= edgeMin)
{
res = dataVector[0];
idx = 0;
}
else
}
else
{
res = dataVector[idxmax + 1];
idx = idxmax;
idx = idxmax + 1;
}
return interpolation;
}
// ---------------------------------------------------------------
inline G4double
G4PhysicsVector::Value(const G4double e, std::size_t& idx) const
{
G4bool interpolation = CheckIndex(e, idx);
G4double res = dataVector[idx];
if (interpolation)
{
res = Interpolation(idx, e);
}
return res;
}
@@ -270,7 +281,7 @@ G4PhysicsVector::LogVectorValue(const G4double e, const G4double loge) const
}
else
{
res = dataVector[idxmax - 1];
res = dataVector[idxmax + 1];
}
return res;
}
@@ -28,7 +28,7 @@
// Author: K.Murakami, 26.09.2005 - Created
// --------------------------------------------------------------------
#ifndef G4VERSION_HH
#define G4VERSION_HH 1
#define G4VERSION_HH
/// @def G4VERSION_NUMBER
/// @brief Integral value representing the current Geant4 version
@@ -59,7 +59,7 @@
#endif
#ifndef G4VERSION_TAG
#define G4VERSION_TAG "$Name: geant4-11-04-beta-01 $"
#define G4VERSION_TAG "$Name: geant4-11-04 $"
#endif
// as variables
@@ -68,10 +68,10 @@
#include "G4Types.hh"
#ifdef G4MULTITHREADED
static const G4String G4Version = "$Name: geant4-11-04-beta-01 [MT]$";
static const G4String G4Version = "$Name: geant4-11-04 [MT]$";
#else
static const G4String G4Version = "$Name: geant4-11-04-beta-01 $";
static const G4String G4Version = "$Name: geant4-11-04 $";
#endif
static const G4String G4Date = "(26-June-2025)";
static const G4String G4Date = "(5-December-2025)";
#endif