BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
PerEntryHistogram.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
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#ifndef PERENTRYHISTOGRAM_H
20#define PERENTRYHISTOGRAM_H
21#include "HistogramAccumulator.hh"
22
23#include <string>
24
25#include "Rtypes.h" // for classdef
26
27class HistogramDef;
28
29class TChain;
30class TDirectory;
31class TH1;
32
47{
48public:
51
53 PerEntryHistogram(const HistogramDef* definition,
54 TChain* chain);
55 virtual ~PerEntryHistogram();
56
59 virtual void AccumulateCurrentEntry(long int entryNumber);
60
62 virtual void Terminate();
63
66 virtual void Write(TDirectory* dir = nullptr);
67
70 inline void AddNEmptyEntries(unsigned long i){accumulator->AddNEmptyEntries(i);}
71
73 double Integral() const;
74
75protected:
76 HistogramAccumulator* accumulator;
77 TChain* chain;
78 std::string selection;
79 TH1* temp;
80 TH1* result;
81 std::string command;
82
83 ClassDef(PerEntryHistogram, 1);
84};
85
86#endif
Class to accumulate and merge histograms in different ways.
void AddNEmptyEntries(unsigned long i)
Common specification for a histogram.
Definition: HistogramDef.hh:34
Holder for information to calculate per entry histograms.
TChain * chain
Cache of chain pointer that provides data.
virtual void Terminate()
Terminate the accumulator and save the result to the result member variable.
double Integral() const
Get the Integral() from the result member histogram if it exists, otherwise 0.
PerEntryHistogram()
Public constructor only for compatibility with ROOT - not intended for use.
virtual void Write(TDirectory *dir=nullptr)
std::string selection
Selection command.
virtual void AccumulateCurrentEntry(long int entryNumber)
TH1 * result
Final result with errors as the error on the mean.
TH1 * temp
Histogram for temporary 1 event data.
std::string command
Draw command.
void AddNEmptyEntries(unsigned long i)