Belle II Software development
BackgroundPDF Class Reference

Parametrization of background PDF in pixels of single module. More...

#include <BackgroundPDF.h>

Public Member Functions

 BackgroundPDF (int moduleID)
 Class constructor.
 
int getModuleID () const
 Returns slot ID.
 
double getPDFValue (int pixelID) const
 Returns PDF value for given pixel.
 
const std::vector< double > & getPDF () const
 Returns pixel part of PDF.
 
double getEfficiency () const
 Returns average of pixel relative efficiencies.
 

Private Member Functions

void set ()
 Sets the PDF.
 

Private Attributes

int m_moduleID
 slot ID
 
std::vector< double > m_pdf
 pixel part of PDF (index = pixelID - 1)
 
double m_effi = 0
 average relative efficiency
 

Friends

class TOPRecoManager
 

Detailed Description

Parametrization of background PDF in pixels of single module.

Definition at line 23 of file BackgroundPDF.h.

Constructor & Destructor Documentation

◆ BackgroundPDF()

BackgroundPDF ( int  moduleID)
explicit

Class constructor.

Parameters
moduleIDslot ID

Definition at line 22 of file BackgroundPDF.cc.

22 :
23 m_moduleID(moduleID)
24 {
25 const auto* yScanner = TOPRecoManager::getYScanner(moduleID);
26 if (not yScanner) B2FATAL("TOP::BackgroundPDF: invalid slot number, moduleID = " << moduleID);
27
28 const auto& pixelPositions = yScanner->getPixelPositions().getPixels();
29 const auto& pixelMasks = yScanner->getPixelMasks().getMasks();
30 const auto& pixelEfficiencies = yScanner->getPixelEfficiencies().getEfficiencies();
31
32 if (pixelMasks.size() != pixelPositions.size() or pixelEfficiencies.size() != pixelPositions.size()) {
33 B2FATAL("TOP::BackgroundPDF: pixel positions, masks and efficiencies have different sizes for slot " << moduleID
34 << LogVar("pixelPositions.size()", pixelPositions.size())
35 << LogVar("pixelMasks.size()", pixelMasks.size())
36 << LogVar("pixelEfficiencies.size()", pixelEfficiencies.size()));
37 }
38
39 m_pdf.resize(pixelPositions.size(), 0);
40 set();
41 }
void set()
Sets the PDF.
std::vector< double > m_pdf
pixel part of PDF (index = pixelID - 1)
Definition: BackgroundPDF.h:66
static const YScanner * getYScanner(int moduleID)
Returns y-scanner of a given module.
Class to store variables with their name which were sent to the logging service.

Member Function Documentation

◆ getEfficiency()

double getEfficiency ( ) const
inline

Returns average of pixel relative efficiencies.

Returns
average of pixel relative efficiencies

Definition at line 56 of file BackgroundPDF.h.

56{return m_effi;}
double m_effi
average relative efficiency
Definition: BackgroundPDF.h:67

◆ getModuleID()

int getModuleID ( ) const
inline

Returns slot ID.

Returns
slot ID

Definition at line 37 of file BackgroundPDF.h.

37{return m_moduleID;}

◆ getPDF()

const std::vector< double > & getPDF ( ) const
inline

Returns pixel part of PDF.

Returns
pixel part of PDF (index = pixelID - 1)

Definition at line 50 of file BackgroundPDF.h.

50{return m_pdf;}

◆ getPDFValue()

double getPDFValue ( int  pixelID) const

Returns PDF value for given pixel.

Parameters
pixelIDpixel ID
Returns
PDF value

Definition at line 72 of file BackgroundPDF.cc.

73 {
74 unsigned k = pixelID - 1;
75 if (k < m_pdf.size()) return m_pdf[k] / TOPRecoManager::getTimeWindowSize();
76 return 0;
77 }
static double getTimeWindowSize()
Returns size of time window.

◆ set()

void set ( )
private

Sets the PDF.

Definition at line 44 of file BackgroundPDF.cc.

45 {
46 const auto* yScanner = TOPRecoManager::getYScanner(m_moduleID);
47 const auto& pixelPositions = yScanner->getPixelPositions().getPixels();
48 const auto& pixelMasks = yScanner->getPixelMasks().getMasks();
49 const auto& pixelEfficiencies = yScanner->getPixelEfficiencies().getEfficiencies();
50
51 double S = 0;
52 for (size_t i = 0; i < m_pdf.size(); i++) {
53 const auto& pixel = pixelPositions[i];
54 double s = pixel.Dx * pixel.Dy;
55 S += s;
56 if (pixelMasks[i]) {
57 m_pdf[i] = s * pixelEfficiencies[i];
58 } else {
59 m_pdf[i] = 0;
60 }
61 }
62
63 double sum = 0;
64 for (auto pdf : m_pdf) sum += pdf;
65 if (sum == 0) return;
66
67 for (auto& pdf : m_pdf) pdf /= sum;
68 m_effi = sum / S;
69 }

Friends And Related Function Documentation

◆ TOPRecoManager

friend class TOPRecoManager
friend

Definition at line 69 of file BackgroundPDF.h.

Member Data Documentation

◆ m_effi

double m_effi = 0
private

average relative efficiency

Definition at line 67 of file BackgroundPDF.h.

◆ m_moduleID

int m_moduleID
private

slot ID

Definition at line 65 of file BackgroundPDF.h.

◆ m_pdf

std::vector<double> m_pdf
private

pixel part of PDF (index = pixelID - 1)

Definition at line 66 of file BackgroundPDF.h.


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