Belle II Software  release-05-02-19
TOPAsicShiftsBS13dAlgorithm.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * *
6  * Author: The Belle II Collaboration *
7  * Contributors: Marko Staric *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #pragma once
13 
14 #include <calibration/CalibrationAlgorithm.h>
15 #include <TH1F.h>
16 #include <vector>
17 
18 namespace Belle2 {
23  namespace TOP {
24 
28  class TOPAsicShiftsBS13dAlgorithm : public CalibrationAlgorithm {
29 
30  public:
31 
34 
36  virtual ~TOPAsicShiftsBS13dAlgorithm() {}
37 
42  void setMinValue(double minVal) {m_minVal = minVal;}
43 
49  void setWindowSize(int size) {m_winSize = size;}
50 
56  void setShiftRange(int begin, int end) {m_shiftBegin = begin; m_shiftEnd = end;}
57 
62  void setMinimalSignificance(double s) {m_minSignificance = s;}
63 
64  private:
65 
69  virtual EResult calibrate() final;
70 
75  void setWindow();
76 
81  double fun(int x);
82 
87  std::vector<double> getPDF(int shift);
88 
94  double logL(std::shared_ptr<TH1F> h, int shift);
95 
96  // parameters
97  double m_minVal = 1.0;
98  int m_shiftBegin = -20;
99  int m_shiftEnd = 20;
100  double m_minSignificance = 5;
102  // other
103  std::vector<double> m_timeReference;
104  int m_winSize = 21;
105  int m_i0 = 0;
106  int m_i1 = 0;
107  std::vector<int> m_lastEntries;
109  };
110 
111  } // end namespace TOP
113 } // end namespace Belle2
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::m_minSignificance
double m_minSignificance
minimal result significance to declare c_OK
Definition: TOPAsicShiftsBS13dAlgorithm.h:109
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::setShiftRange
void setShiftRange(int begin, int end)
Sets the search range.
Definition: TOPAsicShiftsBS13dAlgorithm.h:65
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::TOPAsicShiftsBS13dAlgorithm
TOPAsicShiftsBS13dAlgorithm()
Constructor.
Definition: TOPAsicShiftsBS13dAlgorithm.cc:29
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::setMinimalSignificance
void setMinimalSignificance(double s)
Set minimal significance of the result to declare calibration as OK.
Definition: TOPAsicShiftsBS13dAlgorithm.h:71
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::setWindowSize
void setWindowSize(int size)
Sets size of the window on reference time distribution.
Definition: TOPAsicShiftsBS13dAlgorithm.h:58
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::m_timeReference
std::vector< double > m_timeReference
reference time distribution
Definition: TOPAsicShiftsBS13dAlgorithm.h:112
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::setMinValue
void setMinValue(double minVal)
Sets minimal function value.
Definition: TOPAsicShiftsBS13dAlgorithm.h:51
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::m_i1
int m_i1
last bin of the window on reference time distribution
Definition: TOPAsicShiftsBS13dAlgorithm.h:115
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::logL
double logL(std::shared_ptr< TH1F > h, int shift)
Returns log likelihood of a histogram with respect to PDF at a given shift.
Definition: TOPAsicShiftsBS13dAlgorithm.cc:250
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::m_winSize
int m_winSize
size of the window on reference time distribution
Definition: TOPAsicShiftsBS13dAlgorithm.h:113
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::m_shiftEnd
int m_shiftEnd
shift range: upper limit + 1
Definition: TOPAsicShiftsBS13dAlgorithm.h:108
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::fun
double fun(int x)
Returns measured time distribution at x or minVal for outside-range or empty bins.
Definition: TOPAsicShiftsBS13dAlgorithm.cc:230
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::m_lastEntries
std::vector< int > m_lastEntries
number of histogram entries
Definition: TOPAsicShiftsBS13dAlgorithm.h:116
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::m_i0
int m_i0
first bin of the window on reference time distribution
Definition: TOPAsicShiftsBS13dAlgorithm.h:114
Belle2::CalibrationAlgorithm::EResult
EResult
The result of calibration.
Definition: CalibrationAlgorithm.h:50
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::calibrate
virtual EResult calibrate() final
algorithm implementation
Definition: TOPAsicShiftsBS13dAlgorithm.cc:36
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::getPDF
std::vector< double > getPDF(int shift)
Returns normalized time distribution at a given shift (PDF)
Definition: TOPAsicShiftsBS13dAlgorithm.cc:237
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::m_minVal
double m_minVal
minimal function value
Definition: TOPAsicShiftsBS13dAlgorithm.h:106
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::~TOPAsicShiftsBS13dAlgorithm
virtual ~TOPAsicShiftsBS13dAlgorithm()
Destructor.
Definition: TOPAsicShiftsBS13dAlgorithm.h:45
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::m_shiftBegin
int m_shiftBegin
shift range: lower limit
Definition: TOPAsicShiftsBS13dAlgorithm.h:107
Belle2::TOP::TOPAsicShiftsBS13dAlgorithm::setWindow
void setWindow()
Sets the position of a window containing maximum number of entries of reference time distribution.
Definition: TOPAsicShiftsBS13dAlgorithm.cc:206