9 #include <top/dbobjects/TOPNominalTTS.h>
10 #include <framework/logging/Logger.h>
22 void TOPNominalTTS::appendGaussian(
double norm,
double mean,
double sigma)
25 B2ERROR(
"TOPNominalTTS::appendGaussian: normalization is non-positive number");
32 m_tts.push_back(gauss);
36 double TOPNominalTTS::normalize()
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;
46 double TOPNominalTTS::generateTTS()
const
48 double prob = gRandom->Rndm();
50 for (
const auto& tts : m_tts) {
53 return gRandom->Gaus(tts.position, tts.sigma);
60 bool TOPNominalTTS::isConsistent()
const
62 if (m_tts.empty())
return false;
63 if (!m_normalized)
return false;
68 void TOPNominalTTS::print(
const std::string& title)
const
70 TOPGeoBase::printUnderlined(title);
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;
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]