BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSGeometryFactoryGDML.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#ifdef USE_GDML
20
21#ifndef BDSGEOMETRYFACTORYGDML_H
22#define BDSGEOMETRYFACTORYGDML_H
23
24#include "BDSGeometryFactoryBase.hh"
25
26#include "globals.hh"
27
28#include <map>
29#include <set>
30#include <vector>
31
33class G4Colour;
34class G4LogicalVolume;
35class G4UserLimits;
36class G4VPhysicalVolume;
37
45{
46public:
48 virtual ~BDSGeometryFactoryGDML(){;}
49
52 virtual BDSGeometryExternal* Build(G4String componentName,
53 G4String fileName,
54 std::map<G4String, G4Colour*>* colourMapping = nullptr,
55 G4bool autoColour = true,
56 G4double suggestedLength = 0,
57 G4double suggestedHorizontalWidth = 0,
58 std::vector<G4String>* namedVacuumVolumes = nullptr,
59 G4UserLimits* userLimitsToAttachToAllLVs = nullptr);
60
61protected:
63 virtual G4String PreprocessedName(const G4String& objectName,
64 const G4String& acceleratorComponentName) const;
65
66private:
71 void ReplaceStringInFile(const G4String& filename,
72 const G4String& outputFileName,
73 const G4String& key,
74 const G4String& replacement);
75
78 void GetAllLogicalPhysicalAndMaterials(const G4VPhysicalVolume* volume,
79 std::set<G4VPhysicalVolume*>& pvs,
80 std::set<G4LogicalVolume*>& lvs,
81 std::map<G4String, G4Material*>& materialsGDML);
82};
83
84#endif
85
86#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)
virtual G4String PreprocessedName(const G4String &objectName, const G4String &acceleratorComponentName) const
Use the GDML preprocessing scheme to prepare the preprocesseed volume names.
void ReplaceStringInFile(const G4String &filename, const G4String &outputFileName, const G4String &key, const G4String &replacement)
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, G4UserLimits *userLimitsToAttachToAllLVs=nullptr)