BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSOutputStructures.hh
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#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
45template<class T> class BDSOutputROOTEventSampler;
50class G4Material;
51
63{
64protected:
65 explicit BDSOutputStructures(const BDSGlobalConstants* globals);
66 virtual ~BDSOutputStructures();
67
69 void InitialiseSamplers();
70
73
76
81
84
87
90
93
96
99
102
105
108
110 G4int Create1DHistogram(G4String name,
111 G4String title,
112 G4int nbins,
113 G4double xmin,
114 G4double xmax);
115 G4int Create1DHistogram(G4String name,
116 G4String title,
117 std::vector<double>& edges);
118 G4int Create3DHistogram(G4String name,
119 G4String title,
120 G4int nBinsX, G4double xMin, G4double xMax,
121 G4int nBinsY, G4double yMin, G4double yMax,
122 G4int nBinsZ, G4double zMin, G4double zMax);
123 G4int Create4DHistogram(const G4String& name,
124 const G4String& title,
125 const G4String& eScale,
126 const std::vector<double>& eBinsEdges,
127 G4int nBinsX, G4double xMin, G4double xMax,
128 G4int nBinsY, G4double yMin, G4double yMax,
129 G4int nBinsZ, G4double zMin, G4double zMax,
130 G4int nBinsE, G4double eMin, G4double eMax);
132
138
140#ifdef __ROOTDOUBLE__
142#else
144#endif
145 BDSOutputROOTEventCoords* primaryGlobal;
147#ifdef __ROOTDOUBLE__
148 std::vector<BDSOutputROOTEventSampler<double>*> samplerTrees;
149#else
150 std::vector<BDSOutputROOTEventSampler<float>*> samplerTrees;
151#endif
152 std::vector<std::string> samplerNames;
153 std::vector<BDSOutputROOTEventSamplerC*> samplerCTrees;
154 std::vector<BDSOutputROOTEventSamplerS*> samplerSTrees;
155 std::vector<std::string> samplerCNames;
156 std::vector<std::string> samplerSNames;
157 std::map<G4int, G4int> samplerIDToIndexPlane;
158 std::map<G4int, G4int> samplerIDToIndexCylinder;
159 std::map<G4int, G4int> samplerIDToIndexSphere;
160
175
176 // collimator specific output
177 std::vector<BDSOutputROOTEventCollimator*> collimators;
178 std::vector<G4String> collimatorNames;
180 std::vector<G4int> collimatorIndices;
181 std::map<G4String, G4int> collimatorIndicesByName;
182 std::vector<BDSOutputROOTEventCollimatorInfo> collimatorInfo;
185 std::vector<std::pair<G4double, G4double> > collimatorDifferences;
186
187 // cavity specific output
188 std::vector<G4String> cavityNames;
189 G4int nCavities;
190 std::vector<G4int> cavityIndices;
191 std::map<G4String, G4int> cavityIndicesByName;
192 std::vector<BDSOutputROOTEventCavityInfo> cavityInfo;
193
194 std::map<G4Material*, short int> materialToID;
195 std::map<short int, G4String> materialIDToNameUnique;
196
197private:
202
205
211};
212
213#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 cavity in the model.
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 collimators.
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.
G4int nCavities
Number of cavities in beam line.
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.
std::vector< G4String > cavityNames
Names of cavities in output structures.
BDSOutputROOTEventHistograms * runHistos
Run level histograms.
BDSOutputROOTEventLossWorld * eLossWorldExit
World exit hits.
std::vector< G4int > cavityIndices
Indices in beam line that are cavities.
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::vector< BDSOutputROOTEventCavityInfo > cavityInfo
Cavity parameters.
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 PrepareCavityInformation()
Extract number of collimators and their names from beam line.
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.
std::map< G4String, G4int > cavityIndicesByName
Indices mapped to their name.