9#include <top/dbobjects/TOPNominalTTS.h>
10#include <framework/logging/Logger.h>
25 B2ERROR(
"TOPNominalTTS::appendGaussian: normalization is non-positive number");
32 m_tts.push_back(gauss);
39 for (
const auto& tts :
m_tts) sum += tts.fraction;
40 if (sum == 0)
return 0;
41 for (
auto& tts :
m_tts) tts.fraction /= sum;
48 double prob = gRandom->Rndm();
50 for (
const auto& tts :
m_tts) {
53 return gRandom->Gaus(tts.position, tts.sigma);
62 if (
m_tts.empty())
return false;
72 cout <<
" -> vector is empty!" << endl;
75 cout <<
" PMT type: " <<
m_type << endl;
78 for (
const auto& tts :
m_tts) {
80 cout <<
" Gaussian " << i <<
": ";
81 cout << tts.fraction <<
", ";
82 cout << tts.position <<
" ns, ";
83 cout << tts.sigma <<
" ns" << endl;
85 if (!
m_normalized) cout <<
" warning: fractions not normalized" << endl;
bool m_normalized
normalization flag
unsigned m_type
PMT type (see TOPPmtObsoleteData::EType)
std::vector< Gauss > m_tts
TTS distribution composed of a sum of Gaussians.
double normalize()
Normalize the distribution (fractions)
bool isConsistent() const override
Check for consistency of data members.
void printUnderlined(const std::string &title) const
Print the content of the class.
void appendGaussian(double norm, double mean, double sigma)
Append Gaussian.
void print(const std::string &title="Nominal TTS distribution") const override
Print the content of the class.
double generateTTS() const
Generate time according to TTS distribution.
Abstract base class for different kinds of events.
Gaussian distribution parameters.
float fraction
area normalization
float position
peak position [ns]
float sigma
peak width [ns]