9 #include <top/dbobjects/TOPWavelengthFilter.h>
21 float TOPWavelengthFilter::getBulkTransmittance(
double lambda)
const
23 if (m_transmittances.empty())
return 1;
25 double dlam = lambda - m_lambdaFirst;
26 if (dlam < 0)
return 0;
27 if (dlam > (m_transmittances.size() - 1) * m_lambdaStep)
return m_transmittances.back();
28 unsigned i = int(dlam / m_lambdaStep);
29 if (i > m_transmittances.size() - 2)
return m_transmittances.back();
30 return m_transmittances[i] + (m_transmittances[i + 1] - m_transmittances[i]) / m_lambdaStep * (dlam - i * m_lambdaStep);
34 bool TOPWavelengthFilter::isConsistent()
const
36 if (getName().empty())
return true;
38 if (m_lambdaFirst <= 0)
return false;
39 if (m_lambdaStep <= 0)
return false;
40 if (m_transmittances.empty())
return false;
45 void TOPWavelengthFilter::print(
const std::string& title)
const
47 TOPGeoBase::printUnderlined(title);
48 cout <<
" first point: " << getLambdaFirst() <<
" nm";
49 cout <<
", step: " << getLambdaStep() <<
" nm" << endl;
50 cout <<
" bulk transmittances: [";
51 for (
const auto& trE : m_transmittances) cout << setprecision(3) << trE <<
", ";
53 if (getName().empty()) {
54 cout <<
"(Old geometry payload, filter transmittance is included in QE)" << endl;
Abstract base class for different kinds of events.