11 #define M_PI 3.141592653589793238463 
   19 #if defined __cplusplus 
  103     xDataTOM_element *energyElement, *linearElement, *functional, *frameElement;
 
  104     char const *nativeData;
 
  105     double projectileMass_MeV, targetMass_MeV;
 
  111     energy->
e_inCOMFactor = targetMass_MeV / ( projectileMass_MeV + targetMass_MeV );
 
  114         energy->
type = energyType;
 
  123         if( linearElement == NULL ) {
 
  142             frameElement = functional; }
 
  144             char const *toUnits[3] = { 
"MeV", 
"MeV", 
"1/MeV" };
 
  146             frameElement = linearElement;
 
  169         if( strcmp( child->name, 
"weighted" ) ) 
goto err;
 
  187     char const *toUnits[2] = { 
"MeV", 
"" };
 
  191         if( strcmp( child->
name, 
"weight" ) == 0 ) {
 
  193         else if( strcmp( child->
name, 
"evaporation" ) == 0 ) {
 
  200     weightedFunctional->
weight = weight;
 
  217     char const *toUnits[2] = { 
"MeV", 
"MeV" };
 
  229     if( std::fabs( 1. - norm ) > 0.001 ) printf( 
"bad norm = %e\n", norm );
 
  232     energy->
theta = theta;
 
  245     char const *U, *toUnits[2] = { 
"MeV", 
"MeV" };
 
  266     char const *U, *toUnits[2] = { 
"MeV", 
"MeV" };
 
  287     char const *U, *toUnits[2] = { 
"MeV", 
"MeV" };
 
  299     toUnits[1] = 
"1/MeV";
 
  314     int iE, length, nXs, i1, 
n;
 
  315     double E, T_M, EFL, EFH, argList[3], xs[] = { 1e-5, 1e-3, 1e-1, 1e1, 1e3, 1e5, 3e7 }, norm;
 
  324     char const *EF, *TMUnits[2] = { 
"MeV", 
"MeV" };
 
  326     nXs = 
sizeof( xs ) / 
sizeof( xs[0] );
 
  349     if( ( dists->
Ws = (
double *) 
smr_malloc2( smr, length * 
sizeof( 
double ), 1, 
"dists->Ws" ) ) == NULL ) 
goto err;
 
  352     for( iE = 0; iE < length; iE++ ) {
 
  355         dist = &(dists->
dist[iE]);
 
  359             (
void *) argList, 1e-3, 0, 12, &status ) ) == NULL ) 
goto err;
 
  368         if( ( dist->
Xs = (
double *) 
smr_malloc2( smr, 3 * n * 
sizeof( 
double ), 0, 
"dist->Xs" ) ) == NULL ) 
goto err;
 
  370         dist->
pdf = &(dist->
Xs[
n]);
 
  373         for( i1 = 0; i1 < 
n; i1++ ) {
 
  375             dist->
Xs[i1] = point->
x;
 
  376             dist->
pdf[i1] = point->
y;
 
  386         for( i1 = 0; i1 < 
n; i1++ ) dist->
pdf[i1] /= norm;
 
  397     if( ptwXY_TM != NULL ) 
ptwXY_free( ptwXY_TM );
 
  399     if( cdfX != NULL ) cdfX = 
ptwX_free( cdfX );
 
  408     double *parameters = (
double *) argList, EFL, EFH, T_M;
 
  424     double u1, u2, E1, E2, gamma1, gamma2, signG = 1;
 
  426     u1 = std::sqrt( Ep ) - std::sqrt( E_F );
 
  428     u2 = std::sqrt( Ep ) + std::sqrt( E_F );
 
  433     if( *status != 
nfu_Okay ) 
return( 0. );
 
  442     if( *status != 
nfu_Okay ) 
return( 0. );
 
  443     return( ( u2 * std::sqrt( u2 ) * E2 - u1 * std::sqrt( u1 ) * E1 + signG * ( gamma2 - gamma1 ) ) / ( 3 * std::sqrt( E_F * T_M ) ) );
 
  452     double xs[2] = { 0.0, 1.0 }, productMass_MeV, norm;
 
  490     int numberOfProducts = *((
int *) argList);
 
  491     double e = 0.5 * ( 3 * numberOfProducts - 8 );
 
  508     switch( energy->
type ) {
 
  516         randomEp = decaySamplingInfo->
rng( decaySamplingInfo->
rngState );
 
  520         decaySamplingInfo->
Ep = sampled.
x;
 
  526         decaySamplingInfo->
Ep = theta * sampled.
x;
 
  531         decaySamplingInfo->
Ep *= theta;
 
  536         decaySamplingInfo->
Ep *= theta;
 
  545         decaySamplingInfo->
Ep = sampled.
x;
 
  566     double a = e_in_U_theta, 
b, 
c, 
x, norm_a, xMin = 0., xMax = 
a, sqrt_x, sqrt_pi_2 = std::sqrt( 
M_PI ) / 2.;
 
  568     sqrt_x = std::sqrt( a );
 
  569     norm_a = sqrt_pi_2 * erf( sqrt_x ) - sqrt_x * 
G4Exp( -a );
 
  570     b = norm_a * decaySamplingInfo->
rng( decaySamplingInfo->
rngState );
 
  571     for( i1 = 0; i1 < 16; i1++ ) {
 
  572         x = 0.5 * ( xMin + xMax );
 
  573         sqrt_x = std::sqrt( x );
 
  574         c = sqrt_pi_2 * erf( sqrt_x ) - sqrt_x * 
G4Exp( -x );
 
  582     decaySamplingInfo->
Ep = 
x;
 
  592     double a = e_in_U_theta, 
b, 
c, 
x, norm_a, xMin = 0., xMax = 
a;
 
  594     norm_a = 1 - ( 1 + 
a ) * 
G4Exp( -a );
 
  595     b = 1. - norm_a * decaySamplingInfo->
rng( decaySamplingInfo->
rngState );
 
  596     for( i1 = 0; i1 < 16; i1++ ) {
 
  597         x = 0.5 * ( xMin + xMax );
 
  598         c = ( 1 + 
x ) * 
G4Exp( -x );
 
  606     decaySamplingInfo->
Ep = 
x;
 
  617     double WattMin = 0., WattMax = e_in_U, 
x, y, 
z, energyOut, rand1, rand2;
 
  619     x = 1. + ( Watt_b / ( 8. * Watt_a ) );
 
  620     y = ( x + std::sqrt( x * x - 1. ) ) / Watt_a;
 
  623     G4int icounter_max=1024;
 
  627       if ( icounter > icounter_max ) {
 
  628          G4cout << 
"Loop-counter exceeded the threshold value at " << __LINE__ << 
"th line of " << __FILE__ << 
"." << 
G4endl;
 
  633         energyOut = y * rand1;
 
  635     while( ( ( rand2 - z * ( rand1 + 1. ) ) * ( rand2 - z * ( rand1 + 1. ) ) > Watt_b * y * rand1 ) || ( energyOut < WattMin ) || ( energyOut > WattMax ) ); 
 
  636     decaySamplingInfo->
Ep = energyOut;
 
  649     double rW = decaySamplingInfo->
rng( decaySamplingInfo->
rngState ), cumulativeW = 0., weight;
 
  655         cumulativeW += weight;
 
  656         if( cumulativeW >= rW ) 
break;
 
  661 #if defined __cplusplus 
double MCGIDI_product_getTargetMass_MeV(statusMessageReporting *smr, MCGIDI_product *product)
 
static G4Pow * GetInstance()
 
G4double powA(G4double A, G4double y) const 
 
ptwXYPoints * ptwXY_createFromFunction(int n, double *xs, ptwXY_createFromFunction_callback func, void *argList, double accuracy, int checkForRoots, int biSectionMax, nfu_status *status)
 
ptwXY_interpolation interpolationXY
 
double ptwX_getPointAtIndex_Unsafely(ptwXPoints *ptwX, int64_t index)
 
xDataTOM_element * xDataTOME_getFirstElement(xDataTOM_element *element)
 
static int MCGIDI_energy_parseNBodyPhaseSpaceFromTOM(statusMessageReporting *smr, xDataTOM_element *functional, MCGIDI_energy *energy, MCGIDI_distribution *distribution)
 
enum MCGIDI_energyType type
 
std::vector< ExP01TrackerHit * > a
 
double MCGIDI_product_getMass_MeV(statusMessageReporting *smr, MCGIDI_product *product)
 
int xDataTOME_convertAttributeToInteger(statusMessageReporting *smr, xDataTOM_element *element, char const *name, int *n)
 
static int MCGIDI_energy_parseWattFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_energy *energy)
 
MCGIDI_energyNBodyPhaseSpace NBodyPhaseSpace
 
int MCGIDI_sampling_sampleX_from_pdfOfX(MCGIDI_pdfOfX *dist, MCGIDI_pdfsOfXGivenW_sampled *sampled, double r)
 
ptwXYPoint * ptwXY_getPointAtIndex_Unsafely(ptwXYPoints *ptwXY, int64_t index)
 
int64_t ptwXY_length(ptwXYPoints *ptwXY)
 
ptwXYPoints * ptwXY_free(ptwXYPoints *ptwXY)
 
static double MCGIDI_energy_parseMadlandNixFromTOM_callback_g(double Ep, double EFL, double T_M, nfu_status *status)
 
double primaryGammaMassFactor
 
statusMessageReporting * smr
 
static nfu_status MCGIDI_energy_NBodyPhaseSpacePDF_callback(double x, double *y, void *argList)
 
nfu_status(* ptwXY_createFromFunction_callback)(double x, double *y, void *argList)
 
int MCGIDI_energy_sampleEnergy(statusMessageReporting *smr, MCGIDI_energy *energy, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo)
 
static int MCGIDI_energy_parseMadlandNixFromTOM(statusMessageReporting *smr, xDataTOM_element *functional, MCGIDI_energy *energy)
 
ptwXYPoints * MCGIDI_misc_dataFromElement2ptwXYPointsInUnitsOf(statusMessageReporting *smr, xDataTOM_element *linear, char const *toUnits[2])
 
int MCGIDI_fromTOM_pdfOfX(statusMessageReporting *smr, ptwXYPoints *pdfXY, MCGIDI_pdfOfX *dist, double *norm)
 
static nfu_status MCGIDI_energy_parseMadlandNixFromTOM_callback(double x, double *y, void *argList)
 
G4GLOB_DLL std::ostream G4cout
 
#define smr_setReportError2(smr, libraryID, code, fmt,...)
 
double MCGIDI_sampling_ptwXY_getValueAtX(ptwXYPoints *ptwXY, double x1)
 
xDataTOM_element * xDataTOME_getOneElementByName(statusMessageReporting *smr, xDataTOM_element *element, char const *name, int required)
 
static int MCGIDI_energy_parseGeneralEvaporationFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_energy *energy)
 
MCGIDI_energyWeightedFunctional weightedFunctional[4]
 
int MCGIDI_sampling_pdfsOfXGivenW_release(statusMessageReporting *smr, MCGIDI_pdfsOfXGivenW *dists)
 
ptwXPoints * ptwX_free(ptwXPoints *ptwX)
 
static int MCGIDI_energy_sampleWeightedFunctional(statusMessageReporting *smr, MCGIDI_energy *energy, MCGIDI_quantitiesLookupModes &modes, MCGIDI_decaySamplingInfo *decaySamplingInfo)
 
enum nfu_status_e nfu_status
 
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
 
ptwXY_interpolation interpolationWY
 
MCGIDI_energyWeightedFunctionals weightedFunctionals
 
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)
 
nfu_status ptwXY_normalize(ptwXYPoints *ptwXY1)
 
MCGIDI_energy * MCGIDI_energy_free(statusMessageReporting *smr, MCGIDI_energy *energy)
 
int smr_isOk(statusMessageReporting *smr)
 
static int MCGIDI_energy_parseSimpleMaxwellianFissionFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_energy *energy)
 
static int MCGIDI_energy_parseEvaporationFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_energy *energy)
 
G4double G4Log(G4double x)
 
G4double G4Exp(G4double initial_x)
Exponential Function double precision. 
 
double nf_incompleteGammaFunctionComplementary(double a, double x, nfu_status *status)
 
int MCGIDI_energy_release(statusMessageReporting *smr, MCGIDI_energy *energy)
 
static int MCGIDI_energy_sampleEvaporation(statusMessageReporting *smr, double e_in_U_theta, MCGIDI_decaySamplingInfo *decaySamplingInfo)
 
int MCGIDI_sampling_sampleX_from_pdfsOfXGivenW(MCGIDI_pdfsOfXGivenW *dists, MCGIDI_pdfsOfXGivenW_sampled *sampled, double r)
 
double MCGIDI_outputChannel_getQ_MeV(statusMessageReporting *smr, MCGIDI_outputChannel *outputChannel, double e_in)
 
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 frame
 
G4double energy(const ThreeVector &p, const G4double m)
 
static int MCGIDI_energy_sampleWatt(statusMessageReporting *smr, double e_in_U, double Watt_a, double Watt_b, MCGIDI_decaySamplingInfo *decaySamplingInfo)
 
enum xDataTOM_frame MCGIDI_misc_getProductFrame(statusMessageReporting *smr, xDataTOM_element *frameElement)
 
int MCGIDI_energy_initialize(statusMessageReporting *smr, MCGIDI_energy *energy)
 
int MCGIDI_misc_PQUStringToDouble(statusMessageReporting *smr, char const *str, char const *unit, double conversion, double *value)
 
enum xDataTOM_frame frame
 
MCGIDI_pdfsOfXGivenW dists
 
int MCGIDI_energy_parseFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_distribution *distribution, ptwXYPoints *norms, enum MCGIDI_energyType energyType, double gammaEnergy_MeV)
 
static int MCGIDI_energy_sampleSimpleMaxwellianFission(statusMessageReporting *smr, double e_in_U_theta, MCGIDI_decaySamplingInfo *decaySamplingInfo)
 
double nf_exponentialIntegral(int n, double x, nfu_status *status)
 
static int MCGIDI_energy_parseWeightedFunctionalsFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_energy *energy)
 
int MCGIDI_misc_PQUStringToDoubleInUnitOf(statusMessageReporting *smr, char const *str, char const *toUnit, double *value)
 
ptwXY_interpolation ptwXY_getInterpolation(ptwXYPoints *ptwXY)
 
xDataTOM_element * xDataTOME_getNextElement(xDataTOM_element *element)
 
double nf_incompleteGammaFunction(double a, double x, nfu_status *status)
 
const char * nfu_statusMessage(nfu_status status)
 
MCGIDI_outputChannel * outputChannel
 
int MCGIDI_sampling_pdfsOfX_release(statusMessageReporting *smr, MCGIDI_pdfOfX *dist)
 
static int MCGIDI_energy_parseWeightFromTOM(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_energyWeightedFunctional *weightedFunctional)
 
ptwXY_interpolation interpolationXY
 
double getProjectileEnergy(void) const 
 
MCGIDI_energy * MCGIDI_energy_new(statusMessageReporting *smr)
 
int MCGIDI_fromTOM_pdfsOfXGivenW(statusMessageReporting *smr, xDataTOM_element *element, MCGIDI_pdfsOfXGivenW *dists, ptwXYPoints *norms, char const *toUnits[3])
 
ptwXY_interpolation gInterpolation
 
char const * xDataTOM_getAttributesValueInElement(xDataTOM_element *element, char const *name)
 
double MCGIDI_product_getProjectileMass_MeV(statusMessageReporting *smr, MCGIDI_product *product)
 
nfu_status ptwXY_getXYPairAtIndex(ptwXYPoints *ptwXY, int64_t index, double *x, double *y)