Belle II Software  release-08-01-10
GeometryManager Class Reference

Class to manage the creation and conversion of the geometry. More...

#include <GeometryManager.h>

Collaboration diagram for GeometryManager:

Public Member Functions

G4VPhysicalVolume * getTopVolume ()
 Return a pointer to the top volume. More...
 
void createGeometry (const GearDir &params, GeometryTypes type=FullGeometry)
 Create Geometry. More...
 
void createGeometry (const GeoConfiguration &params, GeometryTypes type=FullGeometry, bool useDB=true)
 Create Geometry. More...
 
GeoConfiguration createGeometryConfig (const GearDir &detectorDir, const IntervalOfValidity &iov)
 Create Geometry configuration object. More...
 
void setDetectorComponents (const std::vector< std::string > &components)
 Set the names of the components to create. More...
 
void setExcludedComponents (const std::vector< std::string > &components)
 Set the names of the components to exclude from creation. More...
 
void setAdditionalComponents (const std::vector< std::string > &components)
 Set the names of addtional components to be added to the default set. More...
 
void setDensityScaling (const std::map< std::string, double > &components)
 Set the density scaling: This is intended for systematic studies only and will scale the density of all materials for each component in the map by the given factor.
 
void setAssignRegions (bool assignRegions)
 Choose whether a region should be assigned to each creator. More...
 
void clear ()
 Delete the existing Geant4 Geometry.
 
void createTGeoRepresentation ()
 Create a TGeo representation of the native geometry description. More...
 
G4VisAttributes * newVisAttributes ()
 Create an anonymous G4VisAttributes for an existing G4LogicalVolume. More...
 

Static Public Member Functions

static GeometryManagergetInstance ()
 Return a reference to the instance.
 

Private Member Functions

 GeometryManager ()
 Default constructor declared private since class is a Singleton.
 
 GeometryManager (const GeometryManager &)=delete
 Copy constructor declared private since class is a Singleton.
 
GeometryManageroperator= (const GeometryManager &)=delete
 Assignment operator declared private since class is a Singleton.
 
 ~GeometryManager ()
 Destructor: make sure we clean up memory at the end.
 

Private Attributes

G4VPhysicalVolume * m_topVolume
 Pointer to the top volume of the native geometry description.
 
std::vector< CreatorBase * > m_creators
 List of all creators, to be freed when geometry is destucted.
 
std::set< std::string > m_components
 List of names of components to be created, all other components will be ignored.
 
std::set< std::string > m_excluded
 List of names of components to be excluded from creation.
 
std::set< std::string > m_additional
 List of additional components to be added to the default set of components.
 
std::map< std::string, double > m_densityScaling
 Scaling factors for densities.
 
bool m_assignRegions {false}
 Bool to indicate whether we automatically assign a region with the creator name to all volumes created by that creator.
 
std::vector< G4VisAttributes * > m_VisAttributes
 List of visualization attributes.
 

Friends

struct std::default_delete< GeometryManager >
 Allow destruction of instance.
 

Detailed Description

Class to manage the creation and conversion of the geometry.

This class is a singleton

Definition at line 47 of file GeometryManager.h.

Member Function Documentation

◆ createGeometry() [1/2]

void createGeometry ( const GearDir params,
GeometryTypes  type = FullGeometry 
)

Create Geometry.

This function will create the geometry representation. First the Materials will be created, than the top volume will be defined and all components of the detector will be built by calling the corresponding creator

Parameters
paramsGearDir pointing to the top element of the geometry parameters
typeType of the geometry to be built

Definition at line 219 of file GeometryManager.cc.

220  {
221  GeoConfiguration config = createGeometryConfig(detectorDir, IntervalOfValidity());
222  createGeometry(config, type, false);
223  }
GeoConfiguration createGeometryConfig(const GearDir &detectorDir, const IntervalOfValidity &iov)
Create Geometry configuration object.
void createGeometry(const GearDir &params, GeometryTypes type=FullGeometry)
Create Geometry.

◆ createGeometry() [2/2]

void createGeometry ( const GeoConfiguration params,
GeometryTypes  type = FullGeometry,
bool  useDB = true 
)

Create Geometry.

This function will create the geometry representation from an existing configuration object. First the Materials will be created, than the top volume will be defined and all components of the detector will be built by calling the corresponding creator

Parameters
paramsgeometry configuration object
typeType of the geometry to be built
useDBwhether the creators should be using the Database or Gearbox

Definition at line 225 of file GeometryManager.cc.

◆ createGeometryConfig()

GeoConfiguration createGeometryConfig ( const GearDir detectorDir,
const IntervalOfValidity iov 
)

Create Geometry configuration object.

This function will convert a Gearbox representation of the geometry to an object containing all necessary parameters

Parameters
detectorDirGearDir pointing to the top element of the geometry parameters
iovInterval of validity for the created object

Definition at line 122 of file GeometryManager.cc.

◆ createTGeoRepresentation()

void createTGeoRepresentation ( )

Create a TGeo representation of the native geometry description.

This method will convert the existing Geometry to a ROOT TGeo representation which can be accessed using the global gGeoManager provided by ROOT.

Definition at line 348 of file GeometryManager.cc.

◆ getTopVolume()

G4VPhysicalVolume* getTopVolume ( )
inline

Return a pointer to the top volume.

Returns 0 if no geometry has been created so far

Definition at line 56 of file GeometryManager.h.

◆ newVisAttributes()

G4VisAttributes * newVisAttributes ( )

Create an anonymous G4VisAttributes for an existing G4LogicalVolume.

Returns
Pointer to the new G4VisAttributes object

Definition at line 371 of file GeometryManager.cc.

◆ setAdditionalComponents()

void setAdditionalComponents ( const std::vector< std::string > &  components)
inline

Set the names of addtional components to be added to the default set.

This member allows to set a list of component names. When creating the the geometry, components matching names in the list will be added if they are not disabled by default. If a list of components is already provided this list is ignored.

Parameters
componentsList of detector components to be added in addition

Definition at line 125 of file GeometryManager.h.

◆ setAssignRegions()

void setAssignRegions ( bool  assignRegions)
inline

Choose whether a region should be assigned to each creator.

If set to true, all volumes created by each creator are assigned a region with the name of the creator

Definition at line 143 of file GeometryManager.h.

◆ setDetectorComponents()

void setDetectorComponents ( const std::vector< std::string > &  components)
inline

Set the names of the components to create.

This member allows to set a list of component names. When creating the the geometry, only components matching names in the list will be created. All other components found in the parameters will be ignored

Parameters
componentsList of detector components to be created

Definition at line 98 of file GeometryManager.h.

◆ setExcludedComponents()

void setExcludedComponents ( const std::vector< std::string > &  components)
inline

Set the names of the components to exclude from creation.

This member allows to set a list of component names. When creating the the geometry, components matching names in the list will be ignored

Parameters
componentsList of detector components to be excluded

Definition at line 110 of file GeometryManager.h.


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