9 #include <top/dbobjects/TOPPmtQE.h>
10 #include <framework/logging/Logger.h>
21 const std::vector<float>& TOPPmtQE::getQE(
unsigned pmtPixel)
const
24 if (pmtPixel < c_NumPmtPixels)
return m_QE[pmtPixel];
26 B2ERROR(
"TOPPmtQE::getQE: invalid pixel ID, returning empty vector");
31 double TOPPmtQE::getQE(
unsigned pmtPixel,
double lambda)
const
34 if (pmtPixel < c_NumPmtPixels)
return interpolate(lambda, m_QE[pmtPixel]);
38 const std::vector<float>& TOPPmtQE::getEnvelopeQE()
const
44 double TOPPmtQE::getEnvelopeQE(
double lambda)
const
47 return interpolate(lambda, m_envelopeQE);
50 double TOPPmtQE::getEfficiency(
unsigned pmtPixel,
double lambda,
bool BfieldOn)
const
53 return getQE(pmtPixel, lambda) * m_CE_withB;
55 return getQE(pmtPixel, lambda) * m_CE_noB;
59 double TOPPmtQE::getCE(
bool BfieldOn)
const
68 double TOPPmtQE::getLambdaLast()
const
71 for (
unsigned pixel = 0; pixel < c_NumPmtPixels; pixel++) {
72 const auto& QE = m_QE[pixel];
73 size = std::max(size, QE.size());
75 return m_lambdaFirst + (size - 1) * m_lambdaStep;
78 double TOPPmtQE::getLambdaLast(
unsigned pmtPixel)
const
81 if (pmtPixel < c_NumPmtPixels) {
82 return m_lambdaFirst + (m_QE[pmtPixel].size() - 1) * m_lambdaStep;
87 void TOPPmtQE::setEnvelopeQE()
const
89 if (!m_envelopeQE.empty())
return;
92 for (
unsigned pixel = 0; pixel < c_NumPmtPixels; pixel++) {
93 const auto& QE = m_QE[pixel];
94 size = std::max(size, QE.size());
96 m_envelopeQE.resize(size, 0);
97 for (
unsigned pixel = 0; pixel < c_NumPmtPixels; pixel++) {
98 const auto& QE = m_QE[pixel];
99 for (
size_t i = 0; i < QE.size(); i++) {
100 m_envelopeQE[i] = std::max(m_envelopeQE[i], QE[i]);
105 double TOPPmtQE::interpolate(
double lambda,
const std::vector<float>& QE)
const
107 double dlam = lambda - m_lambdaFirst;
108 if (dlam < 0 or dlam > (QE.size() - 1) * m_lambdaStep)
return 0;
109 unsigned i = int(dlam / m_lambdaStep);
110 if (i > QE.size() - 2)
return QE.back();
111 return QE[i] + (QE[i + 1] - QE[i]) / m_lambdaStep * (dlam - i * m_lambdaStep);
Abstract base class for different kinds of events.