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 - 2024.
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;
40class BDSColourMap;
42
50{
51public:
54
56 virtual BDSGeometryExternal* Build(G4String componentName,
57 G4String fileName,
58 std::map<G4String, G4Colour*>* colourMapping = nullptr,
59 G4bool autoColour = true,
60 G4double suggestedLength = 0,
61 G4double suggestedHorizontalWidth = 0,
62 std::vector<G4String>* vacuumBiasVolumeNames = nullptr,
63 G4bool makeSensitive = true,
64 BDSSDType sensitivityType = BDSSDType::energydep,
65 BDSSDType vacuumSensitivityType = BDSSDType::energydepvacuum,
66 G4UserLimits* userLimitsToAttachToAllLVs = nullptr) = 0;
67
74 virtual std::set<G4VisAttributes*> ApplyColourMapping(const std::set<G4LogicalVolume*>& lvs,
75 const std::map<G4String, G4Colour*>& mapping,
76 G4bool autoColour,
77 const G4String& preprocessPrefix = "");
78
80 virtual void ApplyUserLimits(const std::set<G4LogicalVolume*>& lvsIn,
81 G4UserLimits* userLimits);
82
84 virtual void ApplySensitivity(BDSGeometryExternal* result,
85 const std::set<G4LogicalVolume*>& allLogicalVolumesIn,
86 BDSSDType generalSensitivity,
87 const std::set<G4LogicalVolume*>& vacuumLogicalVolumes,
88 BDSSDType vacuumSensitivity);
89
90protected:
92 virtual void CleanUp();
93
96 virtual G4String PreprocessedName(const G4String& objectName,
97 const G4String& acceleratorComponentName) const;
98
100 std::set<G4LogicalVolume*> GetVolumes(const std::set<G4LogicalVolume*>& allLVs,
101 std::vector<G4String>* volumeNames,
102 G4bool preprocessGDML,
103 const G4String& componentName) const;
104
105
108 void CleanUpBase();
109
111 void ExpandExtent(const BDSExtent& extent);
112
115 void ExpandExtent(G4double xO, G4double rx,
116 G4double y0, G4double ry,
117 G4double z0, G4double rz);
118
120 void ExpandExtent(G4double x0, G4double xLow, G4double xHigh,
121 G4double y0, G4double yLow, G4double yHigh,
122 G4double z0, G4double zLow, G4double zHigh);
123
125 G4double xmin;
126 G4double xmax;
127 G4double ymin;
128 G4double ymax;
129 G4double zmin;
130 G4double zmax;
132
133 BDSExtent Extent() const {return BDSExtent(xmin, xmax, ymin, ymax, zmin, zmax);}
134};
135
136#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(const std::set< G4LogicalVolume * > &lvs, const std::map< G4String, G4Colour * > &mapping, G4bool autoColour, const G4String &preprocessPrefix="")
Improve type-safety of native enum data type in C++.