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 {
23 class HistDelta {
24 public:
32 enum EDeltaType { c_Disabled = 0, c_Entries = 1, c_Underflow = 2, c_Events = 3};
33 EDeltaType m_type{c_Disabled};
34 int m_parameter{0};
35 unsigned int m_amountDeltas{};
36 std::unique_ptr<TH1> m_lastHist{nullptr};
37 int m_lastValue{0};
38 std::vector<std::unique_ptr<TH1>> m_deltaHists;
39 bool m_updated{false};
40 public:
41
47 HistDelta(EDeltaType t = c_Disabled, int p = 0, unsigned int a = 0);
48
51 ~HistDelta();
52
58 void set(EDeltaType t, int p, unsigned int a);
59
62 void setNotUpdated(void) {m_updated = false;};
63
67 void update(const TH1* hist);
68
71 void reset(void);
72
78 TH1* getDelta(unsigned int n = 0, bool onlyIfUpdated = true) const;
79 };
81}
Class to keep track of delta histograms.
Definition: HistDelta.h:23
void update(const TH1 *hist)
Check if update of delta histogram is necessary.
Definition: HistDelta.cc:40
~HistDelta()
Destructor.
Definition: HistDelta.cc:24
EDeltaType m_type
type of delta algo
Definition: HistDelta.h:33
void set(EDeltaType t, int p, unsigned int a)
Parameter setter.
Definition: HistDelta.cc:30
void reset(void)
Reset histogram and deltas, not the parameters.
Definition: HistDelta.cc:100
std::unique_ptr< TH1 > m_lastHist
Pointer to last histogram state for check.
Definition: HistDelta.h:36
TH1 * getDelta(unsigned int n=0, bool onlyIfUpdated=true) const
Get Delta Histogram.
Definition: HistDelta.cc:107
std::vector< std::unique_ptr< TH1 > > m_deltaHists
vector of histograms (max m_amountDeltas)
Definition: HistDelta.h:38
int m_lastValue
last value for comparison, depending on type
Definition: HistDelta.h:37
unsigned int m_amountDeltas
amount of past histograms, at least 1
Definition: HistDelta.h:35
int m_parameter
parameter depending on algo, e.g.
Definition: HistDelta.h:34
void setNotUpdated(void)
Set not-updated yet status.
Definition: HistDelta.h:62
EDeltaType
enum definition for delta algo Disabled: nothing Entries: use nr histogram entries Underflow: use ent...
Definition: HistDelta.h:32
bool m_updated
if any delta was updated in this event
Definition: HistDelta.h:39
Abstract base class for different kinds of events.