- Timestamp:
- Nov 19, 2009, 2:53:25 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/electromagnetic/lowenergy/src/G4SemiLogInterpolation.cc
r1007 r1192 25 25 // 26 26 // 27 // $Id: G4SemiLogInterpolation.cc,v 1. 6 2006/06/29 19:41:18 gunterExp $28 // GEANT4 tag $Name: geant4-09-02$27 // $Id: G4SemiLogInterpolation.cc,v 1.8 2009/09/25 07:41:34 sincerti Exp $ 28 // GEANT4 tag $Name: emlowen-V09-02-64 $ 29 29 // 30 30 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch) … … 57 57 const G4DataVector& data) const 58 58 { 59 //G4cout << "G4SemiLogInterpolation is performed(2 arguments) " << G4endl; 59 60 G4int nBins = data.size() - 1; 60 61 G4double value = 0.; … … 77 78 return value; 78 79 } 80 81 G4double G4SemiLogInterpolation::Calculate(G4double x, G4int bin, 82 const G4DataVector& points, 83 const G4DataVector& data, 84 const G4DataVector& log_points, 85 const G4DataVector& /*log_data*/) const 86 { 87 //A combination of logarithmic interpolation on energy set and 88 //linear Interpolation on data set 89 //G4cout << "G4SemiLogInterpolation is performed (4 arguments)" << G4endl; 90 G4int nBins = data.size() - 1; 91 G4double value = 0.; 92 G4double log_x = std::log10(x); 93 if (x < points[0]) 94 { 95 value = 0.; 96 } 97 else if (bin < nBins) 98 { 99 G4double e1 = points[bin]; 100 G4double e2 = points[bin+1]; 101 G4double d1 = data[bin]; 102 G4double d2 = data[bin+1]; 103 G4double log_e1 = log_points[bin]; 104 G4double log_e2 = log_points[bin+1]; 105 //G4double log_d1 = log_data[bin]; 106 //G4double log_d2 = log_data[bin+1]; 107 //G4cout << "x = " << x << " , log_x = " << log_x << " , bin = " << bin << G4endl; 108 //G4cout << "e1 = " << e1 << " , d1 = " << d1 << G4endl; 109 //G4cout << "e2 = " << e2 << " , d2 = " << d2 << G4endl; 110 // Values log_e1 and log_e2 are the log values of the corresponding 111 // original energy actual values. Original d1 and d2 values are used. 112 // Simple linear interpolation performed on loagarithmic data 113 // should be equivalent to semi log-log interpolation 114 if (e1 == 0.0) log_e1 = -300; 115 if (e2 == 0.0) log_e2 = -300; 116 value = d1 + (d2 - d1)*(log_x - log_e1)/(log_e2 - log_e1); 117 //G4cout << "G4SemiLogInterpolation - Final Interpolated Value: " << value << G4endl << G4endl; 118 } 119 else 120 { 121 value = data[nBins]; 122 } 123 return value; 124 } 125
Note: See TracChangeset
for help on using the changeset viewer.