BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
RunAnalysis.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#include "HistogramMeanFromFile.hh"
20#include "rebdsim.hh" // for debug __METHOD_NAME__
21#include "Run.hh"
22#include "RunAnalysis.hh"
23
24#include "TChain.h"
25
26#include <iostream>
27
28ClassImp(RunAnalysis)
29
31 Analysis("Run.", nullptr, "RunHistogramsMerged"),
32 run(nullptr)
33{;}
34
36 TChain* chainIn,
37 bool perEntryAnalysis,
38 bool debugIn):
39 Analysis("Run.", chainIn, "RunHistogramsMerged", perEntryAnalysis, debugIn),
40 run(runIn)
41{;}
42
43RunAnalysis::~RunAnalysis() noexcept
44{;}
45
47{
48 if (debug)
49 {std::cout << __METHOD_NAME__ << chain->GetEntries() << " " << std::endl;}
50
51 // loop over events
52 for (int i = 0; i < chain->GetEntries(); ++i)
53 {
54 chain->GetEntry(i);
55
56 if (i == 0)
58 else
60
61 // per event histograms
63
65 }
66}
Base class for any TTree analysis.
Definition: Analysis.hh:44
bool debug
Whether debug print out is used or not.
Definition: Analysis.hh:98
HistogramMeanFromFile * histoSum
Merge of per event stored histograms.
Definition: Analysis.hh:97
void AccumulatePerEntryHistograms(long int entryNumber)
Accumulate means and variances for per entry histograms.
Definition: Analysis.cc:111
virtual void UserProcess()
Virtual function for user to overload and use. Does nothing by default.
Definition: Analysis.cc:83
Accumulator to merge pre-made per-entry histograms.
void Accumulate(BDSOutputROOTEventHistograms *hNew)
Analysis of a run.
Definition: RunAnalysis.hh:36
virtual void Process()
Operate on each entry in the run tree.
Definition: RunAnalysis.cc:46
Run * run
Run object that data loaded from the file will be loaded into.
Definition: RunAnalysis.hh:55
Class to overlay a run from a ROOT file with.
Definition: Run.hh:36
BDSOutputROOTEventHistograms * Histos
Member that ROOT can map file data to locally.
Definition: Run.hh:52