12#if defined __cplusplus
60 double productMass_MeV,
double residualMass_MeV ) {
62 if( angular == NULL )
return( 0 );
76 char const *nativeData;
85 if( strcmp( nativeData,
"isotropic" ) == 0 ) {
91 else if( strcmp( nativeData,
"recoil" ) == 0 ) {
95 double norm, energyFactor;
102 char const *energyUnit, *multiplicityProbabilityUnits[2] = {
"",
"" };
110 frameElement = linearElement;
118 if( ( dists->
Ws = (
double *)
smr_malloc2( smr, W_XYs->
length *
sizeof(
double ), 1,
"dists->Ws" ) ) == NULL )
goto err;
126 for( i = 0; i < W_XYs->
length; i++ ) {
127 XYs = &(W_XYs->
XYs[i]);
128 dist = &(dists->
dist[i]);
129 dists->
Ws[i] = XYs->
value * energyFactor;
134 if( ( dist->
Xs = (
double *)
smr_malloc2( smr, 3 * n *
sizeof(
double ), 0,
"dist->Xs" ) ) == NULL )
goto err;
136 dist->
pdf = &(dist->
Xs[n]);
137 dist->
cdf = &(dist->
pdf[n]);
139 for( j = 0; j < n; j++ ) {
141 dist->
Xs[j] = point->
x;
142 dist->
pdf[j] = point->
y;
150 if( norms != NULL ) {
152 else if( std::fabs( 1. - norm ) > 0.99 ) {
157 for( j = 0; j < n; j++ ) dist->
pdf[j] /= norm;
164 if( frameElement != NULL ) {
168 distribution->
angular = angular;
175 if( cdfX != NULL ) cdfX =
ptwX_free( cdfX );
185 double randomMu = decaySamplingInfo->
rng( decaySamplingInfo->
rngState );
188 switch( angular->
type ) {
191 decaySamplingInfo->
mu = 1. - 2. * decaySamplingInfo->
rng( decaySamplingInfo->
rngState );
198 decaySamplingInfo->
mu = sampled.
x;
207#if defined __cplusplus
MCGIDI_angular * MCGIDI_angular_new(statusMessageReporting *smr)
int MCGIDI_sampling_pdfsOfXGivenW_release(statusMessageReporting *smr, MCGIDI_pdfsOfXGivenW *dists)
int MCGIDI_angular_setTwoBodyMasses(statusMessageReporting *smr, MCGIDI_angular *angular, double projectileMass_MeV, double targetMass_MeV, double productMass_MeV, double residualMass_MeV)
int MCGIDI_angular_release(statusMessageReporting *smr, MCGIDI_angular *angular)
@ MCGIDI_distributionType_angular_e
MCGIDI_angular * MCGIDI_angular_free(statusMessageReporting *smr, MCGIDI_angular *angular)
int MCGIDI_angular_parseFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_distribution *distribution, ptwXYPoints *norms)
@ MCGIDI_angularType_isotropic
@ MCGIDI_angularType_recoil
@ MCGIDI_angularType_linear
int MCGIDI_angular_sampleMu(statusMessageReporting *smr, MCGIDI_angular *angular, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo)
int MCGIDI_sampling_sampleX_from_pdfsOfXGivenW(MCGIDI_pdfsOfXGivenW *dists, MCGIDI_pdfsOfXGivenW_sampled *sampled, double r)
int MCGIDI_angular_initialize(statusMessageReporting *smr, MCGIDI_angular *angular)
int MCGIDI_fromTOM_interpolation(statusMessageReporting *smr, xDataTOM_element *element, int index, enum ptwXY_interpolation_e *interpolation)
ptwXYPoints * MCGIDI_misc_dataFromXYs2ptwXYPointsInUnitsOf(statusMessageReporting *smr, xDataTOM_XYs *XYs, ptwXY_interpolation interpolation, char const *units[2])
double MCGIDI_misc_getUnitConversionFactor(statusMessageReporting *smr, char const *fromUnit, char const *toUnit)
enum xDataTOM_frame MCGIDI_misc_getProductFrame(statusMessageReporting *smr, xDataTOM_element *frameElement)
double getProjectileEnergy(void) const
enum nfu_status_e nfu_status
const char * nfu_statusMessage(nfu_status status)
nfu_status ptwXY_setValueAtX(ptwXYPoints *ptwXY, double x, double y)
nfu_status ptwXY_simpleCoalescePoints(ptwXYPoints *ptwXY)
ptwXYPoint * ptwXY_getPointAtIndex_Unsafely(ptwXYPoints *ptwXY, int64_t index)
enum ptwXY_interpolation_e ptwXY_interpolation
int64_t ptwXY_length(ptwXYPoints *ptwXY)
ptwXPoints * ptwXY_runningIntegral(ptwXYPoints *ptwXY, nfu_status *status)
ptwXYPoints * ptwXY_free(ptwXYPoints *ptwXY)
double ptwX_getPointAtIndex_Unsafely(ptwXPoints *ptwX, int64_t index)
ptwXPoints * ptwX_free(ptwXPoints *ptwX)
#define smr_setReportError2(smr, libraryID, code, fmt,...)
void * smr_freeMemory(void **p)
int smr_isOk(statusMessageReporting *smr)
#define smr_malloc2(smr, size, zero, forItem)
MCGIDI_pdfsOfXGivenW dists
enum xDataTOM_frame frame
double projectileMass_MeV
enum MCGIDI_angularType type
enum xDataTOM_frame frame
enum MCGIDI_distributionType type
ptwXY_interpolation interpolationXY
ptwXY_interpolation interpolationWY
statusMessageReporting * smr
xDataTOM_element * xDataTOME_getOneElementByName(statusMessageReporting *smr, xDataTOM_element *element, char const *name, int required)
char const * xDataTOM_getAttributesValueInElement(xDataTOM_element *element, char const *name)
char const * xDataTOM_subAxes_getUnit(statusMessageReporting *smr, xDataTOM_subAxes *subAxes, int index)
void * xDataTOME_getXDataIfID(statusMessageReporting *smr, xDataTOM_element *TE, char const *ID)