A mask for energy masking.
More...
#include <EnergyMask.h>
|
| EnergyMask (double dyde, double dydL, double dydx, double dy, double dL, double dx, double dE) |
| Constructor.
|
|
double | getStep () const |
| Returns energy step size of the discrete mask.
|
|
double | getFullWidth () const |
| Returns mask full width.
|
|
const std::vector< double > & | getMask () const |
| Returns discrete mask (note: only half of the mask is stored)
|
|
double | getMask (double E) const |
| Returns mask value at given energy difference by calling direct calculation of the convolution.
|
|
double | getMask (int i) const |
| Returns mask value at given index from stored discrete mask.
|
|
double | getMask (int i, double fract) const |
| Returns mask value with linear interpolation between stored discrete mask elements.
|
|
double | getEnergyDifference (int i) |
| Returns energy difference w.r.t center of mask.
|
|
|
static void | setNMin (unsigned Nmin) |
| Sets minimal size of discrete mask.
|
|
static void | setNMax (unsigned Nmax) |
| Sets maximal size of discrete mask.
|
|
|
double | twoSquareConvolution (double E) const |
| Returns a value of convolution of two square distributions at given photon energy using the largest two of full widths (m_A, m_B).
|
|
double | threeSquareConvolution (double E) const |
| Returns a value of convolution of three square distributions at given photon energy.
|
|
double | mask (int i) const |
| Returns mask value at given index from stored discrete mask.
|
|
|
double | m_dE = 0 |
| energy step
|
|
double | m_Wy = 0 |
| enegy full width of dy
|
|
double | m_A = 0 |
| the largest energy full width
|
|
double | m_B = 0 |
| the middle energy full width
|
|
double | m_C = 0 |
| the smallset energy full width
|
|
std::vector< double > | m_mask |
| discrete mask (half of)
|
|
|
static unsigned | s_Nmin = 4 |
| minimal mask size
|
|
static unsigned | s_Nmax = 256 |
| maximal mask size
|
|
A mask for energy masking.
Definition at line 24 of file EnergyMask.h.
◆ EnergyMask()
EnergyMask |
( |
double |
dyde, |
|
|
double |
dydL, |
|
|
double |
dydx, |
|
|
double |
dy, |
|
|
double |
dL, |
|
|
double |
dx, |
|
|
double |
dE |
|
) |
| |
Constructor.
- Parameters
-
dyde | derivative dy/de [cm/eV] |
dydL | derivative dy/dL |
dydx | derivative dy/dx |
dy | effective PMT pad size in y [cm] |
dL | length of particle trajectory within the quartz [cm] |
dx | PMT pad size in x [cm] |
dE | energy step [eV] |
Definition at line 25 of file EnergyMask.cc.
25 :
27 {
28 if (dy <= 0) {
29 B2ERROR("TOP::EnergyMask: dy must be > 0");
30 return;
31 }
32
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());
38
42
43 unsigned N = (
m_A +
m_B +
m_C) / 2.0 / dE + 1;
44 if (N < s_Nmin or N >
s_Nmax)
return;
45
47 for (unsigned i = 0; i <= N; i++) {
51 }
52 } else {
53 for (unsigned i = 0; i <= N; i++) {
57 }
58 }
59 }
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 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)
double m_A
the largest energy full width
double m_B
the middle energy full width
static unsigned s_Nmax
maximal mask size
◆ getEnergyDifference()
double getEnergyDifference |
( |
int |
i | ) |
|
|
inline |
Returns energy difference w.r.t center of mask.
- Parameters
-
i | index (all values are valid) |
- Returns
- energy difference w.r.t center of mask [eV]
Definition at line 99 of file EnergyMask.h.
◆ getFullWidth()
double getFullWidth |
( |
| ) |
const |
|
inline |
Returns mask full width.
- Returns
- full width [eV]
Definition at line 62 of file EnergyMask.h.
◆ getMask() [1/4]
const std::vector< double > & getMask |
( |
| ) |
const |
|
inline |
Returns discrete mask (note: only half of the mask is stored)
- Returns
- discrete mask
Definition at line 68 of file EnergyMask.h.
◆ getMask() [2/4]
double getMask |
( |
double |
E | ) |
const |
Returns mask value at given energy difference by calling direct calculation of the convolution.
- Parameters
-
E | photon energy difference w.r.t center of mask [eV] |
- Returns
- mask value
Definition at line 62 of file EnergyMask.cc.
63 {
66 } else {
68 }
69 }
◆ getMask() [3/4]
double getMask |
( |
int |
i | ) |
const |
Returns mask value at given index from stored discrete mask.
If discrete mask is empty it calls direct calculation of convolution.
- Parameters
-
i | index (all values are valid) |
- Returns
- mask value
Definition at line 72 of file EnergyMask.cc.
73 {
76 }
const std::vector< double > & getMask() const
Returns discrete mask (note: only half of the mask is stored)
double mask(int i) const
Returns mask value at given index from stored discrete mask.
◆ getMask() [4/4]
double getMask |
( |
int |
i, |
|
|
double |
fract |
|
) |
| const |
Returns mask value with linear interpolation between stored discrete mask elements.
If discrete mask is empty it calls direct calculation of convolution.
- Parameters
-
i | index (all values are valid) |
fract | fractional part for linear interpolation (values btw. -0.5 and 0.5) |
- Returns
- mask value
Definition at line 79 of file EnergyMask.cc.
80 {
82
83 if (fract < 0) {
84 i--;
85 fract += 1;
86 }
87 return mask(i) * (1 - fract) +
mask(i + 1) * fract;
88 }
◆ getStep()
Returns energy step size of the discrete mask.
- Returns
- step [eV]
Definition at line 56 of file EnergyMask.h.
◆ mask()
double mask |
( |
int |
i | ) |
const |
|
inlineprivate |
Returns mask value at given index from stored discrete mask.
- Parameters
-
i | index (all values are valid) |
- Returns
- mask value or 0 if index is out of array range
Definition at line 138 of file EnergyMask.h.
139 {
140 unsigned k = std::abs(i);
142 return 0;
143 }
◆ setNMax()
static void setNMax |
( |
unsigned |
Nmax | ) |
|
|
inlinestatic |
Sets maximal size of discrete mask.
- Parameters
-
Definition at line 50 of file EnergyMask.h.
◆ setNMin()
static void setNMin |
( |
unsigned |
Nmin | ) |
|
|
inlinestatic |
Sets minimal size of discrete mask.
- Parameters
-
Definition at line 44 of file EnergyMask.h.
static unsigned s_Nmin
minimal mask size
◆ threeSquareConvolution()
double threeSquareConvolution |
( |
double |
E | ) |
const |
|
private |
Returns a value of convolution of three square distributions at given photon energy.
- Parameters
-
E | photon energy difference w.r.t center of mask [eV] |
- Returns
- convolution value
Definition at line 107 of file EnergyMask.cc.
108 {
110 if (std::abs(
E) >= halfWid)
return 0;
111
112 double t1 = halfWid -
E;
113 double t2 = halfWid +
E;
114 double p = t1 * t1 + t2 * t2;
115
116 double t3 = t1 -
m_A;
117 double t4 = t2 -
m_A;
118 p -= copysign(t3 * t3, t3) + copysign(t4 * t4, t4);
119
122 p -= copysign(t3 * t3, t3) + copysign(t4 * t4, t4);
123
126 p -= copysign(t3 * t3, t3) + copysign(t4 * t4, t4);
127
129 }
◆ twoSquareConvolution()
double twoSquareConvolution |
( |
double |
E | ) |
const |
|
private |
Returns a value of convolution of two square distributions at given photon energy using the largest two of full widths (m_A, m_B).
- Parameters
-
E | photon energy difference w.r.t center of mask [eV] |
- Returns
- convolution value
Definition at line 91 of file EnergyMask.cc.
92 {
93 double x1 = (
m_A -
m_B) / 2;
94 double x2 = (
m_A +
m_B) / 2;
95 double x = std::abs(
E);
96
97 if (x < x1) {
99 } else if (x < x2) {
100 return (x2 - x) / (x2 - x1) /
m_A *
m_Wy;
101 } else {
102 return 0;
103 }
104 }
◆ m_A
◆ m_B
◆ m_C
the smallset energy full width
Definition at line 129 of file EnergyMask.h.
◆ m_dE
◆ m_mask
std::vector<double> m_mask |
|
private |
◆ m_Wy
◆ s_Nmax
◆ s_Nmin
The documentation for this class was generated from the following files: