Ignore:
Timestamp:
Nov 19, 2009, 2:53:25 PM (15 years ago)
Author:
garnier
Message:

update par rapport a CVS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/electromagnetic/lowenergy/src/G4LogLogInterpolation.cc

    r1007 r1192  
    2525//
    2626//
    27 // $Id: G4LogLogInterpolation.cc,v 1.14 2008/12/12 08:50:59 sincerti Exp $
    28 // GEANT4 tag $Name: geant4-09-02 $
     27// $Id: G4LogLogInterpolation.cc,v 1.16 2009/09/25 07:41:34 sincerti Exp $
     28// GEANT4 tag $Name: emlowen-V09-02-64 $
    2929//
    3030// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
     
    3636// 27 Jun 2008   SI         Add check to avoid FPE errors
    3737// 08 Dec 2008   NAK        Log-Log interpolation math formula streamlined, self-test function
     38// 14 Jun 2008   NAK        New implementation for log-log interpolation after directly loading
     39//                          logarithmic values from G4EMLOW dataset
    3840// -------------------------------------------------------------------
    3941
     
    5860                                          const G4DataVector& data) const
    5961{
     62  //G4cout << "G4LogLogInterpolation is performed (2 arguments) " << G4endl;
    6063  G4int nBins = data.size() - 1;
    6164//G4double oldresult = 0.;
     
    105108  return value;
    106109}
     110
     111
     112// Nicolas A. Karakatsanis: New implementation of log-log interpolation after directly loading
     113//                          logarithmic values from G4EMLOW dataset
     114
     115G4double G4LogLogInterpolation::Calculate(G4double x, G4int bin,
     116                                          const G4DataVector& points,
     117                                          const G4DataVector& data,
     118                                          const G4DataVector& log_points,
     119                                          const G4DataVector& log_data) const
     120{
     121  //G4cout << "G4LogLogInterpolation is performed (4 arguments) " << G4endl;
     122  G4int nBins = data.size() - 1;
     123  G4double value = 0.;
     124  G4double log_x = std::log10(x);
     125  if (x < points[0])
     126    {
     127      value = 0.;
     128    }
     129  else if (bin < nBins)
     130    {
     131      G4double log_e1 = log_points[bin];
     132      G4double log_e2 = log_points[bin+1];
     133      G4double log_d1 = log_data[bin];
     134      G4double log_d2 = log_data[bin+1];
     135     
     136      //G4cout << "x = " << x << " , logx = " << log_x  << " , bin = " << bin << G4endl;
     137      //G4cout << "e1 = " << points[bin] << " d1 = " << data[bin] << G4endl;
     138      //G4cout << "e2 = " << points[bin+1] << " d2 = " << data[bin+1] << G4endl;
     139      //G4cout << "loge1 = " << log_e1 << " logd1 = " << log_d1 << G4endl;
     140      //G4cout << "loge2 = " << log_e2 << " logd2 = " << log_d2 << G4endl;
     141
     142// Values e1, e2, d1 and d2 are the log values of the corresponding
     143// original energy and data values. Simple linear interpolation performed
     144// on loagarithmic data should be equivalent to log-log interpolation
     145      value = log_d1 + (log_d2 - log_d1)*(log_x - log_e1)/(log_e2 - log_e1);
     146
     147// Delogarithmize to obtain interpolated value
     148      value = std::pow(10.,value);
     149   }
     150 else
     151   {
     152     value = data[nBins];
     153   }
     154  return value;
     155}
Note: See TracChangeset for help on using the changeset viewer.