BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
#include <EventAnalysis.hh>
Public Member Functions | |
EventAnalysis () | |
EventAnalysis (Event *eventIn, TChain *chain, bool perEntryAnalysis=true, bool processSamplersIn=true, bool debugIn=false, bool printOutIn=true, double printModuloFraction=0.01, bool emittanceOnTheFlyIn=false, long int eventStartIn=0, long int eventEndIn=-1, const std::string &primaryParticleName="") | |
Constructor intended for use to construct an event analysis object. | |
virtual void | Execute () |
virtual void | Process () |
Operate on each entry in the event tree. | |
virtual void | SimpleHistograms () |
Process histogram definitions from configuration instance. | |
virtual void | Terminate () |
Terminate each individual sampler analysis and append optical functions. | |
virtual void | Write (TFile *outputFileName) |
Write analysis including optical functions to an output file. | |
![]() | |
Analysis (const std::string &treeNameIn, TChain *chainIn, const std::string &mergedHistogramNameIn, bool perEntryAnalysis=true, bool debugIn=false) | |
virtual void | Execute () |
Method which calls all other methods in order. | |
virtual void | Process ()=0 |
virtual void | UserProcess () |
Virtual function for user to overload and use. Does nothing by default. | |
virtual void | SimpleHistograms () |
Process histogram definitions from configuration instance. | |
void | PreparePerEntryHistograms () |
Create structures necessary for per entry histograms. | |
void | AccumulatePerEntryHistograms (long int entryNumber) |
Accumulate means and variances for per entry histograms. | |
void | TerminatePerEntryHistograms () |
Prepare result of per entry histogram accumulation. | |
virtual void | Terminate () |
virtual void | Write (TFile *outputFile) |
Write rebdsim histograms. | |
Protected Member Functions | |
void | PreparePerEntryHistogramSets () |
void | AccumulatePerEntryHistogramSets (long int entryNumber) |
void | TerminatePerEntryHistogramSets () |
void | CheckSpectraBranches () |
void | FillHistogram (HistogramDefSet *definition) |
Fill a set of simple histograms across all events. | |
![]() | |
void | FillHistogram (HistogramDef *definition, std::vector< TH1 * > *outputHistograms=nullptr) |
Create an individual histogram based on a definition. | |
Protected Attributes | |
Event * | event |
Event object that data loaded from the file will be loaded into. | |
std::vector< SamplerAnalysis * > | samplerAnalyses |
Holder for sampler analysis objects. | |
std::vector< std::vector< std::vector< double > > > | opticalFunctions |
Optical functions from all samplers. | |
![]() | |
std::string | treeName |
TChain * | chain |
std::string | mergedHistogramName |
Name of directory for merged histograms. | |
std::vector< TH1 * > | simpleHistograms |
std::vector< PerEntryHistogram * > | perEntryHistograms |
HistogramMeanFromFile * | histoSum |
Merge of per event stored histograms. | |
bool | debug |
Whether debug print out is used or not. | |
long int | entries |
Number of entries in the chain. | |
bool | perEntry |
Whether to analyse each entry in the tree in a for loop or not. | |
Private Member Functions | |
void | SetPrintModuloFraction (double fraction) |
Set how often to print out information about the event. | |
void | Initialise () |
Initialise each sampler analysis object in samplerAnalysis. | |
void | ProcessSamplers (bool firstTime=false) |
Process each sampler analysis object. | |
ClassDef (EventAnalysis, 2) | |
Private Attributes | |
bool | printOut |
Whether to print out at all per-event. | |
int | printModulo |
Cache of print modulo fraction. | |
bool | processSamplers |
Whether to process samplers. | |
bool | emittanceOnTheFly |
Whether to calculate emittance fresh at each sampler. | |
long int | eventStart |
Event index to start analysis from. | |
long int | eventEnd |
Event index to end analysis at. | |
long int | nEventsToProcess |
Difference between start and stop. | |
std::vector< PerEntryHistogramSet * > | perEntryHistogramSets |
Cache of all per entry histogram sets. | |
std::map< HistogramDefSet *, std::vector< TH1 * > > | simpleSetHistogramOutputs |
Map of simple histograms created per histogram set for writing out. | |
Event level analysis.
Definition at line 41 of file EventAnalysis.hh.
EventAnalysis::EventAnalysis | ( | ) |
The default constructor is not intended for use and will not work for the purpose of analysis. It is required by the ROOT C++ reflection system in case you wish to save the object.
EventAnalysis::EventAnalysis | ( | Event * | eventIn, |
TChain * | chain, | ||
bool | perEntryAnalysis = true , |
||
bool | processSamplersIn = true , |
||
bool | debugIn = false , |
||
bool | printOutIn = true , |
||
double | printModuloFraction = 0.01 , |
||
bool | emittanceOnTheFlyIn = false , |
||
long int | eventStartIn = 0 , |
||
long int | eventEndIn = -1 , |
||
const std::string & | primaryParticleName = "" |
||
) |
Constructor intended for use to construct an event analysis object.
Definition at line 56 of file EventAnalysis.cc.
References Analysis::debug, event, Event::GetPrimaries(), nEventsToProcess, processSamplers, samplerAnalyses, Event::Samplers, SetPrintModuloFraction(), SamplerAnalysis::UpdateMass(), and Event::UsePrimaries().
|
virtualnoexcept |
Definition at line 143 of file EventAnalysis.cc.
|
protected |
Definition at line 392 of file EventAnalysis.cc.
|
protected |
Definition at line 219 of file EventAnalysis.cc.
|
virtual |
Method which calls all other methods in order. Here we also test if we have to process the samplers on whether to call Process().
Reimplemented from Analysis.
Definition at line 116 of file EventAnalysis.cc.
References Analysis::perEntry, Analysis::PreparePerEntryHistograms(), Process(), processSamplers, SimpleHistograms(), and Terminate().
|
protected |
Fill a set of simple histograms across all events.
Definition at line 404 of file EventAnalysis.cc.
References HistogramDefSet::definitionsV, Analysis::FillHistogram(), and simpleSetHistogramOutputs.
Referenced by SimpleHistograms().
|
private |
Initialise each sampler analysis object in samplerAnalysis.
Definition at line 372 of file EventAnalysis.cc.
References processSamplers, and samplerAnalyses.
Referenced by Process().
|
protected |
Definition at line 381 of file EventAnalysis.cc.
|
virtual |
Operate on each entry in the event tree.
Implements Analysis.
Definition at line 151 of file EventAnalysis.cc.
References HistogramMeanFromFile::Accumulate(), Analysis::AccumulatePerEntryHistograms(), Analysis::debug, Analysis::entries, event, eventEnd, eventStart, Event::Histos, Analysis::histoSum, Initialise(), printModulo, printOut, ProcessSamplers(), processSamplers, and Analysis::UserProcess().
Referenced by Execute().
|
private |
Process each sampler analysis object.
Definition at line 363 of file EventAnalysis.cc.
References processSamplers, and samplerAnalyses.
Referenced by Process().
|
private |
Set how often to print out information about the event.
Definition at line 136 of file EventAnalysis.cc.
References nEventsToProcess, and printModulo.
Referenced by EventAnalysis().
|
virtual |
Process histogram definitions from configuration instance.
Reimplemented from Analysis.
Definition at line 242 of file EventAnalysis.cc.
References FillHistogram(), Config::Instance(), and Analysis::SimpleHistograms().
Referenced by Execute().
|
virtual |
Terminate each individual sampler analysis and append optical functions.
Reimplemented from Analysis.
Definition at line 225 of file EventAnalysis.cc.
References emittanceOnTheFly, opticalFunctions, processSamplers, samplerAnalyses, and Analysis::Terminate().
Referenced by Execute().
|
protected |
Definition at line 398 of file EventAnalysis.cc.
|
virtual |
Write analysis including optical functions to an output file.
Reimplemented from Analysis.
Definition at line 251 of file EventAnalysis.cc.
References opticalFunctions, perEntryHistogramSets, processSamplers, simpleSetHistogramOutputs, and Analysis::Write().
|
private |
Whether to calculate emittance fresh at each sampler.
Definition at line 106 of file EventAnalysis.hh.
Referenced by Terminate().
|
protected |
Event object that data loaded from the file will be loaded into.
Definition at line 80 of file EventAnalysis.hh.
Referenced by EventAnalysis(), and Process().
|
private |
Event index to end analysis at.
Definition at line 108 of file EventAnalysis.hh.
Referenced by Process().
|
private |
Event index to start analysis from.
Definition at line 107 of file EventAnalysis.hh.
Referenced by Process().
|
private |
Difference between start and stop.
Definition at line 109 of file EventAnalysis.hh.
Referenced by EventAnalysis(), and SetPrintModuloFraction().
|
protected |
Optical functions from all samplers.
Definition at line 82 of file EventAnalysis.hh.
Referenced by Terminate(), and Write().
|
private |
Cache of all per entry histogram sets.
Definition at line 112 of file EventAnalysis.hh.
Referenced by Write().
|
private |
Cache of print modulo fraction.
Definition at line 104 of file EventAnalysis.hh.
Referenced by Process(), and SetPrintModuloFraction().
|
private |
Whether to print out at all per-event.
Definition at line 103 of file EventAnalysis.hh.
Referenced by Process().
|
private |
Whether to process samplers.
Definition at line 105 of file EventAnalysis.hh.
Referenced by EventAnalysis(), Execute(), Initialise(), Process(), ProcessSamplers(), Terminate(), and Write().
|
protected |
Holder for sampler analysis objects.
Definition at line 81 of file EventAnalysis.hh.
Referenced by EventAnalysis(), EventAnalysisOrbit::ExtractOrbit(), Initialise(), ProcessSamplers(), and Terminate().
|
private |
Map of simple histograms created per histogram set for writing out.
Definition at line 115 of file EventAnalysis.hh.
Referenced by FillHistogram(), and Write().