9#include <top/reconstruction_cpp/PDF1Dim.h>
10#include <top/reconstruction_cpp/TOPRecoManager.h>
11#include <framework/logging/Logger.h>
27 if (binSize <= 0) B2FATAL(
"TOP::PDF1Dim: bin size must be positive");
28 if (not pdfConstructor.
isValid()) {
29 B2ERROR(
"TOP::PDF1Dim: PDFConstructor is not valid, cannot continue");
39 m_times.push_back(hit.time);
42 std::sort(m_times.begin(), m_times.end());
43 m_tminFot = m_times.front();
44 m_tmaxFot = m_times.back();
58 double t = pdfHisto.GetBinCenter(i + 1);
64 for (
const auto& pixelPDF : pdfConstructor.
getSignalPDF()) {
65 for (const auto& peak : pixelPDF.getPDFPeaks()) {
66 pdfHisto.Fill(peak.t0, m_expectedSignal * peak.nph);
72 m_tminPDF = std::min(m_tminPDF, peak.t0);
73 m_tmaxPDF = std::max(m_tmaxPDF, peak.t0);
78 for (
int i = 0; i < m_numBins; i++) {
79 m_logF.push_back(log(pdfHisto.GetBinContent(i + 1)));
81 m_logBkg = log(m_bkg);
84 m_minT0 = m_tminFot - m_tmaxPDF - 2 * m_binSize;
85 double maxT0 = m_tmaxFot - m_tminPDF;
86 m_numBinsT0 = std::max(
int((maxT0 - m_minT0) / m_binSize), 3) + 1;
87 m_maxT0 = m_minT0 + m_binSize * m_numBinsT0;
95 for (
const auto& time :
m_times) {
97 double t = time - timeShift;
111 for (
size_t i = 0; i <
m_logF.size(); i++) {
112 h.SetBinContent(i + 1, exp(
m_logF[i]));
double getLogL(double timeShift) const
Returns log likelihood.
double m_expectedSignal
expected number of signal photons
TH1F getHistogram(std::string name, std::string title) const
Returns binned one dimensional PDF (projection to time axis)
double m_logBkg
log(m_bkg)
double m_expectedDelta
expected number of delta-ray photons
double m_maxTime
upper edge of the last bin
double m_minTime
lower edge of the first bin
int m_numBins
number of bins for signal PDF
int m_moduleID
slot number
double m_expectedBG
expected number of background photons
std::vector< double > m_times
photon times, from a given slot
int getModuleID() const
Returns slot number.
PDF1Dim(const PDFConstructor &pdfConstructor, double binSize, double timeWindow)
Full constructor.
double m_bkg
background [photons/bin]
std::vector< double > m_logF
log(PDF) values
PDF construction and log likelihood determination for a given track and particle hypothesis.
double getBkgRate() const
Returns estimated background hit rate.
const std::vector< TOPTrack::SelectedHit > & getSelectedHits() const
Returns selected photon hits belonging to this slot.
double getExpectedDeltaPhotons() const
Returns the expected number of delta-ray photons within the default time window.
bool isValid() const
Checks the object status.
const std::vector< SignalPDF > & getSignalPDF() const
Returns signal PDF.
double getExpectedSignalPhotons() const
Returns the expected number of signal photons within the default time window.
const DeltaRayPDF & getDeltaRayPDF() const
Returns delta-ray PDF.
Singleton class providing pre-constructed reconstruction objects.
Abstract base class for different kinds of events.