Class SourceMassDistribution

Inheritance Relationships

Base Type

Class Documentation

class SourceMassDistribution : public SourceFeature

Source position follows a given mass distribution.

The (source)position of the candidate is sampled from a given mass distribution. The distribution uses the getDensity function of the density module. If a weighting for different components is desired, the use of different densities in a densityList is recommended.

The sampling range of the position can be restricted. Default is a sampling for x in [-20, 20] * kpc, y in [-20, 20] * kpc and z in [-4, 4] * kpc.

Public Functions

SourceMassDistribution(ref_ptr<Density> density, double maxDensity = 0, double x = 20 * kpc, double y = 20 * kpc, double z = 4 * kpc)

Constructor

Parameters:
  • density – CRPropa mass distribution

  • maxDensity – maximal density in the region where the position should be sampled

  • x – the position will be sampled in the range [-x, x]. Non symmetric values can be set with setXrange.

  • y – the position will be sampled in the range [-y, y]. Non symmetric values can be set with setYrange.

  • z – the position will be sampled in the range [-z, z]. Non symmetric values can be set with setZrange.

virtual void prepareParticle(ParticleState &particle) const
void setMaximalDensity(double maxDensity)

Set the maximal density in the region of interest. This parameter is necessary for the sampling

Parameters:

maxDensity – maximal density in [particle / m^3]

void setXrange(double xMin, double xMax)

set x-range in which the position of the candidate will be sampled. x in [xMin, xMax].

Parameters:
  • xMin – minimal x value of the allowed sample range in [m]

  • xMax – maximal x value of the allowed sample range in [m]

void setYrange(double yMin, double yMax)

set y-range in which the position of the candidate will be sampled. y in [yMin, yMax].

Parameters:
  • yMin – minimal y value of the allowed sample range in [m]

  • yMax – maximal y value of the allowed sample range in [m]

void setZrange(double zMin, double zMax)

set z-range in which the position of the candidate will be sampled. z in [zMin, zMax].

Parameters:
  • zMin – minimal z value of the allowed sample range in [m]

  • zMax – maximal z value of the allowed sample range in [m]

Vector3d samplePosition() const
void setMaximalTries(int tries)

set the number of maximal tries until the sampling routine breaks.

Parameters:

tries – number of the maximal tries

std::string getDescription()
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

std::string description
mutable size_t _referenceCount