BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSGeometryFactoryGDML.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#ifdef USE_GDML
20
21#ifndef BDSGEOMETRYFACTORYGDML_H
22#define BDSGEOMETRYFACTORYGDML_H
23
24#include "BDSGeometryFactoryBase.hh"
25
26#include "globals.hh"
27#include "G4String.hh"
28#include "G4VisAttributes.hh"
29
30#include <array>
31#include <map>
32#include <set>
33#include <vector>
34
36class G4Colour;
37class G4GDMLParser;
38class G4LogicalVolume;
39class G4UserLimits;
40class G4VPhysicalVolume;
41
49{
50public:
52 virtual ~BDSGeometryFactoryGDML(){;}
53
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>* namedVacuumVolumes = nullptr,
63 G4bool makeSensitive = true,
64 BDSSDType sensitivityType = BDSSDType::energydep,
65 BDSSDType vacuumSensitivityType = BDSSDType::energydepvacuum,
66 G4UserLimits* userLimitsToAttachToAllLVs = nullptr);
67
70 static std::array<G4double, 4> VRGBAStringAndUnitToColourAndStyle(const G4String& value,
71 G4bool& visible);
72
73protected:
75 virtual G4String PreprocessedName(const G4String& objectName,
76 const G4String& acceleratorComponentName) const;
77
78private:
79 std::map<G4String, G4Colour*> BuildColourMap(const std::set<G4LogicalVolume*>& lvsGDML,
80 G4GDMLParser* parser,
81 const G4String& componentName);
82
87 void ReplaceStringInFile(const G4String& filename,
88 const G4String& outputFileName,
89 const G4String& key,
90 const G4String& replacement);
91
94 void GetAllLogicalPhysicalAndMaterials(const G4VPhysicalVolume* volume,
95 std::set<G4VPhysicalVolume*>& pvs,
96 std::set<G4LogicalVolume*>& lvs,
97 std::map<G4String, G4Material*>& materialsGDML);
98};
99
100#endif
101
102#endif
A loaded piece of externally provided geometry.
Base class for external geometry loading factories.
Interface to Geant4's GDML loader.
void GetAllLogicalPhysicalAndMaterials(const G4VPhysicalVolume *volume, std::set< G4VPhysicalVolume * > &pvs, std::set< G4LogicalVolume * > &lvs, std::map< G4String, G4Material * > &materialsGDML)
static std::array< G4double, 4 > VRGBAStringAndUnitToColourAndStyle(const G4String &value, G4bool &visible)
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 > *namedVacuumVolumes=nullptr, G4bool makeSensitive=true, BDSSDType sensitivityType=BDSSDType::energydep, BDSSDType vacuumSensitivityType=BDSSDType::energydepvacuum, G4UserLimits *userLimitsToAttachToAllLVs=nullptr)
virtual G4String PreprocessedName(const G4String &objectName, const G4String &acceleratorComponentName) const
Use the GDML preprocessing scheme to prepare the preprocessed volume names.
void ReplaceStringInFile(const G4String &filename, const G4String &outputFileName, const G4String &key, const G4String &replacement)
Improve type-safety of native enum data type in C++.