Belle II Software development
TestCalibrationAlgorithm.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#include <calibration/CalibrationAlgorithm.h>
11#include <optional>
12
13namespace Belle2 {
22 public:
23
26
29
31 void setForceFail(bool forceFail) {m_forceFail = forceFail;}
32
34 bool getForceFail() {return m_forceFail;}
35
37 void setMinEntries(int minEntries) {m_minEntries = minEntries;}
38
41
43 void setDebugHisto(bool debugHisto) {m_debugHisto = debugHisto;}
44
46 void setAllowedMeanShift(float value) {m_allowedMeanShift = value;}
47
50
51 protected:
52
54 virtual EResult calibrate() override;
55
57 virtual bool isBoundaryRequired(const Calibration::ExpRun& currentRun) override;
58
60 // Notice that we comment out the argument names because we want to avoid compiler warnings about not using them.
61 virtual void boundaryFindingSetup(std::vector<Calibration::ExpRun> /*runs*/, int /*iteration = 0*/) override
62 {
63 m_previousMean.reset();
64 };
65
66 private:
67
69 int m_minEntries = 100;
70
72 int m_forceFail = false;
73
75 int m_debugHisto = false;
76
79
81 std::optional<float> m_previousMean;
82
84 float m_allowedMeanShift = 0.5;
85 };
87} // namespace Belle2
Base class for calibration algorithms.
EResult
The result of calibration.
Test class implementing calibration algorithm.
int m_minEntries
Set when c_NotEnoughData will be returned.
void setMinEntries(int minEntries)
setter for m_minEntries
void setForceFail(bool forceFail)
setter for m_willFail
void setAllowedMeanShift(float value)
Setter for m_allowedMeanShift.
bool getForceFail()
getter for m_willFail
void setDebugHisto(bool debugHisto)
setter for m_debugHisto
virtual void boundaryFindingSetup(std::vector< Calibration::ExpRun >, int) override
Start boundary finding mode, we simply set the previous mean to be a silly amount.
int m_debugHisto
Set if a debugging histogram should be created in the algorithm output directory.
int m_forceFail
Force always fail for testing.
std::optional< float > m_previousMean
During isBoundaryRequired this is used to define the previous run's mean.
virtual EResult calibrate() override
Run algo on data.
float m_allowedMeanShift
Configurable parameter for deciding when to choose a new payload boundary (if used)
float getAllowedMeanShift()
Getter for m_allowedMeanShift.
virtual bool isBoundaryRequired(const Calibration::ExpRun &currentRun) override
Decide if a run should be a payload boundary. Only used in certain Python Algorithm Starategies.
void createDebugHistogram()
Perform debug histogram file creation.
TestCalibrationAlgorithm()
Constructor set the prefix to TestCalibration.
int getMinEntries()
getter for m_minEntries
Abstract base class for different kinds of events.