56{
57
58 static const G4int npp=100;
59 static const G4int mpp=npp+1;
62 static const G4int nls=150;
63 static const G4int mls=nls+1;
66 static const G4double mi=std::exp(lpi);
67 static const G4double max_s=std::exp(lpa);
68 static const G4double dl=(lpa-lpi)/nls;
69 static const G4double edl=std::exp(dl);
73
74 static std::vector<G4int> vZ;
75 static std::vector<G4int> vN;
76 static std::vector<G4double> vH;
77 static std::vector<G4int> vJ;
78 static std::vector<G4double> vM;
79 static std::vector<G4int> vK;
80 static std::vector<G4double*> vT;
81 static std::vector<G4double*> vL;
82
91
93 if(pIU > 50) return 0.;
94 if(pIU > 30 && ((tgN==1 && tgZ==1) || (tgN==8 && tgZ==7))) return 0.;
95 if(pIU > 20 && tgN==2 && tgZ==1) return 0.;
96 if(pIU > 15 && ((tgN==1 && tgZ==2) || (tgN==8 && tgZ==8))) return 0.;
97 if(pIU<toler || A<1) return 1.;
98 if(A>247)
99 {
100 G4cout<<
"-*-Warning-*-G4NeutronCaptureRatio::GetRatio:A="<<A<<
">247, return 0"<<
G4endl;
101 return 0.;
102 }
104 if(nDB && lastZ==tgZ && lastN==tgN && std::fabs(pIU-lastP)<toler) return lastR;
105 if(pIU>max_s)
106 {
107 lastR=CalcCap2In_Ratio(s,tgZ,tgN);
108 return lastR;
109 }
112 if(nDB) for (i=0; i<nDB; i++) if(tgZ==vZ[i] && tgN==vN[i])
113 {
114 found=true;
115 break;
116 }
117 if(!nDB || !found)
118 {
119 lastZ = tgZ;
120 lastN = tgN;
122 lastJ = static_cast<int>(pIU/dp)+1;
123 if(lastJ>npp)
124 {
125 lastJ=npp;
126 lastH=pma;
127 }
128 else lastH = lastJ*dp;
130 lastT[0]=1.;
131 for(
G4int j=1; j<=lastJ; j++)
132 {
133 pv+=dp;
134 lastT[j]=CalcCap2In_Ratio(pv,tgZ,tgN);
135 }
138 lastK = static_cast<int>((ls-lpi)/dl)+1;
139 if(lastK>nls)
140 {
141 lastK=nls;
142 lastM=lpa-lpi;
143 }
144 else lastM = lastK*dl;
145 pv=mi;
146 for(
G4int j=0; j<=lastK; j++)
147 {
148 lastL[j]=CalcCap2In_Ratio(pv,tgZ,tgN);
149 if(j!=lastK) pv*=edl;
150 }
151 i++;
152 vZ.push_back(lastZ);
153 vN.push_back(lastN);
154 vH.push_back(lastH);
155 vJ.push_back(lastJ);
156 vM.push_back(lastM);
157 vK.push_back(lastK);
158 vT.push_back(lastT);
159 vL.push_back(lastL);
160 }
161 else
162 {
163 lastZ=vZ[i];
164 lastN=vN[i];
165 lastH=vH[i];
166 lastJ=vJ[i];
167 lastM=vM[i];
168 lastK=vK[i];
169 lastT=vT[i];
170 lastL=vL[i];
171 if(s>lastH)
172 {
174 if(lastJ<npp)
175 {
176 lastJ = static_cast<int>(pIU/dp)+1;
178 if(lastJ>npp)
179 {
180 lastJ=npp;
181 lastH=pma;
182 }
183 else lastH = lastJ*dp;
184 for(
G4int j=nextN; j<=lastJ; j++)
185 {
186 pv+=dp;
187 lastT[j]=CalcCap2In_Ratio(pv,tgZ,tgN);
188 }
189 }
190 if(lastJ>=nextN)
191 {
192 vH[i]=lastH;
193 vJ[i]=lastJ;
194 }
196 if(pIU>pma && lastK<nls)
197 {
200 lastK = static_cast<int>((ls-lpi)/dl)+1;
201 if(lastK>nls)
202 {
203 lastK=nls;
204 lastM=lpa-lpi;
205 }
206 else lastM = lastK*dl;
207 for(
G4int j=nextK; j<=lastK; j++)
208 {
209 pv*=edl;
210 lastL[j]=CalcCap2In_Ratio(pv,tgZ,tgN);
211 }
212 }
213 if(lastK>=nextK)
214 {
215 vM[i]=lastM;
216 vK[i]=lastK;
217 }
218 }
219 }
220
221 if(pIU<pma)
222 {
223 G4int n=
static_cast<int>(pIU/dp);
226 lastR=v+d*(lastT[
n+1]-v)/dp;
227 }
228 else
229 {
231 G4int n=
static_cast<int>(ls/dl);
234 lastR=v+d*(lastL[
n+1]-v)/dl;
235 }
236 if(lastR<0.) lastR=0.;
237 if(lastR>1.) lastR=1.;
238 return lastR;
239}
G4DLLIMPORT std::ostream G4cout