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>
|
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
|
|
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.
◆ PulseHeightGenerator() [1/2]
◆ PulseHeightGenerator() [2/2]
Constructor.
- Parameters
-
x0 | distribution parameter [ADC counts] |
p1 | distribution parameter, must be non-negative |
p2 | distribution parameter |
xmax | upper bound of range in which to generate [ADC counts] |
Definition at line 25 of file PulseHeightGenerator.cc.
26 :
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;
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
◆ generate()
double generate |
( |
| ) |
const |
Returns generated pulse height.
- Returns
- height [ADC counts]
Definition at line 43 of file PulseHeightGenerator.cc.
44 {
46 while (true) {
47 double x = gRandom->Uniform(
m_xmax);
49 }
50 }
◆ getValue()
double getValue |
( |
double |
x | ) |
const |
|
inline |
Returns distribution value at x.
- Parameters
-
- Returns
- value
Definition at line 49 of file PulseHeightGenerator.h.
50 {
52 return pow(x,
m_p1) * exp(-pow(x,
m_p2));
53 }
◆ m_p1
◆ m_p2
◆ m_vPeak
◆ m_x0
◆ m_xmax
The documentation for this class was generated from the following files: