| 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: G4NeutronHPFastLegendre.hh,v 1.11 2006/06/29 20:47:39 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-03-cand-01 $
|
|---|
| 29 | //
|
|---|
| 30 | #ifndef G4NeutronHPFastLegendre_h
|
|---|
| 31 | #define G4NeutronHPFastLegendre_h 1
|
|---|
| 32 |
|
|---|
| 33 | #include "globals.hh"
|
|---|
| 34 |
|
|---|
| 35 | class G4NeutronHPFastLegendre
|
|---|
| 36 | {
|
|---|
| 37 | public:
|
|---|
| 38 |
|
|---|
| 39 | G4NeutronHPFastLegendre()
|
|---|
| 40 | {
|
|---|
| 41 | value = new G4double * [31];
|
|---|
| 42 | value[0] = l0;
|
|---|
| 43 | value[1] = l1;
|
|---|
| 44 | value[2] = l2;
|
|---|
| 45 | value[3] = l3;
|
|---|
| 46 | value[4] = l4;
|
|---|
| 47 | value[5] = l5;
|
|---|
| 48 | value[6] = l6;
|
|---|
| 49 | value[7] = l7;
|
|---|
| 50 | value[8] = l8;
|
|---|
| 51 | value[9] = l9;
|
|---|
| 52 | value[10] = l10;
|
|---|
| 53 | value[11] = l11;
|
|---|
| 54 | value[12] = l12;
|
|---|
| 55 | value[13] = l13;
|
|---|
| 56 | value[14] = l14;
|
|---|
| 57 | value[15] = l15;
|
|---|
| 58 | value[16] = l16;
|
|---|
| 59 | value[17] = l17;
|
|---|
| 60 | value[18] = l18;
|
|---|
| 61 | value[19] = l19;
|
|---|
| 62 | value[20] = l20;
|
|---|
| 63 | value[21] = l21;
|
|---|
| 64 | value[22] = l22;
|
|---|
| 65 | value[23] = l23;
|
|---|
| 66 | value[24] = l24;
|
|---|
| 67 | value[25] = l25;
|
|---|
| 68 | value[26] = l26;
|
|---|
| 69 | value[27] = l27;
|
|---|
| 70 | value[28] = l28;
|
|---|
| 71 | value[29] = l29;
|
|---|
| 72 | value[30] = l30;
|
|---|
| 73 | integral = new G4double * [31];
|
|---|
| 74 | integral[0] = i0;
|
|---|
| 75 | integral[1] = i1;
|
|---|
| 76 | integral[2] = i2;
|
|---|
| 77 | integral[3] = i3;
|
|---|
| 78 | integral[4] = i4;
|
|---|
| 79 | integral[5] = i5;
|
|---|
| 80 | integral[6] = i6;
|
|---|
| 81 | integral[7] = i7;
|
|---|
| 82 | integral[8] = i8;
|
|---|
| 83 | integral[9] = i9;
|
|---|
| 84 | integral[10] = i10;
|
|---|
| 85 | integral[11] = i11;
|
|---|
| 86 | integral[12] = i12;
|
|---|
| 87 | integral[13] = i13;
|
|---|
| 88 | integral[14] = i14;
|
|---|
| 89 | integral[15] = i15;
|
|---|
| 90 | integral[16] = i16;
|
|---|
| 91 | integral[17] = i17;
|
|---|
| 92 | integral[18] = i18;
|
|---|
| 93 | integral[19] = i19;
|
|---|
| 94 | integral[20] = i20;
|
|---|
| 95 | integral[21] = i21;
|
|---|
| 96 | integral[22] = i22;
|
|---|
| 97 | integral[23] = i23;
|
|---|
| 98 | integral[24] = i24;
|
|---|
| 99 | integral[25] = i25;
|
|---|
| 100 | integral[26] = i26;
|
|---|
| 101 | integral[27] = i27;
|
|---|
| 102 | integral[28] = i28;
|
|---|
| 103 | integral[29] = i29;
|
|---|
| 104 | integral[30] = i30;
|
|---|
| 105 |
|
|---|
| 106 | G4int i;
|
|---|
| 107 | for(i=0;i<31;i++) theNbin[i]=1+200*(i+1);
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 | ~G4NeutronHPFastLegendre()
|
|---|
| 111 | {
|
|---|
| 112 | delete [] value;
|
|---|
| 113 | delete [] integral;
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | G4double Integrate(G4int l, G4double costh)
|
|---|
| 117 | {
|
|---|
| 118 | G4int bin = GetBin(l, costh);
|
|---|
| 119 | G4double y1, y2;
|
|---|
| 120 | // G4cout <<"Testhpw G4NeutronHPFastLegendre::Integrate "<<l<<" "<<bin<<G4endl;
|
|---|
| 121 | y1 = integral[l][bin];
|
|---|
| 122 | y2 = integral[l][bin+1];
|
|---|
| 123 | // G4cout <<"Testhpw G4NeutronHPFastLegendre::Integrate exit"<<G4endl;
|
|---|
| 124 | return Interpolate(bin, l, y1, y2, costh);
|
|---|
| 125 | }
|
|---|
| 126 |
|
|---|
| 127 | inline G4double Evaluate(G4int l, G4double costh)
|
|---|
| 128 | {
|
|---|
| 129 | G4double result;
|
|---|
| 130 | G4int bin = GetBin(l, costh);
|
|---|
| 131 | if(bin != theNbin[l]-1)
|
|---|
| 132 | {
|
|---|
| 133 | G4double y1, y2;
|
|---|
| 134 | y1 = value[l][bin];
|
|---|
| 135 | y2 = value[l][bin+1];
|
|---|
| 136 | result = Interpolate(bin, l, y1, y2, costh);
|
|---|
| 137 | }
|
|---|
| 138 | else
|
|---|
| 139 | {
|
|---|
| 140 | result = value[l][bin];
|
|---|
| 141 | }
|
|---|
| 142 | return result;
|
|---|
| 143 | }
|
|---|
| 144 | private:
|
|---|
| 145 |
|
|---|
| 146 | inline G4int GetBin(G4int l, G4double costh)
|
|---|
| 147 | {
|
|---|
| 148 | G4int bin=0;
|
|---|
| 149 | bin = G4int( (theNbin[l]-1)*(costh+1)/2. );
|
|---|
| 150 | if(bin == theNbin[l]-1) bin--;
|
|---|
| 151 | return bin;
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|
| 154 | inline G4double Interpolate(G4int bin, G4int l, G4double y1, G4double y2, G4double x)
|
|---|
| 155 | {
|
|---|
| 156 | G4double slope = 0, off = 0, x2=0, x1mx2;
|
|---|
| 157 | G4int half = (theNbin[l]-1)/2;
|
|---|
| 158 | // x1 = (bin-half)/G4double(half);
|
|---|
| 159 | x2 = (bin+1-half)/G4double(half);
|
|---|
| 160 | x1mx2 = 1./G4double( (theNbin[l]-1)/2 );
|
|---|
| 161 | // slope = (y2-y1)/(x2-x1);
|
|---|
| 162 | slope = (y2-y1)/x1mx2;
|
|---|
| 163 | off = y2-x2*slope;
|
|---|
| 164 | return x*slope+off;
|
|---|
| 165 | }
|
|---|
| 166 |
|
|---|
| 167 | G4double ** value;
|
|---|
| 168 | G4double ** integral;
|
|---|
| 169 | G4int theNbin[31];
|
|---|
| 170 | static G4double l0[201];
|
|---|
| 171 | static G4double i0[201];
|
|---|
| 172 | static G4double l1[401];
|
|---|
| 173 | static G4double i1[401];
|
|---|
| 174 | static G4double l2[601];
|
|---|
| 175 | static G4double i2[601];
|
|---|
| 176 | static G4double l3[801];
|
|---|
| 177 | static G4double i3[801];
|
|---|
| 178 | static G4double l4[1001];
|
|---|
| 179 | static G4double i4[1001];
|
|---|
| 180 | static G4double l5[1201];
|
|---|
| 181 | static G4double i5[1201];
|
|---|
| 182 | static G4double l6[1401];
|
|---|
| 183 | static G4double i6[1401];
|
|---|
| 184 | static G4double l7[1601];
|
|---|
| 185 | static G4double i7[1601];
|
|---|
| 186 | static G4double l8[1801];
|
|---|
| 187 | static G4double i8[1801];
|
|---|
| 188 | static G4double l9[2001];
|
|---|
| 189 | static G4double i9[2001];
|
|---|
| 190 | static G4double l10[2201];
|
|---|
| 191 | static G4double i10[2201];
|
|---|
| 192 | static G4double l11[2401];
|
|---|
| 193 | static G4double i11[2401];
|
|---|
| 194 | static G4double l12[2601];
|
|---|
| 195 | static G4double i12[2601];
|
|---|
| 196 | static G4double l13[2801];
|
|---|
| 197 | static G4double i13[2801];
|
|---|
| 198 | static G4double l14[3001];
|
|---|
| 199 | static G4double i14[3001];
|
|---|
| 200 | static G4double l15[3201];
|
|---|
| 201 | static G4double i15[3201];
|
|---|
| 202 | static G4double l16[3401];
|
|---|
| 203 | static G4double i16[3401];
|
|---|
| 204 | static G4double l17[3601];
|
|---|
| 205 | static G4double i17[3601];
|
|---|
| 206 | static G4double l18[3801];
|
|---|
| 207 | static G4double i18[3801];
|
|---|
| 208 | static G4double l19[4001];
|
|---|
| 209 | static G4double i19[4001];
|
|---|
| 210 | static G4double l20[4201];
|
|---|
| 211 | static G4double i20[4201];
|
|---|
| 212 | static G4double l21[4401];
|
|---|
| 213 | static G4double i21[4401];
|
|---|
| 214 | static G4double l22[4601];
|
|---|
| 215 | static G4double i22[4601];
|
|---|
| 216 | static G4double l23[4801];
|
|---|
| 217 | static G4double i23[4801];
|
|---|
| 218 | static G4double l24[5001];
|
|---|
| 219 | static G4double i24[5001];
|
|---|
| 220 | static G4double l25[5201];
|
|---|
| 221 | static G4double i25[5201];
|
|---|
| 222 | static G4double l26[5401];
|
|---|
| 223 | static G4double i26[5401];
|
|---|
| 224 | static G4double l27[5601];
|
|---|
| 225 | static G4double i27[5601];
|
|---|
| 226 | static G4double l28[5801];
|
|---|
| 227 | static G4double i28[5801];
|
|---|
| 228 | static G4double l29[6001];
|
|---|
| 229 | static G4double i29[6001];
|
|---|
| 230 | static G4double l30[6201];
|
|---|
| 231 | static G4double i30[6201];
|
|---|
| 232 | };
|
|---|
| 233 | #endif
|
|---|