- Timestamp:
- Jun 18, 2010, 11:42:07 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/cascade/cascade/src/paraMaker.cc
r819 r1315 23 23 // * acceptance of all terms of the Geant4 Software license. * 24 24 // ******************************************************************** 25 // $Id: paraMaker.cc,v 1.17 2010/06/01 17:20:31 mkelsey Exp $ 26 // Geant4 tag: $Name: geant4-09-04-beta-cand-01 $ 25 27 // 28 // 20100412 M. Kelsey -- Modify paraMaker[Truncated] to take buffer as argument 29 // 20100517 M. Kelsey -- BUG FIX: Must check for array boundary "if (Z>=70)" 30 // 20100517 M. Kelsey -- Use G4CascadeInterpolator, which handles boundaries 31 // 20100601 M. Kelsey -- Bug fix from Gunter Folger; resize(6,0.), not clear() 32 26 33 #include "G4InuclSpecialFunctions.hh" 34 #include "G4CascadeInterpolator.hh" 27 35 28 std::pair<std::vector<G4double>, std::vector<G4double> > G4InuclSpecialFunctions::paraMaker(G4double Z) { 29 G4int verboseLevel = 1; 36 void 37 G4InuclSpecialFunctions::paraMaker(G4double Z, 38 std::pair<std::vector<G4double>, std::vector<G4double> >& parms) { 39 G4int verboseLevel(0); 30 40 31 41 if (verboseLevel > 3) { … … 36 46 // coulumb barier, c.s. etc needed for evaporators 37 47 38 const G4double Z1[5] = {10.0, 20.0, 30.0, 50.0, 70.0}; 39 const G4double AP[5] = {0.42, 0.58, 0.68, 0.77, 0.80}; 40 const G4double CP[5] = {0.50, 0.28, 0.20, 0.15, 0.10}; 41 const G4double AA[5] = {0.68, 0.82, 0.91, 0.97, 0.98}; 42 const G4double CA[5] = {0.10, 0.10, 0.10, 0.08, 0.06}; 43 std::vector<G4double> AK(6); 44 std::vector<G4double> CPA(6); 48 static const G4double Z1[5] = {10.0, 20.0, 30.0, 50.0, 70.0}; 49 static const G4double AP[5] = {0.42, 0.58, 0.68, 0.77, 0.80}; 50 static const G4double CP[5] = {0.50, 0.28, 0.20, 0.15, 0.10}; 51 static const G4double AA[5] = {0.68, 0.82, 0.91, 0.97, 0.98}; 52 static const G4double CA[5] = {0.10, 0.10, 0.10, 0.08, 0.06}; 53 54 // Set up input buffer for results 55 std::vector<G4double>& AK = parms.first; 56 AK.resize(6,0.); 57 58 std::vector<G4double>& CPA = parms.second; 59 CPA.resize(6,0.); 60 45 61 AK[0] = 0.0; 46 62 CPA[0] = 0.0; 47 G4double AK2 = 0.0;48 G4double CP2 = 0.0;49 G4double AK6 = 0.0;50 G4double CP6 = 0.0;51 63 52 if (Z < 10.0) { 53 AK2=0.42; 54 CP2=0.5; 55 AK6=0.68; 56 CP6=0.1; 64 static G4CascadeInterpolator<5> interp(Z1, false); // Do not extrapolate 65 AK[1] = interp.interpolate(Z, AP); 66 AK[5] = interp.interpolate(Z, AA); 67 CPA[1] = interp.interpolate(Z, CP); 68 CPA[5] = interp.interpolate(Z, CA); 69 70 AK[2] = AK[1] + 0.06; 71 AK[3] = AK[1] + 0.12; 72 AK[4] = AK[5] - 0.06; 57 73 58 } else if(Z > 70.0) { 59 AK6=0.98; // normal 60 CP6=0.06; 61 AK2=0.8; 62 CP2=0.1; 63 // AK6=1.1; // modified 64 // CP6=0.0; 74 CPA[2] = CPA[1] * 0.5; 75 CPA[3] = CPA[1] / 3.0; 76 CPA[4] = 4.0 * CPA[5] / 3.0; 65 77 66 } else { 67 68 for (G4int i = 1; i < 5; i++) { 69 70 if (Z <= Z1[i]) { 71 G4double Z2 = 1.0 / (Z1[i] - Z1[i - 1]); 72 AK2 = ((AP[i] - AP[i - 1]) * Z + AP[i - 1] * Z1[i] - AP[i] * Z1[i - 1]) * Z2; 73 CP2 = ((CP[i] - CP[i - 1]) * Z + CP[i - 1] * Z1[i] - CP[i] * Z1[i - 1]) * Z2; 74 AK6 = ((AA[i] - AA[i - 1]) * Z + AA[i - 1] * Z1[i] - AA[i] * Z1[i - 1]) * Z2; 75 CP6 = ((CA[i] - CA[i - 1]) * Z + CA[i - 1] * Z1[i] - CA[i] * Z1[i - 1]) * Z2; 76 77 break; 78 }; 79 }; 80 }; 81 82 AK[1] = AK2; 83 AK[5] = AK6; 84 CPA[1] = CP2; 85 CPA[5] = CP6; 86 AK[2] = AK2 + 0.06; 87 CPA[2] = CP2 * 0.5; 88 AK[3] = AK2 + 0.12; 89 CPA[3] = CP2 / 3.0; 90 AK[4] = AK6 - 0.06; 91 CPA[4] = 4.0 * CP6 / 3.0; 92 93 return std::pair<std::vector<G4double>, std::vector<G4double> >(AK, CPA); 78 return; // Buffer filled 94 79 } 95 80 96 std::pair<G4double, G4double> G4InuclSpecialFunctions::paraMakerTruncated(G4double Z) { 97 G4int verboseLevel = 1; 81 void 82 G4InuclSpecialFunctions::paraMakerTruncated(G4double Z, 83 std::pair<G4double,G4double>& parms) { 84 G4int verboseLevel(0); 98 85 99 86 if (verboseLevel > 3) { … … 102 89 103 90 // truncated version of the previous one 104 const G4double Z1[5] = {10.0, 20.0, 30.0, 50.0, 70.0}; 105 const G4double AP[5] = {0.42, 0.58, 0.68, 0.77, 0.8}; 106 const G4double CP[5] = {0.5, 0.28, 0.2, 0.15, 0.1}; 107 G4double AK2=0.; 108 G4double CP2=0.; 91 static const G4double Z1[5] = {10.0, 20.0, 30.0, 50.0, 70.0}; 92 static const G4double AP[5] = {0.42, 0.58, 0.68, 0.77, 0.8}; 93 static const G4double CP[5] = {0.5, 0.28, 0.2, 0.15, 0.1}; 109 94 110 if (Z < 10.0) {111 AK2=0.42;112 CP2=0.5;95 // Set up buffers for output 96 G4double& AK2=parms.first; 97 G4double& CP2=parms.second; 113 98 114 } else if (Z > 70.0) {115 AK2=0.8;116 CP2=0.1;99 static G4CascadeInterpolator<5> interp(Z1, false); // Do not extrapolate 100 AK2 = interp.interpolate(Z, AP); 101 CP2 = interp.interpolate(Z, CP); 117 102 118 } else { 119 120 for (G4int i = 1; i < 5; i++) { 121 122 if (Z < Z1[i]) { 123 G4double Z2 = 1.0 / (Z1[i] - Z1[i - 1]); 124 AK2 = ((AP[i] - AP[i - 1]) * Z + AP[i - 1] * Z1[i] - AP[i] * Z1[i - 1]) * Z2; 125 CP2 = ((CP[i] - CP[i - 1]) * Z + CP[i - 1] * Z1[i] - CP[i] * Z1[i - 1]) * Z2; 126 127 break; 128 }; 129 }; 130 }; 131 132 return std::pair<G4double, G4double>(AK2, CP2); 103 return; // Buffer filled 133 104 }
Note: See TracChangeset
for help on using the changeset viewer.