Belle II Software development
PulseHeightGenerator.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <math.h>
12
13namespace Belle2 {
18 namespace TOP {
19
26
27 public:
28
33 {}
34
42 PulseHeightGenerator(double x0, double p1, double p2, double xmax);
43
49 double getValue(double x) const
50 {
51 x /= m_x0;
52 return pow(x, m_p1) * exp(-pow(x, m_p2));
53 }
54
59 double generate() const;
60
61 private:
62
63 double m_x0 = 0;
64 double m_p1 = 0;
65 double m_p2 = 0;
66 double m_xmax = 0;
67 double m_vPeak = 0;
69 };
70
71
72 } // TOP
74} // Belle2
Generates pulse height according to distribution: P(x) = (x/x0)^p1 * exp(-(x/x0)^p2),...
double getValue(double x) const
Returns distribution value at x.
double m_p2
distribution parameter
PulseHeightGenerator()
Default constructor.
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
double generate() const
Returns generated pulse height.
Abstract base class for different kinds of events.