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

#include <RISI.hpp>

Public Member Functions

 Projectiles ()
 ~Projectiles ()
void add (Protare *a_protare)
void clear ()
std::vector< std::string > projectileIds () const
Projectile const * projectile (std::string const &a_projectile) const
std::vector< std::string > products (std::string const &a_projectile, std::vector< std::string > const &a_seedTargets, int a_maxLevel, double a_energyMax, bool a_onlyIncludeTargets=true) const
void print (std::string const &a_indent="") const
void printAsRIS_file () const

Detailed Description

Stores a list of projectiles.

Definition at line 123 of file RISI.hpp.

Constructor & Destructor Documentation

◆ Projectiles()

GIDI::RISI::Projectiles::Projectiles ( )
inline

Definition at line 129 of file RISI.hpp.

129{}

◆ ~Projectiles()

GIDI::RISI::Projectiles::~Projectiles ( )

Definition at line 543 of file RISI_read.cc.

543 {
544
545 clear( );
546}

Member Function Documentation

◆ add()

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

Adds a_protare to the associated projectile of this.

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

Definition at line 554 of file RISI_read.cc.

554 {
555
556 std::string const &projectile = a_protare->projectile( );
557
558 auto iter = m_projectiles.find( projectile );
559 if( iter == m_projectiles.end( ) ) {
560 m_projectiles[projectile] = new Projectile( projectile );
561 iter = m_projectiles.find( projectile );
562 }
563
564 (*iter).second->add( a_protare );
565}
Projectile const * projectile(std::string const &a_projectile) const
Definition RISI_read.cc:601

◆ clear()

void GIDI::RISI::Projectiles::clear ( )

Clears the contents of the m_projectiles member.

Definition at line 571 of file RISI_read.cc.

571 {
572
573 for( auto iter = m_projectiles.begin( ); iter != m_projectiles.end( ); ++iter ) delete (*iter).second;
574 m_projectiles.clear( );
575}

Referenced by GIDI::RISI::readRIS(), and ~Projectiles().

◆ print()

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

Calls the print method on each Projectile in this.

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

Definition at line 648 of file RISI_read.cc.

648 {
649
650 for( auto iter = m_projectiles.begin( ); iter != m_projectiles.end( ); ++iter ) (*iter).second->print( a_indent );
651}

◆ printAsRIS_file()

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

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

Definition at line 658 of file RISI_read.cc.

658 {
659
660 std::cout << "#ris : 1.0" << std::endl;
661 for( auto iter = m_projectiles.begin( ); iter != m_projectiles.end( ); ++iter ) (*iter).second->printAsRIS_file( );
662}

◆ products()

std::vector< std::string > GIDI::RISI::Projectiles::products ( std::string const & a_projectile,
std::vector< std::string > const & a_seedTargets,
int a_maxLevel,
double a_energyMax,
bool a_onlyIncludeTargets = true ) const

Return a list of products that can be created for the given projectile and initial 'seed' targets.

Parameters
a_projectile[in] Projectile particle id (e.g. 'n' or 'photon')
a_seedTargets[in] List of initial targets, used to determine what products can be created.
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_onlyIncludeTargets[in] Only return products that correspond to protares.

Definition at line 621 of file RISI_read.cc.

622 {
623
624 std::map<std::string, int> productMap;
625
626 auto projectile = m_projectiles.find( a_projectile );
627 if( projectile != m_projectiles.end( ) ) {
628 for( auto targetIter = a_seedTargets.begin( ); targetIter != a_seedTargets.end( ); ++targetIter )
629 (*projectile).second->products( (*targetIter), 0, a_maxLevel, a_energyMax, productMap );
630 }
631
632 std::vector<std::string> productList;
633 for( auto productIter = productMap.begin( ); productIter != productMap.end( ); ++productIter ) productList.push_back( (*productIter).first );
634
635 if( a_onlyIncludeTargets ) {
636 productList = (*projectile).second->filterProducts( productList );
637 }
638
639 return( productList );
640}

◆ projectile()

Projectile const * GIDI::RISI::Projectiles::projectile ( std::string const & a_projectile) const

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

Parameters
a_projectile[in] The name of the projectile to find.
Returns
A pointer to the Projectile object, or nullptr if not found.

Definition at line 601 of file RISI_read.cc.

601 {
602
603 auto projectileIter = m_projectiles.find( a_projectile );
604 if( projectileIter != m_projectiles.end( ) ) {
605 return( (*projectileIter).second );
606 }
607
608 return( nullptr );
609}

Referenced by add(), and products().

◆ projectileIds()

std::vector< std::string > GIDI::RISI::Projectiles::projectileIds ( ) const

Returns a vector containing the particle ids of all projectiles in this collection.

Returns
A vector of projectile ids.

Definition at line 583 of file RISI_read.cc.

583 {
584
585 std::vector<std::string> projectileList;
586
587 for( auto projectileIter = m_projectiles.begin( ); projectileIter != m_projectiles.end( ); ++projectileIter ) {
588 projectileList.push_back( (*projectileIter).first );
589 }
590
591 return( projectileList );
592}

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