Import Geant4 11.1.0 source tree
This commit is contained in:
@@ -169,25 +169,25 @@ G4double G4EMDataSet::FindValue(G4double energy, G4int /* componentId */) const
|
||||
if (energy <= (*energies)[0]) {
|
||||
return (*data)[0];
|
||||
}
|
||||
size_t i = energies->size()-1;
|
||||
std::size_t i = energies->size()-1;
|
||||
if (energy >= (*energies)[i]) { return (*data)[i]; }
|
||||
|
||||
//Nicolas A. Karakatsanis: Check if the logarithmic data have been loaded to decide
|
||||
// which Interpolation-Calculation method will be applied
|
||||
if (log_energies != nullptr)
|
||||
{
|
||||
return algorithm->Calculate(energy, FindLowerBound(energy), *energies, *data, *log_energies, *log_data);
|
||||
return algorithm->Calculate(energy, (G4int)FindLowerBound(energy), *energies, *data, *log_energies, *log_data);
|
||||
}
|
||||
|
||||
return algorithm->Calculate(energy, FindLowerBound(energy), *energies, *data);
|
||||
return algorithm->Calculate(energy, (G4int)FindLowerBound(energy), *energies, *data);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4EMDataSet::PrintData(void) const
|
||||
{
|
||||
size_t size = energies->size();
|
||||
for (size_t i(0); i<size; i++)
|
||||
std::size_t size = energies->size();
|
||||
for (std::size_t i(0); i<size; ++i)
|
||||
{
|
||||
G4cout << "Point: " << ((*energies)[i]/unitEnergies)
|
||||
<< " - Data value: " << ((*data)[i]/unitData);
|
||||
@@ -442,14 +442,14 @@ G4bool G4EMDataSet::SaveData(const G4String& name) const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
size_t G4EMDataSet::FindLowerBound(G4double x) const
|
||||
std::size_t G4EMDataSet::FindLowerBound(G4double x) const
|
||||
{
|
||||
size_t lowerBound = 0;
|
||||
size_t upperBound(energies->size() - 1);
|
||||
std::size_t lowerBound = 0;
|
||||
std::size_t upperBound(energies->size() - 1);
|
||||
|
||||
while (lowerBound <= upperBound)
|
||||
{
|
||||
size_t midBin((lowerBound + upperBound) / 2);
|
||||
std::size_t midBin((lowerBound + upperBound) / 2);
|
||||
|
||||
if (x < (*energies)[midBin]) upperBound = midBin - 1;
|
||||
else lowerBound = midBin + 1;
|
||||
@@ -460,14 +460,14 @@ size_t G4EMDataSet::FindLowerBound(G4double x) const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
size_t G4EMDataSet::FindLowerBound(G4double x, G4DataVector* values) const
|
||||
std::size_t G4EMDataSet::FindLowerBound(G4double x, G4DataVector* values) const
|
||||
{
|
||||
size_t lowerBound = 0;;
|
||||
size_t upperBound(values->size() - 1);
|
||||
std::size_t lowerBound = 0;;
|
||||
std::size_t upperBound(values->size() - 1);
|
||||
|
||||
while (lowerBound <= upperBound)
|
||||
{
|
||||
size_t midBin((lowerBound + upperBound) / 2);
|
||||
std::size_t midBin((lowerBound + upperBound) / 2);
|
||||
|
||||
if (x < (*values)[midBin]) upperBound = midBin - 1;
|
||||
else lowerBound = midBin + 1;
|
||||
@@ -499,13 +499,13 @@ void G4EMDataSet::BuildPdf()
|
||||
pdf = new G4DataVector;
|
||||
G4Integrator <G4EMDataSet, G4double(G4EMDataSet::*)(G4double)> integrator;
|
||||
|
||||
G4int nData = data->size();
|
||||
std::size_t nData = data->size();
|
||||
pdf->push_back(0.);
|
||||
|
||||
// Integrate the data distribution
|
||||
G4int i;
|
||||
std::size_t i;
|
||||
G4double totalSum = 0.;
|
||||
for (i=1; i<nData; i++)
|
||||
for (i=1; i<nData; ++i)
|
||||
{
|
||||
G4double xLow = (*energies)[i-1];
|
||||
G4double xHigh = (*energies)[i];
|
||||
@@ -517,7 +517,7 @@ void G4EMDataSet::BuildPdf()
|
||||
// Normalize to the last bin
|
||||
G4double tot = 0.;
|
||||
if (totalSum > 0.) tot = 1. / totalSum;
|
||||
for (i=1; i<nData; i++)
|
||||
for (i=1; i<nData; ++i)
|
||||
{
|
||||
(*pdf)[i] = (*pdf)[i] * tot;
|
||||
}
|
||||
@@ -540,7 +540,7 @@ G4double G4EMDataSet::RandomSelect(G4int /* componentId */) const
|
||||
G4double x = G4UniformRand();
|
||||
|
||||
// Locate the random value in the X vector based on the PDF
|
||||
size_t bin = FindLowerBound(x,pdf);
|
||||
G4int bin = (G4int)FindLowerBound(x,pdf);
|
||||
|
||||
// Interpolate the PDF to calculate the X value:
|
||||
// linear interpolation in the first bin (to avoid problem with 0),
|
||||
@@ -560,7 +560,7 @@ G4double G4EMDataSet::IntegrationFunction(G4double x)
|
||||
G4double y = 0;
|
||||
|
||||
// Locate the random value in the X vector based on the PDF
|
||||
size_t bin = FindLowerBound(x);
|
||||
G4int bin = (G4int)FindLowerBound(x);
|
||||
|
||||
// Interpolate to calculate the X value:
|
||||
// linear interpolation in the first bin (to avoid problem with 0),
|
||||
|
||||
Reference in New Issue
Block a user