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