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;
double MCGIDI_target_getIndexReactionCrossSectionAtE(statusMessageReporting *smr, MCGIDI_target *target, int index, MCGIDI_quantitiesLookupModes &modes, bool sampling)
double MCGIDI_target_heated_getReactionsThreshold(statusMessageReporting *smr, MCGIDI_target_heated *target, int index)
double getOthersCrossSectionAtE(double e_in, double temperature)
int MCGIDI_sampledProducts_release(statusMessageReporting *smr, MCGIDI_sampledProductsDatas *sampledProductsDatas)
double sumChannelCrossSectionAtE(int nIndices, int *indices, double e_in, double temperature)
MCGIDI_reaction * MCGIDI_target_heated_getReactionAtIndex_smr(statusMessageReporting *smr, MCGIDI_target_heated *target, int index)
std::string * getName(void)
std::vector< channelID > * getProductionChannelIDs(void)
std::string getEqualProbableBinSampleMethod(void)
MCGIDI_target * MCGIDI_target_newRead(statusMessageReporting *smr, const char *fileName)
void setCrossSectionMode(enum MCGIDI_quantityLookupMode mode)
MCGIDI_sampledProductsData * products
double MCGIDI_target_getTotalCrossSectionAtTAndE(statusMessageReporting *smr, MCGIDI_target *target, MCGIDI_quantitiesLookupModes &modes, bool sampling)
std::vector< G4GIDI_Product > * getCaptureFinalState(double e_in, double temperature, double(*rng)(void *), void *rngState)
std::vector< G4GIDI_Product > * getFinalState(int nIndices, int *indices, double e_in, double temperature, double(*rng)(void *), void *rngState)
int readTemperature(int index)
int MCGIDI_target_heated_sampleIndexReactionProductsAtE(statusMessageReporting *smr, MCGIDI_target_heated *target, int index, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo, MCGIDI_sampledProductsDatas *productData)
int getNumberOfChannels(void)
int sampleChannelCrossSectionAtE(int nIndices, int *indices, double e_in, double temperature, double(*rng)(void *), void *rngState)
double G4GIDI_targetMass(const char *targetSymbol)
G4GIDI_target(const char *fileName)
int MCGIDI_target_heated_getReactionsDomain(statusMessageReporting *smr, MCGIDI_target_heated *target, int index, double *EMin, double *EMax)
#define smr_malloc2(smr, size, zero, forItem)
double getReactionsThreshold(int index)
void init(const char *fileName)
int MCGIDI_reaction_getENDF_MTNumber(MCGIDI_reaction *reaction)
MCGIDI_target * MCGIDI_target_free(statusMessageReporting *smr, MCGIDI_target *target)
char const * outputChannelStr
MCGIDI_outputChannel outputChannel
double getReactionsDomain(int index, double *EMin, double *EMax)
int smr_isOk(statusMessageReporting *smr)
int MCGIDI_product_sampleMu(statusMessageReporting *smr, MCGIDI_product *product, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo)
double getElasticFinalState(double e_in, double temperature, double(*rng)(void *), void *rngState)
int smr_initialize(statusMessageReporting *smr, enum smr_status verbosity, int append)
printf("%d Experimental points found\n", nlines)
std::vector< G4GIDI_Product > * getFissionFinalState(double e_in, double temperature, double(*rng)(void *), void *rngState)
MCGIDI_product * MCGIDI_outputChannel_getProductAtIndex(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel, int i)
int setEqualProbableBinSampleMethod(std::string method)
int MCGIDI_target_numberOfProductionReactions(statusMessageReporting *smr, MCGIDI_target *target)
void setProjectileEnergy(double e_in)
void * smr_freeMemory(void **p)
double getFissionCrossSectionAtE(double e_in, double temperature)
std::string * getFilename(void)
void smr_release(statusMessageReporting *smr)
int getNumberOfProductionChannels(void)
std::vector< G4GIDI_Product > * getOthersFinalState(double e_in, double temperature, double(*rng)(void *), void *rngState)
int getTemperatures(double *temperatures)
int MCGIDI_target_getTemperatures(statusMessageReporting *smr, MCGIDI_target *target, double *temperatures)
double getElasticCrossSectionAtE(double e_in, double temperature)
double getTotalCrossSectionAtE(double e_in, double temperature)
int MCGIDI_target_readHeatedTarget(statusMessageReporting *smr, MCGIDI_target *target, int index)
void smr_print(statusMessageReporting *smr, int clear)
int MCGIDI_sampledProducts_initialize(statusMessageReporting *smr, MCGIDI_sampledProductsDatas *sampledProductsDatas, int incrementSize)
double getCaptureCrossSectionAtE(double e_in, double temperature)
int MCGIDI_target_numberOfReactions(statusMessageReporting *smr, MCGIDI_target *target)
MCGIDI_reaction * MCGIDI_target_heated_getReactionAtIndex(MCGIDI_target_heated *target, int index)
std::vector< channelID > * getChannelIDs(void)
channelID getChannelsID(int channelIndex)
void setTemperature(double temperature)