Belle II Software  release-05-02-19
TOP1Dpdf Class Reference

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

#include <TOP1Dpdf.h>

Collaboration diagram for TOP1Dpdf:

Public Member Functions

 TOP1Dpdf (TOPreco &reco, const StoreArray< TOPDigit > &digits, int moduleID, double binSize)
 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 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_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 39 of file TOP1Dpdf.h.

Constructor & Destructor Documentation

◆ TOP1Dpdf()

TOP1Dpdf ( TOPreco reco,
const StoreArray< TOPDigit > &  digits,
int  moduleID,
double  binSize 
)

Full constructor.

Parameters
recoreconstruction object
moduleIDslot number
binSizeapproximate bin size (use getBinSize() to get the actual one)
digitscollection of TOP digits

Definition at line 30 of file TOP1Dpdf.cc.

36  : digits) {
37  if (digit.getHitQuality() == TOPDigit::c_Good) {
38  double t = digit.getTime();
39  m_tminFot = std::min(m_tminFot, t);
40  m_tmaxFot = std::max(m_tmaxFot, t);
41  if (digit.getModuleID() == m_moduleID) {
42  m_times.push_back(t);
43  } else {
44  m_expectedBG += 1;
45  }
46  }
47  }
48  m_expectedBG /= 15; // per module
49  int nbins = (m_tmaxFot - m_tminFot) / m_binSize;
50  m_bkg = std::max(m_expectedBG, 1.0) / std::max(nbins, m_numBins);
51 
52  // temporary histogram to make 1D projection of PDF
53  TH1F pdfHisto("pdf_temporary", "", m_numBins, m_minTime, m_maxTime);
54 
55  // first add background
56  for (int i = 0; i < m_numBins; i++) pdfHisto.SetBinContent(i + 1, m_bkg);
57 
58  // then fill signal PDF
59  bool start = true;
60  for (int pix = 1; pix <= 512; pix++) {
61  for (int k = 0; k < reco.getNumofPDFPeaks(pix); k++) {
62  float pos = 0;
63  float wid = 0;
64  float nph = 0;
65  reco.getPDFPeak(pix, k, pos, wid, nph);
66  m_expectedSignal += nph;
67  double time = pos;
68  pdfHisto.Fill(time, nph);
69  if (start) {
70  start = false;
71  m_tminPDF = time;
72  m_tmaxPDF = time;
73  }
74  m_tminPDF = std::min(m_tminPDF, time);
75  m_tmaxPDF = std::max(m_tmaxPDF, time);
76  }
77  }
78 
79  // finally make look-up table for log(PDF)
80  for (int i = 0; i < m_numBins; i++) {
81  m_logF.push_back(log(pdfHisto.GetBinContent(i + 1)));
82  }
83  m_logBkg = log(m_bkg);
84 
85  // determine T0 search region
87  double maxT0 = m_tmaxFot - m_tminPDF;
88  m_numBinsT0 = std::max(int((maxT0 - m_minT0) / m_binSize), 3) + 1;
90 
91  }
92 
93 
94  double TOP1Dpdf::getLogL(double timeShift) const
95  {
96 
97  double logL = 0;
98  for (const auto& time : m_times) {
99  double f = m_logBkg;

Member Function Documentation

◆ getBinSize()

double getBinSize ( ) const
inline

Returns actual bin size used.

Returns
bin size

Definition at line 57 of file TOP1Dpdf.h.

◆ getExpectedBG()

double getExpectedBG ( ) const
inline

Returns expected number of background photons.

Returns
number of background photons

Definition at line 95 of file TOP1Dpdf.h.

◆ getExpectedSignal()

double getExpectedSignal ( ) const
inline

Returns expected number of signal photons.

Returns
number of signal photons

Definition at line 89 of file TOP1Dpdf.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 119 of file TOP1Dpdf.cc.

◆ getLogL()

double getLogL ( double  timeShift) const

Returns log likelihood.

Parameters
timeShifttime shift of PDF
Returns
log likelihood

Definition at line 102 of file TOP1Dpdf.cc.

◆ getMaxT0()

double getMaxT0 ( ) const
inline

Returns upper edge of the T0 search region.

Returns
upper edge

Definition at line 131 of file TOP1Dpdf.h.

◆ getMinT0()

double getMinT0 ( ) const
inline

Returns lower edge of the T0 search region.

Returns
lower edge

Definition at line 125 of file TOP1Dpdf.h.

◆ getModuleID()

int getModuleID ( ) const
inline

Returns slot number.

Returns
slot number

Definition at line 63 of file TOP1Dpdf.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 137 of file TOP1Dpdf.h.

◆ getNumOfPhotons()

int getNumOfPhotons ( ) const
inline

Returns number of photons.

Returns
number of photons

Definition at line 83 of file TOP1Dpdf.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 77 of file TOP1Dpdf.h.

◆ getTmaxFot()

double getTmaxFot ( ) const
inline

Returns maximal time of selected photons.

Returns
maximal time

Definition at line 119 of file TOP1Dpdf.h.

◆ getTmaxPDF()

double getTmaxPDF ( ) const
inline

Returns maximal time of signal PDF.

Returns
maximal time

Definition at line 107 of file TOP1Dpdf.h.

◆ getTminFot()

double getTminFot ( ) const
inline

Returns minimal time of selected photons.

Returns
minimal time

Definition at line 113 of file TOP1Dpdf.h.

◆ getTminPDF()

double getTminPDF ( ) const
inline

Returns minimal time of signal PDF.

Returns
minimal time

Definition at line 101 of file TOP1Dpdf.h.


The documentation for this class was generated from the following files:
Belle2::TOP::TOP1Dpdf::m_times
std::vector< double > m_times
photon times, from a given slot
Definition: TOP1Dpdf.h:154
Belle2::TOP::TOP1Dpdf::m_minT0
double m_minT0
minimal T0
Definition: TOP1Dpdf.h:159
Belle2::TOP::TOP1Dpdf::m_numBinsT0
int m_numBinsT0
number of bins for T0 finder w/ same bin size as PDF
Definition: TOP1Dpdf.h:161
Belle2::TOP::TOP1Dpdf::m_tmaxFot
double m_tmaxFot
maximal time of photons
Definition: TOP1Dpdf.h:158
Belle2::TOP::TOP1Dpdf::m_expectedSignal
double m_expectedSignal
expected number of signal photons
Definition: TOP1Dpdf.h:163
Belle2::TOP::TOP1Dpdf::m_logBkg
double m_logBkg
log(m_bkg)
Definition: TOP1Dpdf.h:168
Belle2::TOP::TOP1Dpdf::m_moduleID
int m_moduleID
slot number
Definition: TOP1Dpdf.h:149
Belle2::TOP::TOP1Dpdf::m_minTime
double m_minTime
lower edge of the first bin
Definition: TOP1Dpdf.h:151
Belle2::TOP::TOP1Dpdf::m_maxTime
double m_maxTime
upper edge of the last bin
Definition: TOP1Dpdf.h:152
Belle2::TOP::TOP1Dpdf::m_tmaxPDF
double m_tmaxPDF
maximal time of signal PDF
Definition: TOP1Dpdf.h:156
Belle2::TOP::TOP1Dpdf::m_binSize
double m_binSize
bin size
Definition: TOP1Dpdf.h:166
Belle2::TOP::TOP1Dpdf::m_bkg
double m_bkg
background [photons/bin]
Definition: TOP1Dpdf.h:165
Belle2::TOP::TOP1Dpdf::m_logF
std::vector< double > m_logF
log(PDF) values
Definition: TOP1Dpdf.h:167
Belle2::TOP::TOP1Dpdf::m_expectedBG
double m_expectedBG
expected number of background photons
Definition: TOP1Dpdf.h:162
Belle2::TOP::TOP1Dpdf::m_maxT0
double m_maxT0
maximal T0
Definition: TOP1Dpdf.h:160
Belle2::TOP::TOP1Dpdf::m_numBins
int m_numBins
number of bins for signal PDF
Definition: TOP1Dpdf.h:150
Belle2::TOP::TOP1Dpdf::m_tminFot
double m_tminFot
minimal time of photons
Definition: TOP1Dpdf.h:157
Belle2::TOP::TOP1Dpdf::m_tminPDF
double m_tminPDF
minimal time of signal PDF
Definition: TOP1Dpdf.h:155
Belle2::TOP::TOP1Dpdf::getLogL
double getLogL(double timeShift) const
Returns log likelihood.
Definition: TOP1Dpdf.cc:102