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]);
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
ptwXY_interpolation interpolationXY
double ptwX_getPointAtIndex_Unsafely(ptwXPoints *ptwX, int64_t index)
double projectileMass_MeV
int MCGIDI_angular_parseFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_distribution *distribution, ptwXYPoints *norms)
enum MCGIDI_angularType type
int MCGIDI_fromTOM_interpolation(statusMessageReporting *smr, xDataTOM_element *element, int index, enum ptwXY_interpolation_e *interpolation)
ptwXYPoint * ptwXY_getPointAtIndex_Unsafely(ptwXYPoints *ptwXY, int64_t index)
int64_t ptwXY_length(ptwXYPoints *ptwXY)
ptwXYPoints * ptwXY_free(ptwXYPoints *ptwXY)
nfu_status ptwXY_setValueAtX(ptwXYPoints *ptwXY, double x, double y)
statusMessageReporting * smr
int MCGIDI_angular_release(statusMessageReporting *smr, MCGIDI_angular *angular)
#define smr_setReportError2(smr, libraryID, code, fmt,...)
xDataTOM_element * xDataTOME_getOneElementByName(statusMessageReporting *smr, xDataTOM_element *element, char const *name, int required)
MCGIDI_pdfsOfXGivenW dists
int MCGIDI_angular_sampleMu(statusMessageReporting *smr, MCGIDI_angular *angular, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo)
int MCGIDI_sampling_pdfsOfXGivenW_release(statusMessageReporting *smr, MCGIDI_pdfsOfXGivenW *dists)
ptwXPoints * ptwX_free(ptwXPoints *ptwX)
enum xDataTOM_frame frame
enum nfu_status_e nfu_status
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
ptwXY_interpolation interpolationWY
void * xDataTOME_getXDataIfID(statusMessageReporting *smr, xDataTOM_element *TE, char const *ID)
#define smr_malloc2(smr, size, zero, forItem)
ptwXPoints * ptwXY_runningIntegral(ptwXYPoints *ptwXY, nfu_status *status)
int smr_isOk(statusMessageReporting *smr)
enum ptwXY_interpolation_e ptwXY_interpolation
int MCGIDI_sampling_sampleX_from_pdfsOfXGivenW(MCGIDI_pdfsOfXGivenW *dists, MCGIDI_pdfsOfXGivenW_sampled *sampled, double r)
enum MCGIDI_distributionType type
int MCGIDI_angular_setTwoBodyMasses(statusMessageReporting *smr, MCGIDI_angular *angular, double projectileMass_MeV, double targetMass_MeV, double productMass_MeV, double residualMass_MeV)
void * smr_freeMemory(void **p)
ptwXYPoints * MCGIDI_misc_dataFromXYs2ptwXYPointsInUnitsOf(statusMessageReporting *smr, xDataTOM_XYs *XYs, ptwXY_interpolation interpolation, char const *units[2])
nfu_status ptwXY_simpleCoalescePoints(ptwXYPoints *ptwXY)
enum xDataTOM_frame MCGIDI_misc_getProductFrame(statusMessageReporting *smr, xDataTOM_element *frameElement)
MCGIDI_angular * MCGIDI_angular_free(statusMessageReporting *smr, MCGIDI_angular *angular)
double MCGIDI_misc_getUnitConversionFactor(statusMessageReporting *smr, char const *fromUnit, char const *toUnit)
enum xDataTOM_frame frame
const char * nfu_statusMessage(nfu_status status)
MCGIDI_angular * MCGIDI_angular_new(statusMessageReporting *smr)
int MCGIDI_angular_initialize(statusMessageReporting *smr, MCGIDI_angular *angular)
double getProjectileEnergy(void) const
char const * xDataTOM_getAttributesValueInElement(xDataTOM_element *element, char const *name)
char const * xDataTOM_subAxes_getUnit(statusMessageReporting *smr, xDataTOM_subAxes *subAxes, int index)