Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4LinLogInterpolation Class Reference

#include <G4LinLogInterpolation.hh>

Inheritance diagram for G4LinLogInterpolation:
Collaboration diagram for G4LinLogInterpolation:

Public Member Functions

 G4LinLogInterpolation ()
 
 ~G4LinLogInterpolation ()
 
G4double Calculate (G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const
 
G4double Calculate (G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data, const G4DataVector &log_energies, const G4DataVector &log_data) const
 
virtual G4VDataSetAlgorithmClone () const
 
- Public Member Functions inherited from G4VDataSetAlgorithm
 G4VDataSetAlgorithm ()
 
virtual ~G4VDataSetAlgorithm ()
 

Detailed Description

Definition at line 50 of file G4LinLogInterpolation.hh.

Constructor & Destructor Documentation

G4LinLogInterpolation::G4LinLogInterpolation ( )

Definition at line 41 of file G4LinLogInterpolation.cc.

42 { }

Here is the caller graph for this function:

G4LinLogInterpolation::~G4LinLogInterpolation ( )

Definition at line 47 of file G4LinLogInterpolation.cc.

48 { }

Member Function Documentation

G4double G4LinLogInterpolation::Calculate ( G4double  point,
G4int  bin,
const G4DataVector energies,
const G4DataVector data 
) const
virtual

Implements G4VDataSetAlgorithm.

Definition at line 51 of file G4LinLogInterpolation.cc.

54 {
55  //G4cout << "G4LinLogInterpolation is performed on dataset (2 arguments) " << G4endl;
56  G4int nBins = data.size() - 1;
57  G4double value = 0.;
58  if (x < points[0])
59  {
60  value = 0.;
61  }
62  else if (bin < nBins)
63  {
64  G4double e1 = points[bin];
65  G4double e2 = points[bin+1];
66  G4double d1 = std::log(data[bin]);
67  G4double d2 = std::log(data[bin+1]);
68  value = G4Exp(d1 + (d2 - d1)*(x - e1)/ (e2 - e1));
69  }
70  else
71  {
72  value = data[nBins];
73  }
74  return value;
75 }
tuple bin
Definition: plottest35.py:22
static const G4double d2
tuple x
Definition: test.py:50
int G4int
Definition: G4Types.hh:78
const XML_Char int const XML_Char * value
Definition: expat.h:331
static const G4double d1
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:183
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4double G4LinLogInterpolation::Calculate ( G4double  point,
G4int  bin,
const G4DataVector energies,
const G4DataVector data,
const G4DataVector log_energies,
const G4DataVector log_data 
) const
virtual

Implements G4VDataSetAlgorithm.

Definition at line 77 of file G4LinLogInterpolation.cc.

82 {
83  //G4cout << "G4LinLogInterpolation is performed on dataset (4 arguments) " << G4endl;
84  G4int nBins = data.size() - 1;
85  G4double value = 0.;
86  //G4double log_x = std::log10(x);
87  if (x < points[0])
88  {
89  value = 0.;
90  }
91  else if (bin < nBins)
92  {
93  G4double e1 = points[bin];
94  G4double e2 = points[bin+1];
95  G4double d1 = data[bin];
96  G4double d2 = data[bin+1];
97  //G4double log_e1 = log_points[bin];
98  //G4double log_e2 = log_points[bin+1];
99  G4double log_d1 = log_data[bin];
100  G4double log_d2 = log_data[bin+1];
101  if (d1 > 0.0 && d2 > 0.0)
102  {
103 // Values e1, e2, d1 and d2 are the log values of the corresponding
104 // original energy and data values. Simple linear interpolation performed
105 // on loagarithmic data should be equivalent to log-log interpolation
106  //value = log_d1 + (log_d2 - log_d1)*(log_x - log_e1)/(log_e2 - log_e1);
107  value = G4Exp(log_d1 + (log_d2 - log_d1)*(x - e1)/(e2 - e1));
108  }
109  else
110  {
111  if (d1 == 0.0) log_d1 = -300;
112  if (d2 == 0.0) log_d2 = -300;
113  value = G4Exp(log_d1 + (log_d2 - log_d1)*(x - e1)/(e2 - e1));
114  }
115  }
116  else
117  {
118  value = data[nBins];
119  }
120  return value;
121 }
tuple bin
Definition: plottest35.py:22
static const G4double d2
tuple x
Definition: test.py:50
int G4int
Definition: G4Types.hh:78
const XML_Char int const XML_Char * value
Definition: expat.h:331
static const G4double d1
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:183
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

virtual G4VDataSetAlgorithm* G4LinLogInterpolation::Clone ( ) const
inlinevirtual

Implements G4VDataSetAlgorithm.

Definition at line 68 of file G4LinLogInterpolation.hh.

Here is the call graph for this function:


The documentation for this class was generated from the following files: