BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSOutputStructures.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
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#ifndef BDSOUTPUTSTRUCTURES_H
20#define BDSOUTPUTSTRUCTURES_H
21
22#include "globals.hh"
23
24#include <map>
25#include <string>
26#include <utility>
27#include <vector>
28
29// forward declarations
44template<class T> class BDSOutputROOTEventSampler;
49class G4Material;
50
62{
63protected:
64 explicit BDSOutputStructures(const BDSGlobalConstants* globals);
65 virtual ~BDSOutputStructures();
66
68 void InitialiseSamplers();
69
72
75
80
83
86
89
92
95
98
101
104
106 G4int Create1DHistogram(G4String name,
107 G4String title,
108 G4int nbins,
109 G4double xmin,
110 G4double xmax);
111 G4int Create1DHistogram(G4String name,
112 G4String title,
113 std::vector<double>& edges);
114 G4int Create3DHistogram(G4String name,
115 G4String title,
116 G4int nBinsX, G4double xMin, G4double xMax,
117 G4int nBinsY, G4double yMin, G4double yMax,
118 G4int nBinsZ, G4double zMin, G4double zMax);
119 G4int Create4DHistogram(const G4String& name,
120 const G4String& title,
121 const G4String& eScale,
122 const std::vector<double>& eBinsEdges,
123 G4int nBinsX, G4double xMin, G4double xMax,
124 G4int nBinsY, G4double yMin, G4double yMax,
125 G4int nBinsZ, G4double zMin, G4double zMax,
126 G4int nBinsE, G4double eMin, G4double eMax);
128
134
136#ifdef __ROOTDOUBLE__
138#else
140#endif
141 BDSOutputROOTEventCoords* primaryGlobal;
143#ifdef __ROOTDOUBLE__
144 std::vector<BDSOutputROOTEventSampler<double>*> samplerTrees;
145#else
146 std::vector<BDSOutputROOTEventSampler<float>*> samplerTrees;
147#endif
148 std::vector<std::string> samplerNames;
149 std::vector<BDSOutputROOTEventSamplerC*> samplerCTrees;
150 std::vector<BDSOutputROOTEventSamplerS*> samplerSTrees;
151 std::vector<std::string> samplerCNames;
152 std::vector<std::string> samplerSNames;
153 std::map<G4int, G4int> samplerIDToIndexPlane;
154 std::map<G4int, G4int> samplerIDToIndexCylinder;
155 std::map<G4int, G4int> samplerIDToIndexSphere;
156
171
172 // collimator specific output
173 std::vector<BDSOutputROOTEventCollimator*> collimators;
174 std::vector<G4String> collimatorNames;
176 std::vector<G4int> collimatorIndices;
177 std::map<G4String, G4int> collimatorIndicesByName;
178 std::vector<BDSOutputROOTEventCollimatorInfo> collimatorInfo;
181 std::vector<std::pair<G4double, G4double> > collimatorDifferences;
182
183 std::map<G4Material*, short int> materialToID;
184 std::map<short int, G4String> materialIDToNameUnique;
185
186private:
191
194
200};
201
202#endif
A class that holds global options and constants.
Data stored for energy deposition hits per event.
Class to store all beam options for a BDSIM run.
Data stored for each collimator in the model.
Data stored for each collimator per event.
Information about the software and the file.
Holder for a set of histograms to be stored.
Information pertaining to an individual event.
Data stored for world hits per event.
Data stored for energy deposition hits per event.
Information stored per model representing accelerator.
Class to store all options for a BDSIM run.
Information pertaining to a run.
Information stored per cylindrical sampler per event.
Information stored per spherical sampler per event.
Information stored per sampler per event.
Structure to record a trajectory.
Geant4 particle data for particles used in simulation.
Holder for output information.
void InitialiseCollimators()
Construct collimtors.
BDSOutputROOTEventModel * modelOutput
Model output.
G4int Create1DHistogram(G4String name, G4String title, G4int nbins, G4double xmin, G4double xmax)
Create histograms for both evtHistos and runHistos. Return index from evtHistos.
std::vector< G4String > collimatorNames
Names of collimators in output structures.
std::vector< BDSOutputROOTEventCollimator * > collimators
Collimator output structures.
std::vector< std::string > samplerNames
Sampler names to use.
BDSOutputROOTEventSampler< double > * primary
Primary sampler structure.
BDSOutputROOTEventRunInfo * runInfo
Run information.
void InitialiseMaterialMap()
Construct a map of material pointer to integer ID and name.
BDSOutputStructures & operator=(const BDSOutputStructures &)=delete
Unused default constructors.
void ClearStructuresOptions()
Clear the local options structure.
BDSOutputROOTEventHistograms * runHistos
Run level histograms.
BDSOutputROOTEventLossWorld * eLossWorldExit
World exit hits.
void ClearStructuresRunLevel()
Clear the local structures in this class in preparation for a new run.
BDSOutputStructures()=delete
Unused default constructors.
void InitialiseSamplers()
Construct samplers.
void ClearStructuresBeam()
Clear the local beam structure.
std::map< G4String, G4int > collimatorIndicesByName
Indices mapped to their name.
BDSOutputROOTEventLossWorld * eLossWorldContents
Externally supplied world contents hits.
G4int nCollimators
Number of collimators in beam line.
std::vector< BDSOutputROOTEventSampler< double > * > samplerTrees
Sampler structures.
BDSOutputStructures(const BDSOutputStructures &)=delete
Unused default constructors.
std::vector< std::pair< G4double, G4double > > collimatorDifferences
void ClearStructuresModel()
Clear the local model structure.
void ClearStructuresHeader()
Clear the local header structure.
G4int Create4DHistogram(const G4String &name, const G4String &title, const G4String &eScale, const std::vector< double > &eBinsEdges, G4int nBinsX, G4double xMin, G4double xMax, G4int nBinsY, G4double yMin, G4double yMax, G4int nBinsZ, G4double zMin, G4double zMax, G4int nBinsE, G4double eMin, G4double eMax)
Create histograms for both evtHistos and runHistos. Return index from evtHistos.
BDSOutputROOTEventHeader * headerOutput
Information about the file.
BDSOutputROOTEventLossWorld * eLossWorld
World energy deposition.
BDSOutputROOTEventLoss * eLossVacuum
General energy deposition.
std::vector< G4int > collimatorIndices
Indices in beam line that are collimators.
BDSOutputROOTEventInfo * evtInfo
Event information.
BDSOutputROOTEventLoss * pLastHit
Primary loss point.
BDSOutputROOTEventHistograms * evtHistos
Event level histograms.
BDSOutputROOTEventLoss * eLossTunnel
Tunnel energy deposition.
G4int UpdateSamplerStructures()
Interface to allow setting up samplers later for dynamic geometry construction a la SixTrack....
G4int Create3DHistogram(G4String name, G4String title, G4int nBinsX, G4double xMin, G4double xMax, G4int nBinsY, G4double yMin, G4double yMax, G4int nBinsZ, G4double zMin, G4double zMax)
Create histograms for both evtHistos and runHistos. Return index from evtHistos.
void ClearStructuresEventLevel()
Clear the local structures in this class in preparation for a new event.
BDSOutputROOTEventLoss * pFirstHit
Primary hit point.
BDSOutputROOTEventTrajectory * traj
Trajectories.
BDSOutputROOTEventBeam * beamOutput
Beam output.
BDSOutputROOTEventLoss * eLoss
General energy deposition.
std::vector< BDSOutputROOTEventCollimatorInfo > collimatorInfo
void ClearStructuresParticleData()
Clear the local particle data structure.
G4bool localCollimatorsInitialised
Whether we've setup the member vector of collimators. Similarly to localSamplersInitialised.
BDSOutputROOTEventAperture * apertureImpacts
Impacts on the aperture.
BDSOutputROOTParticleData * particleDataOutput
Geant4 information / particle tables.
BDSOutputROOTEventOptions * optionsOutput
Options output.