Belle II Software prerelease-11-00-00a
SVDClusterAbsoluteTimeShifterAlgorithm.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
17namespace Belle2 {
26 public:
27
29 explicit SVDClusterAbsoluteTimeShifterAlgorithm(const std::string& str);
30
33
35 void setAllowedTimeShift(float value) {m_allowedTimeShift = value;}
36
39
41 void setMaximumAllowedShift(const float& value) {m_maximumAllowedShift = value;}
42
45
47 void setTimeAlgorithm(const std::vector<TString>& lst) {m_timeAlgorithms = lst;}
48
50 std::vector<TString> getTimeAlgorithm() {return m_timeAlgorithms;}
51
53 void setMinEntries(const int& minEntries) {m_minEntries = minEntries;}
54
57
58 protected:
59
61 virtual EResult calibrate() override;
62
65 virtual bool isBoundaryRequired(const Calibration::ExpRun& currentRun) override;
66
68 virtual void boundaryFindingSetup(std::vector<Calibration::ExpRun> /*runs*/, int /*iteration = 0*/) override
69 {
71 }
72
73
74 private:
75
76 std::string m_id = "";
77 std::optional<float> m_previousTimeMeanL3V;
78 float m_allowedTimeShift = 2.;
80 int m_minEntries = 100;
81 std::vector<TString> m_timeAlgorithms = {"CoG3", "ELS3", "CoG6"};
82 int m_innerLayer = 3;
83 int m_outerLayer = 6;
84 };
85
97 inline double AbssingleGaus(const double* x, const double* par)
98 {
99 double N = std::fabs(par[0]);
100 double a = par[1];
101 double b = par[2];
102 double e = std::fabs(par[3]);
103 return N * TMath::Gaus(x[0], a, b, true) + e;
104 };
105
118 inline double AbsdoubleGaus(const double* x, const double* par)
119 {
120 double N = std::fabs(par[0]);
121 double f = std::fabs(par[1]);
122 double a = par[2];
123 double b = par[3];
124 double c = par[4];
125 double d = par[5];
126 double e = std::fabs(par[6]);
127 return (N * (f * TMath::Gaus(x[0], a, b) + (1 - f) * TMath::Gaus(x[0], c, d)) /
128 (TMath::Sqrt(2. * TMath::Pi()) * ((b - d) * f + d)) + e);
129 };
130
132} // namespace Belle2
EResult
The result of calibration.
CalibrationAlgorithm(const std::string &collectorModuleName)
Constructor - sets the prefix for collected objects (won't be accesses until execute(....
int m_minEntries
Set the minimum number of entries required in the histograms.
SVDClusterAbsoluteTimeShifterAlgorithm(const std::string &str)
Constructor set the prefix to SVDTimeCalibrationCollector.
void setMinEntries(const int &minEntries)
Set the minimum entries required in the histograms.
std::vector< TString > m_timeAlgorithms
Hardcoded list of time algorithms to calibrate.
std::string m_id
Parameter given to set the UniqueID of the payload.
std::vector< TString > getTimeAlgorithm()
Get list of time algorithm.
void setTimeAlgorithm(const std::vector< TString > &lst)
Set list of time algorithm.
virtual void boundaryFindingSetup(std::vector< Calibration::ExpRun >, int) override
setup the boundary finding
float getMaximumAllowedShift()
Get the maximum allowed deviation of clsOnTracks histo wrt EventT0 histo (m_allowedT0Shift)
float m_maximumAllowedShift
Allowed deviation of clsOnTracks histo wrt EventT0 histo.
std::optional< float > m_previousTimeMeanL3V
Cluster time of the previous run.
virtual bool isBoundaryRequired(const Calibration::ExpRun &currentRun) override
If the event T0 changes significantly return true.
void setMaximumAllowedShift(const float &value)
Setter for m_allowedT0Shift.
void setAllowedTimeShift(float value)
Setter for m_allowedTimeShift.
int getMinEntries()
Get the minimum entries required in the histograms.
double AbsdoubleGaus(const double *x, const double *par)
Double gauss function, where N is a normalization constant, f is the fractional contribution of the f...
double AbssingleGaus(const double *x, const double *par)
Single gauss function, where N is a normalization constant, a is the mean of the Gauss distribution,...
Abstract base class for different kinds of events.