Belle II Software development
HistObject Class Reference

Class to keep track of delta histograms. More...

#include <HistObject.h>

Public Member Functions

 HistObject (void)
 Constructor.
 
 ~HistObject (void)
 Destructor.
 
bool update (TH1 *hist)
 Check if update of histogram is necessary.
 
void resetBeforeEvent (void)
 Reset histogram and update flag, not the entries.
 
bool isUpdated (void)
 Check if hist was updated.
 
TH1 * getHist (void)
 Get hist pointer.
 

Public Attributes

std::unique_ptr< TH1 > m_hist
 Pointer to histogram.
 
bool m_updated = false
 flag if update since last event
 
double m_entries = -1
 entries in previous/current for update check
 

Detailed Description

Class to keep track of delta histograms.

Definition at line 21 of file HistObject.h.

Constructor & Destructor Documentation

◆ HistObject()

HistObject ( void  )
inline

Constructor.

Definition at line 30 of file HistObject.h.

30: m_hist(nullptr), m_updated(false), m_entries(-1) {};
double m_entries
entries in previous/current for update check
Definition: HistObject.h:25
bool m_updated
flag if update since last event
Definition: HistObject.h:24
std::unique_ptr< TH1 > m_hist
Pointer to histogram.
Definition: HistObject.h:23

◆ ~HistObject()

~HistObject ( void  )

Destructor.

Definition at line 12 of file HistObject.cc.

13{
14}

Member Function Documentation

◆ getHist()

TH1 * getHist ( void  )
inline

Get hist pointer.

Returns
hist ptr

Definition at line 54 of file HistObject.h.

54{ return m_hist.get();};

◆ isUpdated()

bool isUpdated ( void  )
inline

Check if hist was updated.

Returns
it was updated

Definition at line 49 of file HistObject.h.

49{ return m_updated;};

◆ resetBeforeEvent()

void resetBeforeEvent ( void  )

Reset histogram and update flag, not the entries.

Definition at line 27 of file HistObject.cc.

28{
29 m_hist = nullptr;
30 m_updated = false;
31}

◆ update()

bool update ( TH1 *  hist)

Check if update of histogram is necessary.

Parameters
histpointer to histogram
Returns
histogram was updated flag (return m_updated)

Definition at line 16 of file HistObject.cc.

17{
18 if (hist) {
19 // usual check for nullptr
20 m_updated |= hist->GetEntries() != m_entries;
21 m_entries = hist->GetEntries();
22 }
23 m_hist = std::unique_ptr<TH1>(hist); // even if it is nullptr
24 return m_updated;
25}

Member Data Documentation

◆ m_entries

double m_entries = -1

entries in previous/current for update check

Definition at line 25 of file HistObject.h.

◆ m_hist

std::unique_ptr<TH1> m_hist

Pointer to histogram.

Definition at line 23 of file HistObject.h.

◆ m_updated

bool m_updated = false

flag if update since last event

Definition at line 24 of file HistObject.h.


The documentation for this class was generated from the following files: