BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
HistogramDefSet.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 HISTOGRAMDEFSET_H
19#define HISTOGRAMDEFSET_H
20#include "SpectraParticles.hh"
21
22#include <map>
23#include <set>
24#include <string>
25
26class HistogramDef;
27
35{
36public:
37 HistogramDefSet(const std::string& branchNameIn,
38 const HistogramDef* baseDefinitionIn,
39 const std::set<ParticleSpec>& particlesSpecs = {},
40 const std::string& particleSpecificationIn = "",
41 const std::string& definitionLineIn = "");
43
44 static std::string AddPDGFilterToSelection(const ParticleSpec& particleSpec,
45 const std::string& selection,
46 const std::string& branchName);
47
49 std::string RemoveSubString(const std::string& stringIn,
50 const std::string& wordToRemove) const;
51
52 void ReplaceStringInVariable(const std::string& match,
53 const std::string& replacement);
54
55 enum class samplertype {plane, cylindrical, spherical};
56 void SetSamplerType(samplertype stIn) {samplerType = stIn;}
57
58 friend std::ostream& operator<< (std::ostream &out, const HistogramDefSet& s);
59
60 std::string branchName;
61 HistogramDef* baseDefinition;
62 std::map<ParticleSpec, HistogramDef*> definitions;
63 std::vector<HistogramDef*> definitionsV;
64 bool dynamicallyStoreIons;
66
67 enum class writewhat {all, particles, ions, topN, topNParticles, topNIons};
68 writewhat what;
69 int topN;
70
71 std::string definitionLine;
72 samplertype samplerType;
73};
74
75#endif
Specification for a set of histograms.
std::vector< HistogramDef * > definitionsV
Vector version for easy iteration.
std::string RemoveSubString(const std::string &stringIn, const std::string &wordToRemove) const
Remove a substring from a string.
std::string definitionLine
Original definition line purely for print out.
bool dynamicallyStoreParticles
Dynamically store all non-ions.
Common specification for a histogram.