G4LogLogInterpolator Class Reference

#include <G4LogLogInterpolator.hh>

Inheritance diagram for G4LogLogInterpolator:

G4IInterpolator

Public Member Functions

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

Detailed Description

Definition at line 50 of file G4LogLogInterpolator.hh.


Constructor & Destructor Documentation

G4LogLogInterpolator::G4LogLogInterpolator (  ) 

Definition at line 42 of file G4LogLogInterpolator.cc.

00043 { }

G4LogLogInterpolator::~G4LogLogInterpolator (  ) 

Definition at line 47 of file G4LogLogInterpolator.cc.

00048 { }


Member Function Documentation

G4double G4LogLogInterpolator::Calculate ( G4double  point,
G4int  bin,
const G4DataVector energies,
const G4DataVector data 
) const [virtual]

Implements G4IInterpolator.

Definition at line 54 of file G4LogLogInterpolator.cc.

00057 {
00058   G4int nBins = data.size() - 1;
00059   // ---- MGP ---- To be verified; value = 0. is redundant here
00060   G4double value = 0.;
00061   if (x < points[0] || x == 0.)
00062     {
00063       value = 0;
00064     }
00065   else if (bin < nBins)
00066     {
00067       G4double e1 = points[bin];
00068       G4double e2 = points[bin+1];
00069       G4double d1 = data[bin];     
00070       G4double d2 = data[bin+1];
00071       
00072       if (d1 != 0. && d2 != 0.)
00073         {
00074           value = (std::log10(d1)*std::log10(e2/x) + std::log10(d2)*std::log10(x/e1)) / std::log10(e2/e1);
00075           value = std::pow(10.,value);
00076         }
00077       else
00078         {
00079           value = 0.;
00080         }
00081     }
00082   else
00083     {
00084       value = data[nBins];
00085     }
00086 
00087   return value;
00088 }

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

Implements G4IInterpolator.

Definition at line 50 of file G4LogLogInterpolator.cc.

00051 { return new G4LogLogInterpolator; }


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