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

#include <MCGIDI.hpp>

Public Member Functions

LUPI_HOST_DEVICE GRIN_capture ()
LUPI_HOST GRIN_capture (SetupInfo &a_setupInfo, GIDI::GRIN::GRIN_continuumGammas const &GRIN_continuumGammas)
LUPI_HOST_DEVICE ~GRIN_capture ()
LUPI_HOST void setUserParticleIndex (int a_particleIndex, int a_userParticleIndex)
LUPI_HOST void setUserParticleIndexViaIntid (int a_particleIntid, int a_userParticleIndex)
template<typename RNG, typename PUSHBACK>
LUPI_HOST_DEVICE bool sampleProducts (ProtareSingle const *a_protare, double a_projectileEnergy, Sampling::Input &a_input, RNG &&a_rng, PUSHBACK &&a_push_back, Sampling::ProductHandler &a_products) const
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)

Detailed Description

Thiis class represents GRIN capture continuum reaction data which has simulated (i.e., modelled) levels.

Definition at line 1144 of file MCGIDI.hpp.

Constructor & Destructor Documentation

◆ GRIN_capture() [1/2]

LUPI_HOST_DEVICE MCGIDI::GRIN_capture::GRIN_capture ( )

Definition at line 445 of file MCGIDI_GRIN.cc.

445 :
446 m_captureNeutronSeparationEnergy( 0.0 ),
447 m_residualIntid( -1 ),
448 m_residualIndex( -1 ),
449 m_residualUserIndex( -1 ),
450 m_residualMass( 0.0 ) {
451
452}

◆ GRIN_capture() [2/2]

LUPI_HOST MCGIDI::GRIN_capture::GRIN_capture ( SetupInfo & a_setupInfo,
GIDI::GRIN::GRIN_continuumGammas const & GRIN_continuumGammas )
Parameters
a_setupInfo[in] Used internally when constructing a Protare to pass information to other constructors.
GRIN_continuumGammas[in] GIDI instance containing the GRIN capture data.

Definition at line 459 of file MCGIDI_GRIN.cc.

459 :
460 m_captureNeutronSeparationEnergy( GRIN_continuumGammas.captureNeutronSeparationEnergy( ).value( ) ),
461 m_residualIntid( GRIN_continuumGammas.captureResidualIntid( ) ),
462 m_residualIndex( GRIN_continuumGammas.captureResidualIndex( ) ),
463 m_residualUserIndex( -1 ),
464 m_residualMass( GRIN_continuumGammas.captureResidualMass( ) ) {
465
466 PoPI::Database const &pops = GRIN_continuumGammas.pops( );
467 GIDI::Suite const &captureLevelProbabilities = GRIN_continuumGammas.captureLevelProbabilities( );
468
469 m_summedProbabilities.reserve( captureLevelProbabilities.size( ) );
470 m_captureLevelProbabilities.reserve( captureLevelProbabilities.size( ) );
471 double sum = 0.0;
472 for( std::size_t index = 0; index < captureLevelProbabilities.size( ); ++index ) {
473 GIDI::GRIN::CaptureLevelProbability const *captureLevelProbability = captureLevelProbabilities.get<GIDI::GRIN::CaptureLevelProbability const>( 0 );
474
475 sum += captureLevelProbability->probabilty( );
476 m_summedProbabilities.push_back( sum );
477 m_captureLevelProbabilities.push_back( new GRIN_captureLevelProbability( a_setupInfo, pops, captureLevelProbability ) );
478 }
479}
T * get(std::size_t a_Index)
Definition GIDI.hpp:2642
std::size_t size() const
Definition GIDI.hpp:2591
@ GRIN_captureLevelProbability
Definition GIDI.hpp:144

◆ ~GRIN_capture()

LUPI_HOST_DEVICE MCGIDI::GRIN_capture::~GRIN_capture ( )

Definition at line 484 of file MCGIDI_GRIN.cc.

484 {
485
486 for( auto iter = m_captureLevelProbabilities.begin( ); iter != m_captureLevelProbabilities.end( ); ++iter ) delete *iter;
487}

Member Function Documentation

◆ sampleProducts()

template<typename RNG, typename PUSHBACK>
LUPI_HOST_DEVICE bool MCGIDI::GRIN_capture::sampleProducts ( ProtareSingle const * a_protare,
double a_projectileEnergy,
Sampling::Input & a_input,
RNG && a_rng,
PUSHBACK && a_push_back,
Sampling::ProductHandler & a_products ) const
inline

This method adds sampled products to a_products.

Parameters
a_protare[in] The ProtareSingle this Reaction belongs to.
a_projectileEnergy[in] The energy of the projectile.
a_input[in] Sample options requested by user.
a_rng[in] The random number generator function that returns a double in the range [0, 1.0).
a_products[in] The object to add all sampled products to.

Definition at line 3069 of file MCGIDI_headerSource.hpp.

3070 {
3071
3072 std::size_t index = 0;
3073 double random = a_rng( );
3074 for( ; index < m_summedProbabilities.size( ) - 1; ++index ) {
3075 if( random < m_summedProbabilities[index] ) break;
3076 }
3077 GRIN_captureLevelProbability *GRIN_captureLevelProbability1 = m_captureLevelProbabilities[index];
3078
3079 double availableEnergy = m_captureNeutronSeparationEnergy + a_projectileEnergy;
3080 int primaryCaptureLevelIndex = GRIN_captureLevelProbability1->sampleCaptureLevel( a_protare, availableEnergy, a_rng );
3081 NuclideGammaBranchStateInfo const *nuclideGammaBranchStateInfo = a_protare->nuclideGammaBranchStateInfos( )[static_cast<std::size_t>(primaryCaptureLevelIndex)];
3082
3083 a_input.m_GRIN_intermediateResidual = nuclideGammaBranchStateInfo->intid( );
3084
3085 a_input.setSampledType( Sampling::SampledType::photon );
3086 a_input.m_dataInTargetFrame = false;
3087 a_input.m_frame = GIDI::Frame::lab;
3088
3089 a_input.m_energyOut1 = availableEnergy - nuclideGammaBranchStateInfo->nuclearLevelEnergy( );
3090 a_input.m_mu = 2 * a_rng( ) - 1.0;
3091 a_input.m_phi = 2.0 * M_PI * a_rng( );
3092
3093 a_products.add( a_projectileEnergy, PoPI::Intids::photon, a_protare->photonIndex( ), a_protare->userPhotonIndex( ),
3094 0.0, a_input, a_rng, a_push_back, true );
3095
3096 a_protare->sampleBranchingGammas( a_input, a_projectileEnergy, primaryCaptureLevelIndex, a_rng, a_push_back, a_products );
3097
3098 if( m_residualIntid != -1 ) {
3099 a_input.m_energyOut1 = 0.0;
3100 a_input.m_mu = 0.0;
3101 a_input.m_phi = 0.0;
3102 a_products.add( a_projectileEnergy, m_residualIntid, m_residualIndex, m_residualUserIndex, m_residualMass, a_input, a_rng, a_push_back, false );
3103 }
3104
3105 return( true );
3106}
#define M_PI
Definition SbMath.h:33
static int constexpr photon
Definition PoPI.hpp:178

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::GRIN_capture::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 522 of file MCGIDI_GRIN.cc.

522 {
523
524 DATA_MEMBER_DOUBLE( m_captureNeutronSeparationEnergy, a_buffer, a_mode );
525 DATA_MEMBER_VECTOR_DOUBLE( m_summedProbabilities, a_buffer, a_mode );
526 DATA_MEMBER_INT( m_residualIntid, a_buffer, a_mode );
527 DATA_MEMBER_INT( m_residualIndex, a_buffer, a_mode );
528 DATA_MEMBER_INT( m_residualUserIndex, a_buffer, a_mode );
529 DATA_MEMBER_DOUBLE( m_residualMass, a_buffer, a_mode );
530
531 std::size_t vectorSize = m_captureLevelProbabilities.size( );
532 int vectorSizeInt = (int) vectorSize;
533 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
534 vectorSize = (std::size_t) vectorSizeInt;
535
536 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
537 m_captureLevelProbabilities.resize( vectorSize, &a_buffer.m_placement );
538 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
539 if( a_buffer.m_placement != nullptr ) {
540 m_captureLevelProbabilities[vectorIndex] = new(a_buffer.m_placement) GRIN_captureLevelProbability;
541 a_buffer.incrementPlacement( sizeof( GRIN_captureLevelProbability ) ); }
542 else {
543 m_captureLevelProbabilities[vectorIndex] = new GRIN_captureLevelProbability;
544 }
545 } }
546 else if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
547 a_buffer.m_placement += m_captureLevelProbabilities.internalSize( );
548 a_buffer.incrementPlacement( sizeof( GRIN_captureLevelProbability ) * vectorSize );
549 }
550
551 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
552 m_captureLevelProbabilities[vectorIndex]->serialize( a_buffer, a_mode );
553 }
554}
#define DATA_MEMBER_VECTOR_DOUBLE(member, buf, mode)
#define DATA_MEMBER_DOUBLE(member, buf, mode)
#define DATA_MEMBER_INT( member, buf, mode)
LUPI_HOST_DEVICE void incrementPlacement(std::size_t a_delta)

◆ setUserParticleIndex()

LUPI_HOST void MCGIDI::GRIN_capture::setUserParticleIndex ( int a_particleIndex,
int a_userParticleIndex )

Updates the m_userParticleIndex to a_userParticleIndex for all particles with PoPs index a_particleIndex.

Parameters
a_particleIndex[in] The PoPs index of the particle whose user index is to be set.
a_userParticleIndex[in] The particle index specified by the user.

Definition at line 496 of file MCGIDI_GRIN.cc.

496 {
497
498 if( m_residualIndex == a_particleIndex ) m_residualUserIndex = a_userParticleIndex;
499}

◆ setUserParticleIndexViaIntid()

LUPI_HOST void MCGIDI::GRIN_capture::setUserParticleIndexViaIntid ( int a_particleIntid,
int a_userParticleIndex )

Updates the m_userParticleIndex to a_userParticleIndex for all particles with PoPs intid a_particleIntid.

Parameters
a_particleIntid[in] The PoPs intid of the particle whose user index is to be set.
a_userParticleIndex[in] The particle index specified by the user.

Definition at line 508 of file MCGIDI_GRIN.cc.

508 {
509
510 if( m_residualIntid == a_particleIntid ) m_residualUserIndex = a_userParticleIndex;
511}

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