Belle II Software  release-05-01-25
TOPNominalQE.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Marko Staric *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <top/dbobjects/TOPNominalQE.h>
12 #include <iostream>
13 
14 using namespace std;
15 
16 namespace Belle2 {
22  double TOPNominalQE::getQE(double lambda) const
23  {
24  double dlam = lambda - m_lambdaFirst;
25  if (dlam < 0 or dlam > (m_QE.size() - 1) * m_lambdaStep) return 0;
26  unsigned i = int(dlam / m_lambdaStep);
27  if (i > m_QE.size() - 2) return m_QE.back();
28  return m_QE[i] + (m_QE[i + 1] - m_QE[i]) / m_lambdaStep * (dlam - i * m_lambdaStep);
29  }
30 
31 
32  bool TOPNominalQE::isConsistent() const
33  {
34  if (m_lambdaFirst <= 0) return false;
35  if (m_lambdaStep <= 0) return false;
36  if (m_CE <= 0) return false;
37  if (m_QE.empty()) return false;
38  return true;
39  }
40 
41 
42  void TOPNominalQE::print(const std::string& title) const
43  {
44  TOPGeoBase::printUnderlined(title);
45  cout << " first point: " << getLambdaFirst() << " nm";
46  cout << ", step: " << getLambdaStep() << " nm";
47  cout << ", CE: " << getCE() << endl;
48  cout << " QE: [";
49  for (const auto& qe : m_QE) cout << qe << ", ";
50  cout << "]" << endl;
51  }
52 
54 } // end Belle2 namespace
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19