Geant4-11
Data Structures | Typedefs | Functions
MCGIDI_product.cc File Reference
#include <string.h>
#include <cmath>
#include "MCGIDI.h"
#include "MCGIDI_misc.h"
#include "MCGIDI_fromTOM.h"

Go to the source code of this file.

Data Structures

struct  polynomialCallbackArgs_s
 

Typedefs

typedef struct polynomialCallbackArgs_s polynomialCallbackArgs
 

Functions

static double MCGIDI_product_evaluatePolynomial (double x, polynomialCallbackArgs *args)
 
MCGIDI_productMCGIDI_product_free (statusMessageReporting *smr, MCGIDI_product *product)
 
int MCGIDI_product_getDomain (statusMessageReporting *smr, MCGIDI_product *product, double *EMin, double *EMax)
 
double MCGIDI_product_getMass_MeV (statusMessageReporting *, MCGIDI_product *product)
 
double MCGIDI_product_getProjectileMass_MeV (statusMessageReporting *smr, MCGIDI_product *product)
 
MCGIDI_target_heatedMCGIDI_product_getTargetHeated (statusMessageReporting *smr, MCGIDI_product *product)
 
double MCGIDI_product_getTargetMass_MeV (statusMessageReporting *smr, MCGIDI_product *product)
 
int MCGIDI_product_initialize (statusMessageReporting *, MCGIDI_product *product)
 
MCGIDI_productMCGIDI_product_new (statusMessageReporting *smr)
 
int MCGIDI_product_parseFromTOM (statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_outputChannel *outputChannel, MCGIDI_POPs *pops, MCGIDI_product *product, int *delayedNeutronIndex)
 
static int MCGIDI_product_parsePiecewiseMultiplicity (statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_product *product)
 
static ptwXYPointsMCGIDI_product_parsePolynomialMultiplicity (statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_product *product)
 
static int MCGIDI_product_parseWeightedReferenceMultiplicityFromTOM (statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_product *product, ptwXYPoints **multiplicityVsEnergy, ptwXYPoints **norms)
 
int MCGIDI_product_release (statusMessageReporting *smr, MCGIDI_product *product)
 
int MCGIDI_product_sampleMu (statusMessageReporting *smr, MCGIDI_product *product, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo)
 
int MCGIDI_product_sampleMultiplicity (statusMessageReporting *, MCGIDI_product *product, double e_in, double r)
 
int MCGIDI_product_setTwoBodyMasses (statusMessageReporting *smr, MCGIDI_product *product, double projectileMass_MeV, double targetMass_MeV, double productMass_MeV, double residualMass_MeV)
 
int MCGIDI_sampledProducts_addProduct (statusMessageReporting *smr, MCGIDI_sampledProductsDatas *sampledProductsDatas, MCGIDI_sampledProductsData *sampledProductsData)
 
MCGIDI_sampledProductsDataMCGIDI_sampledProducts_getProductAtIndex (MCGIDI_sampledProductsDatas *sampledProductsDatas, int index)
 
int MCGIDI_sampledProducts_initialize (statusMessageReporting *smr, MCGIDI_sampledProductsDatas *sampledProductsDatas, int incrementSize)
 
int MCGIDI_sampledProducts_number (MCGIDI_sampledProductsDatas *sampledProductsDatas)
 
int MCGIDI_sampledProducts_release (statusMessageReporting *, MCGIDI_sampledProductsDatas *sampledProductsDatas)
 
int MCGIDI_sampledProducts_remalloc (statusMessageReporting *smr, MCGIDI_sampledProductsDatas *sampledProductsDatas)
 

Typedef Documentation

◆ polynomialCallbackArgs

Function Documentation

◆ MCGIDI_product_evaluatePolynomial()

static double MCGIDI_product_evaluatePolynomial ( double  x,
polynomialCallbackArgs args 
)
static

Definition at line 241 of file MCGIDI_product.cc.

241 {
242
243 int i;
244 double value = 0.;
245
246 x /= args->energyFactor;
247 for( i = args->length; i > 0; i-- ) value = value * x + args->coefficients[i-1];
248
249 return( value );
250}
static char ** args
Definition: G4Xt.cc:51

References args.

Referenced by MCGIDI_product_parsePolynomialMultiplicity().

◆ MCGIDI_product_free()

MCGIDI_product * MCGIDI_product_free ( statusMessageReporting smr,
MCGIDI_product product 
)

Definition at line 51 of file MCGIDI_product.cc.

51 {
52
53 MCGIDI_product_release( smr, product );
54 smr_freeMemory( (void **) &product );
55 return( NULL );
56}
int MCGIDI_product_release(statusMessageReporting *smr, MCGIDI_product *product)
void * smr_freeMemory(void **p)

References MCGIDI_product_release(), and smr_freeMemory().

Referenced by MCGIDI_product_new().

◆ MCGIDI_product_getDomain()

int MCGIDI_product_getDomain ( statusMessageReporting smr,
MCGIDI_product product,
double *  EMin,
double *  EMax 
)

Definition at line 282 of file MCGIDI_product.cc.

282 {
283
284 return( MCGIDI_outputChannel_getDomain( smr, product->outputChannel, EMin, EMax ) );
285}
int MCGIDI_outputChannel_getDomain(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel, double *EMin, double *EMax)
MCGIDI_outputChannel * outputChannel
Definition: MCGIDI.h:403

References MCGIDI_outputChannel_getDomain(), and MCGIDI_product_s::outputChannel.

Referenced by MCGIDI_outputChannel_getDomain(), and MCGIDI_product_parsePolynomialMultiplicity().

◆ MCGIDI_product_getMass_MeV()

double MCGIDI_product_getMass_MeV ( statusMessageReporting smr,
MCGIDI_product product 
)

Definition at line 297 of file MCGIDI_product.cc.

297 {
298
299 return( MCGIDI_POP_getMass_MeV( product->pop ) );
300}
double MCGIDI_POP_getMass_MeV(MCGIDI_POP *pop)
Definition: MCGIDI_pop.cc:212
MCGIDI_POP * pop
Definition: MCGIDI.h:401

References MCGIDI_POP_getMass_MeV(), and MCGIDI_product_s::pop.

Referenced by MCGIDI_energy_parseNBodyPhaseSpaceFromTOM(), MCGIDI_outputChannel_parseFromTOM(), and MCGIDI_outputChannel_sampleProductsAtE().

◆ MCGIDI_product_getProjectileMass_MeV()

double MCGIDI_product_getProjectileMass_MeV ( statusMessageReporting smr,
MCGIDI_product product 
)

Definition at line 311 of file MCGIDI_product.cc.

311 {
312
314}
double MCGIDI_outputChannel_getProjectileMass_MeV(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel)

References MCGIDI_outputChannel_getProjectileMass_MeV(), and MCGIDI_product_s::outputChannel.

Referenced by MCGIDI_energy_parseFromTOM(), and MCGIDI_outputChannel_getProjectileMass_MeV().

◆ MCGIDI_product_getTargetHeated()

MCGIDI_target_heated * MCGIDI_product_getTargetHeated ( statusMessageReporting smr,
MCGIDI_product product 
)

Definition at line 304 of file MCGIDI_product.cc.

304 {
305
306 return( MCGIDI_outputChannel_getTargetHeated( smr, product->outputChannel ) );
307}
MCGIDI_target_heated * MCGIDI_outputChannel_getTargetHeated(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel)

References MCGIDI_outputChannel_getTargetHeated(), and MCGIDI_product_s::outputChannel.

Referenced by MCGIDI_KalbachMann_parseFromTOM(), and MCGIDI_outputChannel_getTargetHeated().

◆ MCGIDI_product_getTargetMass_MeV()

double MCGIDI_product_getTargetMass_MeV ( statusMessageReporting smr,
MCGIDI_product product 
)

Definition at line 318 of file MCGIDI_product.cc.

318 {
319
320 return( MCGIDI_outputChannel_getTargetMass_MeV( smr, product->outputChannel ) );
321}
double MCGIDI_outputChannel_getTargetMass_MeV(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel)

References MCGIDI_outputChannel_getTargetMass_MeV(), and MCGIDI_product_s::outputChannel.

Referenced by MCGIDI_energy_parseFromTOM(), and MCGIDI_outputChannel_getTargetMass_MeV().

◆ MCGIDI_product_initialize()

int MCGIDI_product_initialize ( statusMessageReporting smr,
MCGIDI_product product 
)

Definition at line 42 of file MCGIDI_product.cc.

42 {
43
44 memset( product, 0, sizeof( MCGIDI_product ) );
45 product->delayedNeutronIndex = -1;
46 return( 0 );
47}
int delayedNeutronIndex
Definition: MCGIDI.h:405

References MCGIDI_product_s::delayedNeutronIndex.

Referenced by MCGIDI_product_new(), MCGIDI_product_parseFromTOM(), and MCGIDI_product_release().

◆ MCGIDI_product_new()

MCGIDI_product * MCGIDI_product_new ( statusMessageReporting smr)

Definition at line 31 of file MCGIDI_product.cc.

31 {
32
33 MCGIDI_product *product;
34
35 if( ( product = (MCGIDI_product *) smr_malloc2( smr, sizeof( MCGIDI_product ), 0, "product" ) ) == NULL ) return( NULL );
36 if( MCGIDI_product_initialize( smr, product ) ) product = MCGIDI_product_free( smr, product );
37 return( product );
38}
int MCGIDI_product_initialize(statusMessageReporting *, MCGIDI_product *product)
MCGIDI_product * MCGIDI_product_free(statusMessageReporting *smr, MCGIDI_product *product)
#define smr_malloc2(smr, size, zero, forItem)

References MCGIDI_product_free(), MCGIDI_product_initialize(), and smr_malloc2.

◆ MCGIDI_product_parseFromTOM()

int MCGIDI_product_parseFromTOM ( statusMessageReporting smr,
xDataTOM_element element,
MCGIDI_outputChannel outputChannel,
MCGIDI_POPs pops,
MCGIDI_product product,
int *  delayedNeutronIndex 
)

Definition at line 82 of file MCGIDI_product.cc.

83 {
84
85 char const *name, *label, *delayedNeutron, *multiplicityStr, *multiplicityUnits[2] = { "MeV", "" };
86 xDataTOM_element *multiplicity, *multiplicityTOM, *decayChannelElement;
87 nfu_status status;
88 ptwXYPoints *multiplicityVsEnergy = NULL, *norms1 = NULL, *norms2 = NULL;
89
90 MCGIDI_product_initialize( smr, product );
91
92 product->outputChannel = outputChannel;
93 if( ( name = xDataTOM_getAttributesValueInElement( element, "name" ) ) == NULL ) goto err;
94 if( ( product->pop = MCGIDI_POPs_findParticle( pops, name ) ) == NULL ) {
95 smr_setReportError2( smr, smr_unknownID, 1, "product '%s' not found in pops", name );
96 goto err;
97 }
98 if( ( label = xDataTOM_getAttributesValueInElement( element, "label" ) ) != NULL ) {
99 if( ( product->label = smr_allocateCopyString2( smr, label, "product->label" ) ) == NULL ) goto err;
100 }
101
102 if( ( delayedNeutron = xDataTOM_getAttributesValueInElement( element, "emissionMode" ) ) != NULL ) {
103 if( strcmp( delayedNeutron, "delayed" ) == 0 ) {
104 if( ( delayedNeutron = xDataTOM_getAttributesValueInElement( element, "decayRate" ) ) == NULL ) {
105 goto err;
106 }
107 if( MCGIDI_misc_PQUStringToDoubleInUnitOf( smr, delayedNeutron, "1/s", &(product->delayedNeutronRate) ) != 0 ) goto err;
108 product->delayedNeutronIndex = *delayedNeutronIndex;
109 (*delayedNeutronIndex)++;
110 }
111 }
112
113 if( ( multiplicityStr = xDataTOM_getAttributesValueInElement( element, "multiplicity" ) ) == NULL ) goto err;
114 if( xDataTOME_convertAttributeToInteger( NULL, element, "multiplicity", &(product->multiplicity) ) ) {
115 if( strcmp( multiplicityStr, "energyDependent" ) ) {
116 smr_setReportError2( smr, smr_unknownID, 1, "invalid multiplicity '%s' for product '%s'", multiplicityStr, name );
117 goto err;
118 }
119 if( ( multiplicity = xDataTOME_getOneElementByName( smr, element, "multiplicity", 1 ) ) == NULL ) goto err;
120 if( ( multiplicityTOM = xDataTOME_getOneElementByName( NULL, multiplicity, "weightedReference", 0 ) ) != NULL ) {
121 if( MCGIDI_product_parseWeightedReferenceMultiplicityFromTOM( smr, multiplicityTOM, product, &multiplicityVsEnergy, &norms1 ) ) goto err; }
122 else if( ( multiplicityTOM = xDataTOME_getOneElementByName( NULL, multiplicity, "piecewise", 0 ) ) != NULL ) {
123 if( MCGIDI_product_parsePiecewiseMultiplicity( smr, multiplicityTOM, product ) ) goto err; }
124 else if( ( multiplicityTOM = xDataTOME_getOneElementByName( NULL, multiplicity, "polynomial", 0 ) ) != NULL ) {
125 if( ( multiplicityVsEnergy = MCGIDI_product_parsePolynomialMultiplicity( smr, multiplicityTOM, product ) ) == NULL ) goto err; }
126 else {
127/* ??????? Need to check interpolation. */
128 if( ( multiplicityTOM = xDataTOME_getOneElementByName( smr, multiplicity, "pointwise", 1 ) ) == NULL ) goto err;
129 if( ( multiplicityVsEnergy = MCGIDI_misc_dataFromElement2ptwXYPointsInUnitsOf( smr, multiplicityTOM, multiplicityUnits ) ) == NULL ) goto err;
130 }
131 }
132
133 if( strcmp( product->pop->name, "gamma" ) == 0 ) {
134 if( ( norms2 = ptwXY_new( ptwXY_interpolationLinLin, NULL, 2., 1e-3, 200, 10, &status, 0 ) ) == NULL ) {
135 smr_setReportError2( smr, smr_unknownID, 1, "ptwXY_new err = %d: %s\n", status, nfu_statusMessage( status ) );
136 goto err;
137 }
138 }
139 if( MCGIDI_distribution_parseFromTOM( smr, element, product, pops, norms2 ) ) goto err;
140 if( norms2 != NULL ) {
141 if( ptwXY_length( norms2 ) < 2 ) {
142 norms2 = ptwXY_free( norms2 ); }
143 else {
144 if( ptwXY_simpleCoalescePoints( norms2 ) != nfu_Okay ) goto err;
145 if( ( ptwXY_getYMin( norms2 ) > 0.99 ) && ( ptwXY_getYMax( norms2 ) < 1.01 ) ) norms2 = ptwXY_free( norms2 );
146 }
147 }
148 if( ( norms1 != NULL ) && ( norms2 != NULL ) ) {
149 smr_setReportError2p( smr, smr_unknownID, 1, "norm1 and norm2 are both not NULL" );
150 goto err;
151 }
152
153 product->multiplicityVsEnergy = multiplicityVsEnergy;
154 product->norms = norms1;
155 if( norms2 != NULL ) product->norms = norms2;
156
157 if( ( decayChannelElement = xDataTOME_getOneElementByName( NULL, element, "decayChannel", 0 ) ) != NULL ) {
158 if( MCGIDI_outputChannel_parseFromTOM( smr, decayChannelElement, pops, &(product->decayChannel), NULL, product ) ) goto err;
159 }
160
161 return( 0 );
162
163err:
164 if( multiplicityVsEnergy != NULL ) ptwXY_free( multiplicityVsEnergy );
165 if( norms1 != NULL ) ptwXY_free( norms1 );
166 if( norms2 != NULL ) ptwXY_free( norms2 );
167 MCGIDI_product_release( smr, product );
168 return( 1 );
169}
MCGIDI_POP * MCGIDI_POPs_findParticle(MCGIDI_POPs *pops, char const *name)
Definition: MCGIDI_pop.cc:133
int MCGIDI_distribution_parseFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_product *product, MCGIDI_POPs *pops, ptwXYPoints *norms)
int MCGIDI_outputChannel_parseFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_POPs *pops, MCGIDI_outputChannel *outputChannel, MCGIDI_reaction *reaction, MCGIDI_product *parent)
int MCGIDI_misc_PQUStringToDoubleInUnitOf(statusMessageReporting *smr, char const *str, char const *toUnit, double *value)
Definition: MCGIDI_misc.cc:356
ptwXYPoints * MCGIDI_misc_dataFromElement2ptwXYPointsInUnitsOf(statusMessageReporting *smr, xDataTOM_element *linear, char const *toUnits[2])
Definition: MCGIDI_misc.cc:424
static int MCGIDI_product_parseWeightedReferenceMultiplicityFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_product *product, ptwXYPoints **multiplicityVsEnergy, ptwXYPoints **norms)
static ptwXYPoints * MCGIDI_product_parsePolynomialMultiplicity(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_product *product)
static int MCGIDI_product_parsePiecewiseMultiplicity(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_product *product)
const char * name(G4int ptype)
@ nfu_Okay
Definition: nf_utilities.h:25
enum nfu_status_e nfu_status
const char * nfu_statusMessage(nfu_status status)
Definition: nf_utilities.cc:76
double ptwXY_getYMax(ptwXYPoints *ptwXY)
Definition: ptwXY_core.cc:1269
nfu_status ptwXY_simpleCoalescePoints(ptwXYPoints *ptwXY)
Definition: ptwXY_core.cc:529
ptwXYPoints * ptwXY_new(ptwXY_interpolation interpolation, ptwXY_interpolationOtherInfo const *interpolationOtherInfo, double biSectionMax, double accuracy, int64_t primarySize, int64_t secondarySize, nfu_status *status, int userFlag)
Definition: ptwXY_core.cc:29
@ ptwXY_interpolationLinLin
Definition: ptwXY.h:35
int64_t ptwXY_length(ptwXYPoints *ptwXY)
Definition: ptwXY_core.cc:583
ptwXYPoints * ptwXY_free(ptwXYPoints *ptwXY)
Definition: ptwXY_core.cc:574
double ptwXY_getYMin(ptwXYPoints *ptwXY)
Definition: ptwXY_core.cc:1248
#define smr_setReportError2(smr, libraryID, code, fmt,...)
#define smr_setReportError2p(smr, libraryID, code, fmt)
#define smr_allocateCopyString2(smr, s, forItem)
#define smr_unknownID
char * name
Definition: MCGIDI.h:232
ptwXYPoints * norms
Definition: MCGIDI.h:408
double delayedNeutronRate
Definition: MCGIDI.h:406
int multiplicity
Definition: MCGIDI.h:404
MCGIDI_outputChannel decayChannel
Definition: MCGIDI.h:412
char * label
Definition: MCGIDI.h:402
ptwXYPoints * multiplicityVsEnergy
Definition: MCGIDI.h:407
xDataTOM_element * xDataTOME_getOneElementByName(statusMessageReporting *smr, xDataTOM_element *element, char const *name, int required)
Definition: xDataTOM.cc:246
char const * xDataTOM_getAttributesValueInElement(xDataTOM_element *element, char const *name)
Definition: xDataTOM.cc:286
int xDataTOME_convertAttributeToInteger(statusMessageReporting *smr, xDataTOM_element *element, char const *name, int *n)
Definition: xDataTOM.cc:300

References MCGIDI_product_s::decayChannel, MCGIDI_product_s::delayedNeutronIndex, MCGIDI_product_s::delayedNeutronRate, MCGIDI_product_s::label, MCGIDI_distribution_parseFromTOM(), MCGIDI_misc_dataFromElement2ptwXYPointsInUnitsOf(), MCGIDI_misc_PQUStringToDoubleInUnitOf(), MCGIDI_outputChannel_parseFromTOM(), MCGIDI_POPs_findParticle(), MCGIDI_product_initialize(), MCGIDI_product_parsePiecewiseMultiplicity(), MCGIDI_product_parsePolynomialMultiplicity(), MCGIDI_product_parseWeightedReferenceMultiplicityFromTOM(), MCGIDI_product_release(), MCGIDI_product_s::multiplicity, MCGIDI_product_s::multiplicityVsEnergy, G4InuclParticleNames::name(), MCGIDI_POP_s::name, nfu_Okay, nfu_statusMessage(), MCGIDI_product_s::norms, MCGIDI_product_s::outputChannel, MCGIDI_product_s::pop, ptwXY_free(), ptwXY_getYMax(), ptwXY_getYMin(), ptwXY_interpolationLinLin, ptwXY_length(), ptwXY_new(), ptwXY_simpleCoalescePoints(), smr_allocateCopyString2, smr_setReportError2, smr_setReportError2p, smr_unknownID, xDataTOM_getAttributesValueInElement(), xDataTOME_convertAttributeToInteger(), and xDataTOME_getOneElementByName().

Referenced by MCGIDI_outputChannel_parseFromTOM().

◆ MCGIDI_product_parsePiecewiseMultiplicity()

static int MCGIDI_product_parsePiecewiseMultiplicity ( statusMessageReporting smr,
xDataTOM_element element,
MCGIDI_product product 
)
static

Definition at line 173 of file MCGIDI_product.cc.

173 {
174
175 int i;
176 xDataTOM_XYs *XYs;
177 xDataTOM_regionsXYs *regionsXYs = (xDataTOM_regionsXYs *) element->xDataInfo.data;
178 ptwXYPoints *multiplicityVsEnergy;
179 char const *multiplicityUnits[2] = { "MeV", "" };
180
181 if( ( product->piecewiseMultiplicities = (ptwXYPoints **) smr_malloc2( smr, regionsXYs->length * sizeof( ptwXYPoints * ), 1, "piecewiseMultiplicities" ) ) == NULL ) return( 1 );
182
183 for( i = 0; i < regionsXYs->length; i++ ) {
184/* ??????? Need to check interpolation. */
185 XYs = &(regionsXYs->XYs[i]);
186 if( ( multiplicityVsEnergy = MCGIDI_misc_dataFromXYs2ptwXYPointsInUnitsOf( smr, XYs, ptwXY_interpolationLinLin, multiplicityUnits )
187 ) == NULL ) return( 1 );
188 product->piecewiseMultiplicities[i] = multiplicityVsEnergy;
190 }
191
192 return( 0 );
193}
ptwXYPoints * MCGIDI_misc_dataFromXYs2ptwXYPointsInUnitsOf(statusMessageReporting *smr, xDataTOM_XYs *XYs, ptwXY_interpolation interpolation, char const *units[2])
Definition: MCGIDI_misc.cc:405
int numberOfPiecewiseMultiplicities
Definition: MCGIDI.h:409
ptwXYPoints ** piecewiseMultiplicities
Definition: MCGIDI.h:410
xDataTOM_xDataInfo xDataInfo
Definition: xDataTOM.h:187

References xDataTOM_xDataInfo_s::data, and xDataTOM_element_s::xDataInfo.

Referenced by MCGIDI_product_parseFromTOM().

◆ MCGIDI_product_parsePolynomialMultiplicity()

static ptwXYPoints * MCGIDI_product_parsePolynomialMultiplicity ( statusMessageReporting smr,
xDataTOM_element element,
MCGIDI_product product 
)
static

Definition at line 197 of file MCGIDI_product.cc.

197 {
198
199 int length;
200 double *coefficients;
201 char const *energyUnit;
202 ptwXYPoints *ptwXY = NULL;
203 nfu_status status;
204 double EMin, EMax;
206
207 if( MCGIDI_product_getDomain( smr, product, &EMin, &EMax ) ) goto err;
208
209 length = xDataTOM_polynomial_getDataFromXDataInfo( (xDataTOM_xDataInfo *) &(element->xDataInfo), &coefficients );
210 if( ( ptwXY = ptwXY_new( ptwXY_interpolationLinLin, NULL, 2., 1e-3, length, 10, &status, 0 ) ) == NULL ) {
211 smr_setReportError2( smr, smr_unknownID, 1, "ptwXY_new err = %d: %s\n", status, nfu_statusMessage( status ) );
212 goto err;
213 }
214
215 if( ( energyUnit = xDataTOM_axes_getUnit( smr, &(element->xDataInfo.axes), 0 ) ) == NULL ) goto err;
216 args.energyFactor = MCGIDI_misc_getUnitConversionFactor( smr, energyUnit, "MeV" );
217 if( !smr_isOk( smr ) ) goto err;
218
219 args.length = length;
220 args.coefficients = coefficients;
223 if( length > 2 ) { /* ?????????????? This needs work. */
224 int i, n = 4 * length;
225 double E = EMin, dE = ( EMax - EMin ) / n;
226
227 for( i = 1; i < n; i++ ) {
228 E += dE;
230 }
231 }
232 return( ptwXY );
233
234err:
235 if( ptwXY != NULL ) ptwXY_free( ptwXY );
236 return( NULL );
237}
static const G4double dE
double MCGIDI_misc_getUnitConversionFactor(statusMessageReporting *smr, char const *fromUnit, char const *toUnit)
Definition: MCGIDI_misc.cc:381
int MCGIDI_product_getDomain(statusMessageReporting *smr, MCGIDI_product *product, double *EMin, double *EMax)
static double MCGIDI_product_evaluatePolynomial(double x, polynomialCallbackArgs *args)
nfu_status ptwXY_setValueAtX(ptwXYPoints *ptwXY, double x, double y)
Definition: ptwXY_core.cc:876
int smr_isOk(statusMessageReporting *smr)
xDataTOM_axes axes
Definition: xDataTOM.h:153
char const * xDataTOM_axes_getUnit(statusMessageReporting *smr, xDataTOM_axes *axes, int index)
int xDataTOM_polynomial_getDataFromXDataInfo(xDataTOM_xDataInfo *xDI, double **data)

References args, xDataTOM_xDataInfo_s::axes, dE, MCGIDI_misc_getUnitConversionFactor(), MCGIDI_product_evaluatePolynomial(), MCGIDI_product_getDomain(), CLHEP::detail::n, nfu_statusMessage(), ptwXY_free(), ptwXY_interpolationLinLin, ptwXY_new(), ptwXY_setValueAtX(), smr_isOk(), smr_setReportError2, smr_unknownID, xDataTOM_element_s::xDataInfo, xDataTOM_axes_getUnit(), and xDataTOM_polynomial_getDataFromXDataInfo().

Referenced by MCGIDI_product_parseFromTOM().

◆ MCGIDI_product_parseWeightedReferenceMultiplicityFromTOM()

static int MCGIDI_product_parseWeightedReferenceMultiplicityFromTOM ( statusMessageReporting smr,
xDataTOM_element element,
MCGIDI_product product,
ptwXYPoints **  multiplicityVsEnergy,
ptwXYPoints **  norms 
)
static

Definition at line 254 of file MCGIDI_product.cc.

255 {
256
257 char const *link, *energyInMWUnits[2] = { "MeV", "" };
258 xDataTOM_element *reference, *productTOM, *multiplicity, *weights, *pointwise;
259
260 if( ( reference = xDataTOME_getOneElementByName( smr, element, "reference", 1 ) ) == NULL ) goto err;
261 if( ( link = xDataTOM_getAttributesValueInElement( reference, "xlink:href" ) ) == NULL ) goto err;
262 if( ( productTOM = xDataTOM_getLinksElement( smr, reference, link ) ) == NULL ) goto err;
263 if( ( multiplicity = xDataTOME_getOneElementByName( smr, productTOM, "multiplicity", 1 ) ) == NULL ) goto err;
264 /* Currently, only pointwise supported. */
265 if( ( pointwise = xDataTOME_getOneElementByName( smr, multiplicity, "pointwise", 1 ) ) == NULL ) goto err;
266 if( ( *multiplicityVsEnergy = MCGIDI_misc_dataFromElement2ptwXYPointsInUnitsOf( smr, pointwise, energyInMWUnits ) ) == NULL ) goto err;
267
268 if( ( weights = xDataTOME_getOneElementByName( smr, element, "weights", 1 ) ) == NULL ) goto err;
269 if( ( pointwise = xDataTOME_getOneElementByName( smr, weights, "pointwise", 1 ) ) == NULL ) goto err;
270 if( ( *norms = MCGIDI_misc_dataFromElement2ptwXYPointsInUnitsOf( smr, pointwise, energyInMWUnits ) ) == NULL ) goto err;
271
272 return( 0 );
273
274err:
275 if( *multiplicityVsEnergy != NULL ) *multiplicityVsEnergy = ptwXY_free( *multiplicityVsEnergy );
276 if( *norms != NULL ) *norms = ptwXY_free( *norms );
277 return( 1 );
278}
xDataTOM_element * xDataTOM_getLinksElement(statusMessageReporting *smr, xDataTOM_element *element, char const *link)

References MCGIDI_misc_dataFromElement2ptwXYPointsInUnitsOf(), ptwXY_free(), xDataTOM_getAttributesValueInElement(), xDataTOM_getLinksElement(), and xDataTOME_getOneElementByName().

Referenced by MCGIDI_product_parseFromTOM().

◆ MCGIDI_product_release()

int MCGIDI_product_release ( statusMessageReporting smr,
MCGIDI_product product 
)

Definition at line 60 of file MCGIDI_product.cc.

60 {
61
62 int i;
63
64 if( product->label != NULL ) smr_freeMemory( (void **) &(product->label) );
65
66 if( product->multiplicityVsEnergy != NULL ) ptwXY_free( product->multiplicityVsEnergy );
67 if( product->piecewiseMultiplicities != NULL ) {
68 for( i = 0; i < product->numberOfPiecewiseMultiplicities; i++ ) ptwXY_free( product->piecewiseMultiplicities[i] );
69 smr_freeMemory( (void **) &(product->piecewiseMultiplicities) );
70 }
71 if( product->norms != NULL ) ptwXY_free( product->norms );
72
73 MCGIDI_distribution_release( smr, &(product->distribution) );
75
76 MCGIDI_product_initialize( smr, product );
77 return( 0 );
78}
int MCGIDI_distribution_release(statusMessageReporting *smr, MCGIDI_distribution *distribution)
int MCGIDI_outputChannel_release(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel)
MCGIDI_distribution distribution
Definition: MCGIDI.h:411

References MCGIDI_product_s::decayChannel, MCGIDI_product_s::distribution, MCGIDI_product_s::label, MCGIDI_distribution_release(), MCGIDI_outputChannel_release(), MCGIDI_product_initialize(), MCGIDI_product_s::multiplicityVsEnergy, MCGIDI_product_s::norms, MCGIDI_product_s::numberOfPiecewiseMultiplicities, MCGIDI_product_s::piecewiseMultiplicities, ptwXY_free(), and smr_freeMemory().

Referenced by MCGIDI_outputChannel_release(), MCGIDI_product_free(), and MCGIDI_product_parseFromTOM().

◆ MCGIDI_product_sampleMu()

int MCGIDI_product_sampleMu ( statusMessageReporting smr,
MCGIDI_product product,
MCGIDI_quantitiesLookupModes modes,
MCGIDI_decaySamplingInfo decaySamplingInfo 
)

Definition at line 348 of file MCGIDI_product.cc.

349 {
350
352 smr_setReportError2( smr, smr_unknownID, 1, "product distribution is not angular: type = %d", product->distribution.type );
353 return( 1 );
354 }
355 return( MCGIDI_angular_sampleMu( smr, product->distribution.angular, modes, decaySamplingInfo ) );
356}
@ MCGIDI_distributionType_angular_e
Definition: MCGIDI.h:208
int MCGIDI_angular_sampleMu(statusMessageReporting *smr, MCGIDI_angular *angular, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo)
MCGIDI_angular * angular
Definition: MCGIDI.h:383
enum MCGIDI_distributionType type
Definition: MCGIDI.h:382

References MCGIDI_distribution_s::angular, MCGIDI_product_s::distribution, MCGIDI_angular_sampleMu(), MCGIDI_distributionType_angular_e, smr_setReportError2, smr_unknownID, and MCGIDI_distribution_s::type.

Referenced by G4GIDI_target::getElasticFinalState().

◆ MCGIDI_product_sampleMultiplicity()

int MCGIDI_product_sampleMultiplicity ( statusMessageReporting smr,
MCGIDI_product product,
double  e_in,
double  r 
)

Definition at line 325 of file MCGIDI_product.cc.

325 {
326
327 int i, multiplicity;
328 double y, norm = 1.0;
329 ptwXYPoints *ptwXY = product->multiplicityVsEnergy;
330
331 if( product->piecewiseMultiplicities != NULL ) {
332 for( i = 0; i < product->numberOfPiecewiseMultiplicities - 1; i++ ) {
333 if( e_in < ptwXY_getXMax( product->piecewiseMultiplicities[i] ) ) break;
334 }
335 ptwXY = product->piecewiseMultiplicities[i];
336 }
337 y = MCGIDI_sampling_ptwXY_getValueAtX( ptwXY, e_in );
338 if( product->norms != NULL ) norm = MCGIDI_sampling_ptwXY_getValueAtX( product->norms, e_in );
339 y *= norm;
340 multiplicity = (int) y;
341 if( r < ( y - multiplicity ) ) multiplicity++;
342
343 return( multiplicity );
344}
double MCGIDI_sampling_ptwXY_getValueAtX(ptwXYPoints *ptwXY, double x1)
double ptwXY_getXMax(ptwXYPoints *ptwXY)
Definition: ptwXY_core.cc:1239

References MCGIDI_sampling_ptwXY_getValueAtX(), MCGIDI_product_s::multiplicityVsEnergy, MCGIDI_product_s::norms, MCGIDI_product_s::numberOfPiecewiseMultiplicities, MCGIDI_product_s::piecewiseMultiplicities, and ptwXY_getXMax().

Referenced by MCGIDI_outputChannel_sampleProductsAtE().

◆ MCGIDI_product_setTwoBodyMasses()

int MCGIDI_product_setTwoBodyMasses ( statusMessageReporting smr,
MCGIDI_product product,
double  projectileMass_MeV,
double  targetMass_MeV,
double  productMass_MeV,
double  residualMass_MeV 
)

Definition at line 289 of file MCGIDI_product.cc.

290 {
291
292 return( MCGIDI_angular_setTwoBodyMasses( smr, product->distribution.angular, projectileMass_MeV, targetMass_MeV, productMass_MeV, residualMass_MeV ) );
293}
int MCGIDI_angular_setTwoBodyMasses(statusMessageReporting *smr, MCGIDI_angular *angular, double projectileMass_MeV, double targetMass_MeV, double productMass_MeV, double residualMass_MeV)

References MCGIDI_distribution_s::angular, MCGIDI_product_s::distribution, and MCGIDI_angular_setTwoBodyMasses().

Referenced by MCGIDI_outputChannel_parseFromTOM().

◆ MCGIDI_sampledProducts_addProduct()

int MCGIDI_sampledProducts_addProduct ( statusMessageReporting smr,
MCGIDI_sampledProductsDatas sampledProductsDatas,
MCGIDI_sampledProductsData sampledProductsData 
)

Definition at line 398 of file MCGIDI_product.cc.

398 {
399
400 if( sampledProductsDatas->numberOfProducts == sampledProductsDatas->numberAllocated ) {
401 if( ( MCGIDI_sampledProducts_remalloc( smr, sampledProductsDatas ) ) != 0 ) return( 1 );
402 }
403 sampledProductsDatas->products[sampledProductsDatas->numberOfProducts] = *sampledProductsData;
404 sampledProductsDatas->numberOfProducts++;
405 return( 0 );
406}
int MCGIDI_sampledProducts_remalloc(statusMessageReporting *smr, MCGIDI_sampledProductsDatas *sampledProductsDatas)
MCGIDI_sampledProductsData * products
Definition: MCGIDI.h:294

References MCGIDI_sampledProducts_remalloc(), MCGIDI_sampledProductsDatas_s::numberAllocated, MCGIDI_sampledProductsDatas_s::numberOfProducts, and MCGIDI_sampledProductsDatas_s::products.

Referenced by MCGIDI_outputChannel_sampleProductsAtE(), and MCGIDI_target_sampleNullReactionProductsAtE().

◆ MCGIDI_sampledProducts_getProductAtIndex()

MCGIDI_sampledProductsData * MCGIDI_sampledProducts_getProductAtIndex ( MCGIDI_sampledProductsDatas sampledProductsDatas,
int  index 
)

Definition at line 417 of file MCGIDI_product.cc.

417 {
418
419 if( index < 0 ) return( NULL );
420 if( index >= sampledProductsDatas->numberOfProducts ) return( NULL );
421 return( &(sampledProductsDatas->products[index]) );
422}

References MCGIDI_sampledProductsDatas_s::numberOfProducts, and MCGIDI_sampledProductsDatas_s::products.

◆ MCGIDI_sampledProducts_initialize()

int MCGIDI_sampledProducts_initialize ( statusMessageReporting smr,
MCGIDI_sampledProductsDatas sampledProductsDatas,
int  incrementSize 
)

Definition at line 362 of file MCGIDI_product.cc.

362 {
363
364 if( incrementSize < 10 ) incrementSize = 10;
365 sampledProductsDatas->numberOfProducts = 0;
366 sampledProductsDatas->numberAllocated = 0;
367 sampledProductsDatas->incrementSize = incrementSize;
368 sampledProductsDatas->products = NULL;
369 return( MCGIDI_sampledProducts_remalloc( smr, sampledProductsDatas ) );
370}

References MCGIDI_sampledProductsDatas_s::incrementSize, MCGIDI_sampledProducts_remalloc(), MCGIDI_sampledProductsDatas_s::numberAllocated, MCGIDI_sampledProductsDatas_s::numberOfProducts, and MCGIDI_sampledProductsDatas_s::products.

Referenced by G4GIDI_target::getFinalState().

◆ MCGIDI_sampledProducts_number()

int MCGIDI_sampledProducts_number ( MCGIDI_sampledProductsDatas sampledProductsDatas)

Definition at line 410 of file MCGIDI_product.cc.

410 {
411
412 return( sampledProductsDatas->numberOfProducts );
413}

References MCGIDI_sampledProductsDatas_s::numberOfProducts.

◆ MCGIDI_sampledProducts_release()

int MCGIDI_sampledProducts_release ( statusMessageReporting smr,
MCGIDI_sampledProductsDatas sampledProductsDatas 
)

Definition at line 374 of file MCGIDI_product.cc.

374 {
375
376 smr_freeMemory( (void **) &(sampledProductsDatas->products) );
377 return( 0 );
378}

References MCGIDI_sampledProductsDatas_s::products, and smr_freeMemory().

Referenced by G4GIDI_target::getFinalState().

◆ MCGIDI_sampledProducts_remalloc()

int MCGIDI_sampledProducts_remalloc ( statusMessageReporting smr,
MCGIDI_sampledProductsDatas sampledProductsDatas 
)

Definition at line 382 of file MCGIDI_product.cc.

382 {
383
384 int size = sampledProductsDatas->numberAllocated + sampledProductsDatas->incrementSize;
385
386 if( ( sampledProductsDatas->products = (MCGIDI_sampledProductsData *) smr_realloc2( smr, sampledProductsDatas->products,
387 size * sizeof( MCGIDI_sampledProductsData ), "products" ) ) != NULL ) {
388 sampledProductsDatas->numberAllocated = size;
389 return( 0 );
390 }
391 sampledProductsDatas->numberOfProducts = 0;
392 sampledProductsDatas->numberAllocated = 0;
393 return( 1 );
394}
#define smr_realloc2(smr, old, size, forItem)

References MCGIDI_sampledProductsDatas_s::incrementSize, MCGIDI_sampledProductsDatas_s::numberAllocated, MCGIDI_sampledProductsDatas_s::numberOfProducts, MCGIDI_sampledProductsDatas_s::products, and smr_realloc2.

Referenced by MCGIDI_sampledProducts_addProduct(), and MCGIDI_sampledProducts_initialize().