Belle II Software  release-05-01-25
TOPWavelengthFilter.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Rikuya Okuto *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <top/dbobjects/TOPWavelengthFilter.h>
12 #include <iostream>
13 #include <iomanip>
14 
15 using namespace std;
16 
17 namespace Belle2 {
23  float TOPWavelengthFilter::getBulkTransmittance(double lambda) const
24  {
25  if (m_transmittances.empty()) return 1; // old payload from DB (filter included in QE)
26 
27  double dlam = lambda - m_lambdaFirst;
28  if (dlam < 0) return 0;
29  if (dlam > (m_transmittances.size() - 1) * m_lambdaStep) return m_transmittances.back();
30  unsigned i = int(dlam / m_lambdaStep);
31  if (i > m_transmittances.size() - 2) return m_transmittances.back();
32  return m_transmittances[i] + (m_transmittances[i + 1] - m_transmittances[i]) / m_lambdaStep * (dlam - i * m_lambdaStep);
33  }
34 
35 
36  bool TOPWavelengthFilter::isConsistent() const
37  {
38  if (getName().empty()) return true; // old payload from DB (filter included in QE)
39 
40  if (m_lambdaFirst <= 0) return false;
41  if (m_lambdaStep <= 0) return false;
42  if (m_transmittances.empty()) return false;
43  return true;
44  }
45 
46 
47  void TOPWavelengthFilter::print(const std::string& title) const
48  {
49  TOPGeoBase::printUnderlined(title);
50  cout << " first point: " << getLambdaFirst() << " nm";
51  cout << ", step: " << getLambdaStep() << " nm" << endl;
52  cout << " bulk transmittances: [";
53  for (const auto& trE : m_transmittances) cout << setprecision(3) << trE << ", ";
54  cout << "]" << endl;
55  if (getName().empty()) {
56  cout << "(Old geometry payload, filter transmittance is included in QE)" << endl;
57  }
58 
59  }
60 
62 } // end Belle2 namespace
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19