9#include <top/reconstruction_cpp/BackgroundPDF.h>
10#include <top/reconstruction_cpp/TOPRecoManager.h>
11#include <framework/logging/Logger.h>
26 if (not yScanner) B2FATAL(
"TOP::BackgroundPDF: invalid slot number, moduleID = " << moduleID);
28 const auto& pixelPositions = yScanner->getPixelPositions().getPixels();
29 const auto& pixelMasks = yScanner->getPixelMasks().getMasks();
30 const auto& pixelEfficiencies = yScanner->getPixelEfficiencies().getEfficiencies();
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()));
39 m_pdf.resize(pixelPositions.size(), 0);
47 const auto& pixelPositions = yScanner->getPixelPositions().getPixels();
48 const auto& pixelMasks = yScanner->getPixelMasks().getMasks();
49 const auto& pixelEfficiencies = yScanner->getPixelEfficiencies().getEfficiencies();
52 for (
size_t i = 0; i <
m_pdf.size(); i++) {
53 const auto& pixel = pixelPositions[i];
54 double s = pixel.Dx * pixel.Dy;
57 m_pdf[i] = s * pixelEfficiencies[i];
64 for (
auto pdf :
m_pdf) sum += pdf;
67 for (
auto& pdf :
m_pdf) pdf /= sum;
74 unsigned k = pixelID - 1;
BackgroundPDF(int moduleID)
Class constructor.
double getPDFValue(int pixelID) const
Returns PDF value for given pixel.
double m_effi
average relative efficiency
std::vector< double > m_pdf
pixel part of PDF (index = pixelID - 1)
static double getTimeWindowSize()
Returns size of time window.
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.
Abstract base class for different kinds of events.