Belle II Software development
TOPNominalQE.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <top/dbobjects/TOPNominalQE.h>
10#include <iostream>
11
12using namespace std;
13
14namespace Belle2 {
22 {
23 for (size_t i = 0; i < m_QE.size(); i++) {
24 double lambda = m_lambdaFirst + m_lambdaStep * i;
25 m_QE[i] *= filter.getBulkTransmittance(lambda);
26 }
27 }
28
29
30 double TOPNominalQE::getQE(double lambda) const
31 {
32 double dlam = lambda - m_lambdaFirst;
33 if (dlam < 0 or dlam > (m_QE.size() - 1) * m_lambdaStep) return 0;
34 unsigned i = int(dlam / m_lambdaStep);
35 if (i > m_QE.size() - 2) return m_QE.back();
36 return m_QE[i] + (m_QE[i + 1] - m_QE[i]) / m_lambdaStep * (dlam - i * m_lambdaStep);
37 }
38
39
41 {
42 for (size_t i = 0; i < m_QE.size(); i++) {
43 if (m_QE[i] > 0) return m_lambdaFirst + m_lambdaStep * i;
44 }
45 return getLambdaLast();
46 }
47
48
50 {
51 for (size_t i = m_QE.size() - 1; i < m_QE.size(); i--) {
52 if (m_QE[i] > 0) return m_lambdaFirst + m_lambdaStep * i;
53 }
54 return m_lambdaFirst;
55 }
56
57
59 {
60 if (m_lambdaFirst <= 0) return false;
61 if (m_lambdaStep <= 0) return false;
62 if (m_CE <= 0) return false;
63 if (m_QE.empty()) return false;
64 return true;
65 }
66
67
68 void TOPNominalQE::print(const std::string& title) const
69 {
71 cout << " first point: " << getLambdaFirst() << " nm";
72 cout << ", step: " << getLambdaStep() << " nm";
73 cout << ", CE: " << getCE() << endl;
74 cout << " QE: [";
75 for (const auto& qe : m_QE) cout << qe << ", ";
76 cout << "]" << endl;
77 }
78
80} // end Belle2 namespace
double getLambdaStep() const
Returns wavelenght step.
Definition: TOPNominalQE.h:130
std::vector< float > m_QE
QE data points.
Definition: TOPNominalQE.h:168
const std::vector< float > & getQE() const
Returns quantum efficiency data points.
Definition: TOPNominalQE.h:94
double getCE() const
Returns collection efficiency.
Definition: TOPNominalQE.h:148
float m_lambdaStep
wavelength step [nm]
Definition: TOPNominalQE.h:166
double getLambdaFirst() const
Returns wavelenght of the first data point.
Definition: TOPNominalQE.h:115
double getLambdaLast() const
Returns wavelenght of the last data point.
Definition: TOPNominalQE.h:121
float m_lambdaFirst
wavelength of the first data point [nm]
Definition: TOPNominalQE.h:165
float m_CE
collection efficiency
Definition: TOPNominalQE.h:167
Bulk transmittance of wavelength filter.
std::map< ExpRun, std::pair< double, double > > filter(const std::map< ExpRun, std::pair< double, double > > &runs, double cut, std::map< ExpRun, std::pair< double, double > > &runsRemoved)
filter events to remove runs shorter than cut, it stores removed runs in runsRemoved
Definition: Splitter.cc:38
bool isConsistent() const override
Check for consistency of data members.
Definition: TOPNominalQE.cc:58
void print(const std::string &title="Nominal quantum efficiency") const override
Print the content of the class.
Definition: TOPNominalQE.cc:68
void printUnderlined(const std::string &title) const
Print the content of the class.
Definition: TOPGeoBase.cc:35
double getMaxLambda() const
Returns wavelength of the last nonzero QE data point.
Definition: TOPNominalQE.cc:49
double getMinLambda() const
Returns wavelength of the first nonzero QE data point.
Definition: TOPNominalQE.cc:40
void applyFilterTransmission(const TOPWavelengthFilter &filter)
Multiplies quantum efficiency data points with filter transmission.
Definition: TOPNominalQE.cc:21
Abstract base class for different kinds of events.
STL namespace.