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