Belle II Software  release-08-01-10
PulseHeightGenerator Class Reference

Generates pulse height according to distribution: P(x) = (x/x0)^p1 * exp(-(x/x0)^p2), p1 >= 0, p2 > 0 in the range 0 to xmax. More...

#include <PulseHeightGenerator.h>

Public Member Functions

 PulseHeightGenerator ()
 Default constructor.
 
 PulseHeightGenerator (double x0, double p1, double p2, double xmax)
 Constructor. More...
 
double getValue (double x) const
 Returns distribution value at x. More...
 
double generate () const
 Returns generated pulse height. More...
 

Private Attributes

double m_x0 = 0
 distribution parameter [ADC counts]
 
double m_p1 = 0
 distribution parameter, must be non-negative
 
double m_p2 = 0
 distribution parameter
 
double m_xmax = 0
 upper bound of range [ADC counts]
 
double m_vPeak = 0
 peak value
 

Detailed Description

Generates pulse height according to distribution: P(x) = (x/x0)^p1 * exp(-(x/x0)^p2), p1 >= 0, p2 > 0 in the range 0 to xmax.

Definition at line 25 of file PulseHeightGenerator.h.

Constructor & Destructor Documentation

◆ PulseHeightGenerator()

PulseHeightGenerator ( double  x0,
double  p1,
double  p2,
double  xmax 
)

Constructor.

Parameters
x0distribution parameter [ADC counts]
p1distribution parameter, must be non-negative
p2distribution parameter
xmaxupper bound of range in which to generate [ADC counts]

Definition at line 25 of file PulseHeightGenerator.cc.

26  :
27  m_x0(x0), m_p1(p1), m_p2(p2), m_xmax(xmax)
28  {
29  if (x0 <= 0)
30  B2FATAL("TOP::PulseHeightGenerator: parameter x0 must be positive");
31  if (p1 < 0)
32  B2FATAL("TOP::PulseHeightGenerator: parameter p1 must be non-negative");
33  if (p2 <= 0)
34  B2FATAL("TOP::PulseHeightGenerator: parameter p2 must be positive");
35 
36  double xPeak = pow((p1 / p2), 1 / p2) * x0;
37  if (m_xmax < xPeak) xPeak = m_xmax;
38  m_vPeak = getValue(xPeak);
39 
40  }
double getValue(double x) const
Returns distribution value at x.
double m_p2
distribution parameter
double m_xmax
upper bound of range [ADC counts]
double m_x0
distribution parameter [ADC counts]
double m_p1
distribution parameter, must be non-negative

Member Function Documentation

◆ generate()

double generate ( ) const

Returns generated pulse height.

Returns
height [ADC counts]

Definition at line 43 of file PulseHeightGenerator.cc.

◆ getValue()

double getValue ( double  x) const
inline

Returns distribution value at x.

Parameters
xargument [ADC counts]
Returns
value

Definition at line 49 of file PulseHeightGenerator.h.

50  {
51  x /= m_x0;
52  return pow(x, m_p1) * exp(-pow(x, m_p2));
53  }

The documentation for this class was generated from the following files: