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 // the largest TTS component width and offset, used to skip the peaks that are too far in time
25 for (const auto& gaus : tts.getTTS()) {
26 m_maxSigmaSq = std::max(m_maxSigmaSq, static_cast<double>(gaus.sigma * gaus.sigma));
27 m_maxAbsPos = std::max(m_maxAbsPos, std::abs(static_cast<double>(gaus.position)));
28 }
29 }
30
31 double SignalPDF::getPDFValue(double time, double timeErr, double sigt) const
32 {
33 double wid0 = timeErr * timeErr + sigt * sigt;
34 double f = 0;
35 for (const auto& peak : m_peaks) {
36 // a peak whose every term is rejected by the x > 100 cut below cannot contribute:
37 // the 101 keeps this necessary condition on the safe side of rounding
38 double t = time - peak.t0;
39 double d = std::abs(t) - m_maxAbsPos;
40 if (d > 0 and d * d > 101 * (peak.wid + m_maxSigmaSq + wid0)) continue;
41 for (const auto& gaus : m_tts->getTTS()) {
42 double sigma = peak.wid + gaus.sigma * gaus.sigma + wid0; // sigma squared!
43 double dt = t - gaus.position;
44 double x = dt * dt / sigma;
45 if (x > 100) continue;
46 sigma = sqrt(2 * M_PI * sigma);
47 f += peak.nph * gaus.fraction / sigma * exp(-x / 2);
48 }
49 }
50 return f;
51 }
52
53 } // namespace TOP
55} // namespace Belle2
56
Nominal time transition spread of PMT.
const std::vector< Gauss > & getTTS() const
Returns TTS.
double m_maxAbsPos
the largest of the TTS component offsets in absolute value [ns]
Definition SignalPDF.h:182
std::vector< PDFPeak > m_peaks
PDF peaks.
Definition SignalPDF.h:186
const TOPNominalTTS * m_tts
nominal TTS
Definition SignalPDF.h:180
double m_maxSigmaSq
the largest of the TTS component widths squared [ns^2]
Definition SignalPDF.h:181
double getPDFValue(double time, double timeErr, double sigt=0) const
Returns PDF value at given time.
Definition SignalPDF.cc:31
SignalPDF(int pixelID, const TOPNominalTTS &tts)
Class constructor.
Definition SignalPDF.cc:21
int m_pixelID
pixel ID
Definition SignalPDF.h:179
double sqrt(double a)
sqrt for double
Definition beamHelpers.h:28
Abstract base class for different kinds of events.
STL namespace.