Parameterized TTS for each PMT pixel.
More...
#include <TOPPmtTTSPar.h>
|
enum | { c_NumPmtPixels = 16
} |
| number of PMT pixels More...
|
|
|
| TOPPmtTTSPar () |
| Default constructor.
|
|
| TOPPmtTTSPar (const std::string &serialNumber) |
| Full constructor.
|
|
void | appendGaussian (unsigned pmtPixel, const Gaussian &gaus) |
| Append struct gauss.
|
|
void | appendGaussian (unsigned pmtPixel, double fraction, double mean, double sigma) |
| Append gaussian using its parameters (frac, mean, sigma)
|
|
int | getNumOfPixels () const |
| Returns number of PMT pixels.
|
|
const std::string & | getSerialNumber () const |
| Returns PMT serial number.
|
|
const std::vector< Gaussian > & | getGaussians (unsigned pmtPixel) const |
| Returns vector of gaussians.
|
|
double | getRandomTime (unsigned pmtPixel) const |
| Returns a random number, generated according to the distribution.
|
|
void | normalizeFractions () |
| Normalizes the gaussian fractions to unity.
|
|
Parameterized TTS for each PMT pixel.
Definition at line 26 of file TOPPmtTTSPar.h.
◆ anonymous enum
◆ TOPPmtTTSPar() [1/2]
◆ TOPPmtTTSPar() [2/2]
Full constructor.
- Parameters
-
serialNumber | serial number |
Definition at line 53 of file TOPPmtTTSPar.h.
53 :
54 m_serialNumber(serialNumber)
55 {}
◆ appendGaussian() [1/2]
void appendGaussian |
( |
unsigned | pmtPixel, |
|
|
const Gaussian & | gaus ) |
|
inline |
Append struct gauss.
- Parameters
-
pmtPixel | PMT pixel number (1-based) |
gaus | gaussian to be appended |
Definition at line 63 of file TOPPmtTTSPar.h.
64 {
65 pmtPixel--;
66 if (pmtPixel >= c_NumPmtPixels) {
67 B2ERROR("TOPPmtTTSPar::appendGaussian: invalid PMT pixel "
68 << LogVar("PMT pixel", pmtPixel + 1));
69 return;
70 }
71 m_gaussians[pmtPixel].push_back(gaus);
72 }
◆ appendGaussian() [2/2]
void appendGaussian |
( |
unsigned | pmtPixel, |
|
|
double | fraction, |
|
|
double | mean, |
|
|
double | sigma ) |
|
inline |
Append gaussian using its parameters (frac, mean, sigma)
- Parameters
-
pmtPixel | PMT pixel number (1-based) |
fraction | normalization fraction of the gaussian |
mean | mean of the gaussian |
sigma | sigma of the gaussian |
Definition at line 82 of file TOPPmtTTSPar.h.
83 {
84 Gaussian gaus;
85 gaus.fraction = fraction;
86 gaus.mean = mean;
87 gaus.sigma = sigma;
88 appendGaussian(pmtPixel, gaus);
89 }
◆ getGaussians()
const std::vector< Gaussian > & getGaussians |
( |
unsigned | pmtPixel | ) |
const |
|
inline |
Returns vector of gaussians.
- Parameters
-
pmtPixel | PMT pixel number (1-based) |
- Returns
- vector of gaussians
Definition at line 109 of file TOPPmtTTSPar.h.
110 {
111 pmtPixel--;
112 if (pmtPixel >= c_NumPmtPixels) {
113 B2ERROR("TOPPmtTTSPar::getGaussians: invalid PMT pixel. "
114 "Returning data for pixel 1."
115 << LogVar("PMT pixel", pmtPixel + 1));
116 pmtPixel = 0;
117 }
118 return m_gaussians[pmtPixel];
119 }
◆ getNumOfPixels()
int getNumOfPixels |
( |
| ) |
const |
|
inline |
Returns number of PMT pixels.
- Returns
- number of pixels
Definition at line 95 of file TOPPmtTTSPar.h.
95{return c_NumPmtPixels;}
◆ getRandomTime()
double getRandomTime |
( |
unsigned | pmtPixel | ) |
const |
|
inline |
Returns a random number, generated according to the distribution.
- Parameters
-
pmtPixel | PMT pixel number (1-based) |
- Returns
- random time or 0 for invalid pixel
Definition at line 127 of file TOPPmtTTSPar.h.
128 {
129 pmtPixel--;
130 if (pmtPixel >= c_NumPmtPixels) return 0;
131
132 double prob = gRandom->Rndm();
133 double s = 0;
134 for (const auto& gaus : m_gaussians[pmtPixel]) {
135 s = s + gaus.fraction;
136 if (prob < s) {
137 return gRandom->Gaus(gaus.mean, gaus.sigma);
138 }
139 }
140 return 0;
141 }
◆ getSerialNumber()
const std::string & getSerialNumber |
( |
| ) |
const |
|
inline |
Returns PMT serial number.
- Returns
- serial number
Definition at line 101 of file TOPPmtTTSPar.h.
101{return m_serialNumber;}
◆ normalizeFractions()
void normalizeFractions |
( |
| ) |
|
|
inline |
Normalizes the gaussian fractions to unity.
Definition at line 147 of file TOPPmtTTSPar.h.
148 {
149 double sum = 0;
150 for (int ich = 0 ; ich < c_NumPmtPixels ; ich++) {
151 for (const auto& gaus : m_gaussians[ich]) {
152 sum = sum + gaus.fraction;
153 }
154 if (sum == 0) return;
155 for (auto& gaus : m_gaussians[ich]) {
156 gaus.fraction = gaus.fraction / sum;
157 }
158 }
159 return;
160 }
◆ m_gaussians
std::vector<Gaussian> m_gaussians[c_NumPmtPixels] |
|
private |
TTS distribution composed of Gaussians.
Definition at line 167 of file TOPPmtTTSPar.h.
◆ m_serialNumber
std::string m_serialNumber |
|
private |
The documentation for this class was generated from the following file: