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

Binned one dimensional PDF (a projection of PDF to time axis) More...

#include <PDF1Dim.h>

Collaboration diagram for PDF1Dim:

Public Member Functions

 PDF1Dim (const PDFConstructor &pdfConstructor, double binSize, double timeWindow)
 Full constructor. More...
 
double getBinSize () const
 Returns actual bin size used. More...
 
int getModuleID () const
 Returns slot number. More...
 
TH1F getHistogram (std::string name, std::string title) const
 Returns binned one dimensional PDF (projection to time axis) More...
 
const std::vector< double > & getPhotonTimes () const
 Returns photon times of selected photons in a given slot. More...
 
int getNumOfPhotons () const
 Returns number of photons. More...
 
double getExpectedSignal () const
 Returns expected number of signal photons. More...
 
double getExpectedDeltaPhotons () const
 Returns expected number of delta-ray photons. More...
 
double getExpectedBG () const
 Returns expected number of background photons. More...
 
double getTminPDF () const
 Returns minimal time of signal PDF. More...
 
double getTmaxPDF () const
 Returns maximal time of signal PDF. More...
 
double getTminFot () const
 Returns minimal time of selected photons. More...
 
double getTmaxFot () const
 Returns maximal time of selected photons. More...
 
double getMinT0 () const
 Returns lower edge of the T0 search region. More...
 
double getMaxT0 () const
 Returns upper edge of the T0 search region. More...
 
int getNumBinsT0 () const
 Returns number of bins the T0 search region. More...
 
double getLogL (double timeShift) const
 Returns log likelihood. More...
 

Private Attributes

int m_moduleID = 0
 slot number
 
int m_numBins = 0
 number of bins for signal PDF
 
double m_minTime = 0
 lower edge of the first bin
 
double m_maxTime = 0
 upper edge of the last bin
 
std::vector< double > m_times
 photon times, from a given slot
 
double m_tminPDF = 0
 minimal time of signal PDF
 
double m_tmaxPDF = 0
 maximal time of signal PDF
 
double m_tminFot = 0
 minimal time of photons
 
double m_tmaxFot = 0
 maximal time of photons
 
double m_minT0 = 0
 minimal T0
 
double m_maxT0 = 0
 maximal T0
 
int m_numBinsT0 = 0
 number of bins for T0 finder w/ same bin size as PDF
 
double m_expectedBG = 0
 expected number of background photons
 
double m_expectedSignal = 0
 expected number of signal photons
 
double m_expectedDelta = 0
 expected number of delta-ray photons
 
double m_bkg = 0
 background [photons/bin]
 
double m_binSize = 0
 bin size
 
std::vector< double > m_logF
 log(PDF) values
 
double m_logBkg = 0
 log(m_bkg)
 

Detailed Description

Binned one dimensional PDF (a projection of PDF to time axis)

Definition at line 25 of file PDF1Dim.h.

Constructor & Destructor Documentation

◆ PDF1Dim()

PDF1Dim ( const PDFConstructor pdfConstructor,
double  binSize,
double  timeWindow 
)

Full constructor.

Parameters
pdfConstructorreconstruction object
binSizeapproximate bin size (use getBinSize() to get the actual one)
timeWindowfull time window size

Definition at line 22 of file PDF1Dim.cc.

22  :
23  m_moduleID(pdfConstructor.getModuleID()), m_minTime(TOPRecoManager::getMinTime()),
25  {
26 
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");
30  return;
31  }
32 
33  // binning
34  m_numBins = (m_maxTime - m_minTime) / binSize + 1;
36 
37  // photon times
38  for (const auto& hit : pdfConstructor.getSelectedHits()) {
39  m_times.push_back(hit.time);
40  }
41  if (not m_times.empty()) {
42  std::sort(m_times.begin(), m_times.end());
43  m_tminFot = m_times.front();
44  m_tmaxFot = m_times.back();
45  }
46 
47  m_expectedSignal = pdfConstructor.getExpectedSignalPhotons();
48  m_expectedDelta = pdfConstructor.getExpectedDeltaPhotons();
49  m_expectedBG = std::max(pdfConstructor.getBkgRate() * timeWindow, 0.1);
50 
51  // temporary histogram to make 1D projection of PDF
52  TH1F pdfHisto("pdf_temporary", "", m_numBins, m_minTime, m_maxTime);
53 
54  // first add background and delta-ray PDF's
55  m_bkg = m_expectedBG / timeWindow * m_binSize;
56  const auto& deltaRayPDF = pdfConstructor.getDeltaRayPDF();
57  for (int i = 0; i < m_numBins; i++) {
58  double t = pdfHisto.GetBinCenter(i + 1);
59  pdfHisto.SetBinContent(i + 1, m_bkg + m_expectedDelta * deltaRayPDF.getPDFValue(t) * m_binSize);
60  }
61 
62  // then fill signal PDF
63  bool start = true;
64  for (const auto& pixelPDF : pdfConstructor.getSignalPDF()) {
65  for (const auto& peak : pixelPDF.getPDFPeaks()) {
66  pdfHisto.Fill(peak.t0, m_expectedSignal * peak.nph);
67  if (start) {
68  start = false;
69  m_tminPDF = peak.t0;
70  m_tmaxPDF = peak.t0;
71  }
72  m_tminPDF = std::min(m_tminPDF, peak.t0);
73  m_tmaxPDF = std::max(m_tmaxPDF, peak.t0);
74  }
75  }
76 
77  // finally make look-up table for log(PDF)
78  for (int i = 0; i < m_numBins; i++) {
79  m_logF.push_back(log(pdfHisto.GetBinContent(i + 1)));
80  }
81  m_logBkg = log(m_bkg);
82 
83  // determine T0 search region
85  double maxT0 = m_tmaxFot - m_tminPDF;
86  m_numBinsT0 = std::max(int((maxT0 - m_minT0) / m_binSize), 3) + 1;
88 
89  }
int m_numBinsT0
number of bins for T0 finder w/ same bin size as PDF
Definition: PDF1Dim.h:151
double m_binSize
bin size
Definition: PDF1Dim.h:157
double m_expectedSignal
expected number of signal photons
Definition: PDF1Dim.h:153
double m_tmaxPDF
maximal time of signal PDF
Definition: PDF1Dim.h:146
double m_tmaxFot
maximal time of photons
Definition: PDF1Dim.h:148
double m_logBkg
log(m_bkg)
Definition: PDF1Dim.h:159
double m_expectedDelta
expected number of delta-ray photons
Definition: PDF1Dim.h:154
double m_maxTime
upper edge of the last bin
Definition: PDF1Dim.h:142
double m_minTime
lower edge of the first bin
Definition: PDF1Dim.h:141
double m_maxT0
maximal T0
Definition: PDF1Dim.h:150
int m_numBins
number of bins for signal PDF
Definition: PDF1Dim.h:140
int m_moduleID
slot number
Definition: PDF1Dim.h:139
double m_expectedBG
expected number of background photons
Definition: PDF1Dim.h:152
std::vector< double > m_times
photon times, from a given slot
Definition: PDF1Dim.h:144
double m_tminPDF
minimal time of signal PDF
Definition: PDF1Dim.h:145
double m_bkg
background [photons/bin]
Definition: PDF1Dim.h:156
double m_minT0
minimal T0
Definition: PDF1Dim.h:149
std::vector< double > m_logF
log(PDF) values
Definition: PDF1Dim.h:158
double m_tminFot
minimal time of photons
Definition: PDF1Dim.h:147
static double getMaxTime()
Returns time window upper edge.
static double getMinTime()
Returns time window lower edge.

Member Function Documentation

◆ getBinSize()

double getBinSize ( ) const
inline

Returns actual bin size used.

Returns
bin size

Definition at line 41 of file PDF1Dim.h.

41 {return m_binSize;}

◆ getExpectedBG()

double getExpectedBG ( ) const
inline

Returns expected number of background photons.

Returns
number of background photons

Definition at line 85 of file PDF1Dim.h.

◆ getExpectedDeltaPhotons()

double getExpectedDeltaPhotons ( ) const
inline

Returns expected number of delta-ray photons.

Returns
number of delta-ray photons

Definition at line 79 of file PDF1Dim.h.

◆ getExpectedSignal()

double getExpectedSignal ( ) const
inline

Returns expected number of signal photons.

Returns
number of signal photons

Definition at line 73 of file PDF1Dim.h.

◆ getHistogram()

TH1F getHistogram ( std::string  name,
std::string  title 
) const

Returns binned one dimensional PDF (projection to time axis)

Parameters
namehistogram name
titlehistogram title
Returns
PDF (signal + background)

Definition at line 108 of file PDF1Dim.cc.

◆ getLogL()

double getLogL ( double  timeShift) const

Returns log likelihood.

Parameters
timeShifttime shift of PDF
Returns
log likelihood

Definition at line 92 of file PDF1Dim.cc.

◆ getMaxT0()

double getMaxT0 ( ) const
inline

Returns upper edge of the T0 search region.

Returns
upper edge

Definition at line 121 of file PDF1Dim.h.

◆ getMinT0()

double getMinT0 ( ) const
inline

Returns lower edge of the T0 search region.

Returns
lower edge

Definition at line 115 of file PDF1Dim.h.

◆ getModuleID()

int getModuleID ( ) const
inline

Returns slot number.

Returns
slot number

Definition at line 47 of file PDF1Dim.h.

◆ getNumBinsT0()

int getNumBinsT0 ( ) const
inline

Returns number of bins the T0 search region.

Bin size is the same as for PDF.

Returns
number of bins

Definition at line 127 of file PDF1Dim.h.

◆ getNumOfPhotons()

int getNumOfPhotons ( ) const
inline

Returns number of photons.

Returns
number of photons

Definition at line 67 of file PDF1Dim.h.

◆ getPhotonTimes()

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

Returns photon times of selected photons in a given slot.

Returns
times of TOPDigit::c_Good digits

Definition at line 61 of file PDF1Dim.h.

◆ getTmaxFot()

double getTmaxFot ( ) const
inline

Returns maximal time of selected photons.

Returns
maximal time

Definition at line 109 of file PDF1Dim.h.

◆ getTmaxPDF()

double getTmaxPDF ( ) const
inline

Returns maximal time of signal PDF.

Returns
maximal time

Definition at line 97 of file PDF1Dim.h.

◆ getTminFot()

double getTminFot ( ) const
inline

Returns minimal time of selected photons.

Returns
minimal time

Definition at line 103 of file PDF1Dim.h.

◆ getTminPDF()

double getTminPDF ( ) const
inline

Returns minimal time of signal PDF.

Returns
minimal time

Definition at line 91 of file PDF1Dim.h.


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