Belle II Software  release-08-01-10
EnergyMask Class Reference

A mask for energy masking. More...

#include <EnergyMask.h>

Collaboration diagram for EnergyMask:

Public Member Functions

 EnergyMask (double dyde, double dydL, double dydx, double dy, double dL, double dx, double dE)
 Constructor. More...
 
double getStep () const
 Returns energy step size of the discrete mask. More...
 
double getFullWidth () const
 Returns mask full width. More...
 
const std::vector< double > & getMask () const
 Returns discrete mask (note: only half of the mask is stored) More...
 
double getMask (double E) const
 Returns mask value at given energy difference by calling direct calculation of the convolution. More...
 
double getMask (int i) const
 Returns mask value at given index from stored discrete mask. More...
 
double getMask (int i, double fract) const
 Returns mask value with linear interpolation between stored discrete mask elements. More...
 
double getEnergyDifference (int i)
 Returns energy difference w.r.t center of mask. More...
 

Static Public Member Functions

static void setNMin (unsigned Nmin)
 Sets minimal size of discrete mask. More...
 
static void setNMax (unsigned Nmax)
 Sets maximal size of discrete mask. More...
 

Private Member Functions

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). More...
 
double threeSquareConvolution (double E) const
 Returns a value of convolution of three square distributions at given photon energy. More...
 
double mask (int i) const
 Returns mask value at given index from stored discrete mask. More...
 

Private Attributes

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 Private Attributes

static unsigned s_Nmin = 4
 minimal mask size
 
static unsigned s_Nmax = 256
 maximal mask size
 

Detailed Description

A mask for energy masking.

Definition at line 24 of file EnergyMask.h.

Constructor & Destructor Documentation

◆ EnergyMask()

EnergyMask ( double  dyde,
double  dydL,
double  dydx,
double  dy,
double  dL,
double  dx,
double  dE 
)

Constructor.

Parameters
dydederivative dy/de [cm/eV]
dydLderivative dy/dL
dydxderivative dy/dx
dyeffective PMT pad size in y [cm]
dLlength of particle trajectory within the quartz [cm]
dxPMT pad size in x [cm]
dEenergy step [eV]

Definition at line 25 of file EnergyMask.cc.

25  :
26  m_dE(dE), m_Wy(dy / std::abs(dyde))
27  {
28  if (dy <= 0) {
29  B2ERROR("TOP::EnergyMask: dy must be > 0");
30  return;
31  }
32 
33  std::vector<double> x;
34  x.push_back(m_Wy);
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 
39  m_A = x[2];
40  m_B = x[1];
41  m_C = x[0];
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 
46  if (m_C / m_A > 0.001) {
47  for (unsigned i = 0; i <= N; i++) {
48  double E = i * dE;
49  double p = threeSquareConvolution(E);
50  m_mask.push_back(p);
51  }
52  } else {
53  for (unsigned i = 0; i <= N; i++) {
54  double E = i * dE;
55  double p = twoSquareConvolution(E);
56  m_mask.push_back(p);
57  }
58  }
59  }
R E
internal precision of FFTW codelets
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 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
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
double m_dE
energy step
Definition: EnergyMask.h:125
static unsigned s_Nmax
maximal mask size
Definition: EnergyMask.h:133

Member Function Documentation

◆ getEnergyDifference()

double getEnergyDifference ( int  i)
inline

Returns energy difference w.r.t center of mask.

Parameters
iindex (all values are valid)
Returns
energy difference w.r.t center of mask [eV]

Definition at line 99 of file EnergyMask.h.

99 {return i * m_dE;}

◆ 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
Ephoton energy difference w.r.t center of mask [eV]
Returns
mask value

Definition at line 62 of file EnergyMask.cc.

◆ 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
iindex (all values are valid)
Returns
mask value

Definition at line 72 of file EnergyMask.cc.

◆ 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
iindex (all values are valid)
fractfractional part for linear interpolation (values btw. -0.5 and 0.5)
Returns
mask value

Definition at line 79 of file EnergyMask.cc.

◆ getStep()

double getStep ( ) const
inline

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
iindex (all values are valid)
Returns
mask value or 0 if index is out of array range

Definition at line 138 of file EnergyMask.h.

◆ setNMax()

static void setNMax ( unsigned  Nmax)
inlinestatic

Sets maximal size of discrete mask.

Parameters
Nmaxmaximal size

Definition at line 50 of file EnergyMask.h.

◆ setNMin()

static void setNMin ( unsigned  Nmin)
inlinestatic

Sets minimal size of discrete mask.

Parameters
Nminminimal size

Definition at line 44 of file EnergyMask.h.

◆ threeSquareConvolution()

double threeSquareConvolution ( double  E) const
private

Returns a value of convolution of three square distributions at given photon energy.

Parameters
Ephoton energy difference w.r.t center of mask [eV]
Returns
convolution value

Definition at line 107 of file EnergyMask.cc.

◆ 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
Ephoton energy difference w.r.t center of mask [eV]
Returns
convolution value

Definition at line 91 of file EnergyMask.cc.


The documentation for this class was generated from the following files: