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) 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#include "BinSpecification.hh"
19#include "HistogramDef2D.hh"
20
21#include <string>
22
23ClassImp(HistogramDef2D)
24
26 yBinning(BinSpecification())
27{;}
28
29HistogramDef2D::HistogramDef2D(const std::string& treeNameIn,
30 const std::string& histNameIn,
31 const BinSpecification& xBinningIn,
32 const BinSpecification& yBinningIn,
33 const std::string& variableIn,
34 const std::string& selectionIn,
35 bool perEntryIn):
36 HistogramDef1D(treeNameIn, histNameIn, xBinningIn, variableIn, selectionIn, perEntryIn),
37 yBinning(yBinningIn)
38{
39 nDimensions = 2;
40}
41
42HistogramDef2D::~HistogramDef2D()
43{;}
44
46{
47 std::string result = "{" + std::to_string(xBinning.n) + "," + std::to_string(yBinning.n) + "} {";
48 result += xBinning.GetBinString() + "," + yBinning.GetBinString() + "}";
49 return result;
50}
51
53{
54 std::string result = perEntry ? "Histogram2D" : "SimpleHistogram2D";
55 if (xBinning.isLogSpaced || yBinning.isLogSpaced)
56 {result += xBinning.GetLogString() + yBinning.GetLogString();}
57 return result;
58}
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.