BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
BDSGeometryFactory Class Reference

Interface to external geometry construction. More...

#include <BDSGeometryFactory.hh>

Collaboration diagram for BDSGeometryFactory:
Collaboration graph

Public Member Functions

BDSGeometryExternalBuildGeometry (G4String componentName, const G4String &formatAndFilePath, 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, G4bool stripOuterVolumeAndMakeAssembly=false, G4UserLimits *userLimitsToAttachToAllLVs=nullptr, G4bool dontReloadGeometry=false)
 

Static Public Member Functions

static BDSGeometryFactoryInstance ()
 Singleton accessor. More...
 

Private Member Functions

 BDSGeometryFactory ()
 Private accessor as singleton. More...
 
BDSGeometryFactoryBaseGetAppropriateFactory (BDSGeometryType type)
 Get the appropriate geometry factory. More...
 

Private Attributes

std::map< std::pair< std::string, std::string >, BDSGeometryExternal * > registry
 
std::set< BDSGeometryExternal * > storage
 
BDSGeometryFactoryBasegdml
 Factory instance. More...
 
BDSGeometryFactoryBasesql
 Factory instance. More...
 

Static Private Attributes

static BDSGeometryFactoryinstance = nullptr
 Singleton instance. More...
 

Detailed Description

Interface to external geometry construction.

A factory that uses the correct derived singleton factory of BDSGeometryFactoryBase to construct the required geometry with extents.

Author
Lawrence Deacon, Laurie Nevay

Definition at line 48 of file BDSGeometryFactory.hh.

Constructor & Destructor Documentation

◆ ~BDSGeometryFactory()

BDSGeometryFactory::~BDSGeometryFactory ( )

Definition at line 59 of file BDSGeometryFactory.cc.

◆ BDSGeometryFactory()

BDSGeometryFactory::BDSGeometryFactory ( )
private

Private accessor as singleton.

Definition at line 49 of file BDSGeometryFactory.cc.

References gdml, and sql.

Referenced by Instance().

Here is the caller graph for this function:

Member Function Documentation

◆ BuildGeometry()

BDSGeometryExternal * BDSGeometryFactory::BuildGeometry ( G4String  componentName,
const G4String &  formatAndFilePath,
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,
G4bool  stripOuterVolumeAndMakeAssembly = false,
G4UserLimits *  userLimitsToAttachToAllLVs = nullptr,
G4bool  dontReloadGeometry = false 
)

Determine the geometry format, load it and build the geometry. Optional suggested length and horizontalWidth are in for some cases where it is not possible to query the geometry file for the extent information. Assign a default sensitivity to every volume recursively.

Definition at line 86 of file BDSGeometryFactory.cc.

References BDSGeometryFactoryBase::Build(), BDS::DetermineGeometryType(), BDS::FileExists(), GetAppropriateFactory(), BDS::GetFullPath(), BDSGeometryComponent::MakeAllVolumesSensitive(), registry, BDS::SplitOnColon(), storage, and BDSGeometryComponent::StripOuterAndMakeAssemblyVolume().

Referenced by BDS::BuildBLMs(), BDSElement::BuildContainerLogicalVolume(), BDS::BuildPlacementGeometry(), BDSDetectorConstruction::BuildWorld(), BDSParallelWorldImportance::BuildWorld(), BDSBLMFactory::CreateBLM(), and BDSMagnetOuterFactory::CreateExternal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAppropriateFactory()

BDSGeometryFactoryBase * BDSGeometryFactory::GetAppropriateFactory ( BDSGeometryType  type)
private

Get the appropriate geometry factory.

Definition at line 68 of file BDSGeometryFactory.cc.

References gdml, sql, and BDSTypeSafeEnum< def, inner >::underlying().

Referenced by BuildGeometry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Instance()

BDSGeometryFactory * BDSGeometryFactory::Instance ( )
static

Field Documentation

◆ gdml

BDSGeometryFactoryBase* BDSGeometryFactory::gdml
private

Factory instance.

Definition at line 94 of file BDSGeometryFactory.hh.

Referenced by BDSGeometryFactory(), and GetAppropriateFactory().

◆ instance

BDSGeometryFactory * BDSGeometryFactory::instance = nullptr
staticprivate

Singleton instance.

Definition at line 78 of file BDSGeometryFactory.hh.

Referenced by Instance().

◆ registry

std::map<std::pair<std::string, std::string>, BDSGeometryExternal*> BDSGeometryFactory::registry
private

A registry of all previously constructed components. We use a map instead of an unordered map because map uses operator< whereas unordered_map uses std::hash(key). Hashing isn't provided for std::pair by default but operator< is, so we use map. Map is pair<file name, component name to be used in> : geometry.

Definition at line 84 of file BDSGeometryFactory.hh.

Referenced by BuildGeometry().

◆ sql

BDSGeometryFactoryBase* BDSGeometryFactory::sql
private

Factory instance.

Definition at line 95 of file BDSGeometryFactory.hh.

Referenced by BDSGeometryFactory(), and GetAppropriateFactory().

◆ storage

std::set<BDSGeometryExternal*> BDSGeometryFactory::storage
private

This is where the geometry components are stored and used to manage the associated memory of the pieces of geometry.

Definition at line 88 of file BDSGeometryFactory.hh.

Referenced by BuildGeometry().


The documentation for this class was generated from the following files: