Belle II Software  release-05-01-25
TOPCalTimeWalk.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2020 - 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/TOPCalTimeWalk.h>
12 #include <math.h>
13 
14 namespace Belle2 {
20  void TOPCalTimeWalk::set(const std::vector<double>& timeWalkParams,
21  double noise, double quadratic)
22  {
23  m_timeWalkParams = timeWalkParams;
24  m_noise = noise;
25  m_quadratic = quadratic;
27  }
28 
29  double TOPCalTimeWalk::getTimeWalk(int pulseHeight) const
30  {
31  /* time walk parameters are coefficients in a polynomial
32  * that is evaluated at x = pulseHeight here */
33 
34  double f = 0;
35  double x = 1;
36  for (auto p : m_timeWalkParams) {
37  f += p * x;
38  x *= pulseHeight;
39  }
40  return f;
41  }
42 
43  double TOPCalTimeWalk::getSigmaSq(int pulseHeight) const
44  {
45  if (pulseHeight <= 0) return 0;
46  double x = pulseHeight;
47  return pow(m_noise / x, 2) + pow(m_quadratic * x * x, 2);
48  }
49 
50  double TOPCalTimeWalk::getSigma(int pulseHeight) const
51  {
52  return sqrt(getSigmaSq(pulseHeight));
53  }
54 
55 
57 } // end Belle2 namespace
Belle2::TOPCalTimeWalk::getTimeWalk
double getTimeWalk(int pulseHeight) const
Returns time-walk at given pulse height.
Definition: TOPCalTimeWalk.cc:37
Belle2::TOPCalTimeWalk::getSigma
double getSigma(int pulseHeight) const
Returns an excess of electronic time resolution at given pulse height.
Definition: TOPCalTimeWalk.cc:58
Belle2::TOPCalTimeWalk::set
void set(const std::vector< double > &timeWalkParams, double noise, double quadratic)
Sets all the parameters and switches status to calibrated.
Definition: TOPCalTimeWalk.cc:28
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TOPCalTimeWalk::m_status
EStatus m_status
calibration status
Definition: TOPCalTimeWalk.h:128
Belle2::TOPCalTimeWalk::c_Calibrated
@ c_Calibrated
good calibrated value
Definition: TOPCalTimeWalk.h:43
Belle2::TOPCalTimeWalk::m_noise
double m_noise
noise term excess coefficient [ns]
Definition: TOPCalTimeWalk.h:126
Belle2::TOPCalTimeWalk::m_timeWalkParams
std::vector< double > m_timeWalkParams
parameters of calibration curve [ns]
Definition: TOPCalTimeWalk.h:121
Belle2::TOPCalTimeWalk::getSigmaSq
double getSigmaSq(int pulseHeight) const
Returns an excess of electronic time resolution at given pulse height.
Definition: TOPCalTimeWalk.cc:51
Belle2::TOPCalTimeWalk::m_quadratic
double m_quadratic
quadratic term coefficient [ns]
Definition: TOPCalTimeWalk.h:127