BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Class to accumulate and merge ParticleSets in different ways. More...
#include <ParticleSetAccumulator.hh>
Public Member Functions | |
ParticleSetAccumulator () | |
Default constructor only for ROOT reflexivity - not intended for use. | |
ParticleSetAccumulator (ParticleSet *baseHistogram, const std::string &resultHistName, const std::string &resultHistTitle) | |
virtual | ~ParticleSetAccumulator () |
virtual void | Accumulate (ParticleSet *newValue) |
virtual ParticleSet * | Terminate () |
ParticleSet * | Result () const |
Accessor. | |
void | AddNEmptyEntries (unsigned long i) |
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 (ParticleSetAccumulator, 1) | |
Protected Attributes | |
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. | |
ParticleSet * | mean |
ParticleSet * | variance |
ParticleSet * | result |
Class to accumulate and merge ParticleSets in different ways.
Definition at line 34 of file ParticleSetAccumulator.hh.
ParticleSetAccumulator::ParticleSetAccumulator | ( | ParticleSet * | baseHistogram, |
const std::string & | resultHistName, | ||
const std::string & | resultHistTitle | ||
) |
Construct accumulator based on another histogram of 1,2 or 3 dimensions. Note, the result name must be different from that of baseHistogram if baseHistogram exists in the currently open file.
Definition at line 37 of file ParticleSetAccumulator.cc.
References resultHistName.
|
virtual |
Destructor deletes mean and variance temporary histograms but leaks result as deleting it would remove it from the open file in ROOT.
Definition at line 55 of file ParticleSetAccumulator.cc.
|
virtual |
Loop over the bins in a histogram and accumulate that bin from a new histogram ("newValue"). newValue is assumed to be the exact same as the baseHistogram the instance of this class was constructed with.
Definition at line 62 of file ParticleSetAccumulator.cc.
References AccumulateSingleValue(), and n.
|
protectedvirtual |
Accumulate a single value into the online mean and variance histograms. This by default accumulates the mean and variance with a new value x. The xVari argument is not used in the implementation provided with this class but is used in derived classes with different AccumulateSingleValue implementations.
Definition at line 107 of file ParticleSetAccumulator.cc.
Referenced by Accumulate().
|
inline |
Permit the number of recorded entries to be incremented with zero values, ie just increment n.
Definition at line 65 of file ParticleSetAccumulator.hh.
References n.
|
inline |
Accessor.
Definition at line 61 of file ParticleSetAccumulator.hh.
|
virtual |
Write the result to the result histogram. Calculate the standard error on the mean from the variance for the error in each bin.
Definition at line 83 of file ParticleSetAccumulator.cc.
References n.
|
protected |
Definition at line 86 of file ParticleSetAccumulator.hh.
|
protected |
Counter.
Definition at line 82 of file ParticleSetAccumulator.hh.
Referenced by Accumulate(), AddNEmptyEntries(), and Terminate().
|
protected |
Definition at line 88 of file ParticleSetAccumulator.hh.
|
protected |
Name for resultant histogram.
Definition at line 84 of file ParticleSetAccumulator.hh.
Referenced by ParticleSetAccumulator().
|
protected |
Title for resultant histogram.
Definition at line 85 of file ParticleSetAccumulator.hh.
|
protected |
Whether this instance has been finished.
Definition at line 83 of file ParticleSetAccumulator.hh.
|
protected |
Definition at line 87 of file ParticleSetAccumulator.hh.