BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes
PerEntryHistogram Class Reference

Holder for information to calculate per entry histograms. More...

#include <PerEntryHistogram.hh>

Inheritance diagram for PerEntryHistogram:
Inheritance graph
Collaboration diagram for PerEntryHistogram:
Collaboration graph

Public Member Functions

 PerEntryHistogram ()
 Public constructor only for compatibility with ROOT - not intended for use.
 
 PerEntryHistogram (const HistogramDef *definition, TChain *chain)
 Constructor with a histogram definition and the chain to operate on.
 
virtual void AccumulateCurrentEntry (long int entryNumber)
 
virtual void Terminate ()
 Terminate the accumulator and save the result to the result member variable.
 
virtual void Write (TDirectory *dir=nullptr)
 
void AddNEmptyEntries (unsigned long i)
 
double Integral () const
 Get the Integral() from the result member histogram if it exists, otherwise 0.
 

Protected Member Functions

 ClassDef (PerEntryHistogram, 1)
 

Protected Attributes

HistogramAccumulatoraccumulator
 
TChain * chain
 Cache of chain pointer that provides data.
 
std::string selection
 Selection command.
 
TH1 * temp
 Histogram for temporary 1 event data.
 
TH1 * result
 Final result with errors as the error on the mean.
 
std::string command
 Draw command.
 

Detailed Description

Holder for information to calculate per entry histograms.

This creates a histogram per event and accumulates the mean and variance for every bin in a cloned histogram. In the case of 1 event, the bin error is 0.

This uses a HistogramAccumulator object rather than inheritance as this class has to prepare the base histogram in the constructor first.

Author
Laurie Nevay

Definition at line 46 of file PerEntryHistogram.hh.

Constructor & Destructor Documentation

◆ PerEntryHistogram()

PerEntryHistogram::PerEntryHistogram ( const HistogramDef definition,
TChain *  chain 
)

Constructor with a histogram definition and the chain to operate on.

Definition at line 50 of file PerEntryHistogram.cc.

References command, HistogramFactory::CreateHistogram1D(), HistogramFactory::CreateHistogram2D(), HistogramFactory::CreateHistogram3D(), HistogramFactory::CreateHistogram4D(), and temp.

Here is the call graph for this function:

◆ ~PerEntryHistogram()

PerEntryHistogram::~PerEntryHistogram ( )
virtual

Definition at line 110 of file PerEntryHistogram.cc.

Member Function Documentation

◆ AccumulateCurrentEntry()

void PerEntryHistogram::AccumulateCurrentEntry ( long int  entryNumber)
virtual

Create a histogram of the appropriate dimensions for the currently loaded event then add it to the online (ie running) means and variances.

Reimplemented in PerEntryHistogramSet.

Definition at line 116 of file PerEntryHistogram.cc.

References HistogramAccumulator::Accumulate(), chain, command, selection, and temp.

Referenced by PerEntryHistogramSet::AccumulateCurrentEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddNEmptyEntries()

void PerEntryHistogram::AddNEmptyEntries ( unsigned long  i)
inline

Permit the number of recorded entries to be incremented with zero values, ie just increment n.

Definition at line 70 of file PerEntryHistogram.hh.

References HistogramAccumulator::AddNEmptyEntries().

Here is the call graph for this function:

◆ Integral()

double PerEntryHistogram::Integral ( ) const

Get the Integral() from the result member histogram if it exists, otherwise 0.

Definition at line 142 of file PerEntryHistogram.cc.

References result.

◆ Terminate()

void PerEntryHistogram::Terminate ( )
virtual

Terminate the accumulator and save the result to the result member variable.

Reimplemented in PerEntryHistogramSet.

Definition at line 127 of file PerEntryHistogram.cc.

References result, and HistogramAccumulator::Terminate().

Referenced by PerEntryHistogramSet::Terminate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Write()

void PerEntryHistogram::Write ( TDirectory *  dir = nullptr)
virtual

Forwarding function - call Write on result histograms on the currently open file. Optional directory to specify where the histogram should be moved to.

Reimplemented in PerEntryHistogramSet.

Definition at line 132 of file PerEntryHistogram.cc.

References result.

Referenced by PerEntryHistogramSet::Write().

Here is the caller graph for this function:

Field Documentation

◆ accumulator

HistogramAccumulator* PerEntryHistogram::accumulator
protected

Definition at line 76 of file PerEntryHistogram.hh.

◆ chain

TChain* PerEntryHistogram::chain
protected

Cache of chain pointer that provides data.

Definition at line 77 of file PerEntryHistogram.hh.

Referenced by AccumulateCurrentEntry().

◆ command

std::string PerEntryHistogram::command
protected

Draw command.

Definition at line 81 of file PerEntryHistogram.hh.

Referenced by AccumulateCurrentEntry(), and PerEntryHistogram().

◆ result

TH1* PerEntryHistogram::result
protected

Final result with errors as the error on the mean.

Definition at line 80 of file PerEntryHistogram.hh.

Referenced by Integral(), Terminate(), and Write().

◆ selection

std::string PerEntryHistogram::selection
protected

Selection command.

Definition at line 78 of file PerEntryHistogram.hh.

Referenced by AccumulateCurrentEntry().

◆ temp

TH1* PerEntryHistogram::temp
protected

Histogram for temporary 1 event data.

Definition at line 79 of file PerEntryHistogram.hh.

Referenced by AccumulateCurrentEntry(), and PerEntryHistogram().


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