Changeset 1340 for trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeInterpolator.icc
- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/cascade/cascade/include/G4CascadeInterpolator.icc
r1337 r1340 1 #ifndef G4CASCADE_INTERPOLATOR_ICC 2 #define G4CASCADE_INTERPOLATOR_ICC 1 3 // 2 4 // ******************************************************************** … … 24 26 // ******************************************************************** 25 27 // 26 // $Id: G4CascadeInterpolator.icc,v 1. 6 2010/06/25 09:42:02 gunterExp $27 // GEANT4 tag $Name: geant4-09-04-beta-01$28 // $Id: G4CascadeInterpolator.icc,v 1.8 2010/10/19 19:48:00 mkelsey Exp $ 29 // GEANT4 tag $Name: hadr-casc-V09-03-85 $ 28 30 // 29 31 // Author: Michael Kelsey <kelsey@slac.stanford.edu> … … 43 45 // 20100520 M. Kelsey -- Second bug fix: Loop in bin search should start at 44 46 // i=1, not i=0 (since i-1 is the key). 47 // 20100803 M. Kelsey -- Add printBins() function for debugging 48 // 20101019 M. Kelsey -- CoVerity reports: recursive #include, index overrun 45 49 50 #include "globals.hh" 46 51 #include "G4CascadeInterpolator.hh" 52 #include <iomanip> 47 53 48 54 … … 66 72 } else { // Assume nBins small; linear search 67 73 int i; 68 for (i=1; i< nBins&& x>xBins[i]; i++) {;} // Stops when x within bin i-174 for (i=1; i<last && x>xBins[i]; i++) {;} // Stops when x within bin i-1 69 75 xindex = i-1; 70 76 xbin = xBins[i] - xBins[i-1]; … … 102 108 return (i==last) ? yb[last] : (yb[i] + frac*(yb[i+1]-yb[i])); 103 109 } 110 111 112 // Print bin edges for debugging 113 114 template <int NBINS> 115 void G4CascadeInterpolator<NBINS>::printBins() const { 116 G4cout << " G4CascadeInterpolator<" << NBINS << "> : " << G4endl; 117 for (G4int k=0; k<NBINS; k++) { 118 G4cout << " " << std::setw(5) << xBins[k]; 119 if ((k+1)%12 == 0) G4cout << G4endl; 120 } 121 G4cout << G4endl; 122 } 123 124 #endif /* G4CASCADE_INTERPOLATOR_ICC */
Note: See TracChangeset
for help on using the changeset viewer.