84 init( fileName.c_str( ) );
95 sourceFilename = fileName;
103 equalProbableBinSampleMethod =
"constant";
104 elasticIndices = NULL;
105 nElasticIndices = nCaptureIndices = nFissionIndices = nOthersIndices = 0;
108 p = elasticIndices = (
int *)
xData_malloc2( NULL, n *
sizeof(
double ), 1,
"elasticIndices" );
109 for( i = 0; i <
n; i++ ) {
111 if( channel->
ENDL_C == 10 ) {
117 for( i = 0; i <
n; i++ ) {
119 if( channel->
ENDL_C == 46 ) {
126 for( i = 0; i <
n; i++ ) {
128 if( channel->
fission != NULL ) {
134 for( i = 0; i <
n; i++ ) {
135 for( j = 0, q = elasticIndices; j < nElasticIndices; j++, q++ )
if( *q == i )
break;
136 if( j < nElasticIndices )
continue;
137 for( j = 0, q = captureIndices; j < nCaptureIndices; j++, q++ )
if( *q == i )
break;
138 if( j < nCaptureIndices )
continue;
139 for( j = 0, q = fissionIndices; j < nFissionIndices; j++, q++ )
if( *q == i )
break;
140 if( j < nFissionIndices )
continue;
169 return(
target->targetID->Z );
176 return(
target->targetID->A );
183 return(
target->targetID->m );
211 return( equalProbableBinSampleMethod );
218 if( method ==
"constant" ) {
219 equalProbableBinSampleMethod =
"constant"; }
220 if( method ==
"linear" ) {
221 equalProbableBinSampleMethod =
"linear"; }
261 vector<channelID> *listOfChannels;
263 listOfChannels =
new vector<channelID>(
n );
264 for( i = 0; i <
n; i++ ) (*listOfChannels)[i].ID = channels[i]->
outputChannel;
265 return( listOfChannels );
274 vector<double> *energyGrid;
275 vector<double>::iterator iter;
278 if( n < 0 )
return( NULL );
279 energyGrid =
new vector<double>(
n );
280 for( i = 0, iter = energyGrid->begin( ); i <
n; i++, iter++ ) *iter = dEnergyGrid[i];
281 return( energyGrid );
295 return( sumChannelCrossSectionAtE( nElasticIndices, elasticIndices, e_in, temperature ) );
302 return( sumChannelCrossSectionAtE( nCaptureIndices, captureIndices, e_in, temperature ) );
309 return( sumChannelCrossSectionAtE( nFissionIndices, fissionIndices, e_in, temperature ) );
316 return( sumChannelCrossSectionAtE( nOthersIndices, othersIndices, e_in, temperature ) );
326 for( i = 0; i < nIndices; i++ )
334 double (*rng)(
void * ),
void *rngState ) {
337 double xsec = 0., rxsec = sumChannelCrossSectionAtE( nIndices, indices, e_in, temperature ) *
tpia_misc_drng( rng, rngState );
339 for( i = 0; i < nIndices - 1; i++ ) {
341 if( xsec >= rxsec )
break;
343 return( indices[i] );
355 decaySamplingInfo.
e_in = e_in;
359 decaySamplingInfo.
rng = rng;
360 decaySamplingInfo.
rngState = rngState;
364 return( decaySamplingInfo.
mu );
371 return( getFinalState( nCaptureIndices, captureIndices, e_in, temperature, rng, rngState ) );
378 return( getFinalState( nFissionIndices, fissionIndices, e_in, temperature, rng, rngState ) );
385 return( getFinalState( nOthersIndices, othersIndices, e_in, temperature, rng, rngState ) );
390 vector<G4GIDI_Product> *
G4GIDI_target::getFinalState(
int nIndices,
int *indices,
double e_in,
double temperature,
double (*rng)(
void * ),
void *rngState ) {
392 #define nProductsMax 50
394 vector<G4GIDI_Product> *products = NULL;
398 decaySamplingInfo.
e_in = e_in;
402 decaySamplingInfo.
rng = rng;
403 decaySamplingInfo.
rngState = rngState;
405 if( nIndices == 0 ) {
408 if( nIndices == 1 ) {
409 index = indices[0]; }
411 index = sampleChannelCrossSectionAtE( nIndices, indices, e_in, temperature, rng, rngState );
416 if( ( products =
new vector<G4GIDI_Product>( n ) ) != NULL ) {
417 for( i = 0; i <
n; i++ ) {
418 productData = &(productDatas[i]);
423 (*products)[i].px = productData->
px_vx;
424 (*products)[i].py = productData->
py_vy;
425 (*products)[i].pz = productData->
pz_vz;
void smr_print(statusMessageReporting *smr, FILE *f, int clear)
std::vector< channelID > * getChannelIDs2(GIDI::tpia_channel **channels, int n)
double tpia_target_getTotalCrossSectionAtTAndE(statusMessageReporting *smr, tpia_target *target, double T, xData_Int iEg, double e_in, int crossSectionType)
tpia_channel * tpia_target_heated_getChannelAtIndex_smr(statusMessageReporting *smr, tpia_target_heated *target, int index)
double getFissionCrossSectionAtE(double e_in, double temperature)
std::string * getFilename(void)
int tpia_angular_SampleMu(statusMessageReporting *smr, tpia_angular *angular, tpia_decaySamplingInfo *decaySamplingInfo)
int smr_release(statusMessageReporting *smr)
tpia_target * tpia_target_free(statusMessageReporting *smr, tpia_target *target)
G4GIDI_target(const char *fileName)
double getOthersCrossSectionAtE(double e_in, double temperature)
void init(const char *fileName)
double sumChannelCrossSectionAtE(int nIndices, int *indices, double e_in, double temperature)
tpia_decayChannel decayChannel
double tpia_misc_drng(double(*rng)(void *), void *rngState)
int sampleChannelCrossSectionAtE(int nIndices, int *indices, double e_in, double temperature, double(*rng)(void *), void *rngState)
int tpia_target_heated_sampleIndexChannelProductsAtE(statusMessageReporting *smr, tpia_target_heated *target, int index, tpia_decaySamplingInfo *decaySamplingInfo, int nProductData, tpia_productOutgoingData *productData)
int tpia_target_numberOfProductionChannels(statusMessageReporting *smr, tpia_target *target)
#define xData_malloc2(smr, size, zero, forItem)
xData_Int tpia_target_getEnergyGridAtTIndex(statusMessageReporting *smr, tpia_target *target, int index, double **energyGrid)
tpia_target * tpia_target_createRead(statusMessageReporting *smr, const char *fileName)
double G4GIDI_targetMass(const char *targetSymbol)
std::vector< G4GIDI_Product > * getOthersFinalState(double e_in, double temperature, double(*rng)(void *), void *rngState)
void * xData_free(statusMessageReporting *smr, void *p)
tpia_samplingMethods * samplingMethods
tpia_channel * tpia_target_heated_getChannelAtIndex(tpia_target_heated *target, int index)
double getElasticCrossSectionAtE(double e_in, double temperature)
int getTemperatures(double *temperatures)
double getTotalCrossSectionAtE(double e_in, double temperature)
std::vector< G4GIDI_Product > * getFissionFinalState(double e_in, double temperature, double(*rng)(void *), void *rngState)
double getCaptureCrossSectionAtE(double e_in, double temperature)
double getElasticFinalState(double e_in, double temperature, double(*rng)(void *), void *rngState)
int tpia_target_readHeatedTarget(statusMessageReporting *smr, tpia_target *target, int index, int checkElememtsForAccess)
int tpia_frame_setColumn(statusMessageReporting *smr, tpia_data_frame *frame, int column, int value)
std::vector< G4GIDI_Product > * getFinalState(int nIndices, int *indices, double e_in, double temperature, double(*rng)(void *), void *rngState)
std::string * getName(void)
std::vector< G4GIDI_Product > * getCaptureFinalState(double e_in, double temperature, double(*rng)(void *), void *rngState)
std::vector< double > * getEnergyGridAtTIndex(int index)
int getNumberOfProductionChannels(void)
std::vector< channelID > * getProductionChannelIDs(void)
#define tpia_crossSectionType_pointwise
int smr_isOk(statusMessageReporting *smr)
int setEqualProbableBinSampleMethod(std::string method)
int tpia_target_numberOfChannels(statusMessageReporting *smr, tpia_target *target)
#define tpia_referenceFrame_lab
double tpia_target_getIndexChannelCrossSectionAtE(statusMessageReporting *smr, tpia_target *target, int index, double T, xData_Int iEg, double e_in, int crossSectionType)
int smr_initialize(statusMessageReporting *smr)
tpia_particle * productID
int getNumberOfChannels(void)
int readTemperature(int index)
int tpia_target_getTemperatures(statusMessageReporting *smr, tpia_target *target, double *temperatures)
tpia_product * tpia_decayChannel_getFirstProduct(tpia_decayChannel *decayChannel)
std::vector< channelID > * getChannelIDs(void)
std::string getEqualProbableBinSampleMethod(void)