|
CORSIKA8
0.0.0
The framework to simulate particle cascades for astroparticle physics
|
Describes the composition of matter Allowes and handles the creation of custom matter compositions. More...
#include <NuclearComposition.hpp>
Public Member Functions | |
| NuclearComposition (std::vector< Code > const &pComponents, std::vector< float > const &pFractions) | |
| Constructor The constructore takes a list of elements and a list which describe the relative amount. More... | |
| template<typename TFunction > | |
| auto | getWeightedSum (TFunction const &func) const |
| Sum all all relative composition weighted by func(element) This function sums all relative compositions given during this classes construction. More... | |
| size_t | getSize () const |
| Number of elements in the composition array. More... | |
| std::vector< float > const & | getFractions () const |
| Returns a const reference to the fraction. | |
| std::vector< Code > const & | getComponents () const |
| Returns a const reference to the fraction. | |
| double const | getAverageMassNumber () const |
| template<class TRNG > | |
| Code | sampleTarget (std::vector< CrossSectionType > const &sigma, TRNG &randomStream) const |
| size_t | getHash () const |
| bool | operator== (NuclearComposition const &v) const |
| based on hash value | |
Describes the composition of matter Allowes and handles the creation of custom matter compositions.
Definition at line 26 of file NuclearComposition.hpp.
| corsika::NuclearComposition::NuclearComposition | ( | std::vector< Code > const & | pComponents, |
| std::vector< float > const & | pFractions | ||
| ) |
Constructor The constructore takes a list of elements and a list which describe the relative amount.
Booth lists need to have the same length and the sum all of fractions should be 1. Otherwise an exception is thrown
| pComponents | List of particle types |
| pFractions | List of fractions how much each particle contributes. The sum needs to add up to 1 |
| size_t corsika::NuclearComposition::getSize | ( | ) | const |
Number of elements in the composition array.
| returns | the number of elements in the composition array |
| auto corsika::NuclearComposition::getWeightedSum | ( | TFunction const & | func | ) | const |
Sum all all relative composition weighted by func(element) This function sums all relative compositions given during this classes construction.
Each entry is weighted by the user defined function func given to this function.
| TFunction | Type of functions for the weights. The type should be Code -> float |
| func | Functions for reweighting specific elements |
| returns | the weighted sum with the type defined by the return type of func |