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

#include <MCGIDI.hpp>

Public Member Functions

LUPI_HOST_DEVICE ContinuousEnergyGain ()
LUPI_HOST ContinuousEnergyGain (int a_particleIntid, int a_particleIndex, std::size_t a_size)
LUPI_HOST ContinuousEnergyGainoperator= (ContinuousEnergyGain const &a_continuousEnergyGain)
LUPI_HOST_DEVICE int particleIntid () const
LUPI_HOST_DEVICE int particleIndex () const
LUPI_HOST_DEVICE int userParticleIndex () const
LUPI_HOST void setUserParticleIndex (int a_particleIndex, int a_userParticleIndex)
LUPI_HOST void setUserParticleIndexViaIntid (int a_particleIntid, int a_userParticleIndex)
LUPI_HOST_DEVICE Vector< MCGIDI_FLOAT > const & gain () const
LUPI_HOST void adjustGain (std::size_t a_energy_index, double a_gain)
LUPI_HOST_DEVICE double gain (std::size_t a_energy_index, double a_energy_fraction) const
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST void print (ProtareSingle const *a_protareSingle, std::string const &a_indent, std::string const &a_iFormat, std::string const &a_energyFormat, std::string const &a_dFormat) const

Detailed Description

Definition at line 577 of file MCGIDI.hpp.

Constructor & Destructor Documentation

◆ ContinuousEnergyGain() [1/2]

LUPI_HOST_DEVICE MCGIDI::ContinuousEnergyGain::ContinuousEnergyGain ( )

Definition at line 185 of file MCGIDI_heatedCrossSections.cc.

185 :
186 m_particleIntid( -1 ),
187 m_particleIndex( -1 ),
188 m_userParticleIndex( -1 ) {
189
190}

Referenced by operator=().

◆ ContinuousEnergyGain() [2/2]

LUPI_HOST MCGIDI::ContinuousEnergyGain::ContinuousEnergyGain ( int a_particleIntid,
int a_particleIndex,
std::size_t a_size )

Definition at line 195 of file MCGIDI_heatedCrossSections.cc.

195 :
196 m_particleIntid( a_particleIntid ),
197 m_particleIndex( a_particleIndex ),
198 m_userParticleIndex( -1 ),
199 m_gain( a_size, static_cast<MCGIDI_FLOAT>( 0.0 ) ) {
200
201}
#define MCGIDI_FLOAT
Definition MCGIDI.hpp:18

Member Function Documentation

◆ adjustGain()

LUPI_HOST void MCGIDI::ContinuousEnergyGain::adjustGain ( std::size_t a_energy_index,
double a_gain )
inline

Definition at line 601 of file MCGIDI.hpp.

601{ m_gain[a_energy_index] += a_gain; }

◆ gain() [1/2]

LUPI_HOST_DEVICE Vector< MCGIDI_FLOAT > const & MCGIDI::ContinuousEnergyGain::gain ( ) const
inline

Definition at line 600 of file MCGIDI.hpp.

600{ return( m_gain ); }

Referenced by operator=().

◆ gain() [2/2]

LUPI_HOST_DEVICE double MCGIDI::ContinuousEnergyGain::gain ( std::size_t a_energy_index,
double a_energy_fraction ) const

Definition at line 219 of file MCGIDI_heatedCrossSections.cc.

219 {
220
221 return( a_energy_fraction * m_gain[a_energy_index] + ( 1.0 - a_energy_fraction ) * m_gain[a_energy_index+1] );
222}

◆ operator=()

LUPI_HOST ContinuousEnergyGain & MCGIDI::ContinuousEnergyGain::operator= ( ContinuousEnergyGain const & a_continuousEnergyGain)

Definition at line 206 of file MCGIDI_heatedCrossSections.cc.

206 {
207
208 m_particleIntid = a_continuousEnergyGain.particleIntid( );
209 m_particleIndex = a_continuousEnergyGain.particleIndex( );
210 m_userParticleIndex = a_continuousEnergyGain.userParticleIndex( );
211 m_gain = a_continuousEnergyGain.gain( );
212
213 return( *this );
214}

◆ particleIndex()

LUPI_HOST_DEVICE int MCGIDI::ContinuousEnergyGain::particleIndex ( ) const
inline

Returns the value of the m_particleIndex member of this.

Definition at line 592 of file MCGIDI.hpp.

Referenced by operator=().

◆ particleIntid()

LUPI_HOST_DEVICE int MCGIDI::ContinuousEnergyGain::particleIntid ( ) const
inline

Returns the value of the m_particleIntid member of this.

Definition at line 591 of file MCGIDI.hpp.

Referenced by operator=().

◆ print()

LUPI_HOST void MCGIDI::ContinuousEnergyGain::print ( ProtareSingle const * a_protareSingle,
std::string const & a_indent,
std::string const & a_iFormat,
std::string const & a_energyFormat,
std::string const & a_dFormat ) const

Print to std::cout the content of this. This is mainly meant for debugging.

Parameters
a_protareSingle[in] The ProtareSingle instance this resides in.
a_indent[in] The buffer to read or write data to depending on a_mode.
a_iFormat[in] C printf format specifier for any interger that is printed (e.g., "%3d").
a_energyFormat[in] C printf format specifier for any interger that is printed (e.g., "%20.12e").
a_dFormat[in] C printf format specifier for any interger that is printed (e.g., "%14.7e").

Definition at line 250 of file MCGIDI_heatedCrossSections.cc.

251 {
252
253 std::cout << std::endl;
254 std::cout << a_indent << "# Particle intid = " << m_particleIntid << std::endl;
255 std::cout << a_indent << "# Particle index = " << m_particleIndex << std::endl;
256 std::cout << a_indent << "# Use particle index = " << m_userParticleIndex << std::endl;
257
258 std::cout << a_indent << "# Number of gains = " << m_gain.size( ) << std::endl;
259 for( auto iter = m_gain.begin( ); iter != m_gain.end( ); ++iter )
260 std::cout << a_indent << LUPI::Misc::argumentsToString( a_dFormat.c_str( ), *iter ) << std::endl;
261}
std::string argumentsToString(char const *a_format,...)
Definition LUPI_misc.cc:305

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::ContinuousEnergyGain::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 232 of file MCGIDI_heatedCrossSections.cc.

232 {
233
234 DATA_MEMBER_INT( m_particleIntid, a_buffer, a_mode );
235 DATA_MEMBER_INT( m_particleIndex, a_buffer, a_mode );
236 DATA_MEMBER_INT( m_userParticleIndex, a_buffer, a_mode );
237 DATA_MEMBER_VECTOR_FLOAT_OR_DOUBLE( m_gain, a_buffer, a_mode );
238}
#define DATA_MEMBER_INT( member, buf, mode)
#define DATA_MEMBER_VECTOR_FLOAT_OR_DOUBLE
Definition MCGIDI.hpp:19

◆ setUserParticleIndex()

LUPI_HOST void MCGIDI::ContinuousEnergyGain::setUserParticleIndex ( int a_particleIndex,
int a_userParticleIndex )
inline

Sets member m_userParticleIndex to a_userParticleIndex if particle's index matchs m_particleIndex.

Definition at line 594 of file MCGIDI.hpp.

◆ setUserParticleIndexViaIntid()

LUPI_HOST void MCGIDI::ContinuousEnergyGain::setUserParticleIndexViaIntid ( int a_particleIntid,
int a_userParticleIndex )
inline

Sets member m_userParticleIntid to a_userParticleIndex if particle's intid matchs m_particleIntid.

Definition at line 597 of file MCGIDI.hpp.

◆ userParticleIndex()

LUPI_HOST_DEVICE int MCGIDI::ContinuousEnergyGain::userParticleIndex ( ) const
inline

Returns the value of the m_userParticleIndex member of this.

Definition at line 593 of file MCGIDI.hpp.

Referenced by operator=().


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