BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSGeometryFactoryBase.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 BDSGEOMETRYFACTORYBASE_H
20#define BDSGEOMETRYFACTORYBASE_H
21
22#include "BDSExtent.hh"
23#include "BDSFactoryBase.hh"
24#include "BDSSDType.hh"
25
26#include "globals.hh"
27#include "G4RotationMatrix.hh"
28#include "G4String.hh"
29
30#include <map>
31#include <set>
32#include <vector>
33
34class G4Colour;
35class G4LogicalVolume;
36class G4UserLimits;
37class G4VisAttributes;
38class G4VPhysicalVolume;
39class G4VSolid;
41
49{
50public:
53
55 virtual BDSGeometryExternal* Build(G4String componentName,
56 G4String fileName,
57 std::map<G4String, G4Colour*>* colourMapping = nullptr,
58 G4bool autoColour = true,
59 G4double suggestedLength = 0,
60 G4double suggestedHorizontalWidth = 0,
61 std::vector<G4String>* vacuumBiasVolumeNames = nullptr,
62 G4bool makeSensitive = true,
63 BDSSDType sensitivityType = BDSSDType::energydep,
64 BDSSDType vacuumSensitivityType = BDSSDType::energydepvacuum,
65 G4UserLimits* userLimitsToAttachToAllLVs = nullptr) = 0;
66
73 virtual std::set<G4VisAttributes*> ApplyColourMapping(std::set<G4LogicalVolume*>& lvs,
74 std::map<G4String, G4Colour*>* mapping,
75 G4bool autoColour,
76 const G4String& preprocessPrefix = "");
77
79 virtual void ApplyUserLimits(const std::set<G4LogicalVolume*>& lvsIn,
80 G4UserLimits* userLimits);
81
83 virtual void ApplySensitivity(BDSGeometryExternal* result,
84 const std::set<G4LogicalVolume*>& allLogicalVolumesIn,
85 BDSSDType generalSensitivity,
86 const std::set<G4LogicalVolume*>& vacuumLogicalVolumes,
87 BDSSDType vacuumSensitivity);
88
89protected:
91 virtual void CleanUp();
92
95 virtual G4String PreprocessedName(const G4String& objectName,
96 const G4String& acceleratorComponentName) const;
97
99 std::set<G4LogicalVolume*> GetVolumes(const std::set<G4LogicalVolume*>& allLVs,
100 std::vector<G4String>* volumeNames,
101 G4bool preprocessGDML,
102 const G4String& componentName) const;
103
104
107 void CleanUpBase();
108
110 void ExpandExtent(const BDSExtent& extent);
111
114 void ExpandExtent(G4double xO, G4double rx,
115 G4double y0, G4double ry,
116 G4double z0, G4double rz);
117
119 void ExpandExtent(G4double x0, G4double xLow, G4double xHigh,
120 G4double y0, G4double yLow, G4double yHigh,
121 G4double z0, G4double zLow, G4double zHigh);
122
124 G4double xmin;
125 G4double xmax;
126 G4double ymin;
127 G4double ymax;
128 G4double zmin;
129 G4double zmax;
131
132 BDSExtent Extent() const {return BDSExtent(xmin, xmax, ymin, ymax, zmin, zmax);}
133};
134
135#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.
virtual void ApplySensitivity(BDSGeometryExternal *result, const std::set< G4LogicalVolume * > &allLogicalVolumesIn, BDSSDType generalSensitivity, const std::set< G4LogicalVolume * > &vacuumLogicalVolumes, BDSSDType vacuumSensitivity)
Attach the relevant general and vacuum sensitivity to each volume.
void ExpandExtent(const BDSExtent &extent)
Expand the acuumulated extents using a (possibly asymmetric) extent instance.
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.
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, G4bool makeSensitive=true, BDSSDType sensitivityType=BDSSDType::energydep, BDSSDType vacuumSensitivityType=BDSSDType::energydepvacuum, G4UserLimits *userLimitsToAttachToAllLVs=nullptr)=0
Main method to load and construct geometry.
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="")
Improve type-safety of native enum data type in C++.