Describes the composition of matter Allowes and handles the creation of custom matter compositions.
More...
#include <NuclearComposition.hpp>
|
| | NuclearComposition (std::vector< Code > const &pComponents, std::vector< double > const &pFractions) |
| | Constructor The constructore takes a list of elements and a list which describe the relative amount. More...
|
| |
| template<typename TFunction > |
| auto | getWeighted (TFunction func) const |
| | Returns a vector of the same length as elements in the material with the weighted return of "func". More...
|
| |
| template<typename TFunction > |
| auto | getWeightedSum (TFunction func) const -> decltype(func(std::declval< Code >())) |
| | 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< double > 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 28 of file NuclearComposition.hpp.
◆ NuclearComposition()
| corsika::NuclearComposition::NuclearComposition |
( |
std::vector< Code > const & |
pComponents, |
|
|
std::vector< double > 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.
- Parameters
-
| pComponents | List of particle types. |
| pFractions | List of fractions how much each particle contributes. The sum needs to add up to 1. |
◆ getSize()
| size_t corsika::NuclearComposition::getSize |
( |
| ) |
const |
Number of elements in the composition array.
- Return values
-
| returns | the number of elements in the composition array. |
◆ getWeighted()
template<typename TFunction >
| auto corsika::NuclearComposition::getWeighted |
( |
TFunction |
func | ) |
const |
Returns a vector of the same length as elements in the material with the weighted return of "func".
The typical default application is for cross section weighted with fraction in the material.
- Template Parameters
-
| TFunction | Type of functions for the weights. The type should be Code -> CrossSectionType. |
- Parameters
-
| func | Functions for reweighting specific elements. |
- Return values
-
| returns | the vector with weighted return types of func. |
◆ getWeightedSum()
template<typename TFunction >
| auto corsika::NuclearComposition::getWeightedSum |
( |
TFunction |
func | ) |
const -> decltype(func(std::declval< Code >())) |
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.
- Template Parameters
-
| TFunction | Type of functions for the weights. The type should be Code -> double. |
- Parameters
-
| func | Functions for reweighting specific elements. |
- Return values
-
| returns | the weighted sum with the type defined by the return type of func. |
The documentation for this class was generated from the following file: