Belle II Software  release-05-01-25
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 35 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 27 of file PulseHeightGenerator.cc.

28  :
29  m_x0(x0), m_p1(p1), m_p2(p2), m_xmax(xmax)
30  {
31  if (x0 <= 0)
32  B2FATAL("TOP::PulseHeightGenerator: parameter x0 must be positive");
33  if (p1 < 0)
34  B2FATAL("TOP::PulseHeightGenerator: parameter p1 must be non-negative");
35  if (p2 <= 0)
36  B2FATAL("TOP::PulseHeightGenerator: parameter p2 must be positive");
37 
38  double xPeak = pow((p1 / p2), 1 / p2) * x0;
39  if (m_xmax < xPeak) xPeak = m_xmax;
40  m_vPeak = getValue(xPeak);
41 
42  }

Member Function Documentation

◆ generate()

double generate ( ) const

Returns generated pulse height.

Returns
height [ADC counts]

Definition at line 45 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 59 of file PulseHeightGenerator.h.

63  :
64 

The documentation for this class was generated from the following files:
Belle2::TOP::PulseHeightGenerator::m_vPeak
double m_vPeak
peak value
Definition: PulseHeightGenerator.h:77
Belle2::TOP::PulseHeightGenerator::m_xmax
double m_xmax
upper bound of range [ADC counts]
Definition: PulseHeightGenerator.h:76
Belle2::TOP::PulseHeightGenerator::m_p1
double m_p1
distribution parameter, must be non-negative
Definition: PulseHeightGenerator.h:74
Belle2::TOP::PulseHeightGenerator::getValue
double getValue(double x) const
Returns distribution value at x.
Definition: PulseHeightGenerator.h:59
Belle2::TOP::PulseHeightGenerator::m_x0
double m_x0
distribution parameter [ADC counts]
Definition: PulseHeightGenerator.h:73
Belle2::TOP::PulseHeightGenerator::m_p2
double m_p2
distribution parameter
Definition: PulseHeightGenerator.h:75