G4LinInterpolator Class Reference

#include <G4LinInterpolator.hh>

Inheritance diagram for G4LinInterpolator:

G4IInterpolator

Public Member Functions

 G4LinInterpolator ()
 ~G4LinInterpolator ()
G4double Calculate (G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const
G4IInterpolatorClone () const

Detailed Description

Definition at line 50 of file G4LinInterpolator.hh.


Constructor & Destructor Documentation

G4LinInterpolator::G4LinInterpolator (  ) 

Definition at line 42 of file G4LinInterpolator.cc.

00043 { }

G4LinInterpolator::~G4LinInterpolator (  ) 

Definition at line 47 of file G4LinInterpolator.cc.

00048 { }


Member Function Documentation

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.

00057 {
00058   G4int nBins = data.size() - 1;
00059   G4double value = 0.;
00060   if (x < points[0])
00061     {
00062       value = 0.;
00063     }
00064   else if (bin < nBins)
00065     {
00066       G4double e1 = points[bin];
00067       G4double e2 = points[bin+1];
00068       G4double d1 = data[bin];
00069       G4double d2 = data[bin+1];
00070       value = d1 + (d2 - d1)*(x - e1)/(e2 - e1);
00071     }
00072   else
00073     {
00074       value = data[nBins];
00075     }
00076   return value;
00077 }

G4IInterpolator * G4LinInterpolator::Clone (  )  const [virtual]

Implements G4IInterpolator.

Definition at line 51 of file G4LinInterpolator.cc.

00052 { return new G4LinInterpolator; }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:25 2013 for Geant4 by  doxygen 1.4.7