Belle II Software development
EnergyMask.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 <vector>
12#include <cmath>
13
14namespace Belle2 {
19 namespace TOP {
20
24 class EnergyMask {
25
26 public:
27
38 EnergyMask(double dyde, double dydL, double dydx, double dy, double dL, double dx, double dE);
39
44 static void setNMin(unsigned Nmin) {s_Nmin = Nmin;}
45
50 static void setNMax(unsigned Nmax) {s_Nmax = Nmax;}
51
56 double getStep() const {return m_dE;}
57
62 double getFullWidth() const {return m_A + m_B + m_C;}
63
68 const std::vector<double>& getMask() const {return m_mask;}
69
75 double getMask(double E) const;
76
83 double getMask(int i) const;
84
92 double getMask(int i, double fract) const;
93
99 double getEnergyDifference(int i) {return i * m_dE;}
100
101 private:
102
109 double twoSquareConvolution(double E) const;
110
116 double threeSquareConvolution(double E) const;
117
123 double mask(int i) const;
124
125 double m_dE = 0;
126 double m_Wy = 0;
127 double m_A = 0;
128 double m_B = 0;
129 double m_C = 0;
130 std::vector<double> m_mask;
132 static unsigned s_Nmin;
133 static unsigned s_Nmax;
135 };
136
137
138 inline double EnergyMask::mask(int i) const
139 {
140 unsigned k = std::abs(i);
141 if (k < m_mask.size()) return m_mask[k];
142 return 0;
143 }
144
145
146 } // namespace TOP
148} // namespace Belle2
R E
internal precision of FFTW codelets
A mask for energy masking.
Definition: EnergyMask.h:24
const std::vector< double > & getMask() const
Returns discrete mask (note: only half of the mask is stored)
Definition: EnergyMask.h:68
double getFullWidth() const
Returns mask full width.
Definition: EnergyMask.h:62
double threeSquareConvolution(double E) const
Returns a value of convolution of three square distributions at given photon energy.
Definition: EnergyMask.cc:107
double m_C
the smallset energy full width
Definition: EnergyMask.h:129
double mask(int i) const
Returns mask value at given index from stored discrete mask.
Definition: EnergyMask.h:138
double twoSquareConvolution(double E) const
Returns a value of convolution of two square distributions at given photon energy using the largest t...
Definition: EnergyMask.cc:91
double m_Wy
enegy full width of dy
Definition: EnergyMask.h:126
static void setNMax(unsigned Nmax)
Sets maximal size of discrete mask.
Definition: EnergyMask.h:50
double getStep() const
Returns energy step size of the discrete mask.
Definition: EnergyMask.h:56
std::vector< double > m_mask
discrete mask (half of)
Definition: EnergyMask.h:130
double m_A
the largest energy full width
Definition: EnergyMask.h:127
double m_B
the middle energy full width
Definition: EnergyMask.h:128
static unsigned s_Nmin
minimal mask size
Definition: EnergyMask.h:132
double m_dE
energy step
Definition: EnergyMask.h:125
static unsigned s_Nmax
maximal mask size
Definition: EnergyMask.h:133
double getEnergyDifference(int i)
Returns energy difference w.r.t center of mask.
Definition: EnergyMask.h:99
static void setNMin(unsigned Nmin)
Sets minimal size of discrete mask.
Definition: EnergyMask.h:44
Abstract base class for different kinds of events.