Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
@@ -65,7 +65,7 @@ enum EInside {kOutside,kSurface,kInside};
// kParameterised = (G4PVParameterised) General parameterised volume
// => Distance & location computed to volumes
// after setup/modification via user object
enum EVolume {kNormal,kReplica,kParameterised};
enum EVolume {kNormal,kReplica,kParameterised,kExternal};
// Default max size of Navigation history
//
@@ -73,7 +73,7 @@ G4double G4SimplexDownhill<T>::GetMinimum()
std::vector< G4double >::iterator it_minh =
std::min_element( currentHeights.begin() , currentHeights.end() );
G4int imin = -1;
G4int imin = 0;
G4int i = 0;
for ( std::vector< G4double >::iterator it = currentHeights.begin();
it != currentHeights.end(); it++ )
@@ -424,7 +424,7 @@ std::vector< G4double > G4SimplexDownhill<T>::GetMinimumPoint()
std::vector< G4double >::iterator it_minh =
std::min_element( currentHeights.begin() , currentHeights.end() );;
G4int imin = -1;
G4int imin = 0;
G4int i = 0;
for ( std::vector< G4double >::iterator
it = currentHeights.begin(); it != currentHeights.end(); it++ )
@@ -0,0 +1,48 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
#ifndef G4QUICKRAND_HH
#define G4QUICKRAND_HH
#include <cstdint>
#include "G4Types.hh"
inline G4double G4QuickRand()
{
static const G4double f = 1. / 4294967296.; // 2^-32
// Algorithm "xor" from p.4 of G.Marsaglia, "Xorshift RNGs"
static G4ThreadLocal uint32_t y = 2463534242;
uint32_t x = y;
x ^= x << 13;
x ^= x >> 17;
x ^= x << 5;
y = x;
return x * f;
}
#endif // G4QUICKRAND_HH
+2 -1
View File
@@ -28,10 +28,11 @@ include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4heprandom
HEADERS
G4Poisson.hh
G4QuickRand.hh
G4RandomDirection.hh
G4RandomTools.hh
Randomize.hh
G4UniformRandPool.hh
Randomize.hh
SOURCES
G4Poisson.cc
G4UniformRandPool.cc
+62 -4
View File
@@ -9,13 +9,71 @@
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the SVN log-message one should put at every
committal in the SVN repository !
It DOES NOT substitute the log-message one should put at every
commit in the repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
December 03, 2019 Gabriele Cosmo (global-V10-05-26)
- Updated tag IDs for release 10.6.
November 22, 2019 Jonathan Madsen (global-V10-05-25)
- Updated G4TiMemory.hh to support new macros
- Updated templates.hh to use move semantics in consume_parameters
- Eliminates warning about unnecessary copy for some compilers
- Updated sources.cmake to use ${timemory_LIBRARIES} instead of
difficult to type ${TiMemory_LIBRARIES}
November 19, 2019 Gabriele Cosmo (global-V10-05-24)
- Updated tag IDs for geant4-10-06-cand-01.
November 15, 2019 Gabriele Cosmo (global-V10-05-23)
- Fixed implicit type conversions in G4String internal methods.
November 12, 2019 Gabriele Cosmo (global-V10-05-22)
- Updated tag IDs for geant4-10-06-cand-00.
November 08, 2019 Evgueni Tcherniaev (global-V10-05-21)
- G4SimplexDownhill: fixed minor Coverity defect
October 30, 2019 Gabriele Cosmo (global-V10-05-20)
- Updated date and tag-ID for geant4-10-05-ref-10.
October 25, 2019 Gabriele Cosmo (global-V10-05-19)
- Added 'External' (physical) volume type to geomdefs.hh.
September 30, 2019 Gabriele Cosmo (global-V10-05-18)
- Updated date and tag-ID for geant4-10-05-ref-09.
September 12, 2019 Evgueni Tcherniaev (global-V10-05-17)
- Added HEPRandom/include/G4QuickRand.hh
August 31, 2019 Gabriele Cosmo (global-V10-05-16)
- Updated date and tag-ID for geant4-10-05-ref-08.
August 2, 2019 Makoto Asain (global-V10-05-15)
- G4PhysicsVector::insertAt() : add protection against idx > entries().
Addressing to Bug report #2182.
July 21, 2019 Mihaly Novak (global-V10-05-14)
- G4PhysicsVector: remove temporary codes used during the optimisation of the
physics log-vector data access
July 18, 2019 Mihaly Novak (global-V10-05-13)
- G4PhysicsVector: further optimisation of the LogVectorValue data access method
(all conditional branchings are eliminated by increased robustness of the alg.)
July 17, 2019 Mihaly Novak (global-V10-05-12)
- G4PhysicsVector: add optimised LogVectorValue method(special Value method only
for log-vectors) to G4PhysicsVector
- G4PhysicsVector, G4PhysicsLogVector, G4PhysicsLinearVector, G4PhysicsVector:
change dBin member to invdBin(=1/dBin) to get rid of run-time divisions
July 15, 2019 Gabriele Cosmo (global-V10-05-11)
- Updated date and tag-ID for geant4-10-05-ref-07.
June 17, 2019 Gabriele Cosmo (global-V10-05-10)
- Updated date and tag-ID for geant4-10-05-ref-06.
@@ -53,9 +111,9 @@ March 29, 2019 Gabriele Cosmo (global-V10-05-04)
- Updated date and tag-ID for geant4-10-05-ref-03.
March 17, 2019 Mihaly Novak (global-V10-05-03)
- G4PhysicsVector: adding additional public Value() method option to propagate
- G4PhysicsVector: adding additional public Value() method option to propagate
down the known log-energy value (can avoid the log call in case of log-vector)
- templates: new LOG_EKIN_MIN constant as value taken incase of zero kin-energy.
- templates: new LOG_EKIN_MIN constant as value taken incase of zero kin-energy.
March 13, 2019 Gabriele Cosmo (global-V10-05-02)
- Enable FPE detection on MacOS with clang.
@@ -77,6 +77,15 @@ inline
inline
void G4PhysicsTable::insertAt (size_t idx, G4PhysicsVector* pvec)
{
if(idx > entries())
{
G4ExceptionDescription ed;
ed << "Sprcified index (" << idx << ") is larger than the size of the vector ("
<< entries() << ").";
G4Exception("G4PhysicsTable::insertAt()","Global_PhysTbl0001",
FatalException,ed);
}
G4PhysicsTableIterator itr=begin();
for (size_t i=0; i<idx; ++i) { itr++; }
G4PhysCollection::insert(itr, pvec);
@@ -58,6 +58,7 @@
// instead of G4Pow G4Log is used
// 15 Mar. 2019 M.Novak : added Value method with the known log-energy value
// that can avoid the log call in case of log-vectors
// 16 July 2019 M.Novak : special LogVectorValue method for log-vectors
//---------------------------------------------------------------
#ifndef G4PhysicsVector_h
@@ -93,11 +94,11 @@ class G4PhysicsVector
// the value. Consumer code got changed index and may reuse it
// for the next call to save CPU for bin location.
G4double Value(G4double theEnergy, G4double theLogEnergy,
size_t& lastidx) const;
// Same as Value() above, with the additional log-kinetic energy input
// argument that can be used for faster index computation in case of
// log-vectors.
inline G4double LogVectorValue(const G4double theEnergy,
const G4double theLogEnergy) const;
// Same as the Value method above but specialised for log-vector type.
// Note, unlike the general Value method above, this method will work
// properly only in case of G4PhysicsLogVector-s.
inline G4double Value(G4double theEnergy) const;
// Get the cross-section/energy-loss value corresponding to the
@@ -106,11 +107,6 @@ class G4PhysicsVector
// it should be used instead of the previous method if bin location
// cannot be kept thread safe
inline G4double Value(G4double theEnergy, G4double theLogEnergy) const;
// Same as Value() above with the additional log-kinetic energy input
// argument that can be used for faster index computation in case of
// log-vectors.
inline G4double GetValue(G4double theEnergy, G4bool& isOutRange) const;
// Obsolete method to get value, isOutRange is not used anymore.
// This method is kept for the compatibility reason.
@@ -163,9 +159,9 @@ class G4PhysicsVector
// min value 0, max value VectorLength-1
// idx is suggested bin number from user code
inline size_t FindBin(G4double energy, G4double logener, size_t idx) const;
// Same as FindBin() above with the additional logenergy input argument
// that can be used for faster index computation in case of log-vectors.
inline size_t ComputeLogVectorBin(const G4double logenergy) const;
// Computes the lower index the energy bin in case of log-vector i.e.
// in case of vectors with equal bin widths on log-scale.
void FillSecondDerivatives();
// Initialise second derivatives for spline keeping
@@ -246,17 +242,11 @@ class G4PhysicsVector
// find low edge index of a bin for given energy
// min value 0, max value VectorLength-1
inline size_t FindBinLocation(G4double theEnergy,
G4double theLogEnergy) const;
// same as FindBinLocation() above with the additional log-energy input
// argument that can be used for faster index computations in case of
// log-vectors.
G4bool useSpline;
protected:
G4double dBin; // Bin width - useful only for fixed binning
G4double invdBin; // 1/Bin width - useful only for fixed binning
G4double baseBin; // Set this in constructor for performance
G4int verboseLevel;
@@ -194,11 +194,11 @@ size_t G4PhysicsVector::FindBinLocation(G4double theEnergy) const
{
size_t bin;
if(type == T_G4PhysicsLogVector) {
bin = size_t(G4Log(theEnergy)/dBin - baseBin);
bin = size_t(G4Log(theEnergy)*invdBin - baseBin);
if(bin > 0 && theEnergy < binVector[bin]) { --bin; }
else if(theEnergy > binVector[bin+1]) { ++bin; }
} else if(type == T_G4PhysicsLinearVector) {
bin = size_t( theEnergy/dBin - baseBin );
bin = size_t( theEnergy*invdBin - baseBin );
if(bin > 0 && theEnergy < binVector[bin]) { --bin; }
else if(theEnergy > binVector[bin+1]) { ++bin; }
} else {
@@ -210,26 +210,6 @@ size_t G4PhysicsVector::FindBinLocation(G4double theEnergy) const
}
//---------------------------------------------------------------
inline
size_t G4PhysicsVector::FindBinLocation(G4double theEnergy,
G4double theLogEnergy) const
{
size_t bin;
const G4double ex = (type==T_G4PhysicsLogVector) ? theLogEnergy : theEnergy;
if(type == T_G4PhysicsLogVector || type == T_G4PhysicsLinearVector) {
bin = size_t(ex/dBin - baseBin);
if(bin > 0 && theEnergy < binVector[bin]) { --bin; }
else if(theEnergy > binVector[bin+1]) { ++bin; }
} else {
// Bin location proposed by K.Genser (FNAL)
bin = std::lower_bound(binVector.begin(), binVector.end(), theEnergy)
- binVector.begin() - 1;
}
return std::min(bin, numberOfNodes-2);
}
//---------------------------------------------------------------
inline size_t G4PhysicsVector::FindBin(G4double e, size_t idx) const
@@ -246,23 +226,16 @@ inline size_t G4PhysicsVector::FindBin(G4double e, size_t idx) const
return id;
}
//---------------------------------------------------------------
inline
size_t G4PhysicsVector::FindBin(G4double e, G4double loge, size_t idx) const
size_t G4PhysicsVector::ComputeLogVectorBin(const G4double loge) const
{
size_t id = idx;
if(e < binVector[1]) {
id = 0;
} else if(e >= binVector[numberOfNodes-2]) {
id = numberOfNodes - 2;
} else if(idx >= numberOfNodes || e < binVector[idx]
|| e > binVector[idx+1]) {
id = FindBinLocation(e, loge);
}
return id;
return size_t(std::max(0., std::min(loge*invdBin-baseBin, numberOfNodes-2.)));
}
//---------------------------------------------------------------
inline
@@ -272,13 +245,6 @@ inline
return Value(theEnergy, idx);
}
//---------------------------------------------------------------
inline
G4double G4PhysicsVector::Value(G4double theEnergy, G4double theLogEnergy) const
{
size_t idx=0;
return Value(theEnergy, theLogEnergy, idx);
}
//---------------------------------------------------------------
@@ -290,3 +256,34 @@ inline
}
//---------------------------------------------------------------
inline
G4double G4PhysicsVector::LogVectorValue(const G4double theEnergy,
const G4double theLogEnergy) const
{
// handle cases below/above the enrgy grid (by ek, idx that gives b=0/1)
// ek = x[0] if e<=x[0] and idx will be 0 ^ b=0 => so y=y0
// ek = x[N-1] if e>=x[N-1] and idx will be N-2 ^ b=1 => so y=y_{N-1}
const G4double ek = std::max(binVector[0],
std::min(binVector[numberOfNodes-1], theEnergy));
// compute the lowerindex of the bin (idx \in [0,N-2] will be guaranted)
const size_t idx = ComputeLogVectorBin(theLogEnergy);
// perform the interpolation
const G4double x1 = binVector[idx];
const G4double x2 = binVector[idx+1];
const G4double dl = x2-x1;
// note: all corner cases of the previous methods are covered and eventually
// gives b=0/1 that results in y=y0\y_{N-1} if e<=x[0]/e>=x[N-1] or
// y=y_i/y_{i+1} if e<x[i]/e>=x[i+1] due to small numerical errors
const G4double b = std::max(0., std::min(1., (ek - x1)/dl));
if (useSpline) { // spline interpolation
const G4double os = 0.166666666667; // 1./6.
const G4double a = 1.0 - b;
const G4double c0 = (a*a*a-a)*secDerivative[idx];
const G4double c1 = (b*b*b-b)*secDerivative[idx+1];
return a*dataVector[idx] + b*dataVector[idx+1] + (c0+c1)*dl*dl*os;
} else { // linear interpolation
const G4double y1 = dataVector[idx];
const G4double y2 = dataVector[idx+1];
return y1 + b*(y2-y1);
}
}
+2 -2
View File
@@ -108,8 +108,8 @@ public:
inline G4String& remove(str_size);
inline G4String& remove(str_size, str_size);
inline G4int first(char) const;
inline G4int last(char) const;
inline std::size_t first(char) const;
inline std::size_t last(char) const;
inline G4bool contains(const std::string&) const;
inline G4bool contains(char) const;
@@ -219,12 +219,12 @@ inline G4String& G4String::remove(str_size pos, str_size N)
return *this;
}
inline G4int G4String::first(char ch) const
inline std::size_t G4String::first(char ch) const
{
return find(ch);
}
inline G4int G4String::last(char ch) const
inline std::size_t G4String::last(char ch) const
{
return rfind(ch);
}
@@ -247,7 +247,7 @@ inline G4String G4String::strip (G4int strip_Type, char ch)
switch ( strip_Type ) {
case leading:
{
for(i=0;i<length();i++)
for(i=0;i<length();++i)
{ if (std_string::operator[](i) != ch) { break; } }
retVal = substr(i,length()-i);
}
@@ -255,18 +255,18 @@ inline G4String G4String::strip (G4int strip_Type, char ch)
case trailing:
{
G4int j=0;
for(j=length()-1;j>=0;j--)
for(j=G4int(length()-1);j>=0;--j)
{ if (std_string::operator[](j) != ch) { break; } }
retVal = substr(0,j+1);
}
break;
case both:
{
for(i=0;i<length();i++)
for(i=0;i<length();++i)
{ if (std_string::operator[](i) != ch) { break; } }
G4String tmp(substr(i,length()-i));
G4int k=0;
for(k=tmp.length()-1;k>=0;k--)
for(k=G4int(tmp.length()-1);k>=0;--k)
{ if (tmp.std_string::operator[](k) != ch) { break; } }
retVal = tmp.substr(0,k+1);
}
+105 -27
View File
@@ -37,7 +37,7 @@
// Fundamental definitions
#ifndef G4GMAKE
#include "G4GlobalConfig.hh"
# include "G4GlobalConfig.hh"
#endif
#include "globals.hh"
@@ -45,41 +45,119 @@
//----------------------------------------------------------------------------//
#ifdef GEANT4_USE_TIMEMORY
# if defined __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wexceptions"
# pragma GCC diagnostic ignored "-Wunused-private-field"
# endif
# include <timemory/timemory.hpp>
#include <timemory/timemory.hpp>
typedef tim::auto_timer G4AutoTimer;
inline void InitializeTiMemory()
{
tim::manager* instance = tim::manager::instance();
instance->enable(true);
}
# if defined __GNUC__
# pragma GCC diagnostic pop
# endif
using G4AutoTimer = tim::auto_timer;
#else
#define TIMEMORY_AUTO_TIMER(str)
#define TIMEMORY_AUTO_TIMER_OBJ(str) {}
# include <ostream>
# include <string>
#define TIMEMORY_BASIC_AUTO_TIMER(str)
#define TIMEMORY_BASIC_AUTO_TIMER_OBJ(str) {}
namespace tim
{
template <typename... _Args>
void timemory_init(_Args...)
{
}
inline void timemory_finalize() {}
inline void print_env() {}
#define TIMEMORY_DEBUG_BASIC_AUTO_TIMER(str)
#define TIMEMORY_DEBUG_AUTO_TIMER(str)
/// this provides "functionality" for *_HANDLE macros
/// and can be omitted if these macros are not utilized
struct dummy
{
template <typename... _Args>
dummy(_Args&&...)
{
}
~dummy() = default;
dummy(const dummy&) = default;
dummy(dummy&&) = default;
dummy& operator=(const dummy&) = default;
dummy& operator=(dummy&&) = default;
inline void InitializeTiMemory()
{ }
void start() {}
void stop() {}
void conditional_start() {}
void conditional_stop() {}
void report_at_exit(bool) {}
template <typename... _Args>
void mark_begin(_Args&&...)
{
}
template <typename... _Args>
void mark_end(_Args&&...)
{
}
friend std::ostream& operator<<(std::ostream& os, const dummy&) { return os; }
};
} // namespace tim
// startup/shutdown/configure
# define TIMEMORY_INIT(...)
# define TIMEMORY_FINALIZE()
# define TIMEMORY_CONFIGURE(...)
// label creation
# define TIMEMORY_BASIC_LABEL(...) std::string("")
# define TIMEMORY_LABEL(...) std::string("")
# define TIMEMORY_JOIN(...) std::string("")
// define an object
# define TIMEMORY_BLANK_MARKER(...)
# define TIMEMORY_BASIC_MARKER(...)
# define TIMEMORY_MARKER(...)
// define an unique pointer object
# define TIMEMORY_BLANK_POINTER(...)
# define TIMEMORY_BASIC_POINTER(...)
# define TIMEMORY_POINTER(...)
// define an object with a caliper reference
# define TIMEMORY_BLANK_CALIPER(...)
# define TIMEMORY_BASIC_CALIPER(...)
# define TIMEMORY_CALIPER(...)
// define a static object with a caliper reference
# define TIMEMORY_STATIC_BLANK_CALIPER(...)
# define TIMEMORY_STATIC_BASIC_CALIPER(...)
# define TIMEMORY_STATIC_CALIPER(...)
// invoke member function on caliper reference or type within reference
# define TIMEMORY_CALIPER_APPLY(...)
# define TIMEMORY_CALIPER_TYPE_APPLY(...)
// get an object
# define TIMEMORY_BLANK_HANDLE(...) tim::dummy()
# define TIMEMORY_BASIC_HANDLE(...) tim::dummy()
# define TIMEMORY_HANDLE(...) tim::dummy()
// get a pointer to an object
# define TIMEMORY_BLANK_POINTER_HANDLE(...) nullptr
# define TIMEMORY_BASIC_POINTER_HANDLE(...) nullptr
# define TIMEMORY_POINTER_HANDLE(...) nullptr
// debug only
# define TIMEMORY_DEBUG_BLANK_MARKER(...)
# define TIMEMORY_DEBUG_BASIC_MARKER(...)
# define TIMEMORY_DEBUG_MARKER(...)
// auto-timers
# define TIMEMORY_BLANK_AUTO_TIMER(...)
# define TIMEMORY_BASIC_AUTO_TIMER(...)
# define TIMEMORY_AUTO_TIMER(...)
# define TIMEMORY_BLANK_AUTO_TIMER_HANDLE(...)
# define TIMEMORY_BASIC_AUTO_TIMER_HANDLE(...)
# define TIMEMORY_AUTO_TIMER_HANDLE(...)
# define TIMEMORY_DEBUG_BASIC_AUTO_TIMER(...)
# define TIMEMORY_DEBUG_AUTO_TIMER(...)
using G4AutoTimer = tim::dummy;
#endif
//----------------------------------------------------------------------------//
#endif
@@ -23,14 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
//
// Version information
//
// History:
// 26.09.05 K.Murakami - Created
//
// --------------------------------------------------------------------
#ifndef G4VERSION_HH
#define G4VERSION_HH
@@ -48,7 +44,7 @@
#endif
#ifndef G4VERSION_TAG
#define G4VERSION_TAG "$Name: geant4-10-06-beta-01 $"
#define G4VERSION_TAG "$Name: geant4-10-06 $"
#endif
// as variables
@@ -57,10 +53,10 @@
#include "G4String.hh"
#ifdef G4MULTITHREADED
static const G4String G4Version = "$Name: geant4-10-06-beta-01 [MT]$";
static const G4String G4Version = "$Name: geant4-10-06 [MT]$";
#else
static const G4String G4Version = "$Name: geant4-10-06-beta-01 $";
static const G4String G4Version = "$Name: geant4-10-06 $";
#endif
static const G4String G4Date = "(28-June-2019)";
static const G4String G4Date = "(6-December-2019)";
#endif
@@ -203,8 +203,8 @@ inline int G4rint(double ad)
// G4ConsumeParameters(val);
// }
//
template <typename _Tp, typename... _Args>
inline void G4ConsumeParameters(_Tp, _Args...)
template <typename... _Args>
inline void G4ConsumeParameters(_Args&&...)
{ }
#endif // templates_h
+1 -2
View File
@@ -16,7 +16,6 @@
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
include_directories(${TiMemory_INCLUDE_DIRS})
# List internal includes needed.
@@ -170,7 +169,7 @@ GEANT4_DEFINE_MODULE(NAME G4globman
GLOBAL_DEPENDENCIES
LINK_LIBRARIES
${CLHEP_LIBRARIES}
${TiMemory_LIBRARIES}
${timemory_LIBRARIES}
)
# List any source specific properties here
@@ -51,8 +51,8 @@ G4PhysicsLinearVector::G4PhysicsLinearVector(G4double theEmin,
{
type = T_G4PhysicsLinearVector;
dBin = (theEmax-theEmin)/(G4double)theNbin;
baseBin = theEmin/dBin;
invdBin = 1./((theEmax-theEmin)/(G4double)theNbin);
baseBin = theEmin*invdBin;
numberOfNodes = theNbin + 1;
dataVector.reserve(numberOfNodes);
@@ -63,7 +63,7 @@ G4PhysicsLinearVector::G4PhysicsLinearVector(G4double theEmin,
for (size_t i=1; i<numberOfNodes-1; ++i)
{
binVector.push_back( theEmin + i*dBin );
binVector.push_back( theEmin + i/invdBin );
dataVector.push_back(0.0);
}
binVector.push_back(theEmax);
@@ -82,8 +82,8 @@ G4bool G4PhysicsLinearVector::Retrieve(std::ifstream& fIn, G4bool ascii)
G4bool success = G4PhysicsVector::Retrieve(fIn, ascii);
if (success)
{
dBin = binVector[1]-edgeMin;
baseBin = edgeMin/dBin;
invdBin = 1./(binVector[1]-edgeMin);
baseBin = edgeMin*invdBin;
}
return success;
}
@@ -91,7 +91,7 @@ G4bool G4PhysicsLinearVector::Retrieve(std::ifstream& fIn, G4bool ascii)
void G4PhysicsLinearVector::ScaleVector(G4double factorE, G4double factorV)
{
G4PhysicsVector::ScaleVector(factorE, factorV);
dBin = binVector[1]-edgeMin;
baseBin = edgeMin/dBin;
invdBin = 1./(binVector[1]-edgeMin);
baseBin = edgeMin*invdBin;
}
@@ -59,8 +59,8 @@ G4PhysicsLogVector::G4PhysicsLogVector(G4double theEmin,
{
type = T_G4PhysicsLogVector;
dBin = G4Log(theEmax/theEmin)/(G4double)theNbin;
baseBin = G4Log(theEmin)/dBin;
invdBin = 1./(G4Log(theEmax/theEmin)/(G4double)theNbin);
baseBin = G4Log(theEmin)*invdBin;
numberOfNodes = theNbin + 1;
dataVector.reserve(numberOfNodes);
@@ -71,7 +71,7 @@ G4PhysicsLogVector::G4PhysicsLogVector(G4double theEmin,
for (size_t i=1; i<numberOfNodes-1; ++i)
{
binVector.push_back(G4Exp((baseBin+i)*dBin));
binVector.push_back(G4Exp((baseBin+i)/invdBin));
dataVector.push_back(0.0);
}
binVector.push_back(theEmax);
@@ -89,8 +89,8 @@ G4bool G4PhysicsLogVector::Retrieve(std::ifstream& fIn, G4bool ascii)
G4bool success = G4PhysicsVector::Retrieve(fIn, ascii);
if (success)
{
dBin = G4Log(binVector[1]/edgeMin);
baseBin = G4Log(edgeMin)/dBin;
invdBin = 1./G4Log(binVector[1]/edgeMin);
baseBin = G4Log(edgeMin)*invdBin;
}
return success;
}
@@ -98,6 +98,6 @@ G4bool G4PhysicsLogVector::Retrieve(std::ifstream& fIn, G4bool ascii)
void G4PhysicsLogVector::ScaleVector(G4double factorE, G4double factorV)
{
G4PhysicsVector::ScaleVector(factorE, factorV);
dBin = G4Log(binVector[1]/edgeMin);
baseBin = G4Log(edgeMin)/dBin;
invdBin = 1./G4Log(binVector[1]/edgeMin);
baseBin = G4Log(edgeMin)*invdBin;
}
@@ -61,7 +61,7 @@ G4PhysicsVector::G4PhysicsVector(G4bool val)
: type(T_G4PhysicsVector),
edgeMin(0.), edgeMax(0.), numberOfNodes(0),
useSpline(val),
dBin(0.), baseBin(0.),
invdBin(0.), baseBin(0.),
verboseLevel(0)
{}
@@ -74,7 +74,7 @@ G4PhysicsVector::~G4PhysicsVector()
G4PhysicsVector::G4PhysicsVector(const G4PhysicsVector& right)
{
dBin = right.dBin;
invdBin = right.invdBin;
baseBin = right.baseBin;
verboseLevel = right.verboseLevel;
@@ -87,7 +87,7 @@ G4PhysicsVector::G4PhysicsVector(const G4PhysicsVector& right)
G4PhysicsVector& G4PhysicsVector::operator=(const G4PhysicsVector& right)
{
if (&right==this) { return *this; }
dBin = right.dBin;
invdBin = right.invdBin;
baseBin = right.baseBin;
verboseLevel = right.verboseLevel;
@@ -512,25 +512,6 @@ G4double G4PhysicsVector::Value(G4double theEnergy, size_t& lastIdx) const
//---------------------------------------------------------------
G4double G4PhysicsVector::Value(G4double theEnergy, G4double theLogEnergy,
size_t& lastIdx) const
{
G4double y;
if(theEnergy <= edgeMin) {
lastIdx = 0;
y = dataVector[0];
} else if(theEnergy >= edgeMax) {
lastIdx = numberOfNodes-1;
y = dataVector[lastIdx];
} else {
lastIdx = FindBin(theEnergy, theLogEnergy, lastIdx);
y = Interpolation(lastIdx, theEnergy);
}
return y;
}
//---------------------------------------------------------------
G4double G4PhysicsVector::FindLinearEnergy(G4double rand) const
{
if(1 >= numberOfNodes) { return 0.0; }