Belle II Software development
HistDelta.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#pragma once
9
10#include <TH1.h>
11#include <queue>
12#include <vector>
13
14namespace Belle2 {
19
27 class HistDelta {
28 public:
36 enum EDeltaType { c_Disabled = 0, c_Entries = 1, c_Underflow = 2, c_Events = 3};
37 EDeltaType m_type{c_Disabled};
38 int m_parameter{0};
39 unsigned int m_amountDeltas{};
40 std::unique_ptr<TH1> m_lastHist{nullptr};
41 int m_lastValue{0};
42 std::vector<std::unique_ptr<TH1>> m_deltaHists;
43 bool m_updated{false};
44 public:
45
51 explicit HistDelta(EDeltaType t = c_Disabled, int p = 0, unsigned int a = 0);
52
55 ~HistDelta();
56
62 void set(EDeltaType t, int p, unsigned int a);
63
66 void setNotUpdated(void) {m_updated = false;};
67
71 void update(const TH1* hist);
72
75 void reset(void);
76
82 TH1* getDelta(unsigned int n = 0, bool onlyIfUpdated = true) const;
83 };
84
85}
void update(const TH1 *hist)
Check if update of delta histogram is necessary.
Definition HistDelta.cc:39
~HistDelta()
Destructor.
Definition HistDelta.cc:23
EDeltaType m_type
type of delta algo
Definition HistDelta.h:37
void set(EDeltaType t, int p, unsigned int a)
Parameter setter.
Definition HistDelta.cc:29
void reset(void)
Reset histogram and deltas, not the parameters.
Definition HistDelta.cc:99
std::unique_ptr< TH1 > m_lastHist
Pointer to last histogram state for check.
Definition HistDelta.h:40
TH1 * getDelta(unsigned int n=0, bool onlyIfUpdated=true) const
Get Delta Histogram.
Definition HistDelta.cc:106
std::vector< std::unique_ptr< TH1 > > m_deltaHists
vector of histograms (max m_amountDeltas)
Definition HistDelta.h:42
int m_lastValue
last value for comparison, depending on type
Definition HistDelta.h:41
unsigned int m_amountDeltas
amount of past histograms, at least 1
Definition HistDelta.h:39
int m_parameter
parameter depending on algo, e.g.
Definition HistDelta.h:38
HistDelta(EDeltaType t=c_Disabled, int p=0, unsigned int a=0)
Constructor.
Definition HistDelta.cc:15
void setNotUpdated(void)
Set not-updated yet status.
Definition HistDelta.h:66
EDeltaType
enum definition for delta algo Disabled: nothing Entries: use nr histogram entries Underflow: use ent...
Definition HistDelta.h:36
bool m_updated
if any delta was updated in this event
Definition HistDelta.h:43
Abstract base class for different kinds of events.