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 | Static Private Attributes
BDSFieldBuilder Class Reference

Register for all fields to be built and volumes to be attached to. More...

#include <BDSFieldBuilder.hh>

Collaboration diagram for BDSFieldBuilder:
Collaboration graph

Public Member Functions

void RegisterFieldForConstruction (const BDSFieldInfo *info, G4LogicalVolume *logicalVolume, const G4bool propagateToDaughters=false, const BDSMagnetStrength *magnetStrengthForScaling=nullptr, const G4String &scalingKey="none")
 
void RegisterFieldForConstruction (const BDSFieldInfo *info, const std::vector< G4LogicalVolume * > &logicalVolumes, const G4bool propagateToDaughters=false, const BDSMagnetStrength *magnetStrengthForScaling=nullptr, const G4String &scalingKey="none")
 Similar version but vectorised. More...
 
void RegisterFieldForConstruction (const BDSFieldInfo *info, const std::set< G4LogicalVolume * > &logicalVolumes, const G4bool propagateToDaughters=false, const BDSMagnetStrength *magnetStrengthForScaling=nullptr, const G4String &scalingKey="none")
 Similar version but for a set. More...
 
std::vector< BDSFieldObjects * > CreateAndAttachAll ()
 

Static Public Member Functions

static BDSFieldBuilderInstance ()
 Singleton pattern accessor. More...
 

Private Member Functions

 BDSFieldBuilder ()
 Private default constructor to enforce singleton pattern. More...
 

Private Attributes

std::vector< const BDSFieldInfo * > infos
 Register of components to build. More...
 
std::vector< std::vector< G4LogicalVolume * > > lvs
 Register of components to build. More...
 
std::vector< G4bool > propagators
 Register of components to build. More...
 
std::map< G4int, const BDSMagnetStrength * > scalingStrengths
 Optional register of scaling strengths and keys. More...
 
std::map< G4int, G4String > scalingKeys
 Optional register of scaling strengths and keys. More...
 

Static Private Attributes

static BDSFieldBuilderinstance = nullptr
 Singleton instance. More...
 

Detailed Description

Register for all fields to be built and volumes to be attached to.

This keeps a registry of the field info (the template for a field) and the volume to attach it to, so all fields can actually be constructed at one time irrespective of when they're apparently 'created' in the geometry / individual BDSAcceleratorComponents.

This register does not retain ownership of anything so multiple logical volumes may be safely registered along with a single BDSFieldInfo instance.

Author
Laurie Nevay

Definition at line 47 of file BDSFieldBuilder.hh.

Constructor & Destructor Documentation

◆ ~BDSFieldBuilder()

BDSFieldBuilder::~BDSFieldBuilder ( )

Definition at line 39 of file BDSFieldBuilder.cc.

◆ BDSFieldBuilder()

BDSFieldBuilder::BDSFieldBuilder ( )
private

Private default constructor to enforce singleton pattern.

Definition at line 44 of file BDSFieldBuilder.cc.

References infos, lvs, and propagators.

Referenced by Instance().

Here is the caller graph for this function:

Member Function Documentation

◆ CreateAndAttachAll()

std::vector< BDSFieldObjects * > BDSFieldBuilder::CreateAndAttachAll ( )

Definition at line 110 of file BDSFieldBuilder.cc.

◆ Instance()

BDSFieldBuilder * BDSFieldBuilder::Instance ( )
static

Singleton pattern accessor.

Definition at line 32 of file BDSFieldBuilder.cc.

References BDSFieldBuilder(), and instance.

Referenced by BDSTeleporter::Build(), BDSUndulator::Build(), BDSCavityElement::BuildField(), BDSMagnet::BuildOuterField(), BDSMagnet::BuildVacuumField(), BDSDetectorConstruction::ConstructSDandField(), and BDSAcceleratorComponent::Initialise().

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

◆ RegisterFieldForConstruction() [1/3]

void BDSFieldBuilder::RegisterFieldForConstruction ( const BDSFieldInfo info,
const std::set< G4LogicalVolume * > &  logicalVolumes,
const G4bool  propagateToDaughters = false,
const BDSMagnetStrength magnetStrengthForScaling = nullptr,
const G4String &  scalingKey = "none" 
)

Similar version but for a set.

Definition at line 93 of file BDSFieldBuilder.cc.

References RegisterFieldForConstruction().

Here is the call graph for this function:

◆ RegisterFieldForConstruction() [2/3]

void BDSFieldBuilder::RegisterFieldForConstruction ( const BDSFieldInfo info,
const std::vector< G4LogicalVolume * > &  logicalVolumes,
const G4bool  propagateToDaughters = false,
const BDSMagnetStrength magnetStrengthForScaling = nullptr,
const G4String &  scalingKey = "none" 
)

Similar version but vectorised.

Definition at line 52 of file BDSFieldBuilder.cc.

References infos, lvs, propagators, scalingKeys, and scalingStrengths.

◆ RegisterFieldForConstruction() [3/3]

void BDSFieldBuilder::RegisterFieldForConstruction ( const BDSFieldInfo info,
G4LogicalVolume *  logicalVolume,
const G4bool  propagateToDaughters = false,
const BDSMagnetStrength magnetStrengthForScaling = nullptr,
const G4String &  scalingKey = "none" 
)

Register a field for construction - ie the field specification along with which logical volume to attach it to. The same field specification (info) can be registered for multiple logical volumes as this builder does not retain ownership of anything.

Definition at line 79 of file BDSFieldBuilder.cc.

References RegisterFieldForConstruction().

Referenced by BDSTeleporter::Build(), BDSUndulator::Build(), BDSCavityElement::BuildField(), BDSMagnet::BuildOuterField(), BDSMagnet::BuildVacuumField(), BDSAcceleratorComponent::Initialise(), and RegisterFieldForConstruction().

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

Field Documentation

◆ infos

std::vector<const BDSFieldInfo*> BDSFieldBuilder::infos
private

Register of components to build.

Definition at line 89 of file BDSFieldBuilder.hh.

Referenced by BDSFieldBuilder(), and RegisterFieldForConstruction().

◆ instance

BDSFieldBuilder * BDSFieldBuilder::instance = nullptr
staticprivate

Singleton instance.

Definition at line 86 of file BDSFieldBuilder.hh.

Referenced by Instance().

◆ lvs

std::vector<std::vector<G4LogicalVolume*> > BDSFieldBuilder::lvs
private

Register of components to build.

Definition at line 90 of file BDSFieldBuilder.hh.

Referenced by BDSFieldBuilder(), and RegisterFieldForConstruction().

◆ propagators

std::vector<G4bool> BDSFieldBuilder::propagators
private

Register of components to build.

Definition at line 91 of file BDSFieldBuilder.hh.

Referenced by BDSFieldBuilder(), and RegisterFieldForConstruction().

◆ scalingKeys

std::map<G4int, G4String> BDSFieldBuilder::scalingKeys
private

Optional register of scaling strengths and keys.

Definition at line 96 of file BDSFieldBuilder.hh.

Referenced by RegisterFieldForConstruction().

◆ scalingStrengths

std::map<G4int, const BDSMagnetStrength*> BDSFieldBuilder::scalingStrengths
private

Optional register of scaling strengths and keys.

Definition at line 95 of file BDSFieldBuilder.hh.

Referenced by RegisterFieldForConstruction().


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