Belle II Software development
SignalPDF Class Reference

Parametrization of signal PDF in a single pixel. More...

#include <SignalPDF.h>

Classes

struct  PDFExtra
 Extra information about single PDF peak. More...
 
struct  PDFPeak
 Single PDF peak. More...
 

Public Types

enum  EPeakType {
  c_Unknown = 0 ,
  c_Direct = 1 ,
  c_Reflected = 2
}
 Enumerator for single PDF peak types. More...
 

Public Member Functions

 SignalPDF (int pixelID, const TOPNominalTTS &tts)
 Class constructor.
 
void append (const PDFPeak &peak)
 Appends single PDF peak.
 
void append (const PDFExtra &extra)
 Appends extra information of single PDF peak.
 
void normalize (double a)
 Normalize PDF peaks by dividing nph with given constant.
 
double getSum () const
 Returns a sum of nph of all peaks.
 
int getPixelID () const
 Returns pixel ID.
 
const TOPNominalTTS * getTTS () const
 Returns TTS.
 
const std::vector< PDFPeak > & getPDFPeaks () const
 Returns PDF peaks.
 
const std::vector< PDFExtra > & getPDFExtraInfo () const
 Returns PDF extra info Note: available only if stored on demand.
 
double getMinT0 () const
 Returns the position of the earliest peak (meaningless if there are no peaks)
 
double getMaxT0 () const
 Returns the position of the latest peak (meaningless if there are no peaks)
 
bool isExtraInfoAvailable () const
 Checks if extra info is available.
 
double getPDFValue (double time, double timeErr, double sigt=0) const
 Returns PDF value at given time.
 
double getIntegral (double minTime, double maxTime) const
 Returns integral of PDF from minTime to maxTime.
 

Private Attributes

int m_pixelID = 0
 pixel ID
 
const TOPNominalTTS * m_tts = 0
 nominal TTS
 
double m_maxSigmaSq = 0
 the largest of the TTS component widths squared [ns^2]
 
double m_maxAbsPos = 0
 the largest of the TTS component offsets in absolute value [ns]
 
double m_sum = 0
 sum of nph of all peaks
 
double m_minT0 = 0
 position of the earliest peak [ns]
 
double m_maxT0 = 0
 position of the latest peak [ns]
 
std::vector< PDFPeak > m_peaks
 PDF peaks.
 
std::vector< PDFExtra > m_extras
 extra information (stored only on request)
 

Detailed Description

Parametrization of signal PDF in a single pixel.

PDF is parametrized as a sum of Gaussian distributions.

Definition at line 27 of file SignalPDF.h.

Member Enumeration Documentation

◆ EPeakType

enum EPeakType

Enumerator for single PDF peak types.

Enumerator
c_Unknown 

unknown

c_Direct 

direct photon

c_Reflected 

reflected photon

Definition at line 34 of file SignalPDF.h.

34 {
35 c_Unknown = 0,
36 c_Direct = 1,
37 c_Reflected = 2
38 };
@ c_Unknown
Constant for an not yet determined forward or backward arrangement.

Constructor & Destructor Documentation

◆ SignalPDF()

SignalPDF ( int pixelID,
const TOPNominalTTS & tts )

Class constructor.

Parameters
pixelIDpixel ID
ttsTTS

Definition at line 21 of file SignalPDF.cc.

21 :
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 }

Member Function Documentation

◆ append() [1/2]

void append ( const PDFExtra & extra)
inline

Appends extra information of single PDF peak.

Parameters
extraextra information

Definition at line 104 of file SignalPDF.h.

104{ m_extras.push_back(extra);}

◆ append() [2/2]

void append ( const PDFPeak & peak)
inline

Appends single PDF peak.

Parameters
peaksingle PDF peak

Definition at line 87 of file SignalPDF.h.

88 {
89 if (m_peaks.empty()) {
90 m_minT0 = peak.t0;
91 m_maxT0 = peak.t0;
92 } else {
93 m_minT0 = std::min(m_minT0, peak.t0);
94 m_maxT0 = std::max(m_maxT0, peak.t0);
95 }
96 m_peaks.push_back(peak);
97 m_sum += peak.nph; // accumulated in the same order as the loop in getSum()
98 }

◆ getIntegral()

double getIntegral ( double minTime,
double maxTime ) const
inline

Returns integral of PDF from minTime to maxTime.

Parameters
minTimeintegral lower limit
maxTimeintegral upper limit
Returns
integral of PDF

Definition at line 205 of file SignalPDF.h.

206 {
207 if (m_peaks.empty()) return 0;
208 if (minTime <= m_minT0 and maxTime >= m_maxT0) return m_sum; // all the peaks are inside
209 if (maxTime < m_minT0 or minTime > m_maxT0) return 0; // none of the peaks is inside
210
211 double s = 0;
212 for (const auto& peak : m_peaks) {
213 if (peak.t0 < minTime or peak.t0 > maxTime) continue;
214 s += peak.nph;
215 }
216 return s;
217 }

◆ getMaxT0()

double getMaxT0 ( ) const
inline

Returns the position of the latest peak (meaningless if there are no peaks)

Returns
peak position [ns]

Definition at line 152 of file SignalPDF.h.

152{return m_maxT0;}

◆ getMinT0()

double getMinT0 ( ) const
inline

Returns the position of the earliest peak (meaningless if there are no peaks)

Returns
peak position [ns]

Definition at line 146 of file SignalPDF.h.

146{return m_minT0;}

◆ getPDFExtraInfo()

const std::vector< PDFExtra > & getPDFExtraInfo ( ) const
inline

Returns PDF extra info Note: available only if stored on demand.

Returns
PDF extra info

Definition at line 140 of file SignalPDF.h.

140{return m_extras;}

◆ getPDFPeaks()

const std::vector< PDFPeak > & getPDFPeaks ( ) const
inline

Returns PDF peaks.

Returns
PDF peaks

Definition at line 133 of file SignalPDF.h.

133{return m_peaks;}

◆ getPDFValue()

double getPDFValue ( double time,
double timeErr,
double sigt = 0 ) const

Returns PDF value at given time.

Parameters
timephoton hit time
timeErruncertainty of hit time (sigma)
sigtadditional time smearing
Returns
PDF value

Definition at line 31 of file SignalPDF.cc.

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 }
double sqrt(double a)
sqrt for double
Definition beamHelpers.h:28

◆ getPixelID()

int getPixelID ( ) const
inline

Returns pixel ID.

Returns
pixel ID

Definition at line 121 of file SignalPDF.h.

121{return m_pixelID;}

◆ getSum()

double getSum ( ) const
inline

Returns a sum of nph of all peaks.

Definition at line 200 of file SignalPDF.h.

201 {
202 return m_sum;
203 }

◆ getTTS()

const TOPNominalTTS * getTTS ( ) const
inline

Returns TTS.

Returns
TTS

Definition at line 127 of file SignalPDF.h.

127{return m_tts;}

◆ isExtraInfoAvailable()

bool isExtraInfoAvailable ( ) const
inline

Checks if extra info is available.

Returns
true if available

Definition at line 158 of file SignalPDF.h.

158{return m_extras.size() == m_peaks.size();}

◆ normalize()

void normalize ( double a)
inline

Normalize PDF peaks by dividing nph with given constant.

Parameters
anormalization constant

Definition at line 193 of file SignalPDF.h.

194 {
195 for (auto& peak : m_peaks) peak.nph /= a;
196 m_sum = 0;
197 for (const auto& peak : m_peaks) m_sum += peak.nph;
198 }

Member Data Documentation

◆ m_extras

std::vector<PDFExtra> m_extras
private

extra information (stored only on request)

Definition at line 187 of file SignalPDF.h.

◆ m_maxAbsPos

double m_maxAbsPos = 0
private

the largest of the TTS component offsets in absolute value [ns]

Definition at line 182 of file SignalPDF.h.

◆ m_maxSigmaSq

double m_maxSigmaSq = 0
private

the largest of the TTS component widths squared [ns^2]

Definition at line 181 of file SignalPDF.h.

◆ m_maxT0

double m_maxT0 = 0
private

position of the latest peak [ns]

Definition at line 185 of file SignalPDF.h.

◆ m_minT0

double m_minT0 = 0
private

position of the earliest peak [ns]

Definition at line 184 of file SignalPDF.h.

◆ m_peaks

std::vector<PDFPeak> m_peaks
private

PDF peaks.

Definition at line 186 of file SignalPDF.h.

◆ m_pixelID

int m_pixelID = 0
private

pixel ID

Definition at line 179 of file SignalPDF.h.

◆ m_sum

double m_sum = 0
private

sum of nph of all peaks

Definition at line 183 of file SignalPDF.h.

◆ m_tts

const TOPNominalTTS* m_tts = 0
private

nominal TTS

Definition at line 180 of file SignalPDF.h.


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