10 #if defined __cplusplus
65 double xSampled = sampled->
x, frac = 1.;
71 frac = ( dists->
Ws[iW+1] - sampled->
w ) / ( dists->
Ws[iW+1] - dists->
Ws[iW] );
72 sampled->
x = frac * xSampled + ( 1 - frac ) * sampled->
x; }
74 frac =
G4Log( dists->
Ws[iW+1] / sampled->
w ) /
G4Log( dists->
Ws[iW+1] / dists->
Ws[iW] );
75 sampled->
x = frac * xSampled + ( 1 - frac ) * sampled->
x; }
77 frac = ( dists->
Ws[iW+1] - sampled->
w ) / ( dists->
Ws[iW+1] - dists->
Ws[iW] );
80 frac =
G4Log( dists->
Ws[iW+1] / sampled->
w ) /
G4Log( dists->
Ws[iW+1] / dists->
Ws[iW] );
87 sampled->
iX2 = sampled->
iX1;
107 sampled->
x = dist->
Xs[0];
111 frac = ( dist->
cdf[iX+1] - rngValue ) / ( dist->
cdf[iX+1] - dist->
cdf[iX] );
112 sampled->
x = frac * dist->
Xs[
iX] + ( 1 - frac ) * dist->
Xs[iX+1]; }
117 if( dist->
pdf[iX] == 0 ) {
118 sampled->
x = dist->
Xs[
iX];
119 if( iX == 0 ) sampled->
x = dist->
Xs[1]; }
121 frac = ( dist->
cdf[iX+1] - rngValue ) / ( dist->
cdf[iX+1] - dist->
cdf[iX] );
122 sampled->
x = frac * dist->
Xs[
iX] + ( 1 - frac ) * dist->
Xs[iX+1];
125 s1 = s1 / ( dist->
Xs[iX+1] - dist->
Xs[
iX] );
126 d1 = rngValue - dist->
cdf[
iX];
127 d2 = dist->
cdf[iX+1] - rngValue;
129 sampled->
x = dist->
Xs[
iX] + ( std::sqrt( dist->
pdf[iX] * dist->
pdf[iX] + 2. * s1 * d1 ) - dist->
pdf[
iX] ) / s1; }
131 sampled->
x = dist->
Xs[iX+1] - ( dist->
pdf[iX+1] - std::sqrt( dist->
pdf[iX+1] * dist->
pdf[iX+1] - 2. * s1 * d2 ) ) / s1;
146 double randomW = decaySamplingInfo->
rng( decaySamplingInfo->
rngState ), randomX = decaySamplingInfo->
rng( decaySamplingInfo->
rngState );
161 e_in = pdfOfWGivenV->
Ws[iV];
165 sampledX.
w = sampledW.
x;
169 double x = sampledX.
x,
w = sampledW.
x, Vs[3] = { e_in, pdfOfWGivenV->
Ws[iV], pdfOfWGivenV->
Ws[iV+1] };
172 sampledX.
w = sampledW.
x;
179 decaySamplingInfo->
mu = sampledW.
x;
180 decaySamplingInfo->
Ep = sampledX.
x;
192 frac = ( ws[2] - ws[0] ) / ( ws[2] - ws[1] );
193 *y = frac * y1 + ( 1 - frac ) * y2; }
195 frac =
G4Log( ws[2] / ws[0] ) /
G4Log( ws[2] / ws[1] );
196 *y = frac * y1 + ( 1 - frac ) * y2; }
198 frac = ( ws[2] - ws[0] ) / ( ws[2] - ws[1] );
201 frac =
G4Log( ws[2] / ws[0] ) /
G4Log( ws[2] / ws[1] );
226 #if defined __cplusplus