9#include <top/reconstruction_cpp/EnergyMask.h>
10#include <framework/logging/Logger.h>
26 m_dE(dE), m_Wy(dy /
std::abs(dyde))
29 B2ERROR(
"TOP::EnergyMask: dy must be > 0");
33 std::vector<double> x;
35 x.push_back(std::abs(dL * dydL / dyde));
36 x.push_back(std::abs(dx * dydx / dyde));
37 std::sort(x.begin(), x.end());
43 unsigned N = (
m_A +
m_B +
m_C) / 2.0 / dE + 1;
44 if (N < s_Nmin or N >
s_Nmax)
return;
47 for (
unsigned i = 0; i <= N; i++) {
53 for (
unsigned i = 0; i <= N; i++) {
87 return mask(i) * (1 - fract) +
mask(i + 1) * fract;
93 double x1 = (
m_A -
m_B) / 2;
94 double x2 = (
m_A +
m_B) / 2;
95 double x = std::abs(
E);
100 return (x2 - x) / (x2 - x1) /
m_A *
m_Wy;
110 if (std::abs(
E) >= halfWid)
return 0;
112 double t1 = halfWid -
E;
113 double t2 = halfWid +
E;
114 double p = t1 * t1 + t2 * t2;
116 double t3 = t1 -
m_A;
117 double t4 = t2 -
m_A;
118 p -= copysign(t3 * t3, t3) + copysign(t4 * t4, t4);
122 p -= copysign(t3 * t3, t3) + copysign(t4 * t4, t4);
126 p -= copysign(t3 * t3, t3) + copysign(t4 * t4, t4);
const std::vector< double > & getMask() const
Returns discrete mask (note: only half of the mask is stored)
double threeSquareConvolution(double E) const
Returns a value of convolution of three square distributions at given photon energy.
double m_C
the smallset energy full width
double mask(int i) const
Returns mask value at given index from stored discrete mask.
double twoSquareConvolution(double E) const
Returns a value of convolution of two square distributions at given photon energy using the largest t...
double m_Wy
enegy full width of dy
std::vector< double > m_mask
discrete mask (half of)
EnergyMask(double dyde, double dydL, double dydx, double dy, double dL, double dx, double dE)
Constructor.
double m_A
the largest energy full width
double m_B
the middle energy full width
static unsigned s_Nmin
minimal mask size
static unsigned s_Nmax
maximal mask size
Abstract base class for different kinds of events.