Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
MCGIDI::Probabilities::NBodyPhaseSpace2d Class Reference

#include <MCGIDI_functions.hpp>

Inheritance diagram for MCGIDI::Probabilities::NBodyPhaseSpace2d:

Public Member Functions

LUPI_HOST_DEVICE NBodyPhaseSpace2d ()
LUPI_HOST NBodyPhaseSpace2d (GIDI::Functions::NBodyPhaseSpace2d const &a_NBodyPhaseSpace2d, SetupInfo *a_setupInfo)
LUPI_HOST_DEVICE ~NBodyPhaseSpace2d ()
LUPI_HOST_DEVICE double evaluate (double a_x2, double a_x1) const
template<typename RNG>
LUPI_HOST_DEVICE double sample (double a_x2, double a_rngValue, RNG &&a_rng) const
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
Public Member Functions inherited from MCGIDI::Probabilities::ProbabilityBase2d_d2
LUPI_HOST_DEVICE ProbabilityBase2d_d2 ()
LUPI_HOST ProbabilityBase2d_d2 (GIDI::Functions::FunctionForm const &a_probabilty)
LUPI_HOST ProbabilityBase2d_d2 (GIDI::Functions::FunctionForm const &a_probabilty, Vector< double > const &a_Xs)
LUPI_HOST_DEVICE double evaluate (double a_x2, double a_x1) const
template<typename RNG>
LUPI_HOST_DEVICE double sample (double a_x2, double a_rngValue, RNG &&a_rng) const
template<typename RNG>
LUPI_HOST_DEVICE double sample2dOf3d (double a_x2, double a_rngValue, RNG &&a_rng, double *a_x1_1, double *a_x1_2) const
Public Member Functions inherited from MCGIDI::Probabilities::ProbabilityBase2d_d1
LUPI_HOST_DEVICE ProbabilityBase2d_d1 ()
LUPI_HOST ProbabilityBase2d_d1 (GIDI::Functions::FunctionForm const &a_probabilty)
LUPI_HOST ProbabilityBase2d_d1 (GIDI::Functions::FunctionForm const &a_probabilty, Vector< double > const &a_Xs)
LUPI_HOST_DEVICE double evaluate (double a_x2, double a_x1) const
template<typename RNG>
LUPI_HOST_DEVICE double sample (double a_x2, double a_rngValue, RNG &&a_rng) const
template<typename RNG>
LUPI_HOST_DEVICE double sample2dOf3d (double a_x2, double a_rngValue, RNG &&a_rng, double *a_x1_1, double *a_x1_2) const
Public Member Functions inherited from MCGIDI::Probabilities::ProbabilityBase2d
LUPI_HOST_DEVICE ProbabilityBase2d ()
LUPI_HOST ProbabilityBase2d (GIDI::Functions::FunctionForm const &a_probabilty)
LUPI_HOST ProbabilityBase2d (GIDI::Functions::FunctionForm const &a_probabilty, Vector< double > const &a_Xs)
LUPI_HOST_DEVICE ~ProbabilityBase2d ()
LUPI_HOST_DEVICE ProbabilityBase2dType type () const
LUPI_HOST_DEVICE String typeString () const
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate (double a_x2, double a_x1) const MCGIDI_TRUE_VIRTUAL
template<typename RNG>
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double sample (double a_x2, double a_rngValue, RNG &&a_rng) const MCGIDI_TRUE_VIRTUAL
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
template<typename RNG>
LUPI_HOST_DEVICE double sample (double a_x2, double a_rngValue, RNG &&a_rng) const
Public Member Functions inherited from MCGIDI::Probabilities::ProbabilityBase
LUPI_HOST_DEVICE ProbabilityBase ()
LUPI_HOST ProbabilityBase (GIDI::Functions::FunctionForm const &a_probabilty)
LUPI_HOST ProbabilityBase (GIDI::Functions::FunctionForm const &a_probabilty, Vector< double > const &a_Xs)
LUPI_HOST_DEVICE ~ProbabilityBase ()
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
Public Member Functions inherited from MCGIDI::Functions::FunctionBase
LUPI_HOST_DEVICE FunctionBase ()
LUPI_HOST FunctionBase (GIDI::Functions::FunctionForm const &a_function)
LUPI_HOST_DEVICE FunctionBase (int a_dimension, double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue=0)
virtual LUPI_HOST_DEVICE ~FunctionBase ()=0
LUPI_HOST_DEVICE Interpolation interpolation () const
LUPI_HOST_DEVICE double domainMin () const
LUPI_HOST_DEVICE double domainMax () const
LUPI_HOST_DEVICE double outerDomainValue () const
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)

Additional Inherited Members

Protected Attributes inherited from MCGIDI::Probabilities::ProbabilityBase2d
ProbabilityBase2dType m_type
Protected Attributes inherited from MCGIDI::Probabilities::ProbabilityBase
Vector< double > m_Xs

Detailed Description

Definition at line 598 of file MCGIDI_functions.hpp.

Constructor & Destructor Documentation

◆ NBodyPhaseSpace2d() [1/2]

LUPI_HOST_DEVICE MCGIDI::Probabilities::NBodyPhaseSpace2d::NBodyPhaseSpace2d ( )

Definition at line 1947 of file MCGIDI_functions.cc.

1947 :
1948 m_numberOfProducts( 0 ),
1949 m_mass( 0.0 ),
1950 m_energy_in_COMFactor( 0.0 ),
1951 m_massFactor( 0.0 ),
1952 m_Q( 0.0 ),
1953 m_dist( nullptr ) {
1954
1956}

◆ NBodyPhaseSpace2d() [2/2]

LUPI_HOST MCGIDI::Probabilities::NBodyPhaseSpace2d::NBodyPhaseSpace2d ( GIDI::Functions::NBodyPhaseSpace2d const & a_NBodyPhaseSpace2d,
SetupInfo * a_setupInfo )

Definition at line 1960 of file MCGIDI_functions.cc.

1960 :
1961 ProbabilityBase2d_d2( a_NBodyPhaseSpace2d ),
1962 m_numberOfProducts( a_NBodyPhaseSpace2d.numberOfProducts( ) ),
1963 m_mass( PoPI_AMU2MeV_c2 * a_NBodyPhaseSpace2d.mass( ).value( ) ),
1964 m_energy_in_COMFactor( a_setupInfo->m_protare.targetMass( ) / ( a_setupInfo->m_protare.projectileMass( ) + a_setupInfo->m_protare.targetMass( ) ) ),
1965 m_massFactor( 1 - a_setupInfo->m_product1Mass / m_mass ),
1966 m_Q( a_setupInfo->m_Q ),
1967 m_dist( nullptr ) {
1968
1970 double xs[2] = { 0.0, 1.0 };
1971 ptwXYPoints *pdf = nullptr;
1972
1973 pdf = ptwXY_createFromFunction( nullptr, 2, xs, MCGIDI_NBodyPhaseSpacePDF_callback, (void *) &m_numberOfProducts, 1e-3, 0, 16 );
1974 if( pdf == nullptr ) throw std::runtime_error( "NBodyPhaseSpace2d::NBodyPhaseSpace2d: ptwXY_createFromFunction returned nullptr" );
1975
1976 m_dist = ptwXY_To_Xs_pdf_cdf1d( pdf );
1977 ptwXY_free( pdf );
1978}
#define PoPI_AMU2MeV_c2
Definition PoPI.hpp:30
ptwXYPoints * ptwXY_createFromFunction(statusMessageReporting *smr, int n, double *xs, ptwXY_createFromFunction_callback func, void *argList, double accuracy, int checkForRoots, int biSectionMax)
Definition ptwXY_misc.c:46
struct ptwXYPoints_s ptwXYPoints
ptwXYPoints * ptwXY_free(ptwXYPoints *ptwXY)
Definition ptwXY_core.c:782

◆ ~NBodyPhaseSpace2d()

LUPI_HOST_DEVICE MCGIDI::Probabilities::NBodyPhaseSpace2d::~NBodyPhaseSpace2d ( )

Definition at line 1983 of file MCGIDI_functions.cc.

1983 {
1984
1985 delete m_dist;
1986}

Member Function Documentation

◆ evaluate()

LUPI_HOST_DEVICE double MCGIDI::Probabilities::NBodyPhaseSpace2d::evaluate ( double a_x2,
double a_x1 ) const

Definition at line 2001 of file MCGIDI_functions.cc.

2001 {
2002
2003 double EMax = ( m_energy_in_COMFactor * a_x2 + m_Q ) * m_massFactor;
2004 double x1 = a_x1 / EMax;
2005
2006 return( m_dist->evaluate( x1 ) );
2007}

◆ sample()

template<typename RNG>
LUPI_HOST_DEVICE double MCGIDI::Probabilities::NBodyPhaseSpace2d::sample ( double a_x2,
double a_rngValue,
RNG && a_rng ) const

Definition at line 2003 of file MCGIDI_headerSource.hpp.

2003 {
2004
2005 double energyMax = m_energy_in_COMFactor * a_x2 + m_Q;
2006
2007 if( energyMax < 0.0 ) return( 0.0 ); // Kludge for now until for upscatter model A until sampling below threshold is fixed.
2008
2009 return( energyMax * m_massFactor * m_dist->sample( a_rngValue, a_rng ) );
2010}

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::Probabilities::NBodyPhaseSpace2d::serialize ( LUPI::DataBuffer & a_buffer,
LUPI::DataBuffer::Mode a_mode )

This method serializes this for broadcasting as needed for MPI and GPUs. The method can count the number of required bytes, pack this or unpack this depending on a_mode.

Parameters
a_buffer[in] The buffer to read or write data to depending on a_mode.
a_mode[in] Specifies the action of this method.

Definition at line 2017 of file MCGIDI_functions.cc.

2017 {
2018
2019 ProbabilityBase2d::serialize( a_buffer, a_mode );
2020 DATA_MEMBER_INT( m_numberOfProducts, a_buffer, a_mode );
2021 DATA_MEMBER_DOUBLE( m_mass, a_buffer, a_mode );
2022 DATA_MEMBER_DOUBLE( m_energy_in_COMFactor, a_buffer, a_mode );
2023 DATA_MEMBER_DOUBLE( m_massFactor, a_buffer, a_mode );
2024 DATA_MEMBER_DOUBLE( m_Q, a_buffer, a_mode );
2025
2026 m_dist = serializeProbability1d( a_buffer, a_mode, m_dist );
2027}
#define DATA_MEMBER_DOUBLE(member, buf, mode)
#define DATA_MEMBER_INT( member, buf, mode)
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE Probabilities::ProbabilityBase1d * serializeProbability1d(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Probabilities::ProbabilityBase1d *a_probability1d)

The documentation for this class was generated from the following files: