Import Geant4 11.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2024-12-06 11:11:40 +01:00
parent e58e650b32
commit 32390e802b
1984 changed files with 98713 additions and 83996 deletions
@@ -47,7 +47,7 @@ G4ChebyshevApproximation::G4ChebyshevApproximation(function pFunction, G4int n,
{
G4int i = 0, j = 0;
G4double rootSum = 0.0, cofj = 0.0;
G4double* tempFunction = new G4double[fNumber];
auto tempFunction = new G4double[fNumber];
G4double weight = 2.0 / fNumber;
G4double cof = 0.5 * weight * pi; // pi/n
@@ -93,7 +93,7 @@ G4ChebyshevApproximation::G4ChebyshevApproximation(function pFunction, G4int nx,
}
G4int i = 0, j = 0;
G4double rootSum = 0.0, cofj = 0.0;
G4double* tempFunction = new G4double[fNumber];
auto tempFunction = new G4double[fNumber];
G4double weight = 2.0 / fNumber;
G4double cof = 0.5 * weight * pi; // pi/nx
@@ -143,7 +143,7 @@ G4ChebyshevApproximation::G4ChebyshevApproximation(function pFunction,
{
G4int i = 0, j = 0;
G4double rootSum = 0.0, cofj = 0.0;
G4double* tempFunction = new G4double[fNumber];
auto tempFunction = new G4double[fNumber];
G4double weight = 2.0 / fNumber;
G4double cof = 0.5 * weight * pi; // pi/n
@@ -118,6 +118,8 @@ void G4ConvergenceTester::AddScore(G4double x)
void G4ConvergenceTester::calStat()
{
if (n == 0) return;
efficiency = G4double(nonzero_histories.size()) / n;
mean = sum / n;
@@ -223,10 +225,10 @@ void G4ConvergenceTester::calStat()
}
else
{
G4int i = G4int(nonzero_histories.size());
auto i = G4int(nonzero_histories.size());
// 5% criterion
G4int j = G4int(i * 0.05);
auto j = G4int(i * 0.05);
while(G4int(largest_scores.size()) > j)
{
largest_scores.pop_back();
@@ -623,7 +625,7 @@ void G4ConvergenceTester::check_stat_history(std::ostream& out)
second_ally[i] = fom_history[N + i];
}
pearson_r = calc_Pearson_r(G4int(N), first_ally, second_ally);
pearson_r = calc_Pearson_r(G4int(N), std::move(first_ally), std::move(second_ally));
t = pearson_r * std::sqrt((N - 2) / (1 - pearson_r * pearson_r));
if(t < 0.429318)
@@ -691,7 +693,7 @@ void G4ConvergenceTester::calc_slope_fit(const std::vector<G4double>&)
{
// create PDF bins
G4double max = largest_scores.front();
G4int last = G4int(largest_scores.size());
auto last = G4int(largest_scores.size());
G4double min = 0.0;
if(largest_scores.back() != 0)
{
@@ -65,7 +65,7 @@ G4DataInterpolation::G4DataInterpolation(G4double pX[], G4double pY[],
G4int i = 0;
G4double p = 0.0, qn = 0.0, sig = 0.0, un = 0.0;
const G4double maxDerivative = 0.99e30;
G4double* u = new G4double[fNumber - 1];
auto u = new G4double[fNumber - 1];
for(i = 0; i < fNumber; ++i)
{
@@ -152,8 +152,8 @@ G4double G4DataInterpolation::PolynomInterpolation(G4double pX,
G4int i = 0, j = 1, k = 0;
G4double mult = 0.0, difi = 0.0, deltaLow = 0.0, deltaUp = 0.0, cd = 0.0,
y = 0.0;
G4double* c = new G4double[fNumber];
G4double* d = new G4double[fNumber];
auto c = new G4double[fNumber];
auto d = new G4double[fNumber];
G4double diff = std::fabs(pX - fArgument[0]);
for(i = 0; i < fNumber; ++i)
{
@@ -205,7 +205,7 @@ void G4DataInterpolation::PolIntCoefficient(G4double cof[]) const
G4int i = 0, j = 0;
G4double factor;
G4double reducedY = 0.0, mult = 1.0;
G4double* tempArgument = new G4double[fNumber];
auto tempArgument = new G4double[fNumber];
for(i = 0; i < fNumber; ++i)
{
@@ -252,8 +252,8 @@ G4double G4DataInterpolation::RationalPolInterpolation(G4double pX,
G4int i = 0, j = 1, k = 0;
const G4double tolerance = 1.6e-24;
G4double mult = 0.0, difi = 0.0, cd = 0.0, y = 0.0, cof = 0.0;
G4double* c = new G4double[fNumber];
G4double* d = new G4double[fNumber];
auto c = new G4double[fNumber];
auto d = new G4double[fNumber];
G4double diff = std::fabs(pX - fArgument[0]);
for(i = 0; i < fNumber; ++i)
{
@@ -31,6 +31,8 @@
#include "G4GaussHermiteQ.hh"
#include "G4PhysicalConstants.hh"
#include <limits>
// ----------------------------------------------------------
//
// Constructor for Gauss-Hermite
@@ -87,7 +89,12 @@ G4GaussHermiteQ::G4GaussHermiteQ(function pFunction, G4int nHermite)
}
temp = std::sqrt((G4double) 2 * nHermite) * temp2;
newton1 = newton0;
newton0 = newton1 - temp1 / temp;
G4double ratio = std::numeric_limits<G4double>::max();
if(temp > 0.0)
{
ratio = temp1 / temp;
}
newton0 = newton1 - ratio;
if(std::fabs(newton0 - newton1) <= tolerance)
{
break;