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

#include <G4GIDI.hh>

Public Member Functions

 G4GIDI_target (PoPI::Database const &a_pops, MCGIDI::DomainHash const &a_domainHash, GIDI::Protare const &a_GIDI_protare, MCGIDI::Protare *a_MCGIDI_protare)
 ~G4GIDI_target ()
std::string const * getName () const
std::string const * getFilename () const
std::string const * getEvaluation () const
int getZ () const
int getA () const
int getM () const
double getMass () const
std::vector< int > const & elasticIndices ()
std::vector< int > const & captureIndices ()
std::vector< int > const & fissionIndices ()
std::vector< int > const & othersIndices ()
int getNumberOfChannels () const
int getNumberOfProductionChannels () const
channelID getChannelsID (int channelIndex) const
std::vector< channelID > * getChannelIDs () const
std::vector< channelID > * getProductionChannelIDs () const
double getTotalCrossSectionAtE (double a_energy, double a_temperature) const
double getElasticCrossSectionAtE (double a_energy, double a_temperature) const
double getCaptureCrossSectionAtE (double a_energy, double a_temperature) const
double getFissionCrossSectionAtE (double a_energy, double a_temperature) const
double getOthersCrossSectionAtE (double a_energy, double a_temperature) const
double sumChannelCrossSectionAtE (std::vector< int > const &a_indices, double a_energy, double a_temperature) const
double sumChannelCrossSectionAtE (int a_nIndices, int const *a_indices, double a_energy, double a_temperature) const
int sampleChannelCrossSectionAtE (std::vector< int > const &a_indices, double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
int sampleChannelCrossSectionAtE (int a_nIndices, int const *a_indices, double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
double getElasticFinalState (double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
std::vector< G4GIDI_Product > * getCaptureFinalState (double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
std::vector< G4GIDI_Product > * getFissionFinalState (double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
std::vector< G4GIDI_Product > * getOthersFinalState (double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
std::vector< G4GIDI_Product > * getFinalState (std::vector< int > const &a_indices, double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
std::vector< G4GIDI_Product > * getFinalState (int a_nIndices, int const *a_indices, double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const

Detailed Description

A class to store map files for a particular projectile.

Definition at line 48 of file G4GIDI.hh.

Constructor & Destructor Documentation

◆ G4GIDI_target()

G4GIDI_target::G4GIDI_target ( PoPI::Database const & a_pops,
MCGIDI::DomainHash const & a_domainHash,
GIDI::Protare const & a_GIDI_protare,
MCGIDI::Protare * a_MCGIDI_protare )
Parameters
a_MCProtare[in] The MCGIDI protare.

Definition at line 37 of file G4GIDI_target.cc.

38 :
39 m_MCGIDI_protare( a_MCGIDI_protare ),
40 m_target( a_GIDI_protare.target( ).ID( ) ),
41 m_fileName( a_GIDI_protare.fileName( ) ),
42 m_evaluation( a_GIDI_protare.evaluation( ) ),
43 m_targetZ( 0 ),
44 m_targetA( 0 ),
45 m_targetM( 0 ),
46 m_targetMass( 0.0 ),
47 m_domainHash( a_domainHash ),
48 m_elasticAngular( nullptr ) {
49
50 PoPI::Base const *targetAsBase = &a_pops.get<PoPI::Base const>( m_target );
51 PoPI::Base const *targetAsBase2 = targetAsBase;
52 if( targetAsBase->isAlias( ) ) {
53 targetAsBase2 = &a_pops.get<PoPI::Base const>( a_pops.final( m_target ) );
54 }
55 m_targetZ = PoPI::particleZ( *targetAsBase2, true );
56 m_targetA = PoPI::particleA( *targetAsBase2, true );
57 m_targetM = PoPI::particleMetaStableIndex( *targetAsBase );
58 if( targetAsBase2->isParticle( ) ) {
59 PoPI::Particle const *targetAsParticle = static_cast<PoPI::Particle const *>( targetAsBase2 );
60 m_targetMass = targetAsParticle->massValue( "amu" );
61 }
62
63 for( std::size_t reactionIndex = 0; reactionIndex < a_MCGIDI_protare->numberOfReactions( ); ++reactionIndex ) {
64 MCGIDI::Reaction const *reaction = a_MCGIDI_protare->reaction( reactionIndex );
65
66 if( reaction->ENDF_MT( ) == 2 ) {
67 m_elasticIndices.push_back( static_cast<int>( reactionIndex ) ); }
68 else if( reaction->ENDF_MT( ) == 18 ) {
69 m_fissionIndices.push_back( static_cast<int>( reactionIndex ) ); }
70 else if( reaction->ENDF_MT( ) == 102 ) {
71 m_captureIndices.push_back( static_cast<int>( reactionIndex ) ); }
72 else {
73 m_othersIndices.push_back( static_cast<int>( reactionIndex ) );
74 }
75 }
76
77 if( m_elasticIndices.size( ) > 0 ) {
78 MCGIDI::Reaction const *elastic = a_MCGIDI_protare->reaction( m_elasticIndices[0] );
79 MCGIDI::Product const *firstProduct = elastic->product( 0 );
80 MCGIDI::Distributions::AngularTwoBody const *angularTwoBody = static_cast<MCGIDI::Distributions::AngularTwoBody const *>( firstProduct->distribution( ) );
81 m_elasticAngular = angularTwoBody->angular( );
82 }
83}
LUPI_HOST_DEVICE Distributions::Distribution const * distribution() const
Definition MCGIDI.hpp:1220
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE std::size_t numberOfReactions() const MCGIDI_TRUE_VIRTUAL
MCGIDI_VIRTUAL_FUNCTION LUPI_HOST_DEVICE Reaction const * reaction(std::size_t a_index) const MCGIDI_TRUE_VIRTUAL
bool isAlias(void) const
Definition PoPI.hpp:658
virtual double massValue(char const *a_unit) const
G4double elastic(Particle const *const p1, Particle const *const p2)
int particleA(Base const &a_particle, bool a_isNeutronProtonANucleon=false)
Definition PoPI_misc.cc:227
int particleMetaStableIndex(Base const &a_particle)
Definition PoPI_misc.cc:349
int particleZ(Base const &a_particle, bool a_isNeutronProtonANucleon=false)
Definition PoPI_misc.cc:150

◆ ~G4GIDI_target()

G4GIDI_target::~G4GIDI_target ( )

Definition at line 88 of file G4GIDI_target.cc.

88 {
89
90 delete m_MCGIDI_protare;
91}

Member Function Documentation

◆ captureIndices()

std::vector< int > const & G4GIDI_target::captureIndices ( )
inline

Definition at line 87 of file G4GIDI.hh.

87{ return( m_captureIndices ); }

◆ elasticIndices()

std::vector< int > const & G4GIDI_target::elasticIndices ( )
inline

Definition at line 86 of file G4GIDI.hh.

86{ return( m_elasticIndices ); }

◆ fissionIndices()

std::vector< int > const & G4GIDI_target::fissionIndices ( )
inline

Definition at line 88 of file G4GIDI.hh.

88{ return( m_fissionIndices ); }

◆ getA()

int G4GIDI_target::getA ( ) const
inline

Definition at line 76 of file G4GIDI.hh.

76{ return( m_targetA ); }

◆ getCaptureCrossSectionAtE()

double G4GIDI_target::getCaptureCrossSectionAtE ( double a_energy,
double a_temperature ) const

Definition at line 167 of file G4GIDI_target.cc.

167 {
168
169 return( sumChannelCrossSectionAtE( m_captureIndices, a_energy, a_temperature ) );
170}
double sumChannelCrossSectionAtE(std::vector< int > const &a_indices, double a_energy, double a_temperature) const

◆ getCaptureFinalState()

std::vector< G4GIDI_Product > * G4GIDI_target::getCaptureFinalState ( double a_energy,
double a_temperature,
double(* a_rng )(void *),
void * a_rngState ) const

Definition at line 257 of file G4GIDI_target.cc.

257 {
258
259 return( getFinalState( m_captureIndices, a_energy, a_temperature, a_rng, a_rngState ) );
260}
std::vector< G4GIDI_Product > * getFinalState(std::vector< int > const &a_indices, double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const

Referenced by G4LENDCapture::ApplyYourself().

◆ getChannelIDs()

std::vector< channelID > * G4GIDI_target::getChannelIDs ( ) const

Definition at line 119 of file G4GIDI_target.cc.

119 {
120
121 std::vector<channelID> *channelIDs = new std::vector<channelID>( 0 );
122
123 for( std::size_t reactionIndex = 0; reactionIndex < m_MCGIDI_protare->numberOfReactions( ); ++reactionIndex ) {
124 MCGIDI::Reaction const *reaction = m_MCGIDI_protare->reaction( reactionIndex );
125 channelIDs->push_back( reaction->label( ).c_str( ) );
126 }
127
128 return( channelIDs );
129}

◆ getChannelsID()

channelID G4GIDI_target::getChannelsID ( int channelIndex) const

Definition at line 111 of file G4GIDI_target.cc.

111 {
112
113 return( channelID( m_MCGIDI_protare->reaction( channelIndex )->label( ).c_str( ) ) );
114}
#define channelID
Definition G4GIDI.hh:36

◆ getElasticCrossSectionAtE()

double G4GIDI_target::getElasticCrossSectionAtE ( double a_energy,
double a_temperature ) const

Definition at line 159 of file G4GIDI_target.cc.

159 {
160
161 return( sumChannelCrossSectionAtE( m_elasticIndices, a_energy, a_temperature ) );
162}

◆ getElasticFinalState()

double G4GIDI_target::getElasticFinalState ( double a_energy,
double a_temperature,
double(* a_rng )(void *),
void * a_rngState ) const

Definition at line 249 of file G4GIDI_target.cc.

249 {
250
251 return( m_elasticAngular->sample( a_energy, a_rng( a_rngState ), [&]() -> double { return a_rng( a_rngState ); } ) );
252}

Referenced by G4LENDElastic::ApplyYourself(), and G4LENDModel::ApplyYourself().

◆ getEvaluation()

std::string const * G4GIDI_target::getEvaluation ( ) const
inline

Definition at line 74 of file G4GIDI.hh.

74{ return( &m_evaluation ); }

◆ getFilename()

std::string const * G4GIDI_target::getFilename ( ) const
inline

Definition at line 73 of file G4GIDI.hh.

73{ return( &m_fileName ); }

◆ getFinalState() [1/2]

std::vector< G4GIDI_Product > * G4GIDI_target::getFinalState ( int a_nIndices,
int const * a_indices,
double a_energy,
double a_temperature,
double(* a_rng )(void *),
void * a_rngState ) const

Definition at line 334 of file G4GIDI_target.cc.

335 {
336
337 std::vector<int> indices( a_nIndices );
338 for( int index = 0; index < a_nIndices; ++index ) indices[index] = a_indices[index];
339
340 return( getFinalState( indices, a_energy, a_temperature, a_rng, a_rngState ) );
341}

◆ getFinalState() [2/2]

std::vector< G4GIDI_Product > * G4GIDI_target::getFinalState ( std::vector< int > const & a_indices,
double a_energy,
double a_temperature,
double(* a_rng )(void *),
void * a_rngState ) const

Definition at line 281 of file G4GIDI_target.cc.

282 {
283
284 int reactionIndex;
285
286 if( a_indices.size( ) == 0 ) return( NULL );
287 if( a_indices.size( ) == 1 ) {
288 reactionIndex = a_indices[0]; }
289 else {
290 reactionIndex = sampleChannelCrossSectionAtE( a_indices, a_energy, a_temperature, a_rng, a_rngState );
291 }
292
293 MCGIDI::Sampling::StdVectorProductHandler productHandler;
294 MCGIDI::Sampling::Input input( false, MCGIDI::Sampling::Upscatter::Model::none );
295 input.setTemperatureAndEnergy( a_temperature, a_energy );
296
297 MCGIDI::Reaction const *reaction = m_MCGIDI_protare->reaction( reactionIndex );
298 reaction->sampleProducts( m_MCGIDI_protare, input, [&]() -> double { return a_rng( a_rngState ); },
299 [&] (MCGIDI::Sampling::Product &a_product) -> void { productHandler.push_back( a_product ); }, productHandler );
300
301 std::vector<G4GIDI_Product> *products = new std::vector<G4GIDI_Product>( productHandler.size( ) );
302
303 for( std::size_t index = 0; index < productHandler.size( ); ++index ) {
304 MCGIDI::Sampling::Product &productIn = productHandler[index];
305 G4GIDI_Product &productOut = (*products)[index];
306
307 if( productIn.m_productIntid == 1020000000 ) { // Neutron.
308 productOut.A = 1;
309 productOut.Z = 0;
310 productOut.m = 0; }
311 else if( productIn.m_productIntid == 1000000000 ) { // Photon.
312 productOut.A = 0;
313 productOut.Z = 0;
314 productOut.m = 0; }
315 else {
316 PoPI::ParseIntidInfo parseIntidInfo( productIn.m_productIntid );
317 productOut.A = parseIntidInfo.AAA( );
318 productOut.Z = parseIntidInfo.ZZZ( );
319 productOut.m = parseIntidInfo.metaStableIndex( );
320 }
321
322 productOut.kineticEnergy = productIn.m_kineticEnergy;
323 productOut.px = productIn.m_px_vx;
324 productOut.py = productIn.m_py_vy;
325 productOut.pz = productIn.m_pz_vz;
326 }
327
328 return( products );
329}
double px
Definition G4GIDI.hh:44
double pz
Definition G4GIDI.hh:44
double kineticEnergy
Definition G4GIDI.hh:44
double py
Definition G4GIDI.hh:44
int sampleChannelCrossSectionAtE(std::vector< int > const &a_indices, double a_energy, double a_temperature, double(*a_rng)(void *), void *a_rngState) const
LUPI_HOST_DEVICE void push_back(Product &a_product)

Referenced by getCaptureFinalState(), getFinalState(), getFissionFinalState(), and getOthersFinalState().

◆ getFissionCrossSectionAtE()

double G4GIDI_target::getFissionCrossSectionAtE ( double a_energy,
double a_temperature ) const

Definition at line 175 of file G4GIDI_target.cc.

175 {
176
177 return( sumChannelCrossSectionAtE( m_fissionIndices, a_energy, a_temperature ) );
178}

◆ getFissionFinalState()

std::vector< G4GIDI_Product > * G4GIDI_target::getFissionFinalState ( double a_energy,
double a_temperature,
double(* a_rng )(void *),
void * a_rngState ) const

Definition at line 265 of file G4GIDI_target.cc.

265 {
266
267 return( getFinalState( m_fissionIndices, a_energy, a_temperature, a_rng, a_rngState ) );
268}

Referenced by G4LENDFission::ApplyYourself().

◆ getM()

int G4GIDI_target::getM ( ) const
inline

Definition at line 77 of file G4GIDI.hh.

77{ return( m_targetM ); }

◆ getMass()

double G4GIDI_target::getMass ( ) const
inline

Definition at line 78 of file G4GIDI.hh.

78{ return( m_targetMass ); }

◆ getName()

std::string const * G4GIDI_target::getName ( ) const
inline

Definition at line 72 of file G4GIDI.hh.

72{ return( &m_target ); }

◆ getNumberOfChannels()

int G4GIDI_target::getNumberOfChannels ( ) const

Definition at line 96 of file G4GIDI_target.cc.

96 {
97
98 return( static_cast<int>( m_MCGIDI_protare->numberOfReactions( ) ) );
99}

◆ getNumberOfProductionChannels()

int G4GIDI_target::getNumberOfProductionChannels ( ) const

Definition at line 103 of file G4GIDI_target.cc.

103 {
104
105 return( static_cast<int>( m_MCGIDI_protare->numberOfOrphanProducts( ) ) );
106}

◆ getOthersCrossSectionAtE()

double G4GIDI_target::getOthersCrossSectionAtE ( double a_energy,
double a_temperature ) const

Definition at line 183 of file G4GIDI_target.cc.

183 {
184
185 return( sumChannelCrossSectionAtE( m_othersIndices, a_energy, a_temperature ) );
186}

◆ getOthersFinalState()

std::vector< G4GIDI_Product > * G4GIDI_target::getOthersFinalState ( double a_energy,
double a_temperature,
double(* a_rng )(void *),
void * a_rngState ) const

Definition at line 273 of file G4GIDI_target.cc.

273 {
274
275 return( getFinalState( m_othersIndices, a_energy, a_temperature, a_rng, a_rngState ) );
276}

Referenced by G4LENDInelastic::ApplyYourself().

◆ getProductionChannelIDs()

std::vector< channelID > * G4GIDI_target::getProductionChannelIDs ( ) const

Definition at line 134 of file G4GIDI_target.cc.

134 {
135
136 std::vector<channelID> *channelIDs = new std::vector<channelID>( 0 );
137
138 for( std::size_t reactionIndex = 0; reactionIndex < m_MCGIDI_protare->numberOfOrphanProducts( ); ++reactionIndex ) {
139 MCGIDI::Reaction const *reaction = m_MCGIDI_protare->orphanProduct( reactionIndex );
140 channelIDs->push_back( reaction->label( ).c_str( ) );
141 }
142
143 return( channelIDs );
144}

◆ getTotalCrossSectionAtE()

double G4GIDI_target::getTotalCrossSectionAtE ( double a_energy,
double a_temperature ) const

Definition at line 149 of file G4GIDI_target.cc.

149 {
150
151 std::size_t hashIndex = m_domainHash.index( a_energy );
152
153 return( m_MCGIDI_protare->crossSection( m_URR_protareInfos, hashIndex, a_temperature, a_energy ) );
154}

◆ getZ()

int G4GIDI_target::getZ ( ) const
inline

Definition at line 75 of file G4GIDI.hh.

75{ return( m_targetZ ); }

◆ othersIndices()

std::vector< int > const & G4GIDI_target::othersIndices ( )
inline

Definition at line 89 of file G4GIDI.hh.

89{ return( m_othersIndices ); }

◆ sampleChannelCrossSectionAtE() [1/2]

int G4GIDI_target::sampleChannelCrossSectionAtE ( int a_nIndices,
int const * a_indices,
double a_energy,
double a_temperature,
double(* a_rng )(void *),
void * a_rngState ) const

Definition at line 237 of file G4GIDI_target.cc.

238 {
239
240 std::vector<int> indices( a_nIndices );
241 for( int index = 0; index < a_nIndices; ++index ) indices[index] = a_indices[index];
242
243 return( sampleChannelCrossSectionAtE( indices, a_energy, a_temperature, a_rng, a_rngState ) );
244}

◆ sampleChannelCrossSectionAtE() [2/2]

int G4GIDI_target::sampleChannelCrossSectionAtE ( std::vector< int > const & a_indices,
double a_energy,
double a_temperature,
double(* a_rng )(void *),
void * a_rngState ) const

Definition at line 217 of file G4GIDI_target.cc.

218 {
219
220 int index = 0;
221 int nIndices = static_cast<int>( a_indices.size( ) );
222 double crossSectionSample = sumChannelCrossSectionAtE( a_indices, a_energy, a_temperature );
223 double crossSectionSum = 0.0;
224
225 crossSectionSample *= a_rng( a_rngState );
226 for( ; index < nIndices; ++index ) {
227 crossSectionSum += sumChannelCrossSectionAtE( 1, &a_indices[index], a_energy, a_temperature );
228 if( crossSectionSum >= crossSectionSample ) break;
229 }
230 if( index == nIndices ) --index; // This should really be an error.
231
232 return( a_indices[index] );
233}

Referenced by getFinalState(), and sampleChannelCrossSectionAtE().

◆ sumChannelCrossSectionAtE() [1/2]

double G4GIDI_target::sumChannelCrossSectionAtE ( int a_nIndices,
int const * a_indices,
double a_energy,
double a_temperature ) const

Definition at line 206 of file G4GIDI_target.cc.

206 {
207
208 std::vector<int> indices( a_nIndices );
209 for( int index = 0; index < a_nIndices; ++index ) indices[index] = a_indices[index];
210
211 return( sumChannelCrossSectionAtE( indices, a_energy, a_temperature ) );
212}

◆ sumChannelCrossSectionAtE() [2/2]

double G4GIDI_target::sumChannelCrossSectionAtE ( std::vector< int > const & a_indices,
double a_energy,
double a_temperature ) const

Definition at line 191 of file G4GIDI_target.cc.

191 {
192
193 std::size_t hashIndex = m_domainHash.index( a_energy );
194 double crossSection = 0.0;
195
196 for( auto indexIter = a_indices.begin( ); indexIter != a_indices.end( ); ++indexIter ) {
197 crossSection += m_MCGIDI_protare->reactionCrossSection( *indexIter, m_URR_protareInfos, hashIndex, a_temperature, a_energy );
198 }
199
200 return( crossSection );
201}

Referenced by getCaptureCrossSectionAtE(), getElasticCrossSectionAtE(), getFissionCrossSectionAtE(), getOthersCrossSectionAtE(), sampleChannelCrossSectionAtE(), and sumChannelCrossSectionAtE().


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