Class PDFSegmentSchechter

Inheritance Relationships

Base Type

Class Documentation

class PDFSegmentSchechter : public pdfs::PDFSegment

Class representing a Schechter-function segment of a PDF.

This class implements the PDFSegment interface for a Schechter-function distribution, defined by a characteristic scale and a power-law index. It provides methods to evaluate the PDF at a given point and to sample a random value from the PDF segment according to the Schechter-function distribution.

Public Functions

inline PDFSegmentSchechter(double sMin, double sMax, double sStar, double alpha)

Constructor for PDFSegmentSchechter.

Parameters:
  • sMin – The lower limit of the segment.

  • sMax – The upper limit of the segment.

  • sStar – The characteristic scale of the Schechter function.

  • alpha – The power-law index of the Schechter function.

PDFSegmentSchechter(std::ifstream &file, FileFormats fmt, double &sMin, double &sMax, double &wgt)

Construct PDFSegmentSchechter from a PDF file contents.

How the arguments are interpreted depends on fmt; if fmt is basic, then sMin and sMax are inputs, and wgt is ignored, while if fmt is advanced, then sMin and sMax are ignored and wgt is an output.

Parameters:
  • file – File stream from which to construct

  • fmt – Format of the file being read

  • sMin – The lower limit of the segment

  • sMax – The upper limit of the segment

  • wgt – The weight of the segment

PDFSegmentSchechter(toml::node_view<const toml::node> node, FileFormats fmt, double &sMin, double &sMax, double &wgt)

Construct PDFSegmentSchechter from a toml-format PDF descriptor.

A toml-based counterpart to the ifstream-based constructor above, interpreting its arguments identically: how they are interpreted depends on fmt; if fmt is basic, then sMin and sMax are inputs, and wgt is ignored, while if fmt is advanced, then sMin and sMax are ignored and wgt is an output.

Parameters:
  • node – A toml node view onto this segment’s own segmentN table (see parsePDFToml)

  • fmt – Format of the descriptor being read

  • sMin – The lower limit of the segment

  • sMax – The upper limit of the segment

  • wgt – The weight of the segment

PDFSegmentSchechter(const PDFSegmentSchechter&) = default
auto operator=(const PDFSegmentSchechter&) -> PDFSegmentSchechter& = default
PDFSegmentSchechter(PDFSegmentSchechter&&) = default
auto operator=(PDFSegmentSchechter&&) -> PDFSegmentSchechter& = default
~PDFSegmentSchechter() override = default
inline virtual auto operator()(double x) const -> double override

Evaluate the PDF segment at a given point.

Parameters:

x – The point at which to evaluate the PDF segment.

Returns:

The value of the PDF segment at the given point.

inline virtual auto expectationValue(const double a, const double b) const -> double override

Calculate the expectation value of the PDF segment.

Parameters:
  • a – The lower limit of the range for expectation value calculation; if set to a value <= sMin, will be set to sMin_.

  • b – The upper limit of the range for expectation value calculation; if set to a value >= sMax, will be set to sMax_.

Returns:

The expectation value of the PDF segment.

inline virtual auto expectationValue() const -> double override

Calculate the expectation value of the PDF segment over its entire range.

Returns:

The expectation value of the PDF segment.

inline virtual auto integral(const double a, const double b) const -> double override

Calculate the integral of the PDF segment over a specified range.

Parameters:
  • a – The lower limit of the range for integral calculation; if set to a value <= sMin, will be set to sMin_.

  • b – The upper limit of the range for integral calculation; if set to a value >= sMax, will be set to sMax_.

Returns:

The integral of the PDF segment over the specified range.

inline virtual auto draw(const double a, const double b) const -> double override

Sample a random value from the PDF segment within a specified range.

Parameters:
  • a – The lower limit of the sampling range (should be >= sMin_).

  • b – The upper limit of the sampling range (should be <= sMax_).

Returns:

A random value drawn from the PDF segment within the specified range.

inline virtual auto draw() const -> double override

Sample a random value from the PDF segment.

Returns:

A random value drawn from the PDF segment.