Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4LinInterpolator Class Reference

#include <G4LinInterpolator.hh>

+ Inheritance diagram for G4LinInterpolator:

Public Member Functions

 G4LinInterpolator ()
 
 ~G4LinInterpolator ()
 
G4double Calculate (G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const
 
G4IInterpolatorClone () const
 
- Public Member Functions inherited from G4IInterpolator
 G4IInterpolator ()
 
virtual ~G4IInterpolator ()
 
virtual G4double Calculate (G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const =0
 
virtual G4IInterpolatorClone () const =0
 

Detailed Description

Definition at line 50 of file G4LinInterpolator.hh.

Constructor & Destructor Documentation

◆ G4LinInterpolator()

G4LinInterpolator::G4LinInterpolator ( )

Definition at line 42 of file G4LinInterpolator.cc.

43{ }

Referenced by Clone().

◆ ~G4LinInterpolator()

G4LinInterpolator::~G4LinInterpolator ( )

Definition at line 47 of file G4LinInterpolator.cc.

48{ }

Member Function Documentation

◆ Calculate()

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

Implements G4IInterpolator.

Definition at line 54 of file G4LinInterpolator.cc.

57{
58 G4int nBins = data.size() - 1;
59 G4double value = 0.;
60 if (x < points[0])
61 {
62 value = 0.;
63 }
64 else if (bin < nBins)
65 {
66 G4double e1 = points[bin];
67 G4double e2 = points[bin+1];
68 G4double d1 = data[bin];
69 G4double d2 = data[bin+1];
70 value = d1 + (d2 - d1)*(x - e1)/(e2 - e1);
71 }
72 else
73 {
74 value = data[nBins];
75 }
76 return value;
77}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66

◆ Clone()

G4IInterpolator * G4LinInterpolator::Clone ( ) const
virtual

Implements G4IInterpolator.

Definition at line 51 of file G4LinInterpolator.cc.

52{ return new G4LinInterpolator; }

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