Belle II Software  release-08-01-10
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 
12 using namespace std;
13 
14 namespace Belle2 {
21  void TOPNominalQE::applyFilterTransmission(const TOPWavelengthFilter& filter)
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 
40  double TOPNominalQE::getMinLambda() const
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 
49  double TOPNominalQE::getMaxLambda() const
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 
58  bool TOPNominalQE::isConsistent() const
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  {
70  TOPGeoBase::printUnderlined(title);
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
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
Abstract base class for different kinds of events.