53 init( fileName.c_str( ) );
60 int i, j,
n, *
p, *q, ir;
64 sourceFilename = fileName;
70 projectilesPOPID =
target->projectilePOP->globalPoPsIndex;
73 equalProbableBinSampleMethod =
"constant";
74 elasticIndices = NULL;
75 nElasticIndices = nCaptureIndices = nFissionIndices = nOthersIndices = 0;
78 if( ( p = elasticIndices = (
int *)
smr_malloc2( &smr, n *
sizeof(
double ), 1,
"elasticIndices" ) ) == NULL ) {
82 for( i = 0; i <
n; i++ ) {
90 for( i = 0; i <
n; i++ ) {
99 for( i = 0; i <
n; i++ ) {
102 if( ( ir != 18 ) && ( ir != 19 ) && ( ir != 20 ) && ( ir != 21 ) && ( ir != 38 ) )
continue;
107 for( i = 0; i <
n; i++ ) {
108 for( j = 0, q = elasticIndices; j < nElasticIndices; j++, q++ )
if( *q == i )
break;
109 if( j < nElasticIndices )
continue;
110 for( j = 0, q = captureIndices; j < nCaptureIndices; j++, q++ )
if( *q == i )
break;
111 if( j < nCaptureIndices )
continue;
112 for( j = 0, q = fissionIndices; j < nFissionIndices; j++, q++ )
if( *q == i )
break;
113 if( j < nFissionIndices )
continue;
119 printf(
"elastic %d: ", nElasticIndices );
120 for( i = 0; i < nElasticIndices; i++ )
printf(
" %d", elasticIndices[i] );
121 printf(
"\ncapture %d: ", nCaptureIndices );
122 for( i = 0; i < nCaptureIndices; i++ )
printf(
" %d", captureIndices[i] );
123 printf(
"\nfission %d: ", nFissionIndices );
124 for( i = 0; i < nFissionIndices; i++ )
printf(
" %d", fissionIndices[i] );
125 printf(
"\nothers %d: ", nOthersIndices );
126 for( i = 0; i < nOthersIndices; i++ )
printf(
" %d", othersIndices[i] );
153 return(
target->targetPOP->Z );
160 return(
target->targetPOP->A );
167 return(
target->targetPOP->m );
195 return( equalProbableBinSampleMethod );
202 if( method ==
"constant" ) {
203 equalProbableBinSampleMethod =
"constant"; }
204 if( method ==
"linear" ) {
205 equalProbableBinSampleMethod =
"linear"; }
245 vector<channelID> *listOfChannels;
247 listOfChannels =
new vector<channelID>(
n );
248 for( i = 0; i <
n; i++ ) {
252 return( listOfChannels );
279 return( sumChannelCrossSectionAtE( nElasticIndices, elasticIndices, e_in, temperature ) );
286 return( sumChannelCrossSectionAtE( nCaptureIndices, captureIndices, e_in, temperature ) );
293 return( sumChannelCrossSectionAtE( nFissionIndices, fissionIndices, e_in, temperature ) );
300 return( sumChannelCrossSectionAtE( nOthersIndices, othersIndices, e_in, temperature ) );
315 for( i = 0; i < nIndices; i++ )
323 double (*rng)(
void * ),
void *rngState ) {
326 double xsec = 0., rxsec = sumChannelCrossSectionAtE( nIndices, indices, e_in, temperature ) * rng( rngState );
333 for( i = 0; i < nIndices - 1; i++ ) {
335 if( xsec >= rxsec )
break;
337 return( indices[i] );
359 decaySamplingInfo.
rng = rng;
360 decaySamplingInfo.
rngState = rngState;
366 return( decaySamplingInfo.
mu );
373 return( getFinalState( nCaptureIndices, captureIndices, e_in, temperature, rng, rngState ) );
380 return( getFinalState( nFissionIndices, fissionIndices, e_in, temperature, rng, rngState ) );
387 return( getFinalState( nOthersIndices, othersIndices, e_in, temperature, rng, rngState ) );
393 double (*rng)(
void * ),
void *rngState ) {
396 vector<G4GIDI_Product> *products = NULL;
403 decaySamplingInfo.
rng = rng;
404 decaySamplingInfo.
rngState = rngState;
406 if( nIndices == 0 ) {
409 if( nIndices == 1 ) {
410 index = indices[0]; }
412 index = sampleChannelCrossSectionAtE( nIndices, indices, e_in, temperature, rng, rngState );
427 &decaySamplingInfo, &sampledProductsDatas );
433 if( ( products =
new vector<G4GIDI_Product>( n ) ) != NULL ) {
434 for( i = 0; i <
n; i++ ) {
435 productData = &(sampledProductsDatas.
products[i]);
436 (*products)[i].A = productData->
pop->
A;
437 (*products)[i].Z = productData->
pop->
Z;
438 (*products)[i].m = productData->
pop->
m;
440 (*products)[i].px = productData->
px_vx;
441 (*products)[i].py = productData->
py_vy;
442 (*products)[i].pz = productData->
pz_vz;
443 (*products)[i].birthTimeSec = productData->
birthTimeSec;