49 G4int low(0), high(0);
51 for (i0=0; i0<nEnergy; i0++)
54 if(theCoeff[i0].
GetEnergy()>anEnergy)
break;
56 low = std::max(0, high-1);
67 for(i0=0; i0<601; i0++)
74 try01 += (2.*l+1)/2.*theCoeff[low].
GetCoeff(m_tmp)*theLeg.
Evaluate(l, costh);
76 if(try01>max1) max1=try01;
81 try02 += (2.*l+1)/2.*theCoeff[high].
GetCoeff(m_tmp)*theLeg.
Evaluate(l, costh);
83 if(try02>max2) max2=try02;
90 G4int icounter_max=1024;
94 if ( icounter > icounter_max ) {
95 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
105 v1 += (2.*l+1)/2.*theCoeff[low].
GetCoeff(m_tmp)*legend;
111 v2 += (2.*l+1)/2.*theCoeff[high].
GetCoeff(m_tmp)*legend;
117 if(0>=theNorm)
break;
119 while(random>value/theNorm);
131 G4int low(0), high(0);
133 for (i0=0; i0<nEnergy; i0++)
136 if(theCoeff[i0].
GetEnergy()>anEnergy)
break;
138 low = std::max(0, high-1);
149 for(i0=0; i0<601; i0++)
157 if(try01>max1) max1=try01;
163 if(try02>max2) max2=try02;
170 G4int icounter_max=1024;
174 if ( icounter > icounter_max ) {
175 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
184 v1 += (2.*l+1)/2.*theCoeff[low].
GetCoeff(l)*legend;
189 v2 += (2.*l+1)/2.*theCoeff[high].
GetCoeff(l)*legend;
191 v1 = std::max(0.,v1);
192 v2 = std::max(0.,v2);
195 if(0>=theNorm)
break;
197 while(random>value/theNorm);
207 G4int low(0), high(0);
209 for (i0=0; i0<nEnergy; i0++)
212 if(theCoeff[i0].
GetEnergy()>anEnergy)
break;
214 low = std::max(0, high-1);
221 G4double try01=0, try02=0, try11=0, try12=0;
236 theNorm = std::max(try1, try2);
241 G4int icounter_max=1024;
245 if ( icounter > icounter_max ) {
246 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
255 v1 += (2.*l+1)/2.*theCoeff[low].
GetCoeff(l)*legend;
260 v2 += (2.*l+1)/2.*theCoeff[high].
GetCoeff(l)*legend;
265 while(random>value/theNorm);
273 G4int low(0), high(0);
275 for (i0=0; i0<nEnergy; i0++)
279 if(theCoeff[i0].
GetEnergy()>energy)
break;
281 low = std::max(0, high-1);
290 for(i0=0; i0<601; i0++)
296 theBuffer.
SetData(i0, costh, y);
301 for (i0=1; i0<601; i0++)
304 if(rand < theBuffer.
GetY(i0)/theBuffer.
GetY(600))
break;
315 x1 = theBuffer.
GetY(it)/norm;
316 x2 = theBuffer.
GetY(it-1)/norm;
317 y1 = theBuffer.
GetX(it);
318 y2 = theBuffer.
GetX(it-1);
G4GLOB_DLL std::ostream G4cout
G4InterpolationScheme GetScheme(G4int index) const
G4double Evaluate(G4int l, G4double costh)
G4double Integrate(G4int l, G4double costh)
G4double Interpolate(G4InterpolationScheme aScheme, G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
G4double Sample(G4double energy)
G4double GetEnergy(G4int i)
G4double Integrate(G4int k, G4double costh)
G4double SampleDiscreteTwoBody(G4double anEnergy)
G4double GetCoeff(G4int i, G4int l)
G4double SampleMax(G4double energy)
G4double SampleElastic(G4double anEnergy)
G4double GetCoeff(G4int l)
void SetData(G4int i, G4double x, G4double y)
G4double GetY(G4double x)
G4double GetX(G4int i) const