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
HistogramAccumulatorMerge Class Reference

Class to combine histograms of mean with error on mean. More...

#include <HistogramAccumulatorMerge.hh>

Inheritance diagram for HistogramAccumulatorMerge:
Inheritance graph
Collaboration diagram for HistogramAccumulatorMerge:
Collaboration graph

Public Member Functions

 HistogramAccumulatorMerge ()
 Default constructor only for ROOT reflexivity - not intended for use.
 
 HistogramAccumulatorMerge (TH1 *baseHistogram, int nDimensionsIn, const std::string &resultHistName, const std::string &resultHistTitle)
 Constructor simply passes down to base class.
 
virtual void Accumulate (TH1 *newValue)
 
- Public Member Functions inherited from HistogramAccumulator
 HistogramAccumulator ()
 Default constructor only for ROOT reflexivity - not intended for use.
 
 HistogramAccumulator (TH1 *baseHistogram, const std::string &resultHistNameIn, const std::string &resultHistTitleIn)
 
 HistogramAccumulator (TH1 *baseHistogram, int nDimensionsIn, const std::string &resultHistName, const std::string &resultHistTitle)
 
virtual ~HistogramAccumulator ()
 
virtual void Accumulate (TH1 *newValue)
 
virtual TH1 * Terminate ()
 
TH1 * Result () const
 Accessor.
 
void AddNEmptyEntries (unsigned long i)
 
unsigned long N () const
 Access currently accumulated number of entries.
 

Protected Member Functions

virtual void AccumulateSingleValue (double oldMean, double oldVari, double x, double xVari, unsigned long nEntriesAccumulated, unsigned long nEntriesToAccumulate, double &newMean, double &newVari) const
 
 ClassDef (HistogramAccumulatorMerge, 1)
 
- Protected Member Functions inherited from HistogramAccumulator
virtual void AccumulateSingleValue (double oldMean, double oldVari, double x, double xVari, unsigned long nEntriesAccumulated, unsigned long nEntriesToAccumulate, double &newMean, double &newVari) const
 
 ClassDef (HistogramAccumulator, 1)
 

Additional Inherited Members

- Protected Attributes inherited from HistogramAccumulator
int nDimensions
 Number of dimensions.
 
unsigned long n
 Counter.
 
bool terminated
 Whether this instance has been finished.
 
const std::string resultHistName
 Name for resultant histogram.
 
const std::string resultHistTitle
 Title for resultant histogram.
 
TH1 * mean
 
TH1 * variance
 
TH1 * result
 

Detailed Description

Class to combine histograms of mean with error on mean.

This uses the functionality of HistogramAccumulator to accumulate a combined mean and error on the mean from histograms already containing means and error the mean. i.e. The incoming histograms have already averaged many (at least 2) events.

This overrides two methods for the accumulation but the inheritance saves on repetition in the constructor and structures.

Author
Laurie Nevay

Definition at line 44 of file HistogramAccumulatorMerge.hh.

Constructor & Destructor Documentation

◆ HistogramAccumulatorMerge()

HistogramAccumulatorMerge::HistogramAccumulatorMerge ( TH1 *  baseHistogram,
int  nDimensionsIn,
const std::string &  resultHistName,
const std::string &  resultHistTitle 
)

Constructor simply passes down to base class.

Definition at line 37 of file HistogramAccumulatorMerge.cc.

◆ ~HistogramAccumulatorMerge()

virtual HistogramAccumulatorMerge::~HistogramAccumulatorMerge ( )
inlinevirtual

Definition at line 56 of file HistogramAccumulatorMerge.hh.

Member Function Documentation

◆ Accumulate()

void HistogramAccumulatorMerge::Accumulate ( TH1 *  newValue)
virtual

This method must be overridden as the information passed to the AccumualteSingleValue is different.

Reimplemented from HistogramAccumulator.

Definition at line 47 of file HistogramAccumulatorMerge.cc.

References AccumulateSingleValue(), HistogramAccumulator::n, and HistogramAccumulator::nDimensions.

Here is the call graph for this function:

◆ AccumulateSingleValue()

void HistogramAccumulatorMerge::AccumulateSingleValue ( double  oldMean,
double  oldVari,
double  x,
double  xVari,
unsigned long  nEntriesAccumulated,
unsigned long  nEntriesToAccumulate,
double &  newMean,
double &  newVari 
) const
protectedvirtual

This implements a different method from the base class that is used to combine means and variances from different samples of the same underlying experiment / data.

Reimplemented from HistogramAccumulator.

Definition at line 189 of file HistogramAccumulatorMerge.cc.

Referenced by Accumulate().

Here is the caller graph for this function:

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