Class SourceGenericComposition

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class SourceGenericComposition : public SourceFeature

Add multiple cosmic rays with energies described by an expression string.

This is particularly useful if an arbitrary combination of nuclei types with specific energy spectra. The strings parsed may contain ‘A’ (atomic mass), ‘Z’ (atomic number). The following units are recognized as part of the strings: GeV, TeV, PeV, EeV. The variable for energy is ‘E’, with limits ‘Emin’, ‘Emax’. This property only works if muparser is available. For details about the library see: https://beltoforion.de/en/muparser/

Public Functions

SourceGenericComposition(double Emin, double Emax, std::string expression, size_t bins = 1024)

Constructor

Parameters:
  • Emin – minimum energy [in Joules]

  • Emax – maximum energy [in Joules]

  • expression – string containing the expression to generate the composition

  • bins – number of energy bins

void add(int id, double abundance)

Add an individual particle id.

Parameters:
  • id – id of the particle following the PDG numbering scheme

  • abundance – relative abundance of individual particle species

void add(int A, int Z, double abundance)

Add an individual particle id.

Parameters:
  • A – atomic mass of the cosmic-ray nucleus

  • Z – atomic number of the cosmic-ray nucleus

  • abundance – relative abundance of individual particle species

virtual void prepareParticle(ParticleState &particle) const
void setDescription()
inline const std::vector<double> *getNucleusCDF(int id) const
virtual void prepareCandidate(Candidate &candidate) const
std::string getDescription() const
inline size_t addReference() const
inline size_t removeReference() const
inline int removeReferenceNoDelete() const
inline size_t getReferenceCount() const

Protected Attributes

double Emin
double Emax
size_t bins
std::string expression
std::vector<double> energy
std::vector<Nucleus> nuclei
std::vector<double> cdf
std::string description
mutable size_t _referenceCount
struct Nucleus

Public Members

int id
std::vector<double> cdf