BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSGeometryFactoryBase.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 BDSGEOMETRYFACTORYBASE_H
20#define BDSGEOMETRYFACTORYBASE_H
21
22#include "BDSExtent.hh"
23#include "BDSFactoryBase.hh"
24
25#include "globals.hh"
26#include "G4RotationMatrix.hh"
27#include "G4String.hh"
28
29#include <map>
30#include <set>
31#include <vector>
32
33class G4Colour;
34class G4LogicalVolume;
35class G4UserLimits;
36class G4VisAttributes;
37class G4VPhysicalVolume;
38class G4VSolid;
40
48{
49public:
52
54 virtual BDSGeometryExternal* Build(G4String componentName,
55 G4String fileName,
56 std::map<G4String, G4Colour*>* colourMapping = nullptr,
57 G4bool autoColour = true,
58 G4double suggestedLength = 0,
59 G4double suggestedHorizontalWidth = 0,
60 std::vector<G4String>* vacuumBiasVolumeNames = nullptr,
61 G4UserLimits* userLimitsToAttachToAllLVs = nullptr) = 0;
62
69 virtual std::set<G4VisAttributes*> ApplyColourMapping(std::set<G4LogicalVolume*>& lvs,
70 std::map<G4String, G4Colour*>* mapping,
71 G4bool autoColour,
72 const G4String& preprocessPrefix = "");
73
75 virtual void ApplyUserLimits(const std::set<G4LogicalVolume*>& lvsIn,
76 G4UserLimits* userLimits);
77
78protected:
80 virtual void CleanUp();
81
84 virtual G4String PreprocessedName(const G4String& objectName,
85 const G4String& acceleratorComponentName) const;
86
88 std::set<G4LogicalVolume*> GetVolumes(const std::set<G4LogicalVolume*>& allLVs,
89 std::vector<G4String>* volumeNames,
90 G4bool preprocessGDML,
91 const G4String& componentName) const;
92
93
96 void CleanUpBase();
97
99 void ExpandExtent(const BDSExtent& extent);
100
103 void ExpandExtent(G4double xO, G4double rx,
104 G4double y0, G4double ry,
105 G4double z0, G4double rz);
106
108 void ExpandExtent(G4double x0, G4double xLow, G4double xHigh,
109 G4double y0, G4double yLow, G4double yHigh,
110 G4double z0, G4double zLow, G4double zHigh);
111
113 G4double xmin;
114 G4double xmax;
115 G4double ymin;
116 G4double ymax;
117 G4double zmin;
118 G4double zmax;
120
121 BDSExtent Extent() const {return BDSExtent(xmin, xmax, ymin, ymax, zmin, zmax);}
122};
123
124#endif
Holder for +- extents in 3 dimensions.
Definition: BDSExtent.hh:39
Common temporary storage for all factories no matter what geometry.
A loaded piece of externally provided geometry.
Base class for external geometry loading factories.
G4double ymax
Extent in one dimension.
void ExpandExtent(const BDSExtent &extent)
Expand the acuumulated extents using a (possibly asymmetric) extent instance.
virtual BDSGeometryExternal * Build(G4String componentName, G4String fileName, std::map< G4String, G4Colour * > *colourMapping=nullptr, G4bool autoColour=true, G4double suggestedLength=0, G4double suggestedHorizontalWidth=0, std::vector< G4String > *vacuumBiasVolumeNames=nullptr, G4UserLimits *userLimitsToAttachToAllLVs=nullptr)=0
Main method to load and construct geometry.
virtual G4String PreprocessedName(const G4String &objectName, const G4String &acceleratorComponentName) const
std::set< G4LogicalVolume * > GetVolumes(const std::set< G4LogicalVolume * > &allLVs, std::vector< G4String > *volumeNames, G4bool preprocessGDML, const G4String &componentName) const
Get the volumes that match the name. Volume names are matched exactly and are case sensitive.
virtual void CleanUp()
Virtual clean up that derived classes can override that calls CleanUpBase().
G4double xmin
Extent in one dimension.
G4double ymin
Extent in one dimension.
G4double zmin
Extent in one dimension.
G4double zmax
Extent in one dimension.
G4double xmax
Extent in one dimension.
virtual void ApplyUserLimits(const std::set< G4LogicalVolume * > &lvsIn, G4UserLimits *userLimits)
Attach a set of user limits to every logical volume supplied.
virtual std::set< G4VisAttributes * > ApplyColourMapping(std::set< G4LogicalVolume * > &lvs, std::map< G4String, G4Colour * > *mapping, G4bool autoColour, const G4String &preprocessPrefix="")