Belle II Software  release-08-01-10
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 
14 namespace Belle2 {
23  class HistDelta {
24  public:
32  enum EDeltaType { c_Disabled = 0, c_Entries = 1, c_Underflow = 2, c_Events = 3};
34  int m_parameter{};
35  unsigned int m_amountDeltas{};
36  TH1* m_lastHist{};
37  int m_lastValue{};
38  std::vector<TH1*> m_deltaHists;
39  bool m_updated{};
40  public:
41 
47  HistDelta(EDeltaType t = c_Disabled, int p = 0, unsigned int a = 0);
48 
54  void set(EDeltaType t, int p, unsigned int a);
55 
58  void setNotUpdated(void) {m_updated = false;};
59 
63  void update(TH1* hist);
64 
67  void reset(void);
68 
74  TH1* getDelta(unsigned int n = 0, bool onlyIfUpdated = true);
75  };
77 }
Class to keep track of delta histograms.
Definition: HistDelta.h:23
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:24
void reset(void)
Reset histogram and deltas, not the parameters.
Definition: HistDelta.cc:92
TH1 * getDelta(unsigned int n=0, bool onlyIfUpdated=true)
Get Delta Histogram.
Definition: HistDelta.cc:100
std::vector< 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
HistDelta(EDeltaType t=c_Disabled, int p=0, unsigned int a=0)
Construktor.
Definition: HistDelta.cc:15
void setNotUpdated(void)
Set not-updated yet status.
Definition: HistDelta.h:58
EDeltaType
enum definition for delta algo Disabled: nothing Entries: use nr histogram entries Underflow: use ent...
Definition: HistDelta.h:32
void update(TH1 *hist)
Check if update of delta histogram is necessary.
Definition: HistDelta.cc:31
TH1 * m_lastHist
Pointer to last histogram state for check.
Definition: HistDelta.h:36
bool m_updated
if any delta was updated in this event
Definition: HistDelta.h:39
Abstract base class for different kinds of events.