BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
HistogramDef2D.cc
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#include "BinSpecification.hh"
20#include "HistogramDef2D.hh"
21
22#include <string>
23
24ClassImp(HistogramDef2D)
25
27 yBinning(BinSpecification())
28{;}
29
30HistogramDef2D::HistogramDef2D(const std::string& treeNameIn,
31 const std::string& histNameIn,
32 const BinSpecification& xBinningIn,
33 const BinSpecification& yBinningIn,
34 const std::string& variableIn,
35 const std::string& selectionIn,
36 bool perEntryIn):
37 HistogramDef1D(treeNameIn, histNameIn, xBinningIn, variableIn, selectionIn, perEntryIn),
38 yBinning(yBinningIn)
39{
40 nDimensions = 2;
41}
42
43HistogramDef2D::~HistogramDef2D()
44{;}
45
47{
48 std::string result = "{" + std::to_string(xBinning.n) + "," + std::to_string(yBinning.n) + "} {";
49 result += xBinning.GetBinString() + "," + yBinning.GetBinString() + "}";
50 return result;
51}
52
54{
55 std::string result = perEntry ? "Histogram2D" : "SimpleHistogram2D";
56 if (xBinning.isLogSpaced || yBinning.isLogSpaced)
57 {result += xBinning.GetLogString() + yBinning.GetLogString();}
58 return result;
59}
Binning specification for a single dimension.
std::string GetLogString() const
Utility function.
std::string GetBinString() const
Return the filename or the binning.
Specification for 1D histogram.
Specification for 2D histogram.
virtual std::string GetBinningString() const
Return n bins and ranges.
HistogramDef2D()
Public constructor only for compatibility with ROOT - not intended for use.
virtual std::string GetHistogramString() const
Get the first string that defines the histogram in rebdsim for feedback.