Belle II Software development
SignalPDF.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <top/reconstruction_cpp/SignalPDF.h>
10#include <cmath>
11
12using namespace std;
13
14namespace Belle2 {
19 namespace TOP {
20
21 SignalPDF::SignalPDF(int pixelID, const TOPNominalTTS& tts):
22 m_pixelID(pixelID), m_tts(&tts)
23 {}
24
25 double SignalPDF::getPDFValue(double time, double timeErr, double sigt) const
26 {
27 double wid0 = timeErr * timeErr + sigt * sigt;
28 double f = 0;
29 for (const auto& peak : m_peaks) {
30 for (const auto& gaus : m_tts->getTTS()) {
31 double sigma = peak.wid + gaus.sigma * gaus.sigma + wid0; // sigma squared!
32 double x = pow(time - peak.t0 - gaus.position, 2) / sigma;
33 if (x > 100) continue;
34 sigma = sqrt(2 * M_PI * sigma);
35 f += peak.nph * gaus.fraction / sigma * exp(-x / 2);
36 }
37 }
38 return f;
39 }
40
41 double SignalPDF::getIntegral(double minTime, double maxTime) const
42 {
43 double s = 0;
44 for (const auto& peak : m_peaks) {
45 if (peak.t0 < minTime or peak.t0 > maxTime) continue;
46 s += peak.nph;
47 }
48 return s;
49 }
50
51
52 } // namespace TOP
54} // namespace Belle2
55
Nominal time transition spread of PMT.
Definition: TOPNominalTTS.h:23
const std::vector< Gauss > & getTTS() const
Returns TTS.
Definition: TOPNominalTTS.h:74
std::vector< PDFPeak > m_peaks
PDF peaks.
Definition: SignalPDF.h:156
const TOPNominalTTS * m_tts
nominal TTS
Definition: SignalPDF.h:155
double getPDFValue(double time, double timeErr, double sigt=0) const
Returns PDF value at given time.
Definition: SignalPDF.cc:25
double getIntegral(double minTime, double maxTime) const
Returns integral of PDF from minTime to maxTime.
Definition: SignalPDF.cc:41
SignalPDF(int pixelID, const TOPNominalTTS &tts)
Class constructor.
Definition: SignalPDF.cc:21
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.
STL namespace.