Belle II Software development
TOPCalTOFCorrection.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/TOPCalTOFCorrection.h>
10
11using namespace std;
12
13namespace Belle2 {
18
19 void TOPCalTOFCorrection::set(const TProfile* pf)
20 {
21 m_zmin = pf->GetXaxis()->GetXmin();
22 m_dz = pf->GetXaxis()->GetBinWidth(1);
23 for (int i = 1; i <= pf->GetNbinsX(); i++) {
24 if (pf->GetBinEntries(i) > 100) m_corrections.push_back(pf->GetBinContent(i));
25 else m_corrections.push_back(0.);
26 }
27 }
28
29 double TOPCalTOFCorrection::get(double z) const
30 {
31 if (m_corrections.empty()) return 0;
32 if (z < m_zmin) return 0;
33
34 unsigned i = (z - m_zmin) / m_dz;
35 if (i < m_corrections.size()) return m_corrections[i];
36 return 0;
37 }
38
40} // end Belle2 namespace
41
std::vector< float > m_corrections
time-of-flight corrections as function of z
void set(const TProfile *pf)
Setter.
double get(double z) const
Getter.
Abstract base class for different kinds of events.
STL namespace.