Import Geant4 2.0.0 source tree
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LorentzRotation.hh,v 1.2 1999/11/16 17:29:12 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#ifndef G4LorentzRotation_hh
|
||||
#define G4LorentzRotation_hh
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LorentzVector.hh,v 1.2 1999/11/16 17:29:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#ifndef G4LorentzVector_hh
|
||||
#define G4LorentzVector_hh
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Normal3D.hh,v 1.2 1999/11/16 17:29:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#ifndef G4NORMAL3D_HH
|
||||
#define G4NORMAL3D_HH
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Plane3D.hh,v 1.2 1999/11/16 17:29:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#ifndef G4PLANE3D_HH
|
||||
#define G4PLANE3D_HH
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Point3D.hh,v 1.2 1999/11/16 17:29:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#ifndef G4POINT3D_HH
|
||||
#define G4POINT3D_HH
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Transform3D.hh,v 1.2 1999/11/16 17:29:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#ifndef G4TRANSFORM3D_HH
|
||||
#define G4TRANSFORM3D_HH
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Vector3D.hh,v 1.2 1999/11/16 17:29:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#ifndef G4VECTOR3D_HH
|
||||
#define G4VECTOR3D_HH
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: geomdefs.hh,v 1.2 1999/11/16 17:29:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ChebyshevApproximation.hh,v 1.2 1999/11/16 17:30:55 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4DataInterpolation.hh,v 1.2 1999/11/16 17:30:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GaussChebyshevQ.hh,v 1.2 1999/11/16 17:30:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GaussHermiteQ.hh,v 1.2 1999/11/16 17:30:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GaussJacobiQ.hh,v 1.2 1999/11/16 17:30:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GaussLaguerreQ.hh,v 1.2 1999/11/16 17:30:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GaussLegendreQ.hh,v 1.2 1999/11/16 17:30:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Integrator.hh,v 1.3 1999/11/16 17:30:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: G4Integrator.hh,v 1.4 2000/06/15 17:31:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Class collecting template integrator methods for generic funtions.
|
||||
// Template class collecting integrator methods for generic funtions.
|
||||
|
||||
// History:
|
||||
//
|
||||
// 04.09.99 V.Grichine, first implementation based on G4SimpleIntegration class
|
||||
// and H.-P. Wellisch, G.Cosmo, and E.Cherniaev advises
|
||||
// H.P.Wellisch, G.Cosmo, and E.Cherniaev advises
|
||||
// 08.09.99 V.Grichine, methods involving orthogonal polynomials
|
||||
//
|
||||
|
||||
@@ -26,133 +26,84 @@
|
||||
#include "globals.hh"
|
||||
#include <math.h>
|
||||
|
||||
template <class T, class F>
|
||||
class G4Integrator
|
||||
{
|
||||
public:
|
||||
public: // with description
|
||||
|
||||
G4Integrator(){;}
|
||||
|
||||
~G4Integrator(){;}
|
||||
|
||||
// Simpson integration method
|
||||
|
||||
template <class T, class F> G4double
|
||||
Simpson( T& typeT, F f, G4double a, G4double b, G4int n ) ;
|
||||
|
||||
template <class T, class F> G4double
|
||||
Simpson( T* ptrT, F f, G4double a, G4double b, G4int n ) ;
|
||||
|
||||
G4double Simpson( T& typeT, F f, G4double a, G4double b, G4int n ) ;
|
||||
G4double Simpson( T* ptrT, F f, G4double a, G4double b, G4int n ) ;
|
||||
G4double Simpson( G4double (*f)(G4double),
|
||||
G4double a, G4double b, G4int n ) ;
|
||||
// Simpson integration method
|
||||
|
||||
// Adaptive Gauss method
|
||||
|
||||
template <class T, class F> G4double
|
||||
AdaptiveGauss( T& typeT, F f, G4double a, G4double b, G4double e ) ;
|
||||
|
||||
template <class T, class F> G4double
|
||||
AdaptiveGauss( T* ptrT, F f, G4double a, G4double b, G4double e ) ;
|
||||
|
||||
G4double AdaptiveGauss( T& typeT, F f, G4double a, G4double b, G4double e ) ;
|
||||
G4double AdaptiveGauss( T* ptrT, F f, G4double a, G4double b, G4double e ) ;
|
||||
G4double AdaptiveGauss( G4double (*f)(G4double),
|
||||
G4double a, G4double b, G4double e ) ;
|
||||
// Adaptive Gauss method
|
||||
|
||||
|
||||
// Integration methods involving orthogohol polynomials
|
||||
|
||||
G4double Legendre( T& typeT, F f, G4double a, G4double b, G4int n) ;
|
||||
G4double Legendre( T* ptrT, F f, G4double a, G4double b, G4int n) ;
|
||||
G4double Legendre( G4double (*f)(G4double), G4double a, G4double b, G4int n) ;
|
||||
//
|
||||
// Methods involving Legendre polynomials
|
||||
|
||||
|
||||
template <class T, class F>
|
||||
G4double Legendre( T& typeT, F f, G4double a, G4double b, G4int n) ;
|
||||
|
||||
template <class T, class F>
|
||||
G4double Legendre( T* ptrT, F f, G4double a, G4double b, G4int n) ;
|
||||
|
||||
G4double Legendre( G4double (*f)(G4double), G4double a, G4double b, G4int n) ;
|
||||
|
||||
// Legendre10 is very fast and accurate anough
|
||||
|
||||
template <class T, class F>
|
||||
G4double Legendre10( T& typeT, F f,G4double a, G4double b) ;
|
||||
|
||||
template <class T, class F>
|
||||
G4double Legendre10( T* ptrT, F f,G4double a, G4double b) ;
|
||||
|
||||
G4double Legendre10( G4double (*f)(G4double), G4double a, G4double b) ;
|
||||
//
|
||||
// Legendre10 is very fast and accurate enough
|
||||
|
||||
G4double Legendre96( T& typeT, F f,G4double a, G4double b) ;
|
||||
G4double Legendre96( T* ptrT, F f,G4double a, G4double b) ;
|
||||
G4double Legendre96( G4double (*f)(G4double), G4double a, G4double b) ;
|
||||
//
|
||||
// Legendre96 is very accurate and fast enough
|
||||
|
||||
template <class T, class F>
|
||||
G4double Legendre96( T& typeT, F f,G4double a, G4double b) ;
|
||||
|
||||
template <class T, class F>
|
||||
G4double Legendre96( T* ptrT, F f,G4double a, G4double b) ;
|
||||
|
||||
G4double Legendre96( G4double (*f)(G4double), G4double a, G4double b) ;
|
||||
|
||||
G4double Chebyshev( T& typeT, F f, G4double a, G4double b, G4int n) ;
|
||||
G4double Chebyshev( T* ptrT, F f, G4double a, G4double b, G4int n) ;
|
||||
G4double Chebyshev( G4double (*f)(G4double), G4double a, G4double b, G4int n) ;
|
||||
//
|
||||
// Methods involving Chebyshev polynomials
|
||||
|
||||
template <class T, class F>
|
||||
G4double Chebyshev( T& typeT, F f, G4double a, G4double b, G4int n) ;
|
||||
|
||||
template <class T, class F>
|
||||
G4double Chebyshev( T* ptrT, F f, G4double a, G4double b, G4int n) ;
|
||||
|
||||
G4double Chebyshev( G4double (*f)(G4double), G4double a, G4double b, G4int n) ;
|
||||
|
||||
G4double Laguerre( T& typeT, F f, G4double alpha, G4int n) ;
|
||||
G4double Laguerre( T* ptrT, F f, G4double alpha, G4int n) ;
|
||||
G4double Laguerre( G4double (*f)(G4double), G4double alpha, G4int n) ;
|
||||
//
|
||||
// Method involving Laguerre polynomials
|
||||
|
||||
template <class T, class F>
|
||||
G4double Laguerre( T& typeT, F f, G4double alpha, G4int n) ;
|
||||
|
||||
template <class T, class F>
|
||||
G4double Laguerre( T* ptrT, F f, G4double alpha, G4int n) ;
|
||||
|
||||
G4double Laguerre( G4double (*f)(G4double), G4double alpha, G4int n) ;
|
||||
|
||||
G4double Hermite( T& typeT, F f, G4int n) ;
|
||||
G4double Hermite( T* ptrT, F f, G4int n) ;
|
||||
G4double Hermite( G4double (*f)(G4double), G4int n) ;
|
||||
//
|
||||
// Method involving Hermite polynomials
|
||||
|
||||
template <class T, class F>
|
||||
G4double Hermite( T& typeT, F f, G4int n) ;
|
||||
|
||||
template <class T, class F>
|
||||
G4double Hermite( T* ptrT, F f, G4int n) ;
|
||||
|
||||
G4double Hermite( G4double (*f)(G4double), G4int n) ;
|
||||
|
||||
// Method involving Jacobi polynomials
|
||||
|
||||
template <class T, class F>
|
||||
G4double Jacobi( T& typeT, F f, G4double alpha, G4double beta, G4int n) ;
|
||||
|
||||
template <class T, class F>
|
||||
G4double Jacobi( T* ptrT, F f, G4double alpha, G4double beta, G4int n) ;
|
||||
|
||||
G4double Jacobi( G4double (*f)(G4double), G4double alpha,
|
||||
G4double beta, G4int n) ;
|
||||
// Method involving Jacobi polynomials
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Auxiliary function for adaptive Gauss method
|
||||
|
||||
template <class T, class F> G4double
|
||||
Gauss( T& typeT, F f, G4double a, G4double b ) ;
|
||||
|
||||
template <class T, class F> G4double
|
||||
Gauss( T* ptrT, F f, G4double a, G4double b ) ;
|
||||
|
||||
G4double Gauss( T& typeT, F f, G4double a, G4double b ) ;
|
||||
G4double Gauss( T* ptrT, F f, G4double a, G4double b ) ;
|
||||
G4double Gauss( G4double (*f)(G4double), G4double a, G4double b) ;
|
||||
|
||||
//
|
||||
|
||||
template <class T, class F> void
|
||||
AdaptGauss( T& typeT, F f, G4double a, G4double b,
|
||||
G4double e, G4double& sum, G4int& n) ;
|
||||
|
||||
template <class T, class F> void
|
||||
AdaptGauss( T* typeT, F f, G4double a, G4double b,
|
||||
G4double e, G4double& sum, G4int& n ) ;
|
||||
|
||||
void AdaptGauss( T& typeT, F f, G4double a, G4double b,
|
||||
G4double e, G4double& sum, G4int& n) ;
|
||||
void AdaptGauss( T* typeT, F f, G4double a, G4double b,
|
||||
G4double e, G4double& sum, G4int& n ) ;
|
||||
void AdaptGauss( G4double (*f)(G4double), G4double a, G4double b,
|
||||
G4double e, G4double& sum, G4int& n ) ;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Integrator.icc,v 1.4 1999/11/23 14:59:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: G4Integrator.icc,v 1.6 2000/06/15 17:31:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Implementation of G4Integrator methods.
|
||||
//
|
||||
@@ -21,11 +21,11 @@
|
||||
// Integration of class member functions T::f by Simpson method.
|
||||
|
||||
template <class T, class F>
|
||||
G4double G4Integrator::Simpson( T& typeT,
|
||||
F f,
|
||||
G4double xInitial,
|
||||
G4double xFinal,
|
||||
G4int iterationNumber )
|
||||
G4double G4Integrator<T,F>::Simpson( T& typeT,
|
||||
F f,
|
||||
G4double xInitial,
|
||||
G4double xFinal,
|
||||
G4int iterationNumber )
|
||||
{
|
||||
G4int i ;
|
||||
G4double step = (xFinal - xInitial)/iterationNumber ;
|
||||
@@ -52,7 +52,7 @@ G4double G4Integrator::Simpson( T& typeT,
|
||||
// Convenient to use with 'this' pointer
|
||||
|
||||
template <class T, class F>
|
||||
G4double G4Integrator::Simpson( T* ptrT,
|
||||
G4double G4Integrator<T,F>::Simpson( T* ptrT,
|
||||
F f,
|
||||
G4double xInitial,
|
||||
G4double xFinal,
|
||||
@@ -83,7 +83,8 @@ G4double G4Integrator::Simpson( T* ptrT,
|
||||
// Convenient to use, when function f is defined in global scope, i.e. in main()
|
||||
// program
|
||||
|
||||
G4double G4Integrator::Simpson( G4double (*f)(G4double),
|
||||
template <class T, class F>
|
||||
G4double G4Integrator<T,F>::Simpson( G4double (*f)(G4double),
|
||||
G4double xInitial,
|
||||
G4double xFinal,
|
||||
G4int iterationNumber )
|
||||
@@ -116,7 +117,7 @@ G4double G4Integrator::Simpson( G4double (*f)(G4double),
|
||||
//
|
||||
|
||||
template <class T, class F>
|
||||
G4double G4Integrator::Gauss( T& typeT, F f,
|
||||
G4double G4Integrator<T,F>::Gauss( T& typeT, F f,
|
||||
G4double xInitial, G4double xFinal )
|
||||
{
|
||||
static G4double root = 1.0/sqrt(3.0) ;
|
||||
@@ -135,7 +136,7 @@ G4double G4Integrator::Gauss( T& typeT, F f,
|
||||
//
|
||||
|
||||
template <class T, class F> G4double
|
||||
G4Integrator::Gauss( T* ptrT, F f, G4double a, G4double b )
|
||||
G4Integrator<T,F>::Gauss( T* ptrT, F f, G4double a, G4double b )
|
||||
{
|
||||
return Gauss(*ptrT,f,a,b) ;
|
||||
}
|
||||
@@ -144,7 +145,8 @@ G4Integrator::Gauss( T* ptrT, F f, G4double a, G4double b )
|
||||
//
|
||||
//
|
||||
|
||||
G4double G4Integrator::Gauss( G4double (*f)(G4double),
|
||||
template <class T, class F>
|
||||
G4double G4Integrator<T,F>::Gauss( G4double (*f)(G4double),
|
||||
G4double xInitial, G4double xFinal)
|
||||
{
|
||||
static G4double root = 1.0/sqrt(3.0) ;
|
||||
@@ -162,14 +164,14 @@ G4double G4Integrator::Gauss( G4double (*f)(G4double),
|
||||
//
|
||||
|
||||
template <class T, class F>
|
||||
void G4Integrator::AdaptGauss( T& typeT, F f, G4double xInitial,
|
||||
void G4Integrator<T,F>::AdaptGauss( T& typeT, F f, G4double xInitial,
|
||||
G4double xFinal, G4double fTolerance,
|
||||
G4double& sum,
|
||||
G4int& depth )
|
||||
{
|
||||
if(depth > 100)
|
||||
{
|
||||
G4cout<<"G4Integrator::AdaptGauss: WARNING !!!"<<G4endl ;
|
||||
G4cout<<"G4Integrator<T,F>::AdaptGauss: WARNING !!!"<<G4endl ;
|
||||
G4cout
|
||||
<<"Function varies too rapidly to get stated accuracy in 100 steps "<<G4endl ;
|
||||
|
||||
@@ -192,19 +194,19 @@ G4cout
|
||||
}
|
||||
|
||||
template <class T, class F>
|
||||
void G4Integrator::AdaptGauss( T* ptrT, F f, G4double xInitial,
|
||||
void G4Integrator<T,F>::AdaptGauss( T* ptrT, F f, G4double xInitial,
|
||||
G4double xFinal, G4double fTolerance,
|
||||
G4double& sum,
|
||||
G4int& depth )
|
||||
{
|
||||
return AdaptGauss(*ptrT,f,xInitial,xFinal,fTolerance,sum,depth) ;
|
||||
AdaptGauss(*ptrT,f,xInitial,xFinal,fTolerance,sum,depth) ;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
void G4Integrator::AdaptGauss( G4double (*f)(G4double),
|
||||
template <class T, class F>
|
||||
void G4Integrator<T,F>::AdaptGauss( G4double (*f)(G4double),
|
||||
G4double xInitial, G4double xFinal,
|
||||
G4double fTolerance, G4double& sum,
|
||||
G4int& depth )
|
||||
@@ -242,7 +244,7 @@ void G4Integrator::AdaptGauss( G4double (*f)(G4double),
|
||||
// Convenient for using with class object typeT
|
||||
|
||||
template<class T, class F> G4double
|
||||
G4Integrator::AdaptiveGauss( T& typeT, F f, G4double xInitial,
|
||||
G4Integrator<T,F>::AdaptiveGauss( T& typeT, F f, G4double xInitial,
|
||||
G4double xFinal, G4double e )
|
||||
{
|
||||
G4int depth = 0 ;
|
||||
@@ -257,7 +259,7 @@ G4Integrator::AdaptiveGauss( T& typeT, F f, G4double xInitial,
|
||||
// Convenient for using with 'this' pointer
|
||||
|
||||
template<class T, class F> G4double
|
||||
G4Integrator::AdaptiveGauss( T* ptrT, F f, G4double xInitial,
|
||||
G4Integrator<T,F>::AdaptiveGauss( T* ptrT, F f, G4double xInitial,
|
||||
G4double xFinal, G4double e )
|
||||
{
|
||||
return AdaptiveGauss(*ptrT,f,xInitial,xFinal,e) ;
|
||||
@@ -268,8 +270,8 @@ G4Integrator::AdaptiveGauss( T* ptrT, F f, G4double xInitial,
|
||||
// Adaptive Gauss integration with accuracy 'e'
|
||||
// Convenient for using with global scope function f
|
||||
|
||||
G4double
|
||||
G4Integrator::AdaptiveGauss( G4double (*f)(G4double),
|
||||
template <class T, class F> G4double
|
||||
G4Integrator<T,F>::AdaptiveGauss( G4double (*f)(G4double),
|
||||
G4double xInitial, G4double xFinal, G4double e )
|
||||
{
|
||||
G4int depth = 0 ;
|
||||
@@ -301,7 +303,7 @@ G4Integrator::AdaptiveGauss( G4double (*f)(G4double),
|
||||
// Convenient for using with some class object dataT
|
||||
|
||||
template <class T, class F> G4double
|
||||
G4Integrator::Legendre( T& typeT, F f, G4double a, G4double b, G4int nLegendre)
|
||||
G4Integrator<T,F>::Legendre( T& typeT, F f, G4double a, G4double b, G4int nLegendre)
|
||||
{
|
||||
G4double newton, newton1, temp1, temp2, temp3, temp ;
|
||||
G4double xDiff, xMean, dx, integral ;
|
||||
@@ -312,7 +314,7 @@ G4Integrator::Legendre( T& typeT, F f, G4double a, G4double b, G4int nLegendre)
|
||||
|
||||
if(2*fNumber != k)
|
||||
{
|
||||
G4Exception("Invalid (odd) n Legendre in G4Integrator::Legendre") ;
|
||||
G4Exception("Invalid (odd) n Legendre in G4Integrator<T,F>::Legendre") ;
|
||||
}
|
||||
|
||||
G4double* fAbscissa = new G4double[fNumber] ;
|
||||
@@ -362,7 +364,7 @@ G4Integrator::Legendre( T& typeT, F f, G4double a, G4double b, G4int nLegendre)
|
||||
// Convenient for using with the pointer 'this'
|
||||
|
||||
template <class T, class F> G4double
|
||||
G4Integrator::Legendre( T* ptrT, F f, G4double a, G4double b, G4int nLegendre)
|
||||
G4Integrator<T,F>::Legendre( T* ptrT, F f, G4double a, G4double b, G4int nLegendre)
|
||||
{
|
||||
return Legendre(*ptrT,f,a,b,nLegendre) ;
|
||||
}
|
||||
@@ -371,8 +373,8 @@ G4Integrator::Legendre( T* ptrT, F f, G4double a, G4double b, G4int nLegendre)
|
||||
//
|
||||
// Convenient for using with global scope function f
|
||||
|
||||
|
||||
G4double G4Integrator::
|
||||
template <class T, class F>
|
||||
G4double G4Integrator<T,F>::
|
||||
Legendre( G4double (*f)(G4double), G4double a, G4double b, G4int nLegendre)
|
||||
{
|
||||
G4double newton, newton1, temp1, temp2, temp3, temp ;
|
||||
@@ -384,7 +386,7 @@ Legendre( G4double (*f)(G4double), G4double a, G4double b, G4int nLegendre)
|
||||
|
||||
if(2*fNumber != k)
|
||||
{
|
||||
G4Exception("Invalid (odd) n Legendre in G4Integrator::Legendre") ;
|
||||
G4Exception("Invalid (odd) n Legendre in G4Integrator<T,F>::Legendre") ;
|
||||
}
|
||||
|
||||
G4double* fAbscissa = new G4double[fNumber] ;
|
||||
@@ -438,7 +440,7 @@ Legendre( G4double (*f)(G4double), G4double a, G4double b, G4int nLegendre)
|
||||
// Convenient for using with class object typeT
|
||||
|
||||
template <class T, class F>
|
||||
G4double G4Integrator::Legendre10( T& typeT, F f,G4double a, G4double b)
|
||||
G4double G4Integrator<T,F>::Legendre10( T& typeT, F f,G4double a, G4double b)
|
||||
{
|
||||
G4int i ;
|
||||
G4double xDiff, xMean, dx, integral ;
|
||||
@@ -468,7 +470,7 @@ Legendre( G4double (*f)(G4double), G4double a, G4double b, G4int nLegendre)
|
||||
// Convenient for using with the pointer 'this'
|
||||
|
||||
template <class T, class F>
|
||||
G4double G4Integrator::Legendre10( T* ptrT, F f,G4double a, G4double b)
|
||||
G4double G4Integrator<T,F>::Legendre10( T* ptrT, F f,G4double a, G4double b)
|
||||
{
|
||||
return Legendre10(*ptrT,f,a,b) ;
|
||||
}
|
||||
@@ -477,8 +479,8 @@ G4double G4Integrator::Legendre10( T* ptrT, F f,G4double a, G4double b)
|
||||
//
|
||||
// Convenient for using with global scope functions
|
||||
|
||||
G4double
|
||||
G4Integrator::Legendre10( G4double (*f)(G4double), G4double a, G4double b)
|
||||
template <class T, class F> G4double
|
||||
G4Integrator<T,F>::Legendre10( G4double (*f)(G4double), G4double a, G4double b)
|
||||
{
|
||||
G4int i ;
|
||||
G4double xDiff, xMean, dx, integral ;
|
||||
@@ -513,7 +515,7 @@ G4Integrator::Legendre10( G4double (*f)(G4double), G4double a, G4double b)
|
||||
// Convenient for using with some class object typeT
|
||||
|
||||
template <class T, class F>
|
||||
G4double G4Integrator::Legendre96( T& typeT, F f,G4double a, G4double b)
|
||||
G4double G4Integrator<T,F>::Legendre96( T& typeT, F f,G4double a, G4double b)
|
||||
{
|
||||
G4int i ;
|
||||
G4double xDiff, xMean, dx, integral ;
|
||||
@@ -605,7 +607,7 @@ G4double G4Integrator::Legendre96( T& typeT, F f,G4double a, G4double b)
|
||||
// Convenient for using with the pointer 'this'
|
||||
|
||||
template <class T, class F>
|
||||
G4double G4Integrator::Legendre96( T* ptrT, F f,G4double a, G4double b)
|
||||
G4double G4Integrator<T,F>::Legendre96( T* ptrT, F f,G4double a, G4double b)
|
||||
{
|
||||
return Legendre96(*ptrT,f,a,b) ;
|
||||
}
|
||||
@@ -614,8 +616,8 @@ G4double G4Integrator::Legendre96( T* ptrT, F f,G4double a, G4double b)
|
||||
//
|
||||
// Convenient for using with global scope function f
|
||||
|
||||
G4double
|
||||
G4Integrator::Legendre96( G4double (*f)(G4double), G4double a, G4double b)
|
||||
template <class T, class F> G4double
|
||||
G4Integrator<T,F>::Legendre96( G4double (*f)(G4double), G4double a, G4double b)
|
||||
{
|
||||
G4int i ;
|
||||
G4double xDiff, xMean, dx, integral ;
|
||||
@@ -713,7 +715,7 @@ G4Integrator::Legendre96( G4double (*f)(G4double), G4double a, G4double b)
|
||||
// Convenient for using with class object typeT
|
||||
|
||||
template <class T, class F> G4double
|
||||
G4Integrator::Chebyshev( T& typeT, F f, G4double a,
|
||||
G4Integrator<T,F>::Chebyshev( T& typeT, F f, G4double a,
|
||||
G4double b, G4int nChebyshev )
|
||||
{
|
||||
G4int i ;
|
||||
@@ -746,7 +748,7 @@ G4Integrator::Chebyshev( T& typeT, F f, G4double a,
|
||||
// Convenient for using with 'this' pointer
|
||||
|
||||
template <class T, class F> G4double
|
||||
G4Integrator::Chebyshev( T* ptrT, F f, G4double a, G4double b, G4int n)
|
||||
G4Integrator<T,F>::Chebyshev( T* ptrT, F f, G4double a, G4double b, G4int n)
|
||||
{
|
||||
return Chebyshev(*ptrT,f,a,b,n) ;
|
||||
}
|
||||
@@ -755,8 +757,8 @@ G4Integrator::Chebyshev( T* ptrT, F f, G4double a, G4double b, G4int n)
|
||||
//
|
||||
// For use with global scope functions f
|
||||
|
||||
G4double
|
||||
G4Integrator::Chebyshev( G4double (*f)(G4double),
|
||||
template <class T, class F> G4double
|
||||
G4Integrator<T,F>::Chebyshev( G4double (*f)(G4double),
|
||||
G4double a, G4double b, G4int nChebyshev)
|
||||
{
|
||||
G4int i ;
|
||||
@@ -798,7 +800,7 @@ G4Integrator::Chebyshev( G4double (*f)(G4double),
|
||||
// (T::f)
|
||||
|
||||
template <class T, class F> G4double
|
||||
G4Integrator::Laguerre( T& typeT, F f, G4double alpha, G4int nLaguerre )
|
||||
G4Integrator<T,F>::Laguerre( T& typeT, F f, G4double alpha, G4int nLaguerre )
|
||||
{
|
||||
const G4double tolerance = 1.0e-10 ;
|
||||
const G4int maxNumber = 12 ;
|
||||
@@ -872,7 +874,7 @@ newton += ((1.0+2.55*cofi)/(1.9*cofi) + 1.26*cofi*alpha/(1.0+3.5*cofi))*
|
||||
//
|
||||
|
||||
template <class T, class F> G4double
|
||||
G4Integrator::Laguerre( T* ptrT, F f, G4double alpha, G4int nLaguerre )
|
||||
G4Integrator<T,F>::Laguerre( T* ptrT, F f, G4double alpha, G4int nLaguerre )
|
||||
{
|
||||
return Laguerre(*ptrT,f,alpha,nLaguerre) ;
|
||||
}
|
||||
@@ -881,8 +883,8 @@ G4Integrator::Laguerre( T* ptrT, F f, G4double alpha, G4int nLaguerre )
|
||||
//
|
||||
// For use with global scope functions f
|
||||
|
||||
G4double
|
||||
G4Integrator::Laguerre( G4double (*f)(G4double),
|
||||
template <class T, class F> G4double
|
||||
G4Integrator<T,F>::Laguerre( G4double (*f)(G4double),
|
||||
G4double alpha, G4int nLaguerre)
|
||||
{
|
||||
const G4double tolerance = 1.0e-10 ;
|
||||
@@ -958,7 +960,8 @@ newton += ((1.0+2.55*cofi)/(1.9*cofi) + 1.26*cofi*alpha/(1.0+3.5*cofi))*
|
||||
// (Adapted from Numerical Recipes in C)
|
||||
//
|
||||
|
||||
G4double G4Integrator::GammaLogarithm(G4double xx)
|
||||
template <class T, class F>
|
||||
G4double G4Integrator<T,F>::GammaLogarithm(G4double xx)
|
||||
{
|
||||
static G4double cof[6] = { 76.18009172947146, -86.50532032941677,
|
||||
24.01409824083091, -1.231739572450155,
|
||||
@@ -989,7 +992,7 @@ G4double G4Integrator::GammaLogarithm(G4double xx)
|
||||
//
|
||||
|
||||
template <class T, class F>
|
||||
G4double G4Integrator::Hermite( T& typeT, F f, G4int nHermite)
|
||||
G4double G4Integrator<T,F>::Hermite( T& typeT, F f, G4int nHermite)
|
||||
{
|
||||
const G4double tolerance = 1.0e-12 ;
|
||||
const G4int maxNumber = 12 ;
|
||||
@@ -1050,7 +1053,7 @@ G4double G4Integrator::Hermite( T& typeT, F f, G4int nHermite)
|
||||
}
|
||||
if(k > maxNumber)
|
||||
{
|
||||
G4Exception("Too many (>12) iterations in G4Integrator::Hermite") ;
|
||||
G4Exception("Too many (>12) iterations in G4Integrator<T,F>::Hermite") ;
|
||||
}
|
||||
fAbscissa[i-1] = newton ;
|
||||
fWeight[i-1] = 2.0/(temp*temp) ;
|
||||
@@ -1072,7 +1075,7 @@ G4double G4Integrator::Hermite( T& typeT, F f, G4int nHermite)
|
||||
// For use with 'this' pointer
|
||||
|
||||
template <class T, class F>
|
||||
G4double G4Integrator::Hermite( T* ptrT, F f, G4int n)
|
||||
G4double G4Integrator<T,F>::Hermite( T* ptrT, F f, G4int n)
|
||||
{
|
||||
return Hermite(*ptrT,f,n) ;
|
||||
}
|
||||
@@ -1081,7 +1084,8 @@ G4double G4Integrator::Hermite( T* ptrT, F f, G4int n)
|
||||
//
|
||||
// For use with global scope f
|
||||
|
||||
G4double G4Integrator::Hermite( G4double (*f)(G4double), G4int nHermite)
|
||||
template <class T, class F>
|
||||
G4double G4Integrator<T,F>::Hermite( G4double (*f)(G4double), G4int nHermite)
|
||||
{
|
||||
const G4double tolerance = 1.0e-12 ;
|
||||
const G4int maxNumber = 12 ;
|
||||
@@ -1142,7 +1146,7 @@ G4double G4Integrator::Hermite( G4double (*f)(G4double), G4int nHermite)
|
||||
}
|
||||
if(k > maxNumber)
|
||||
{
|
||||
G4Exception("Too many (>12) iterations in G4Integrator::Hermite") ;
|
||||
G4Exception("Too many (>12) iterations in G4Integrator<T,F>::Hermite") ;
|
||||
}
|
||||
fAbscissa[i-1] = newton ;
|
||||
fWeight[i-1] = 2.0/(temp*temp) ;
|
||||
@@ -1168,7 +1172,7 @@ G4double G4Integrator::Hermite( G4double (*f)(G4double), G4int nHermite)
|
||||
//
|
||||
|
||||
template <class T, class F>
|
||||
G4double G4Integrator::Jacobi( T& typeT, F f, G4double alpha,
|
||||
G4double G4Integrator<T,F>::Jacobi( T& typeT, F f, G4double alpha,
|
||||
G4double beta, G4int nJacobi)
|
||||
{
|
||||
const G4double tolerance = 1.0e-12 ;
|
||||
@@ -1254,7 +1258,7 @@ G4double G4Integrator::Jacobi( T& typeT, F f, G4double alpha,
|
||||
}
|
||||
if (k > maxNumber)
|
||||
{
|
||||
G4Exception("Too many iterations (>12) in G4Integrator::Jacobi") ;
|
||||
G4Exception("Too many iterations (>12) in G4Integrator<T,F>::Jacobi") ;
|
||||
}
|
||||
fAbscissa[i-1] = root ;
|
||||
fWeight[i-1] = exp(GammaLogarithm((G4double)(alpha+nJacobi)) +
|
||||
@@ -1280,7 +1284,7 @@ G4double G4Integrator::Jacobi( T& typeT, F f, G4double alpha,
|
||||
// For use with 'this' pointer
|
||||
|
||||
template <class T, class F>
|
||||
G4double G4Integrator::Jacobi( T* ptrT, F f, G4double alpha,
|
||||
G4double G4Integrator<T,F>::Jacobi( T* ptrT, F f, G4double alpha,
|
||||
G4double beta, G4int n)
|
||||
{
|
||||
return Jacobi(*ptrT,f,alpha,beta,n) ;
|
||||
@@ -1290,7 +1294,8 @@ G4double G4Integrator::Jacobi( T* ptrT, F f, G4double alpha,
|
||||
//
|
||||
// For use with global scope f
|
||||
|
||||
G4double G4Integrator::Jacobi( G4double (*f)(G4double), G4double alpha,
|
||||
template <class T, class F>
|
||||
G4double G4Integrator<T,F>::Jacobi( G4double (*f)(G4double), G4double alpha,
|
||||
G4double beta, G4int nJacobi)
|
||||
{
|
||||
const G4double tolerance = 1.0e-12 ;
|
||||
@@ -1376,7 +1381,7 @@ G4double G4Integrator::Jacobi( G4double (*f)(G4double), G4double alpha,
|
||||
}
|
||||
if (k > maxNumber)
|
||||
{
|
||||
G4Exception("Too many iterations (>12) in G4Integrator::Jacobi") ;
|
||||
G4Exception("Too many iterations (>12) in G4Integrator<T,F>::Jacobi") ;
|
||||
}
|
||||
fAbscissa[i-1] = root ;
|
||||
fWeight[i-1] = exp(GammaLogarithm((G4double)(alpha+nJacobi)) +
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SimpleIntegration.hh,v 1.2 1999/11/16 17:30:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VGaussianQuadrature.hh,v 1.2 1999/11/16 17:30:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ChebyshevApproximation.cc,v 1.2 1999/11/16 17:31:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
|
||||
#include "G4ChebyshevApproximation.hh"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4DataInterpolation.cc,v 1.3 1999/11/16 17:31:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#include "G4DataInterpolation.hh"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GaussChebyshevQ.cc,v 1.2 1999/11/16 17:31:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#include "G4GaussChebyshevQ.hh"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GaussHermiteQ.cc,v 1.2 1999/11/16 17:31:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#include "G4GaussHermiteQ.hh"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GaussJacobiQ.cc,v 1.2 1999/11/16 17:31:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#include "G4GaussJacobiQ.hh"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GaussLaguerreQ.cc,v 1.2 1999/11/16 17:31:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#include "G4GaussLaguerreQ.hh"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GaussLegendreQ.cc,v 1.2 1999/11/16 17:31:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#include "G4GaussLegendreQ.hh"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SimpleIntegration.cc,v 1.2 1999/11/16 17:31:11 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Implementation file for simple integration methods
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VGaussianQuadrature.cc,v 1.2 1999/11/16 17:31:11 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Implementation file for G4VGaussianQuadrature virtual base class
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Poisson.hh,v 1.5 2000/01/06 14:13:08 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: Randomize.hh,v 1.2 1999/11/16 17:31:35 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
#ifndef randomize_h
|
||||
#define randomize_h 1
|
||||
|
||||
@@ -1,233 +0,0 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4RandDistributionTest.cc,v 1.3 1999/11/23 15:00:00 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
#include "Randomize.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
HepJamesRandom theJamesEngine;
|
||||
RandEngine theRandEngine;
|
||||
DRand48Engine theDRand48Engine;
|
||||
RanluxEngine theRanluxEngine(19780503,4);
|
||||
RanecuEngine theRanecuEngine;
|
||||
|
||||
void init()
|
||||
{
|
||||
char Pause;
|
||||
|
||||
G4cout << G4endl << G4endl;
|
||||
G4cout << "---------------------------- Random shooting test -----------------------------" << G4endl;
|
||||
G4cout << " -------------------- " << G4endl;
|
||||
G4cout << " >>> Random Engines available <<<" << G4endl << G4endl;
|
||||
G4cout << " > HepJamesRandom (default)" << G4endl;
|
||||
G4cout << " > Rand" << G4endl;
|
||||
G4cout << " > DRand48" << G4endl;
|
||||
G4cout << " > Ranlux" << G4endl;
|
||||
G4cout << " > Ranecu" << G4endl << G4endl;
|
||||
G4cout << " ----- Press <ENTER> to continue -----";
|
||||
if ( (Pause = G4cin.get()) != '\n') exit(0);
|
||||
G4cout << G4endl;
|
||||
|
||||
} // end init()
|
||||
|
||||
|
||||
void layout()
|
||||
{
|
||||
HepFloat m=3.0;
|
||||
const HepInt size=5;
|
||||
HepDouble vect[size];
|
||||
|
||||
G4cout << " Flat ]0,1[ : " << RandFlat::shoot() << G4endl;
|
||||
G4cout << " Flat ]0,5[ : " << RandFlat::shoot(5) << G4endl;
|
||||
G4cout << " Flat ]-5,3[ : " << RandFlat::shoot(-5,3) << G4endl;
|
||||
G4cout << " Exp (m=1) : " << RandExponential::shoot() << G4endl;
|
||||
G4cout << " Exp (m=3) : " << RandExponential::shoot(3) << G4endl;
|
||||
G4cout << " Gauss (m=1) : " << RandGauss::shoot() << G4endl;
|
||||
G4cout << " Gauss (m=3,v=1) : " << RandGauss::shoot(3,1) << G4endl;
|
||||
G4cout << " Wigner(1,0.2) : " << RandBreitWigner::shoot(1,0.2) << G4endl;
|
||||
G4cout << " Wigner(1,0.2,1) : " << RandBreitWigner::shoot(1,0.2,1) << G4endl;
|
||||
G4cout << " Wigner2(1,0.2) : " << RandBreitWigner::shootM2(1,0.2) << G4endl;
|
||||
G4cout << " Wigner2(1,0.2,1) : " << RandBreitWigner::shootM2(1,0.2,1) << G4endl;
|
||||
G4cout << " IntFlat [0,99[ : " << RandFlat::shootInt(99) << G4endl;
|
||||
G4cout << " IntFlat [-99,37[ : " << RandFlat::shootInt(-99,37) << G4endl;
|
||||
G4cout << " Poisson (m=3.0) : " << RandPoisson::shoot(m) << G4endl;
|
||||
G4cout << G4endl;
|
||||
G4cout << " Shooting an array of 5 flat numbers ..." << G4endl << G4endl;
|
||||
RandFlat::shootArray(size,vect);
|
||||
for ( HepInt i=0; i<size; ++i )
|
||||
G4cout << " " << vect[i];
|
||||
G4cout << G4endl << G4endl;
|
||||
} // end layout()
|
||||
|
||||
void dist_layout()
|
||||
{
|
||||
HepFloat m=3.0;
|
||||
const HepInt size=5;
|
||||
HepDouble vect[size];
|
||||
char Pause;
|
||||
|
||||
HepJamesRandom aJamesEngine;
|
||||
RandEngine aRandEngine;
|
||||
DRand48Engine aDRand48Engine;
|
||||
RanluxEngine aRanluxEngine(19780503,4);
|
||||
RanecuEngine aRanecuEngine;
|
||||
|
||||
RandFlat aFlatObj(aJamesEngine);
|
||||
RandExponential anExponentialObj(aRandEngine);
|
||||
RandGauss aGaussObj(aDRand48Engine);
|
||||
RandBreitWigner aBreitObj(aRanluxEngine);
|
||||
RandPoisson aPoissonObj(aRanecuEngine);
|
||||
|
||||
G4cout << " ----- Press <ENTER> to continue -----";
|
||||
if ( (Pause = G4cin.get()) != '\n') exit(0);
|
||||
G4cout << "-------------------- Shooting test on distribution objects --------------------" << G4endl;
|
||||
G4cout << G4endl;
|
||||
G4cout << " Flat ]0,1[ : " << aFlatObj.fire() << G4endl;
|
||||
G4cout << " Flat ]0,5[ : " << aFlatObj.fire(5) << G4endl;
|
||||
G4cout << " Flat ]-5,3[ : " << aFlatObj.fire(-5,3) << G4endl;
|
||||
G4cout << " Exp (m=1) : " << anExponentialObj.fire() << G4endl;
|
||||
G4cout << " Exp (m=3) : " << anExponentialObj.fire(3) << G4endl;
|
||||
G4cout << " Gauss (m=1) : " << aGaussObj.fire() << G4endl;
|
||||
G4cout << " Gauss (m=3,v=1) : " << aGaussObj.fire(3,1) << G4endl;
|
||||
G4cout << " Wigner(1,0.2) : " << aBreitObj.fire(1,0.2) << G4endl;
|
||||
G4cout << " Wigner(1,0.2,1) : " << aBreitObj.fire(1,0.2,1) << G4endl;
|
||||
G4cout << " Wigner2(1,0.2) : " << aBreitObj.fireM2(1,0.2) << G4endl;
|
||||
G4cout << " Wigner2(1,0.2,1) : " << aBreitObj.fireM2(1,0.2,1) << G4endl;
|
||||
G4cout << " IntFlat [0,99[ : " << aFlatObj.fireInt(99) << G4endl;
|
||||
G4cout << " IntFlat [-99,37[ : " << aFlatObj.fireInt(-99,37) << G4endl;
|
||||
G4cout << " Poisson (m=3.0) : " << aPoissonObj.fire(m) << G4endl;
|
||||
G4cout << G4endl;
|
||||
G4cout << " Shooting an array of 5 flat numbers ..." << G4endl << G4endl;
|
||||
aFlatObj.fireArray(size,vect);
|
||||
for ( HepInt i=0; i<size; ++i )
|
||||
G4cout << " " << vect[i];
|
||||
G4cout << G4endl << G4endl;
|
||||
G4cout << " ----- Press <ENTER> to continue -----";
|
||||
if ( (Pause = G4cin.get()) != '\n') exit(0);
|
||||
} // end dist_layout()
|
||||
|
||||
void user_layout()
|
||||
{
|
||||
HepFloat m=3.0;
|
||||
const HepInt size=5;
|
||||
HepDouble vect[size];
|
||||
char sel;
|
||||
HepRandomEngine* anEngine;
|
||||
|
||||
G4cout << G4endl << G4endl;
|
||||
G4cout << "-------------------- Shooting test skeeping the generator ---------------------" << G4endl;
|
||||
G4cout << G4endl;
|
||||
G4cout << " >>> Select a Random Engine <<<" << G4endl << G4endl;
|
||||
G4cout << " 1. HepJamesRandom (default)" << G4endl;
|
||||
G4cout << " 2. Rand" << G4endl;
|
||||
G4cout << " 3. DRand48" << G4endl;
|
||||
G4cout << " 4. Ranlux" << G4endl;
|
||||
G4cout << " 5. Ranecu" << G4endl << G4endl;
|
||||
G4cout << " > ";
|
||||
G4cin >> sel;
|
||||
while ((sel!='1')&&(sel!='2')&&(sel!='3')&&(sel!='4')&&(sel!='5')) {
|
||||
G4cout << G4endl << " >>> Choice not legal !! [1..5]<<<" << G4endl;
|
||||
G4cin >> sel;
|
||||
}
|
||||
|
||||
switch (sel) {
|
||||
case '1':
|
||||
anEngine = &theJamesEngine;
|
||||
break;
|
||||
case '2':
|
||||
anEngine = &theRandEngine;
|
||||
break;
|
||||
case '3':
|
||||
anEngine = &theDRand48Engine;
|
||||
break;
|
||||
case '4':
|
||||
anEngine = &theRanluxEngine;
|
||||
break;
|
||||
case '5':
|
||||
anEngine = &theRanecuEngine;
|
||||
break;
|
||||
|
||||
default:
|
||||
anEngine = &theJamesEngine;
|
||||
break;
|
||||
}
|
||||
G4cout << G4endl;
|
||||
|
||||
G4cout << " Flat ]0,1[ : " << RandFlat::shoot(anEngine) << G4endl;
|
||||
G4cout << " Flat ]0,5[ : " << RandFlat::shoot(anEngine,5) << G4endl;
|
||||
G4cout << " Flat ]-5,3[ : " << RandFlat::shoot(anEngine,-5,3) << G4endl;
|
||||
G4cout << " Exp (m=1) : " << RandExponential::shoot(anEngine) << G4endl;
|
||||
G4cout << " Exp (m=3) : " << RandExponential::shoot(anEngine,3) << G4endl;
|
||||
G4cout << " Gauss (m=1) : " << RandGauss::shoot(anEngine) << G4endl;
|
||||
G4cout << " Gauss (m=3,v=1) : " << RandGauss::shoot(anEngine,3,1) << G4endl;
|
||||
G4cout << " Wigner(1,0.2) : " << RandBreitWigner::shoot(anEngine,1,0.2) << G4endl;
|
||||
G4cout << " Wigner(1,0.2,1) : " << RandBreitWigner::shoot(anEngine,1,0.2,1) << G4endl;
|
||||
G4cout << " Wigner2(1,0.2) : " << RandBreitWigner::shootM2(anEngine,1,0.2) << G4endl;
|
||||
G4cout << " Wigner2(1,0.2,1) : " << RandBreitWigner::shootM2(anEngine,1,0.2,1) << G4endl;
|
||||
G4cout << " IntFlat [0,99[ : " << RandFlat::shootInt(anEngine,99) << G4endl;
|
||||
G4cout << " IntFlat [-99,37[ : " << RandFlat::shootInt(anEngine,-99,37) << G4endl;
|
||||
G4cout << " Poisson (m=3.0) : " << RandPoisson::shoot(anEngine,m) << G4endl;
|
||||
G4cout << G4endl;
|
||||
G4cout << " Shooting an array of 5 flat numbers ..." << G4endl << G4endl;
|
||||
RandFlat::shootArray(anEngine,size,vect);
|
||||
for ( HepInt i=0; i<size; ++i )
|
||||
G4cout << " " << vect[i];
|
||||
G4cout << G4endl << G4endl;
|
||||
} // end layout()
|
||||
|
||||
void start_test()
|
||||
{
|
||||
char Pause;
|
||||
|
||||
G4cout << "------------------------- Test on HepJamesRandom ----------------------------" << G4endl;
|
||||
G4cout << G4endl;
|
||||
layout();
|
||||
G4cout << " ----- Press <ENTER> to continue -----";
|
||||
if ( (Pause = G4cin.get()) != '\n') exit(0);
|
||||
G4cout << G4endl;
|
||||
G4cout << "--------------------------- Test on RandEngine ------------------------------" << G4endl;
|
||||
G4cout << G4endl;
|
||||
HepRandom::setTheEngine(&theRandEngine);
|
||||
layout();
|
||||
G4cout << " ----- Press <ENTER> to continue -----";
|
||||
if ( (Pause = G4cin.get()) != '\n') exit(0);
|
||||
G4cout << G4endl;
|
||||
G4cout << "------------------------- Test on DRand48Engine -----------------------------" << G4endl;
|
||||
G4cout << G4endl;
|
||||
HepRandom::setTheEngine(&theDRand48Engine);
|
||||
layout();
|
||||
G4cout << " ----- Press <ENTER> to continue -----";
|
||||
if ( (Pause = G4cin.get()) != '\n') exit(0);
|
||||
G4cout << G4endl;
|
||||
G4cout << "--------------------- Test on RanluxEngine (luxury 4) ------------------------" << G4endl;
|
||||
G4cout << G4endl;
|
||||
HepRandom::setTheEngine(&theRanluxEngine);
|
||||
layout();
|
||||
G4cout << " ----- Press <ENTER> to continue -----";
|
||||
if ( (Pause = G4cin.get()) != '\n') exit(0);
|
||||
G4cout << G4endl;
|
||||
G4cout << "-------------------------- Test on RanecuEngine ------------------------------" << G4endl;
|
||||
G4cout << G4endl;
|
||||
HepRandom::setTheEngine(&theRanecuEngine);
|
||||
layout();
|
||||
dist_layout();
|
||||
user_layout();
|
||||
} // end start_test()
|
||||
|
||||
|
||||
HepInt main() {
|
||||
|
||||
init();
|
||||
start_test();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,282 +0,0 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4RandGlobalTest.cc,v 1.3 1999/11/23 15:00:00 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
#include "Randomize.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
RandEngine theRandEngine;
|
||||
DRand48Engine theDRand48Engine;
|
||||
RanluxEngine theRanluxEngine(19780503,4);
|
||||
RanecuEngine theRanecuEngine;
|
||||
|
||||
//======================== CHI-SQUARED TEST ============================
|
||||
|
||||
HepInt box[10], chi[8], more=1;
|
||||
HepInt prob[8] = { 1, 5, 25, 50, 75, 95, 99, 100 };
|
||||
HepFloat perc[8] = { 2.09, 3.33, 5.90, 8.34, 11.39, 16.92, 21.67, 100.0 };
|
||||
|
||||
void even_test(HepInt seq)
|
||||
{
|
||||
HepInt i,j;
|
||||
char Pause;
|
||||
|
||||
for (i=0; i<8; ++i)
|
||||
chi[i]=0;
|
||||
|
||||
G4cout << "\t\t\t --- CHI-SQUARED TEST ---" << G4endl;
|
||||
HepInt fac = HepInt(seq/100);
|
||||
|
||||
G4cout << G4endl;
|
||||
|
||||
for (HepInt k=0; k<seq; ++k) {
|
||||
for (i=0; i<10; ++i)
|
||||
box[i]=0;
|
||||
for (i=0; i<1000; ++i) {
|
||||
HepInt h = HepInt(100*G4UniformRand());
|
||||
for (j=0; j<10; ++j)
|
||||
if ((10*j <= h) && (h < 10*(j+1))) ++box[j];
|
||||
}
|
||||
HepFloat X=0;
|
||||
for (i=0; i<10; ++i) {
|
||||
HepFloat t=HepFloat(box[i]-100);
|
||||
X += t*t;
|
||||
}
|
||||
X /= 100;
|
||||
if (k == (seq%100)) {
|
||||
G4cout << "\tDistribution of a single run (rand_valuex100) ..."
|
||||
<< G4endl << G4endl;
|
||||
G4cout << "\t\t 1 10 20 30 40 50 60 70 80 90 100" << G4endl;
|
||||
G4cout << "\t\t";
|
||||
for (j=0; j<10; ++j)
|
||||
G4cout << box[j] << " ";
|
||||
G4cout << G4endl;
|
||||
G4cout << "\t\t\t Chi-squared = " << X << G4endl << G4endl;
|
||||
}
|
||||
for (i=0; i<8; ++i)
|
||||
if (X <= perc[i]) ++chi[i];
|
||||
}
|
||||
G4cout << "\tDistribution of Chi-squared for " << seq << " sequences ..."
|
||||
<< G4endl << G4endl;
|
||||
G4cout << "\t\t\t %" << "\tChi-sq " << "\tExpected" << G4endl;
|
||||
for (j=0; j<8; ++j)
|
||||
G4cout << "\t\t\tX <= " << perc[j] << ":\t" << chi[j]/fac
|
||||
<< "\t" << prob[j] << G4endl;
|
||||
G4cout << G4endl;
|
||||
G4cout << G4endl;
|
||||
G4cout << " ----- Press <ENTER> to continue -----";
|
||||
if ( (Pause = G4cin.get()) != '\n') exit(0);
|
||||
if (more == 1)
|
||||
if ( (Pause = G4cin.get()) != '\n') exit(0);
|
||||
G4cout << G4endl;
|
||||
} // end even_test()
|
||||
|
||||
//====================== SERIAL CORRELATION TEST =======================
|
||||
|
||||
void corr_test(HepInt seq)
|
||||
{
|
||||
HepInt i,j;
|
||||
char Pause;
|
||||
HepDouble U;
|
||||
HepDouble UU;
|
||||
HepDouble UV;
|
||||
HepDouble corr = 0.;
|
||||
HepDouble stde = 0.;
|
||||
HepDouble mv = -1./999;
|
||||
HepDouble std = (-mv)*sqrt(HepDouble(1000*(997)/(1001)));
|
||||
HepDouble next, uni, w, mve, temp[10000];
|
||||
|
||||
G4cout << "\t\t\t--- SERIAL CORRELATION TEST ---" << G4endl << G4endl;
|
||||
|
||||
for (j=0; j<seq; ++j) {
|
||||
U = 0.; UU = 0.; UV = 0.;
|
||||
uni = G4UniformRand();
|
||||
w = uni;
|
||||
for (i=1; i<1000; ++i) {
|
||||
next = G4UniformRand();
|
||||
U += next;
|
||||
UU += next*next;
|
||||
UV += uni*next;
|
||||
uni = next;
|
||||
}
|
||||
U += w;
|
||||
UU += w*w;
|
||||
UV += uni*w;
|
||||
temp[j] = (1000*UV-U*U)/(1000*UU-U*U);
|
||||
corr += temp[j];
|
||||
}
|
||||
|
||||
mve = corr/seq;
|
||||
for (j=0; j<seq; ++j) {
|
||||
temp[j] -= mve;
|
||||
stde += temp[j]*temp[j];
|
||||
}
|
||||
stde = sqrt((1./(seq-1))*stde);
|
||||
|
||||
G4cout << "Mean value predicted : " << mv << "\t"
|
||||
<< "Standard deviation predicted: " << std << G4endl
|
||||
<< "Mean value effective : " << mve << "\t"
|
||||
<< "Standard deviation effective: " << stde << G4endl << G4endl;
|
||||
G4cout << " ----- Press <ENTER> to continue -----";
|
||||
if ( (Pause = G4cin.get()) != '\n') exit(0);
|
||||
G4cout << G4endl;
|
||||
|
||||
} // end corr_test
|
||||
|
||||
//=========================== SPATIAL TEST =============================
|
||||
|
||||
#define PI 3.1415926
|
||||
|
||||
static unsigned long twotoj[16] = { 0x1L,0x2L,0x4L,0x8L,0x10L,0x20L,0x40L,
|
||||
0x80L,0x100L,0x200L,0x400L,0x800L,
|
||||
0x1000L,0x2000L,0x4000L,0x8000L };
|
||||
|
||||
HepFloat fnc(HepFloat x1, HepFloat x2, HepFloat x3, HepFloat x4)
|
||||
{
|
||||
return (HepFloat) sqrt(x1*x1+x2*x2+x3*x3+x4*x4);
|
||||
}
|
||||
|
||||
void spat_test ()
|
||||
{
|
||||
char Pause;
|
||||
long iy[4],jpower,k;
|
||||
HepInt i,j;
|
||||
HepFloat x1,x2,x3,x4,yprob[4];
|
||||
|
||||
G4cout << "\t\t\t --- SPATIAL TEST ---" << G4endl
|
||||
<< "\tCalculates PI statistically using volume of unit n-sphere "
|
||||
<< "n = 2,3,4"
|
||||
<< G4endl << G4endl;
|
||||
for (i=1; i<=3; i++) iy[i]=0;
|
||||
G4cout << "\t\t\t# pts\tPI\t(4/3)PI\t(1/2)PI^2" << G4endl << G4endl;
|
||||
for (j=1; j<=15; j++) {
|
||||
for (k=twotoj[j-1]; k>=0; k--) {
|
||||
x1 = (HepFloat) G4UniformRand();
|
||||
x2 = (HepFloat) G4UniformRand();
|
||||
x3 = (HepFloat) G4UniformRand();
|
||||
x4 = (HepFloat) G4UniformRand();
|
||||
if (fnc(x1,x2,0.,0.) < 1.) ++iy[1];
|
||||
if (fnc(x1,x2,x3,0.) < 1.) ++iy[2];
|
||||
if (fnc(x1,x2,x3,x4) < 1.) ++iy[3];
|
||||
}
|
||||
jpower = twotoj[j];
|
||||
for (i=1; i<=3; i++)
|
||||
yprob[i] = (HepFloat) twotoj[i+1]*iy[i]/jpower;
|
||||
if ((jpower <= 32768) && (jpower != 0))
|
||||
G4cout << "\t\t\t" << jpower << "\t" << yprob[1] << "\t"
|
||||
<< yprob[2] << "\t" << yprob[3] << G4endl;
|
||||
}
|
||||
G4cout << G4endl;
|
||||
G4cout << "\t\t\tactual" << "\t" << PI << "\t"
|
||||
<< 4.*PI/3. << "\t" << .5*PI*PI << G4endl << G4endl;
|
||||
|
||||
if (more != 99) {
|
||||
G4cout << " ----- Press <ENTER> to continue -----";
|
||||
if ( (Pause = G4cin.get()) != '\n') exit(0);
|
||||
G4cout << G4endl;
|
||||
}
|
||||
} // end spat_test()
|
||||
|
||||
//============================= GLOBAL =================================
|
||||
|
||||
void init()
|
||||
{
|
||||
G4cout << G4endl << G4endl;
|
||||
G4cout << "-------------------------- Random distribution test ---------------------------" << G4endl;
|
||||
G4cout << " ------------------------ " << G4endl;
|
||||
G4cout << " >>> Random Engines available <<< " << G4endl << G4endl;
|
||||
G4cout << " > HepJamesRandom (default)" << G4endl;
|
||||
G4cout << " > Rand" << G4endl;
|
||||
G4cout << " > DRand48" << G4endl;
|
||||
G4cout << " > Ranlux" << G4endl;
|
||||
G4cout << " > Ranecu" << G4endl << G4endl;
|
||||
G4cout << " >>> Tests performed <<< " << G4endl << G4endl;
|
||||
G4cout << " > Even distribution test" << G4endl;
|
||||
G4cout << " > Serial correlation test" << G4endl;
|
||||
G4cout << " > Spatial test" << G4endl;
|
||||
G4cout << G4endl << G4endl;
|
||||
|
||||
} // end init()
|
||||
|
||||
|
||||
void layout(HepInt seq)
|
||||
{
|
||||
even_test(seq);
|
||||
corr_test(seq);
|
||||
spat_test();
|
||||
} // end layout()
|
||||
|
||||
|
||||
void start_test()
|
||||
{
|
||||
char sel;
|
||||
HepInt seq;
|
||||
|
||||
G4cout << " Select the number of random values sequences:" << G4endl;
|
||||
G4cout << "\t a - 100 sequences of 1000 random values" << G4endl;
|
||||
G4cout << "\t b - 1000 sequences of 1000 random values" << G4endl;
|
||||
G4cout << "\t c - 10000 sequences of 1000 random values" << G4endl;
|
||||
G4cout << " > ";
|
||||
G4cin >> sel;
|
||||
if ((sel!='a')&&(sel!='b')&&(sel!='c'))
|
||||
exit(0);
|
||||
switch (sel) {
|
||||
case 'a':
|
||||
seq = 100;
|
||||
break;
|
||||
case 'b':
|
||||
seq = 1000;
|
||||
break;
|
||||
case 'c':
|
||||
seq = 10000;
|
||||
break;
|
||||
default:
|
||||
seq = 100;
|
||||
break;
|
||||
}
|
||||
|
||||
G4cout << G4endl << G4endl;
|
||||
G4cout << "------------------------- Test on HepJamesRandom ----------------------------" << G4endl;
|
||||
G4cout << G4endl;
|
||||
layout(seq);
|
||||
G4cout << G4endl << G4endl;
|
||||
more = 0;
|
||||
G4cout << "--------------------------- Test on RandEngine ------------------------------" << G4endl;
|
||||
G4cout << G4endl;
|
||||
HepRandom::setTheEngine(&theRandEngine);
|
||||
layout(seq);
|
||||
G4cout << G4endl << G4endl;
|
||||
G4cout << "------------------------- Test on DRand48Engine -----------------------------" << G4endl;
|
||||
G4cout << G4endl;
|
||||
HepRandom::setTheEngine(&theDRand48Engine);
|
||||
layout(seq);
|
||||
G4cout << G4endl << G4endl;
|
||||
G4cout << "--------------------- Test on RanluxEngine (luxury 4) ------------------------" << G4endl;
|
||||
G4cout << G4endl;
|
||||
HepRandom::setTheEngine(&theRanluxEngine);
|
||||
layout(seq);
|
||||
G4cout << G4endl << G4endl;
|
||||
more = 99;
|
||||
G4cout << "-------------------------- Test on RanecuEngine ------------------------------" << G4endl;
|
||||
G4cout << G4endl;
|
||||
HepRandom::setTheEngine(&theRanecuEngine);
|
||||
layout(seq);
|
||||
} // end start_test()
|
||||
|
||||
|
||||
HepInt main() {
|
||||
|
||||
init();
|
||||
start_test();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ShootBitTest.cc,v 1.4 1999/12/15 14:50:29 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
//
|
||||
//
|
||||
|
||||
// Tests RandFlat::fireBit() member function
|
||||
// Peter Urban, 5th Sep 1996
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "g4std/iomanip"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Timer.hh"
|
||||
|
||||
int main()
|
||||
{
|
||||
HepRandomEngine* e= HepRandom::getTheEngine();
|
||||
RandFlat r(*e);
|
||||
|
||||
const long NumTest= 10000;
|
||||
|
||||
G4cout << "Printed value: (relative frequency - probability)" << G4endl;
|
||||
G4cout << NumTest << " random numbers" << G4endl << G4endl;
|
||||
|
||||
long sum= 0;
|
||||
long i, j;
|
||||
|
||||
for (i=0; i<NumTest; i++) {
|
||||
sum+= r.fireBit();
|
||||
}
|
||||
G4cout << "fireBit " << double(sum)/NumTest-0.5 << G4endl;
|
||||
sum= 0;
|
||||
for (i=0; i<NumTest; i++) {
|
||||
sum+= r.shootBit();
|
||||
}
|
||||
G4cout << "shootBit " << double(sum)/NumTest-0.5 << G4endl;
|
||||
sum= 0;
|
||||
for (i=0; i<NumTest; i++) {
|
||||
sum+= r.shootBit(e);
|
||||
}
|
||||
G4cout << "shootBit(engine) " << double(sum)/NumTest-0.5 << G4endl;
|
||||
|
||||
|
||||
const long Num= 1000000;
|
||||
int iii; long lll;
|
||||
|
||||
G4Timer theTimer;
|
||||
G4cout << G4endl << "Performance test: " << G4endl;
|
||||
|
||||
G4cout << "shootBit() vs G4UniformRand()<0.5: ";
|
||||
theTimer.Start();
|
||||
for (i=0; i<Num; i++)
|
||||
iii = RandFlat::shootBit();
|
||||
theTimer.Stop();
|
||||
G4cout << theTimer.GetUserElapsed() << " vs ";
|
||||
theTimer.Start();
|
||||
for (i=0; i<Num; i++)
|
||||
G4UniformRand()<0.5;
|
||||
theTimer.Stop();
|
||||
G4cout << theTimer.GetUserElapsed() << G4endl << G4endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
# $Id: GNUmakefile,v 1.1 1999/01/07 16:08:59 gunter Exp $
|
||||
# ----------------------------------------------------------------
|
||||
# Makes test program in environment variable G4TARGET.
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
ifndef G4TARGET
|
||||
G4TARGET := $(TESTTARGET)
|
||||
endif
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../../..
|
||||
endif
|
||||
|
||||
G4EXEC_BUILD = true
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
# Override some variables for binmake.gmk.
|
||||
#
|
||||
INCFLAGS := -I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPRandom/include
|
||||
LDLIBS := -lG4global
|
||||
|
||||
include $(G4INSTALL)/config/binmake.gmk
|
||||
+52
-1
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.41 2000/02/11 14:07:19 gcosmo Exp $
|
||||
$Id: History,v 1.50 2000/06/26 16:28:55 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,57 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
June 26, 2000 G.Cosmo (global-V01-01-05)
|
||||
- Fixes for problem report #104, STLInterface:
|
||||
o defs.h: defined G4RWTHROW(a) to abort() in case G4NO_STD_EXCEPTIONS
|
||||
is set.
|
||||
o tpsrtvec.icc, tvordvec.icc: corrected implementation of last() in case
|
||||
of call to G4RWTHROW(a).
|
||||
o cstring.icc: defined function G4String::strcasecompare(a,b) which will
|
||||
NOT invoke the non-ANSI function strcasecmp(a,b) when G4USE_STD_NAMESPACE
|
||||
is set.
|
||||
- STLInterface/defs.h: fixed memory leaks in destruction of 'str' in
|
||||
destructors and copy-constructors of G4RWGeneralException and G4RWBoundsErr.
|
||||
- G4Timer.cc: added definition of 'vfork' for IRIX6_2 (requested by FNAL
|
||||
in report #104).
|
||||
|
||||
June 15, 2000 G.Cosmo (global-V01-01-04)
|
||||
- Introduced fixes to g4std/complex for ISO and non-ISO compliance.
|
||||
Defined G4complex type as complex type of doubles.
|
||||
- Changed implementation of G4Integrator to a template class, to allow
|
||||
porting on Solaris CC compiler which does not implement templated member
|
||||
functions.
|
||||
|
||||
May 25, 2000 J.Allison (global-V01-01-03)
|
||||
- Added new G4UnitDefinition("kg/m3",...) to G4UnitsTable.cc.
|
||||
|
||||
March 23, 2000 G.Cosmo (global-V01-01-02)
|
||||
- Added class G4PhysicsLnVector[.hh.cc] implementing a physics vector
|
||||
with natural logarithmic scale for energy/momentum bins. (M.G.Pia)
|
||||
|
||||
March 21, 2000 G.Cosmo (global-V01-01-01)
|
||||
- STLInterface: forced initialization of vectors' members also for
|
||||
ordered/sorted collections. Even when using the access operator
|
||||
vector::operator[] as left-hand operand, it requires the vector
|
||||
to be not empty. Removed usage of vector::reserve(capacity).
|
||||
|
||||
March 11, 2000 G.Cosmo (global-V01-01-00)
|
||||
- STLInterface: implemented correct behavior for vectors' default constructors,
|
||||
as expected by the RW interface.
|
||||
o for pointer/value ordered/sorted collections, an EMPTY STL vector is
|
||||
created and the vector capacity is set to G4RWDEFAULT_CAPACITY
|
||||
using vector::reserve(capacity). No element initialisation is done.
|
||||
o for pointer/value simple collections, a default constructor creating
|
||||
an EMPTY STL vector is implemented; the constructor taking the capacity
|
||||
as argument, creates an STL vector of the given capacity and explicitly
|
||||
initialises its elements. NB: pointers are initialised to zero.
|
||||
- Added "g4std/complex" wrapper file (V.Grichine)
|
||||
|
||||
February 16, 2000 H.Kurashige (global-V01-00-04)
|
||||
- G4UserLimits[.hh.icc]: added identifier for a concrete instance of the
|
||||
class. Added new member fType (G4String), SetType/GetType methods and
|
||||
new constructor.
|
||||
|
||||
February 08, 2000 G.Cosmo (global-V01-00-03)
|
||||
- STLInterface/cstring.icc: fixed yet another bug in G4String::toUpper()
|
||||
and G4String::toLower(). Loop over the string characters was causing
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.19 2000/02/11 14:08:38 gcosmo Exp $
|
||||
$Id: History,v 1.22 2000/06/26 16:25:56 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -20,6 +20,37 @@ committal in the CVS repository !
|
||||
|
||||
STL Interface
|
||||
-------------
|
||||
|
||||
June 26, 00 G.Cosmo (STLInterface-V01-01-01)
|
||||
- Fixes for problem report #104:
|
||||
o defs.h: defined G4RWTHROW(a) to abort() in case G4NO_STD_EXCEPTIONS
|
||||
is set.
|
||||
o tpsrtvec.icc, tvordvec.icc: corrected implementation of last() in case
|
||||
of call to G4RWTHROW(a).
|
||||
o cstring.icc: defined function G4String::strcasecompare(a,b) which will
|
||||
NOT invoke the non-ANSI function strcasecmp(a,b) when G4USE_STD_NAMESPACE
|
||||
is set.
|
||||
- defs.h:
|
||||
o fixed memory leaks in destruction of 'str' in destructors and
|
||||
copy-constructors of G4RWGeneralException and G4RWBoundsErr.
|
||||
|
||||
March 21, 00 G.Cosmo (STLInterface-V01-01-00)
|
||||
- Forced initialization of vectors' members also for ordered/sorted
|
||||
collections. Even when using the access operator vector::operator[]
|
||||
as left-hand operand, it requires the vector to be not empty. Removed
|
||||
usage of vector::reserve(capacity).
|
||||
|
||||
March 10, 00 G.Cosmo
|
||||
- Implemented correct behavior for vectors' default constructors, as
|
||||
expected by the RW interface.
|
||||
o for pointer/value ordered/sorted collections, an EMPTY STL vector is
|
||||
created and the vector capacity is set to a G4RWDEFAULT_CAPACITY
|
||||
using vector::reserve(capacity). No element initialisation is done.
|
||||
o for pointer/value simple collections, a default constructor creating
|
||||
and EMPTY vector is implemented; the constructor taking the capacity
|
||||
as argument, creates an STL vector of the given capacity and explicitly
|
||||
initialises its elements. Pointers are initialised to zero.
|
||||
|
||||
February 8, 00 G.Cosmo
|
||||
- cstring.icc: fixed yet another bug in G4String::toUpper() and
|
||||
G4String::toLower(). Loop over the string characters was causing
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: cstring.h,v 1.7 1999/12/15 18:12:53 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: cstring.h,v 1.8 2000/06/26 16:25:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -156,6 +156,8 @@ public:
|
||||
|
||||
inline const char* data() const;
|
||||
|
||||
inline int strcasecompare(const char*, const char*) const;
|
||||
|
||||
inline unsigned int hash( caseCompare cmp = exact ) const;
|
||||
inline unsigned int stlhash() const;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: cstring.icc,v 1.4 2000/02/08 14:15:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: cstring.icc,v 1.5 2000/06/26 16:25:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -228,22 +228,40 @@ G4String::operator const char*() const
|
||||
return c_str();
|
||||
}
|
||||
|
||||
int G4String::strcasecompare(const char* s1, const char* s2) const
|
||||
{
|
||||
#ifndef G4USE_STD_NAMESPACE
|
||||
return strcasecmp(s1,s2);
|
||||
#else
|
||||
char* buf1 = new char[strlen(s1)+1];
|
||||
char* buf2 = new char[strlen(s2)+1];
|
||||
|
||||
for (size_t i=0; i<=strlen(s1); i++)
|
||||
buf1[i] = tolower(s1[i]);
|
||||
for (size_t j=0; j<=strlen(s2); j++)
|
||||
buf2[j] = tolower(s2[j]);
|
||||
|
||||
int res = strcmp(buf1, buf2);
|
||||
delete [] buf1;
|
||||
delete [] buf2;
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
int G4String::compareTo(const char* s, caseCompare mode)
|
||||
{
|
||||
//GB:OSF1-cxx if(mode=exact)
|
||||
if(mode==exact)
|
||||
return strcmp(c_str(),s);
|
||||
else
|
||||
return strcasecmp(c_str(),s);
|
||||
return strcasecompare(c_str(),s);
|
||||
}
|
||||
|
||||
int G4String::compareTo(const G4String& s, caseCompare mode)
|
||||
{
|
||||
//GB:OSF1-cxx if(mode=exact)
|
||||
if(mode==exact)
|
||||
return strcmp(data(),s.data());
|
||||
return strcmp(c_str(),s.c_str());
|
||||
else
|
||||
return strcasecmp(data(),s.data());
|
||||
return strcasecompare(c_str(),s.c_str());
|
||||
}
|
||||
|
||||
G4String& G4String::prepend (const char* str)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: ctoken.h,v 1.5 1999/11/29 10:17:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: defs.h,v 1.7 1999/11/29 16:52:36 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: defs.h,v 1.8 2000/06/26 16:25:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -60,13 +60,14 @@ public:
|
||||
|
||||
G4RWBoundsErr(const G4RWBoundsErr&e)
|
||||
{
|
||||
delete [] str;
|
||||
str=new char[strlen(e.str)+1];
|
||||
strcpy(str,e.str);
|
||||
}
|
||||
|
||||
~G4RWBoundsErr()
|
||||
{
|
||||
delete str;
|
||||
delete [] str;
|
||||
}
|
||||
|
||||
const char * why() const
|
||||
@@ -92,13 +93,14 @@ public:
|
||||
|
||||
G4RWGeneralException(const G4RWGeneralException&e)
|
||||
{
|
||||
delete [] str;
|
||||
str=new char[strlen(e.str)+1];
|
||||
strcpy(str,e.str);
|
||||
}
|
||||
|
||||
~G4RWGeneralException()
|
||||
{
|
||||
delete str;
|
||||
delete [] str;
|
||||
}
|
||||
|
||||
const char * why() const
|
||||
@@ -112,6 +114,10 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#define G4RWTHROW(a) throw a
|
||||
#ifndef G4NO_STD_EXCEPTIONS
|
||||
#define G4RWTHROW(a) throw a
|
||||
#else
|
||||
#define G4RWTHROW(a) abort()
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: rstream.h,v 1.4 1999/11/25 10:14:45 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: rw2stl_algo.h,v 1.4 1999/11/25 10:14:45 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: tpordvec.h,v 1.7 1999/11/26 17:17:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: tpordvec.icc,v 1.2 2000/02/01 16:55:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: tpordvec.icc,v 1.4 2000/03/22 08:05:40 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -17,8 +17,9 @@
|
||||
|
||||
template<class T >
|
||||
G4RWTPtrOrderedVector<T>::G4RWTPtrOrderedVector(size_t capacity)
|
||||
: std_pvector(capacity,(T*)0),rwsize(0){}
|
||||
|
||||
: std_pvector(capacity,(T*)0),rwsize(0){} // Here Rogue-Wave would leave
|
||||
// pointers T* uninitialised and
|
||||
// would create an EMPTY vector!
|
||||
template<class T >
|
||||
G4RWTPtrOrderedVector<T>::G4RWTPtrOrderedVector(const G4RWTPtrOrderedVector<T>& v)
|
||||
: std_pvector(v),rwsize(v.rwsize){}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: tpsrtvec.h,v 1.8 1999/11/26 17:17:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: tpsrtvec.icc,v 1.3 2000/02/01 16:55:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: tpsrtvec.icc,v 1.6 2000/06/26 16:25:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -17,12 +17,9 @@
|
||||
|
||||
template<class T>
|
||||
G4RWTPtrSortedVector<T>::G4RWTPtrSortedVector(size_t n)
|
||||
: std_pvector(n),rwsize(0)
|
||||
{
|
||||
for(int i=0;i<n;i++)
|
||||
std_pvector::operator[](i)=0;
|
||||
}
|
||||
|
||||
: std_pvector(n,(T*)0),rwsize(0){} // Here Rogue-Wave would leave
|
||||
// pointers T* uninitialised and
|
||||
// would create an EMPTY vector!
|
||||
template<class T>
|
||||
G4RWTPtrSortedVector<T>::G4RWTPtrSortedVector(const G4RWTPtrSortedVector<T>& v)
|
||||
: std_pvector(v), rwsize(v.rwsize){}
|
||||
@@ -171,10 +168,9 @@ T* const & G4RWTPtrSortedVector<T>::first () const
|
||||
template<class T>
|
||||
T* const & G4RWTPtrSortedVector<T>::last () const
|
||||
{
|
||||
if(rwsize)
|
||||
return std_pvector::operator[](rwsize-1);
|
||||
else
|
||||
if(!rwsize)
|
||||
G4RWTHROW(G4RWBoundsErr("G4RWTPtrSortedVector last()",rwsize,0));
|
||||
return std_pvector::operator[](rwsize-1);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: tpvector.h,v 1.9 2000/02/11 14:09:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: tpvector.icc,v 1.6 2000/02/11 14:09:25 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: tpvector.icc,v 1.7 2000/03/10 15:53:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -21,8 +21,8 @@ G4RWTPtrVector<T>::G4RWTPtrVector ()
|
||||
|
||||
template<class T>
|
||||
G4RWTPtrVector<T>::G4RWTPtrVector (size_t n)
|
||||
: std_pvector(n), rwsize(n){}
|
||||
|
||||
: std_pvector(n, (T*)0), rwsize(n){} // Here Rogue-Wave would leave
|
||||
// pointers T* uninitialised.
|
||||
template<class T>
|
||||
G4RWTPtrVector<T>::G4RWTPtrVector (size_t n, T* const & iPtr)
|
||||
: std_pvector(n, iPtr), rwsize(n){}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: tvordvec.h,v 1.7 1999/11/26 17:17:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: tvordvec.h,v 1.8 2000/03/10 15:53:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: tvordvec.icc,v 1.2 2000/02/01 16:55:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: tvordvec.icc,v 1.5 2000/06/26 16:25:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -17,8 +17,9 @@
|
||||
|
||||
template<class T>
|
||||
G4RWTValOrderedVector<T>::G4RWTValOrderedVector(size_t capacity)
|
||||
: std_vector(capacity),rwsize(0){}
|
||||
|
||||
: std_vector(capacity, T()),rwsize(0){} // Here Rogue-Wave would leave
|
||||
// members T uninitialised and
|
||||
// would create an EMPTY vector!
|
||||
template<class T>
|
||||
G4RWTValOrderedVector<T>::G4RWTValOrderedVector(const G4RWTValOrderedVector<T>& v)
|
||||
: std_vector(v),rwsize(v.rwsize){}
|
||||
@@ -128,10 +129,9 @@ T G4RWTValOrderedVector<T>::first() const
|
||||
template<class T>
|
||||
T G4RWTValOrderedVector<T>::last() const
|
||||
{
|
||||
if(rwsize)
|
||||
return std_vector::operator[](rwsize-1);
|
||||
else
|
||||
if(!rwsize)
|
||||
G4RWTHROW(G4RWBoundsErr("G4RWTValOrderedVector last",rwsize,0));
|
||||
return std_vector::operator[](rwsize-1);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: tvvector.h,v 1.7 1999/11/26 17:17:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: tvvector.h,v 1.8 2000/03/10 15:53:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: tvvector.icc,v 1.2 2000/02/01 16:55:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: tvvector.icc,v 1.3 2000/03/10 15:53:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -21,7 +21,7 @@ G4RWTValVector<T>::G4RWTValVector ()
|
||||
|
||||
template<class T>
|
||||
G4RWTValVector<T>::G4RWTValVector (size_t n)
|
||||
: std_vector(n), rwsize(n){}
|
||||
: std_vector(n,T()), rwsize(n){}
|
||||
|
||||
template<class T>
|
||||
G4RWTValVector<T>::G4RWTValVector (size_t n, const T& ival)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Allocator.hh,v 1.3 1999/11/23 15:00:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4AllocatorPage.hh,v 1.2 1999/11/16 17:40:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4AllocatorUnit.hh,v 1.2 1999/11/16 17:40:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4DataVector.hh,v 1.4 1999/11/23 15:00:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FastVector.hh,v 1.3 1999/11/23 15:00:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LPhysicsFreeVector.hh,v 1.2 1999/11/16 17:40:38 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LPhysicsFreeVector.icc,v 1.2 1999/11/23 15:00:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4OrderedTable.hh,v 1.4 1999/11/16 17:40:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsFreeVector.hh,v 1.2 1999/11/16 17:40:40 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsLinearVector.hh,v 1.2 1999/11/16 17:40:40 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsLnVector.hh,v 1.3 2000/03/23 09:20:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// G4PhysicsLnVector.hh
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// A physics vector which has values of energy-loss, cross-section,
|
||||
// and other physics values of a particle in matter in a given
|
||||
// range of the energy, momentum, etc. The scale of energy/momentum
|
||||
// bins is natural logarithmic.
|
||||
//
|
||||
// History:
|
||||
// 27 Apr. 1999, M.G. Pia: Created, copying from G4PhysicsLogVector
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
#ifndef G4PhysicsLnVector_h
|
||||
#define G4PhysicsLnVector_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4DataVector.hh"
|
||||
#include "G4PhysicsVector.hh"
|
||||
|
||||
|
||||
class G4PhysicsLnVector : public G4PhysicsVector
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
G4PhysicsLnVector();
|
||||
G4PhysicsLnVector(size_t theNbin);
|
||||
G4PhysicsLnVector(G4double theEmin, G4double theEmax, size_t theNbin);
|
||||
// Because of logarithmic scale, note that 'theEmin' has to be
|
||||
// greater than zero. No protection exists against this error.
|
||||
|
||||
// Destructor
|
||||
~G4PhysicsLnVector();
|
||||
|
||||
protected:
|
||||
|
||||
size_t FindBinLocation(G4double theEnergy) const;
|
||||
// Find bin# in which theEnergy belongs - pure virtual function
|
||||
|
||||
private:
|
||||
|
||||
G4double dBin; // Bin width - useful only for fixed binning
|
||||
G4double baseBin; // Set this in constructor for performance
|
||||
|
||||
};
|
||||
|
||||
|
||||
inline size_t G4PhysicsLnVector::FindBinLocation(G4double theEnergy) const {
|
||||
|
||||
// For G4PhysicsLnVector, FindBinLocation is implemented using
|
||||
// a simple arithmetic calculation.
|
||||
//
|
||||
// Because this is a virtual function, it is accessed through a
|
||||
// pointer to the G4PhyiscsVector object for most usages. In this
|
||||
// case, 'inline' will not be invoked. However, there is a possibility
|
||||
// that the user access to the G4PhysicsLnVector object directly and
|
||||
// not through pointers or references. In this case, the 'inline' will
|
||||
// be invoked. (See R.B.Murray, "C++ Strategies and Tactics", Chap.6.6)
|
||||
|
||||
return size_t( log(theEnergy)/dBin - baseBin );
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsLogVector.hh,v 1.2 1999/11/16 17:40:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsOrderedFreeVector.hh,v 1.3 1999/11/16 17:40:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// PhysicsOrderedFreeVector Class Definition
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsOrderedFreeVector.icc,v 1.2 1999/11/23 15:00:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// PhysicsOrderedFreeVector Class Inline Functions Definitions
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsTable.hh,v 1.3 1999/11/16 17:40:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsVector.hh,v 1.3 1999/11/16 17:40:43 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsVector.icc,v 1.1 1999/11/16 17:40:46 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4RotationMatrix.hh,v 1.2 1999/11/16 17:40:47 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ThreeVector.hh,v 1.2 1999/11/16 17:40:47 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Timer.hh,v 1.10 2000/01/06 14:27:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Types.hh,v 1.4 1999/12/15 18:05:19 gracia Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// GEANT4 native types
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UnitsTable.hh,v 1.9 2000/01/19 11:16:46 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UnitsTest.hh,v 1.4 1999/11/19 09:19:30 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UserLimits.hh,v 1.4 1999/11/23 15:00:04 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: G4UserLimits.hh,v 1.6 2000/02/17 16:13:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// class G4UserLimits
|
||||
@@ -20,6 +20,7 @@
|
||||
//
|
||||
// 01-11-97: change GetMaxAllowedStep(), Hisaya Kurashige
|
||||
// 08-04-98: new data members, mma
|
||||
// 02-16-00: add fType member and accessors, Hisaya Kurashige
|
||||
//
|
||||
#ifndef G4USERLIMITS_HH
|
||||
#define G4USERLIMITS_HH
|
||||
@@ -37,16 +38,21 @@ public: // with description
|
||||
G4double utimeMax = DBL_MAX,
|
||||
G4double uekinMin = 0.,
|
||||
G4double urangMin = 0. );
|
||||
G4UserLimits(const G4String& type,
|
||||
G4double ustepMax = DBL_MAX,
|
||||
G4double utrakMax = DBL_MAX,
|
||||
G4double utimeMax = DBL_MAX,
|
||||
G4double uekinMin = 0.,
|
||||
G4double urangMin = 0. );
|
||||
virtual ~G4UserLimits();
|
||||
|
||||
public: // with description
|
||||
|
||||
// If a Logical Volume has a G4UserLimits object,
|
||||
// the Step length should be limited as shorter
|
||||
// than MaxAllowedStep in the volume.
|
||||
// In the current design, the other limits are irrelavant in tracking
|
||||
|
||||
virtual G4double GetMaxAllowedStep(const G4Track&);
|
||||
// If a Logical Volume has a G4UserLimits object, the Step length should
|
||||
// be limited as shorter than MaxAllowedStep in the volume.
|
||||
// In the current design, the other limits are irrelevant in tracking
|
||||
|
||||
virtual G4double GetUserMaxTrackLength(const G4Track&) ;
|
||||
virtual G4double GetUserMaxTime (const G4Track&);
|
||||
virtual G4double GetUserMinEkine(const G4Track&);
|
||||
@@ -57,6 +63,14 @@ public: // with description
|
||||
virtual void SetUserMaxTime(G4double utimeMax);
|
||||
virtual void SetUserMinEkine(G4double uekinMin);
|
||||
virtual void SetUserMinRange(G4double urangMin);
|
||||
|
||||
const G4String & GetType() const;
|
||||
void SetType(const G4String& type);
|
||||
// Set/Get type name for UserLimits.
|
||||
// This type member is supposed to be used to check real class types for
|
||||
// each concrete instantiation of G4UserLimits. In other words, users who
|
||||
// use special classes derived from this base class should name their class
|
||||
// with a proper identifier.
|
||||
|
||||
protected: // with description
|
||||
|
||||
@@ -65,6 +79,8 @@ protected: // with description
|
||||
G4double fMaxTime; // max time
|
||||
G4double fMinEkine; // min kinetic energy (only for charged particles)
|
||||
G4double fMinRange; // min remaining range (only for charged particles)
|
||||
|
||||
G4String fType; // type name
|
||||
};
|
||||
|
||||
#include "G4UserLimits.icc"
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UserLimits.icc,v 1.3 1999/11/22 15:12:45 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: G4UserLimits.icc,v 1.5 2000/02/17 16:13:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -27,9 +27,28 @@ inline G4UserLimits::G4UserLimits(G4double ustepMax,
|
||||
G4double uekinMin,
|
||||
G4double urangMin)
|
||||
:fMaxStep (ustepMax),fMaxTrack(utrakMax),fMaxTime(utimeMax),
|
||||
fMinEkine(uekinMin),fMinRange(urangMin)
|
||||
fMinEkine(uekinMin),fMinRange(urangMin),fType("base")
|
||||
{}
|
||||
|
||||
inline G4UserLimits::G4UserLimits(const G4String& type,
|
||||
G4double ustepMax,
|
||||
G4double utrakMax,
|
||||
G4double utimeMax,
|
||||
G4double uekinMin,
|
||||
G4double urangMin)
|
||||
:fMaxStep (ustepMax),fMaxTrack(utrakMax),fMaxTime(utimeMax),
|
||||
fMinEkine(uekinMin),fMinRange(urangMin),fType(type)
|
||||
{}
|
||||
|
||||
inline const G4String& G4UserLimits::GetType() const
|
||||
{
|
||||
return fType;
|
||||
}
|
||||
|
||||
inline void G4UserLimits::SetType(const G4String& type)
|
||||
{
|
||||
fType = type;
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
inline G4UserLimits::~G4UserLimits(){}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4coutDestination.hh,v 1.2 1999/11/16 17:40:51 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ios.hh,v 1.5 1999/12/15 18:05:18 gracia Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4strstreambuf.hh,v 1.6 1999/12/16 08:15:57 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: PhysicalConstants.h,v 1.4 1999/11/19 09:19:31 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: SystemOfUnits.h,v 1.4 1999/11/19 09:19:31 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: algorithm,v 1.3 1999/11/16 17:42:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ---------------- algorithm ----------------
|
||||
//
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
//
|
||||
// $Id: complex,v 1.3 2000/06/15 17:32:10 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ---------------- complex ----------------
|
||||
//
|
||||
#ifndef G4_COMPLEX_H
|
||||
#define G4_COMPLEX_H
|
||||
|
||||
#ifndef G4USE_STD_NAMESPACE
|
||||
#if defined(__hpux) || defined(__linux)
|
||||
#include <complex>
|
||||
typedef complex<double> G4complex;
|
||||
#else
|
||||
#include <complex.h>
|
||||
typedef complex G4complex;
|
||||
#endif
|
||||
#else
|
||||
#include <complex>
|
||||
typedef std::complex<double> G4complex;
|
||||
#endif
|
||||
|
||||
#endif /* G4_COMPLEX_H */
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: fstream,v 1.3 1999/11/16 17:43:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ---------------- fstream ----------------
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: functional,v 1.3 1999/11/16 17:43:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ---------------- functional ----------------
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: iomanip,v 1.3 1999/11/16 17:43:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ---------------- iomanip ----------------
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: iostream,v 1.3 1999/11/16 17:43:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ---------------- iostream ----------------
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: map,v 1.3 1999/11/16 17:43:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ---------------- map ----------------
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: set,v 1.3 1999/11/16 17:43:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ---------------- set ----------------
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: streambuf,v 1.3 1999/11/16 17:43:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ---------------- streambuf ----------------
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: strstream,v 1.3 1999/11/16 17:43:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ---------------- strstream ----------------
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: vector,v 1.3 1999/11/16 17:43:09 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// ---------------- vector ----------------
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: globals.hh,v 1.15 2000/01/19 11:12:44 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// Global Constants and typedefs
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: templates.hh,v 1.5 2000/01/03 11:39:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// -*- C++ -*-
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Exception.cc,v 1.8 1999/11/29 10:17:46 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LPhysicsFreeVector.cc,v 1.2 1999/11/16 17:46:51 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsFreeVector.cc,v 1.2 1999/11/16 17:46:51 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsLinearVector.cc,v 1.2 1999/11/16 17:46:52 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PhysicsLnVector.cc,v 1.3 2000/03/23 09:21:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// G4PhysicsLnVector.cc
|
||||
//
|
||||
// History:
|
||||
// 27 Apr. 1999, M.G. Pia: Created, copying from G4PhysicsLogVector
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
#include "G4PhysicsLnVector.hh"
|
||||
|
||||
|
||||
G4PhysicsLnVector::G4PhysicsLnVector()
|
||||
: dBin(0.), baseBin(0.)
|
||||
{}
|
||||
|
||||
|
||||
G4PhysicsLnVector::G4PhysicsLnVector(size_t theNbin)
|
||||
{
|
||||
|
||||
// Add extra one bin (hidden to user) to handle correctly when
|
||||
// Energy=theEmax in getValue.
|
||||
dataVector.resize(theNbin+1);
|
||||
binVector.resize(theNbin+1);
|
||||
|
||||
ptrNextTable = 0;
|
||||
numberOfBin = theNbin;
|
||||
dBin = 0.;
|
||||
baseBin = 0.;
|
||||
|
||||
edgeMin = 0.;
|
||||
edgeMax = 0.;
|
||||
|
||||
lastBin = INT_MAX;
|
||||
lastEnergy = -DBL_MAX;
|
||||
lastValue = DBL_MAX;
|
||||
}
|
||||
|
||||
|
||||
G4PhysicsLnVector::G4PhysicsLnVector(G4double theEmin,
|
||||
G4double theEmax, size_t theNbin)
|
||||
{
|
||||
|
||||
// Add extra one bin (hidden to user) to handle correctly when
|
||||
// Energy=theEmax in getValue.
|
||||
dataVector.resize(theNbin+1);
|
||||
binVector.resize(theNbin+1);
|
||||
|
||||
ptrNextTable = 0;
|
||||
numberOfBin = theNbin;
|
||||
dBin = log(theEmax/theEmin) / numberOfBin;
|
||||
baseBin = log(theEmin)/dBin;
|
||||
|
||||
for (G4int i=0; i<numberOfBin+1; i++) {
|
||||
binVector(i) = exp(log(theEmin)+i*dBin);
|
||||
}
|
||||
|
||||
edgeMin = binVector(0);
|
||||
edgeMax = binVector(numberOfBin-1);
|
||||
|
||||
lastBin = INT_MAX;
|
||||
lastEnergy = -DBL_MAX;
|
||||
lastValue = DBL_MAX;
|
||||
}
|
||||
|
||||
|
||||
G4PhysicsLnVector::~G4PhysicsLnVector(){}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user