BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
HistogramDef.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef HISTOGRAMDEF_H
19#define HISTOGRAMDEF_H
20
21#include <iostream>
22#include <string>
23
24#include "Rtypes.h" // for classdef
25
33{
34public:
37
39 HistogramDef(const std::string& treeNameIn,
40 const std::string& histNameIn,
41 int nDimensionsIn,
42 const std::string& variable,
43 const std::string& selectionIn = "1",
44 bool perEnetry = true);
45 virtual ~HistogramDef(){;};
46
48 virtual HistogramDef* Clone() const = 0;
49
51 friend std::ostream& operator<< (std::ostream &out, const HistogramDef& s);
52
54 virtual std::string GetBinningString() const = 0;
55
57 virtual std::string GetHistogramString() const = 0;
58
60 void ReplaceStringInVariable(const std::string& match,
61 const std::string& replacement);
62
63 std::string treeName;
64 std::string histName;
65 int nDimensions;
66 std::string variable;
67 std::string selection;
68 bool perEntry;
69
70 ClassDef(HistogramDef, 1);
71};
72
73#endif
Common specification for a histogram.
HistogramDef()
Public constructor only for compatibility with ROOT - not intended for use.
virtual std::string GetHistogramString() const =0
Get the first string that defines the histogram in rebdsim for feedback.
friend std::ostream & operator<<(std::ostream &out, const HistogramDef &s)
Print out the definition in the original syntax.
void ReplaceStringInVariable(const std::string &match, const std::string &replacement)
Little utility function.
virtual HistogramDef * Clone() const =0
Copy this instance. Virtual to be overridden in derived classes.
virtual std::string GetBinningString() const =0
Provide the binning string in the original input format for feedback.