Belle II Software  release-08-01-10
SVDClusterTimeShifterAlgorithm.h
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 #pragma once
10 
11 #include <calibration/CalibrationAlgorithm.h>
12 
13 #include "TMath.h"
14 
15 #include <optional>
16 
17 namespace Belle2 {
26  public:
27 
29  explicit SVDClusterTimeShifterAlgorithm(const std::string& str);
30 
33 
35  void setMaximumAllowedShift(const float& value) {m_maximumAllowedShift = value;}
36 
38  void setTimeAlgorithm(const std::vector<TString>& lst) {m_timeAlgorithms = lst;}
39 
41  void setMinEntries(const int& minEntries) {m_minEntries = minEntries;}
42 
43  protected:
44 
46  virtual EResult calibrate() override;
47 
48  private:
49 
50  std::string m_id = "";
51  float m_maximumAllowedShift = 15;
52  int m_minEntries = 1000;
53  std::vector<TString> m_timeAlgorithms = {"CoG3", "ELS3", "CoG6"};
54  };
55 
65  inline double singleGaus(const double* x, const double* par)
66  {
67  double N = std::fabs(par[0]);
68  double a = par[1];
69  double b = par[2];
70  double e = std::fabs(par[3]);
71  return N * TMath::Gaus(x[0], a, b, true) + e;
72  };
73 
86  inline double doubleGaus(const double* x, const double* par)
87  {
88  double N = std::fabs(par[0]);
89  double f = std::fabs(par[1]);
90  double a = par[2];
91  double b = par[3];
92  double c = par[4];
93  double d = par[5];
94  double e = std::fabs(par[6]);
95  return (N * (f * TMath::Gaus(x[0], a, b) + (1 - f) * TMath::Gaus(x[0], c, d)) /
96  (TMath::Sqrt(2. * TMath::Pi()) * ((b - d) * f + d)) + e);
97  };
98 
100 } // namespace Belle2
Base class for calibration algorithms.
EResult
The result of calibration.
Class implementing SVDClusterTimeShifter algorithm.
int m_minEntries
Set the minimun number of entries required in the histograms.
void setMinEntries(const int &minEntries)
Set the minimum entries required in the histograms.
std::vector< TString > m_timeAlgorithms
List of time algorithms to calibrate.
std::string m_id
Parameter given to set the UniqueID of the payload.
void setTimeAlgorithm(const std::vector< TString > &lst)
set list of time algorithm
float m_maximumAllowedShift
Allowed deviation of clsOnTracks histo wrt EventT0 histo.
SVDClusterTimeShifterAlgorithm(const std::string &str)
Constructor set the prefix to SVDTimeCalibrationCollector.
virtual EResult calibrate() override
Run algo on data.
void setMaximumAllowedShift(const float &value)
Setter for m_allowedT0Shift.
double doubleGaus(const double *x, const double *par)
Double gaus function, where N is a normalization constant, f is the fractional contribution of the fi...
double singleGaus(const double *x, const double *par)
Single gaus function, where N is a normalization constant, a is the mean of the Gaus distribution,...
Abstract base class for different kinds of events.