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
PerEntryHistogramSet Class Referenceabstract

Histogram over a set of integers not number line. More...

#include <PerEntryHistogramSet.hh>

Inheritance diagram for PerEntryHistogramSet:
Inheritance graph
Collaboration diagram for PerEntryHistogramSet:
Collaboration graph

Public Member Functions

 PerEntryHistogramSet (const HistogramDefSet *definitionIn, Event *eventIn, TChain *chainIn)
 
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)
 
virtual void CheckSampler ()=0
 
- Public Member Functions inherited from PerEntryHistogram
 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.
 
void AddNEmptyEntries (unsigned long i)
 
double Integral () const
 Get the Integral() from the result member histogram if it exists, otherwise 0.
 

Protected Member Functions

virtual void GetPDGIDSetFromSampler (std::set< long long int > &setIn) const =0
 
bool IsIon (long long int pdgID) const
 
void CreatePerEntryHistogram (long long int pdgID)
 
std::vector< long long int > TopUtility (const std::set< long long int > &s, size_t n) const
 Utility function to find top N in set s. Sorted in descending order of integral.
 
std::vector< long long int > TopNNonIons (int n) const
 Get top part of set. Sorted in descending order of integral.
 
std::vector< long long int > TopNIons (int n) const
 Get top part of set. Sorted in descending order of integral.
 
std::vector< long long int > TopN (int n) const
 Get top part of set. Sorted in descending order of integral.
 
- Protected Member Functions inherited from PerEntryHistogram
 ClassDef (PerEntryHistogram, 1)
 

Protected Attributes

HistogramDefbaseDefinition
 
Eventevent
 
TChain * chain
 
std::string branchName
 
bool dynamicallyStoreParticles
 
bool dynamicallyStoreIons
 
long long int nEntries
 
HistogramDefSet::writewhat what
 
int topN
 
BDSOutputROOTEventSampler< double > * sampler
 
BDSOutputROOTEventSampler< float > * sampler
 
std::set< long long int > allPDGIDs
 
std::set< long long int > ions
 
std::set< long long int > nonIons
 
std::map< ParticleSpec, PerEntryHistogram * > histograms
 
std::map< long long int, PerEntryHistogram * > histogramsByPDGID
 
std::vector< PerEntryHistogram * > allPerEntryHistograms
 
- Protected Attributes inherited from PerEntryHistogram
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

Histogram over a set of integers not number line.

Author
L. Nevay

Definition at line 61 of file PerEntryHistogramSet.hh.

Constructor & Destructor Documentation

◆ PerEntryHistogramSet()

PerEntryHistogramSet::PerEntryHistogramSet ( const HistogramDefSet definitionIn,
Event eventIn,
TChain *  chainIn 
)

Definition at line 38 of file PerEntryHistogramSet.cc.

◆ ~PerEntryHistogramSet()

PerEntryHistogramSet::~PerEntryHistogramSet ( )
virtual

Definition at line 91 of file PerEntryHistogramSet.cc.

Member Function Documentation

◆ AccumulateCurrentEntry()

void PerEntryHistogramSet::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 from PerEntryHistogram.

Definition at line 98 of file PerEntryHistogramSet.cc.

References PerEntryHistogram::AccumulateCurrentEntry(), CheckSampler(), and GetPDGIDSetFromSampler().

Here is the call graph for this function:

◆ CheckSampler()

virtual void PerEntryHistogramSet::CheckSampler ( )
pure virtual

Ensure sampler is setup even if it wasn't on at the beginning when we inspected the model tree. We need this to build up unique PDG IDs by manually looping over the data. A derived class must implement this for each type of sampler data we have.

Implemented in PerEntryHistogramSetC, PerEntryHistogramSetPlane, and PerEntryHistogramSetS.

Referenced by AccumulateCurrentEntry().

Here is the caller graph for this function:

◆ CreatePerEntryHistogram()

void PerEntryHistogramSet::CreatePerEntryHistogram ( long long int  pdgID)
protected

Definition at line 70 of file PerEntryHistogramSet.cc.

◆ GetPDGIDSetFromSampler()

virtual void PerEntryHistogramSet::GetPDGIDSetFromSampler ( std::set< long long int > &  setIn) const
protectedpure virtual

Derived class should get the partID member and form a set from the specific type of sampler it is.

Implemented in PerEntryHistogramSetC, PerEntryHistogramSetPlane, and PerEntryHistogramSetS.

Referenced by AccumulateCurrentEntry().

Here is the caller graph for this function:

◆ IsIon()

bool PerEntryHistogramSet::IsIon ( long long int  pdgID) const
inlineprotected

Definition at line 84 of file PerEntryHistogramSet.hh.

◆ Terminate()

void PerEntryHistogramSet::Terminate ( )
virtual

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

Reimplemented from PerEntryHistogram.

Definition at line 129 of file PerEntryHistogramSet.cc.

References PerEntryHistogram::Terminate().

Here is the call graph for this function:

◆ TopN()

std::vector< long long int > PerEntryHistogramSet::TopN ( int  n) const
protected

Get top part of set. Sorted in descending order of integral.

Definition at line 200 of file PerEntryHistogramSet.cc.

References TopUtility().

Referenced by Write().

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

◆ TopNIons()

std::vector< long long int > PerEntryHistogramSet::TopNIons ( int  n) const
protected

Get top part of set. Sorted in descending order of integral.

Definition at line 195 of file PerEntryHistogramSet.cc.

References TopUtility().

Referenced by Write().

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

◆ TopNNonIons()

std::vector< long long int > PerEntryHistogramSet::TopNNonIons ( int  n) const
protected

Get top part of set. Sorted in descending order of integral.

Definition at line 190 of file PerEntryHistogramSet.cc.

References TopUtility().

Referenced by Write().

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

◆ TopUtility()

std::vector< long long int > PerEntryHistogramSet::TopUtility ( const std::set< long long int > &  s,
size_t  n 
) const
protected

Utility function to find top N in set s. Sorted in descending order of integral.

Definition at line 167 of file PerEntryHistogramSet.cc.

Referenced by TopN(), TopNIons(), and TopNNonIons().

Here is the caller graph for this function:

◆ Write()

void PerEntryHistogramSet::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 from PerEntryHistogram.

Definition at line 135 of file PerEntryHistogramSet.cc.

References TopN(), TopNIons(), TopNNonIons(), and PerEntryHistogram::Write().

Here is the call graph for this function:

Field Documentation

◆ allPDGIDs

std::set<long long int> PerEntryHistogramSet::allPDGIDs
protected

Definition at line 114 of file PerEntryHistogramSet.hh.

◆ allPerEntryHistograms

std::vector<PerEntryHistogram*> PerEntryHistogramSet::allPerEntryHistograms
protected

Definition at line 119 of file PerEntryHistogramSet.hh.

◆ baseDefinition

HistogramDef* PerEntryHistogramSet::baseDefinition
protected

Definition at line 98 of file PerEntryHistogramSet.hh.

◆ branchName

std::string PerEntryHistogramSet::branchName
protected

Definition at line 101 of file PerEntryHistogramSet.hh.

◆ chain

TChain* PerEntryHistogramSet::chain
protected

Definition at line 100 of file PerEntryHistogramSet.hh.

◆ dynamicallyStoreIons

bool PerEntryHistogramSet::dynamicallyStoreIons
protected

Definition at line 103 of file PerEntryHistogramSet.hh.

◆ dynamicallyStoreParticles

bool PerEntryHistogramSet::dynamicallyStoreParticles
protected

Definition at line 102 of file PerEntryHistogramSet.hh.

◆ event

Event* PerEntryHistogramSet::event
protected

Definition at line 99 of file PerEntryHistogramSet.hh.

◆ histograms

std::map<ParticleSpec, PerEntryHistogram*> PerEntryHistogramSet::histograms
protected

Definition at line 117 of file PerEntryHistogramSet.hh.

◆ histogramsByPDGID

std::map<long long int, PerEntryHistogram*> PerEntryHistogramSet::histogramsByPDGID
protected

Definition at line 118 of file PerEntryHistogramSet.hh.

◆ ions

std::set<long long int> PerEntryHistogramSet::ions
protected

Definition at line 115 of file PerEntryHistogramSet.hh.

◆ nEntries

long long int PerEntryHistogramSet::nEntries
protected

Definition at line 104 of file PerEntryHistogramSet.hh.

◆ nonIons

std::set<long long int> PerEntryHistogramSet::nonIons
protected

Definition at line 116 of file PerEntryHistogramSet.hh.

◆ sampler [1/2]

BDSOutputROOTEventSampler<double>* PerEntryHistogramSet::sampler
protected

Definition at line 109 of file PerEntryHistogramSet.hh.

◆ sampler [2/2]

BDSOutputROOTEventSampler<float>* PerEntryHistogramSet::sampler
protected

Definition at line 111 of file PerEntryHistogramSet.hh.

◆ topN

int PerEntryHistogramSet::topN
protected

Definition at line 106 of file PerEntryHistogramSet.hh.

◆ what

HistogramDefSet::writewhat PerEntryHistogramSet::what
protected

Definition at line 105 of file PerEntryHistogramSet.hh.


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