Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
GIDI::RISI::Projectile Class Reference

#include <RISI.hpp>

Public Member Functions

 Projectile (std::string const &a_id)
 ~Projectile ()
void add (Protare *a_protare)
bool fissionPresent (std::vector< std::string > targetIds) const
std::vector< std::string > targetIds () const
void products (std::string const &a_target, int a_level, int a_maxLevel, double a_energyMax, std::map< std::string, int > &a_products) const
std::vector< std::string > filterProducts (std::vector< std::string > const &a_productIds) const
Target const * target (std::string const &a_targetName) const
void print (std::string const &a_indent="") const
void printAsRIS_file () const

Detailed Description

Stores a list of projectiles and their associated Target instance.

Definition at line 101 of file RISI.hpp.

Constructor & Destructor Documentation

◆ Projectile()

GIDI::RISI::Projectile::Projectile ( std::string const & a_id)
inline

Definition at line 108 of file RISI.hpp.

108 :
109 m_id( a_id ) {
110 }

◆ ~Projectile()

GIDI::RISI::Projectile::~Projectile ( )

Definition at line 388 of file RISI_read.cc.

388 {
389
390 for( auto iter = m_targets.begin( ); iter != m_targets.end( ); ++iter ) delete (*iter).second;
391
392}

Member Function Documentation

◆ add()

void GIDI::RISI::Projectile::add ( Protare * a_protare)

Adds a_protare to the associated target of this.

Parameters
a_protare[in] The Protare instance to add to this.

Definition at line 400 of file RISI_read.cc.

400 {
401
402 std::string const &target = a_protare->target( );
403
404 auto iter = m_targets.find( target );
405 if( iter == m_targets.end( ) ) {
406 m_targets[target] = new Target( target );
407 iter = m_targets.find( target );
408 }
409
410 (*iter).second->add( a_protare );
411}
Target const * target(std::string const &a_targetName) const
Definition RISI_read.cc:438

◆ filterProducts()

std::vector< std::string > GIDI::RISI::Projectile::filterProducts ( std::vector< std::string > const & a_productIds) const

Filter an initial list of products, returning only those that are available as targets for this projectile

Parameters
a_products[in] The list of product IDs to filter.
Returns
A vector of filtered product IDs.

Definition at line 501 of file RISI_read.cc.

501 {
502
503 std::vector<std::string> filteredProducts;
504
505 for (const auto &productId : a_productIds) {
506 if (m_targets.find(productId) != m_targets.end()) {
507 filteredProducts.push_back(productId);
508 }
509 }
510
511 return filteredProducts;
512}

◆ fissionPresent()

bool GIDI::RISI::Projectile::fissionPresent ( std::vector< std::string > targetIds) const

Returns true if any target in this projectile has fission reactions.

Returns
True if fission reactions are present, false otherwise.

Definition at line 419 of file RISI_read.cc.

419 {
420
421 for( auto& targetId : targetIds ) {
422 auto iter = m_targets.find( targetId );
423 if ( iter == m_targets.end( ) ) {
424 throw LUPI::Exception( "Target " + targetId + " missing from .ris file for projectile " + m_id );
425 }
426 if( (*iter).second->fissionPresent( ) ) return true;
427 }
428 return false;
429}
std::vector< std::string > targetIds() const
Definition RISI_read.cc:453

◆ print()

void GIDI::RISI::Projectile::print ( std::string const & a_indent = "") const

Prints this id and then calls the print method on each Target in this.

Parameters
a_indent[in] The Protare instance to add to this.

Definition at line 520 of file RISI_read.cc.

520 {
521
522 std::cout << a_indent + m_id << std::endl;
523 for( auto iter = m_targets.begin( ); iter != m_targets.end( ); ++iter ) (*iter).second->print( a_indent + " " );
524}

◆ printAsRIS_file()

void GIDI::RISI::Projectile::printAsRIS_file ( ) const

Calls the printAsRIS_file method on each Target in this. This method attempts to print this as it appears in a file.

Definition at line 531 of file RISI_read.cc.

531 {
532
533 for( auto iter = m_targets.begin( ); iter != m_targets.end( ); ++iter ) (*iter).second->printAsRIS_file( );
534}

◆ products()

void GIDI::RISI::Projectile::products ( std::string const & a_target,
int a_level,
int a_maxLevel,
double a_energyMax,
std::map< std::string, int > & a_products ) const

Populate std::map with product id: max multiplicity for that product that can be created from the given target.

Parameters
a_target[in] Target particle id.
a_level[in] The current recursive level.
a_maxLevel[in] The maximum recursive level requested by the user.
a_energyMax[in] Only reactions with effective thresholds less than this value are processed.
a_products[in] The map to be populated with (product: max multiplicity) pairs.

Definition at line 474 of file RISI_read.cc.

474 {
475
476 auto productIter = a_products.find( a_target );
477 if( productIter != a_products.end( ) ) {
478 if( a_level < (*productIter).second ) {
479 // found a way to make the product in fewer reaction steps
480 a_products[a_target] = a_level;
481 } else {
482 return;
483 }
484 } else {
485 a_products[a_target] = a_level; // Adds a_target to a_products.
486 }
487
488 if( a_level >= a_maxLevel ) return;
489
490 auto targetIter = m_targets.find( a_target );
491 if( targetIter != m_targets.end( ) ) (*targetIter).second->products( this, a_level + 1, a_maxLevel, a_energyMax, a_products );
492}

Referenced by GIDI::RISI::Protare::products().

◆ target()

Target const * GIDI::RISI::Projectile::target ( std::string const & a_targetName) const

Returns a pointer to the target with the specified name, or nullptr if not found.

Parameters
a_targetName[in] The name of the target to find.
Returns
A pointer to the Target object, or nullptr if not found.

Definition at line 438 of file RISI_read.cc.

438 {
439
440 auto targetIter = m_targets.find( a_targetName );
441 if( targetIter != m_targets.end( ) ) {
442 return (*targetIter).second;
443 }
444 return nullptr;
445}

Referenced by add().

◆ targetIds()

std::vector< std::string > GIDI::RISI::Projectile::targetIds ( ) const

Returns a vector containing the names of all targets available for this projectile.

Returns
A vector of target names.

Definition at line 453 of file RISI_read.cc.

453 {
454
455 std::vector<std::string> targetList;
456
457 for( auto targetIter = m_targets.begin( ); targetIter != m_targets.end( ); ++targetIter ) {
458 targetList.push_back( (*targetIter).first );
459 }
460
461 return( targetList );
462}

Referenced by fissionPresent().


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