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

#include <MCGIDI.hpp>

Public Member Functions

LUPI_HOST_DEVICE GRIN_inelasticForEnergy ()
LUPI_HOST GRIN_inelasticForEnergy (SetupInfo &a_setupInfo, double a_projectileMass, double a_targetMass, PoPI::Database const &a_pops, GIDI::GRIN::InelasticIncidentEnergy const *inelasticIncidentEnergy)
LUPI_HOST_DEVICE ~GRIN_inelasticForEnergy ()
LUPI_HOST_DEVICE int sampleLevelIndex (double a_projectileEnergy, double a_random) const
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)

Detailed Description

This class represents GRIN inelastic continuum reaction data which has simulated levels.

Definition at line 1032 of file MCGIDI.hpp.

Constructor & Destructor Documentation

◆ GRIN_inelasticForEnergy() [1/2]

LUPI_HOST_DEVICE MCGIDI::GRIN_inelasticForEnergy::GRIN_inelasticForEnergy ( )

Definition at line 107 of file MCGIDI_GRIN.cc.

107 {
108
109}

◆ GRIN_inelasticForEnergy() [2/2]

LUPI_HOST MCGIDI::GRIN_inelasticForEnergy::GRIN_inelasticForEnergy ( SetupInfo & a_setupInfo,
double a_projectileMass,
double a_targetMass,
PoPI::Database const & a_pops,
GIDI::GRIN::InelasticIncidentEnergy const * inelasticIncidentEnergy )
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 116 of file MCGIDI_GRIN.cc.

117 :
118 m_levelsAndProbabilities( a_setupInfo, a_pops, inelasticIncidentEnergy->table( ), true ) {
119
120 std::vector<std::size_t> indices;
121 std::vector<double> thresholds;
122 std::size_t index = 0;
123 double priorThreshold = -1;
124 for( auto iter = m_levelsAndProbabilities.m_levels.begin( ); iter != m_levelsAndProbabilities.m_levels.end( ); ++iter, ++index ) {
125 NuclideGammaBranchStateInfo const *nuclideGammaBranchStateInfo = a_setupInfo.m_protare.nuclideGammaBranchStateInfos( )[static_cast<std::size_t>(*iter)];
126 double levelEnergy = nuclideGammaBranchStateInfo->nuclearLevelEnergy( );
127
128 double threshold = ( a_projectileMass + a_targetMass + levelEnergy / 2 ) * levelEnergy / a_targetMass;
129 if( threshold > priorThreshold ) {
130 if( thresholds.size( ) > 0 )
131 indices.push_back( index - 1 );
132 thresholds.push_back( threshold );
133 priorThreshold = threshold;
134 }
135 }
136 indices.push_back( m_levelsAndProbabilities.m_levels.size( ) - 1 );
137
138 m_indices = indices;
139 m_thresholds = thresholds;
140}

◆ ~GRIN_inelasticForEnergy()

LUPI_HOST_DEVICE MCGIDI::GRIN_inelasticForEnergy::~GRIN_inelasticForEnergy ( )

Definition at line 145 of file MCGIDI_GRIN.cc.

145 {
146
147}

Referenced by ~GRIN_inelasticForEnergy().

Member Function Documentation

◆ sampleLevelIndex()

LUPI_HOST_DEVICE int MCGIDI::GRIN_inelasticForEnergy::sampleLevelIndex ( double a_projectileEnergy,
double a_random ) const

Definition at line 152 of file MCGIDI_GRIN.cc.

152 {
153
154 std::size_t index = 0;
155
156 for( auto iter = m_thresholds.begin( ); iter != m_thresholds.end( ); ++iter, ++index ) {
157 if( *iter >= a_projectileEnergy ) break;
158 }
159
160 if( index == 0 ) return( -1 );
161
162 --index;
163
164 double randomMax = a_random * m_levelsAndProbabilities.m_summedProbabilities[m_indices[index]];
165 for( index = 0; index < m_levelsAndProbabilities.m_levels.size( ) - 1; ++index ) {
166 if( m_levelsAndProbabilities.m_summedProbabilities[index] >= randomMax ) {
167 break;
168 }
169 }
170 return( m_levelsAndProbabilities.m_levels[index] );
171}

Referenced by sampleLevelIndex(), and MCGIDI::GRIN_inelastic::sampleProducts().

◆ serialize()

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

181 {
182
183 DATA_MEMBER_VECTOR_SIZE_T( m_indices, a_buffer, a_mode );
184 DATA_MEMBER_VECTOR_DOUBLE( m_thresholds, a_buffer, a_mode );
185 m_levelsAndProbabilities.serialize( a_buffer, a_mode );
186}
#define DATA_MEMBER_VECTOR_DOUBLE(member, buf, mode)
#define DATA_MEMBER_VECTOR_SIZE_T(member, buf, mode)

Referenced by serialize().


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