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 | Friends
BDSPhysicalVolumeInfoRegistry Class Reference

A registry of physical volume info instances that can be searched. More...

#include <BDSPhysicalVolumeInfoRegistry.hh>

Collaboration diagram for BDSPhysicalVolumeInfoRegistry:
Collaboration graph

Public Member Functions

 ~BDSPhysicalVolumeInfoRegistry ()
 
void RegisterInfo (G4VPhysicalVolume *physicalVolume, BDSPhysicalVolumeInfo *info, G4bool isReadOutVolume=false, G4bool isTunnel=false)
 
void RegisterInfo (const std::set< G4VPhysicalVolume * > &physicalVolumes, BDSPhysicalVolumeInfo *info, G4bool isReadOutVolume=false, G4bool isTunnel=false)
 Loop version of the same function above but for a set of pvs. More...
 
BDSPhysicalVolumeInfoGetInfo (G4VPhysicalVolume *logicalVolume, G4bool isTunnel=false)
 
void RegisterExcludedPV (G4VPhysicalVolume *physicalVolume)
 

Static Public Member Functions

static BDSPhysicalVolumeInfoRegistryInstance ()
 Singleton accessor. More...
 

Private Member Functions

 BDSPhysicalVolumeInfoRegistry ()
 Default constructor is private as singleton. More...
 
G4bool IsRegistered (G4VPhysicalVolume *physicalVolume)
 Check whether a physical volume is registered at all. More...
 
G4bool IsRegisteredToReadOutRegister (G4VPhysicalVolume *physicalVolume)
 Check whether a physical volume is registered to the read out registry. More...
 
G4bool IsRegisteredToBackupRegister (G4VPhysicalVolume *physicalVolume)
 Check whether a physical volume is registered ot the general backup registry. More...
 
G4bool IsRegisteredToTunnelRegister (G4VPhysicalVolume *physicalVolume)
 

Private Attributes

std::map< G4VPhysicalVolume *, BDSPhysicalVolumeInfo * > readOutRegister
 Registry is a map - note 'register' is a protected keyword. More...
 
std::map< G4VPhysicalVolume *, BDSPhysicalVolumeInfo * > backupRegister
 
std::map< G4VPhysicalVolume *, BDSPhysicalVolumeInfo * > tunnelRegister
 
std::set< G4VPhysicalVolume * > excludedVolumes
 
std::set< BDSPhysicalVolumeInfo * > pvInfosForDeletion
 
BDSPVInfoIterator readOutSearch
 Search iterator. More...
 
BDSPVInfoIterator backupSearch
 Search iterator. More...
 
BDSPVInfoIterator tunnelSearch
 Search iterator. More...
 

Static Private Attributes

static BDSPhysicalVolumeInfoRegistryinstance = nullptr
 The singleton instance. More...
 

Friends

std::ostream & operator<< (std::ostream &out, BDSPhysicalVolumeInfoRegistry const &r)
 output stream More...
 

Detailed Description

A registry of physical volume info instances that can be searched.

This actually contains two registries - one for read out geometry and one for general geometry. The reason for this is that the physical volumes of the general geometry are much more numerous and would increase the search time of whole registry

Author
Laurie Nevay

Definition at line 55 of file BDSPhysicalVolumeInfoRegistry.hh.

Constructor & Destructor Documentation

◆ ~BDSPhysicalVolumeInfoRegistry()

BDSPhysicalVolumeInfoRegistry::~BDSPhysicalVolumeInfoRegistry ( )

Destructor resets instance to 0 so that the class can be reinstantiated if necessary

Definition at line 44 of file BDSPhysicalVolumeInfoRegistry.cc.

References instance.

◆ BDSPhysicalVolumeInfoRegistry()

BDSPhysicalVolumeInfoRegistry::BDSPhysicalVolumeInfoRegistry ( )
private

Default constructor is private as singleton.

Definition at line 38 of file BDSPhysicalVolumeInfoRegistry.cc.

References backupSearch, readOutRegister, and readOutSearch.

Referenced by Instance().

Here is the caller graph for this function:

Member Function Documentation

◆ GetInfo()

BDSPhysicalVolumeInfo * BDSPhysicalVolumeInfoRegistry::GetInfo ( G4VPhysicalVolume *  logicalVolume,
G4bool  isTunnel = false 
)

Get the logical volume info for a particular logical volume (by address). Note, returns null pointer if none found. If isTunnel, gets only from tunnelRegistry.

Definition at line 94 of file BDSPhysicalVolumeInfoRegistry.cc.

References backupSearch, IsRegisteredToBackupRegister(), IsRegisteredToReadOutRegister(), readOutSearch, and tunnelSearch.

Referenced by BDSTrajectoryPoint::BDSTrajectoryPoint(), BDSOutputROOTEventTrajectory::FillIndividualTrajectory(), BDSSDApertureImpacts::ProcessHits(), BDSSDEnergyDeposition::ProcessHits(), BDSSDCollimator::ProcessHitsOrdered(), and BDSSDEnergyDeposition::ProcessHitsTrack().

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

◆ Instance()

BDSPhysicalVolumeInfoRegistry * BDSPhysicalVolumeInfoRegistry::Instance ( )
static

◆ IsRegistered()

G4bool BDSPhysicalVolumeInfoRegistry::IsRegistered ( G4VPhysicalVolume *  physicalVolume)
private

Check whether a physical volume is registered at all.

Definition at line 130 of file BDSPhysicalVolumeInfoRegistry.cc.

References IsRegisteredToBackupRegister(), and IsRegisteredToReadOutRegister().

Referenced by RegisterInfo().

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

◆ IsRegisteredToBackupRegister()

G4bool BDSPhysicalVolumeInfoRegistry::IsRegisteredToBackupRegister ( G4VPhysicalVolume *  physicalVolume)
private

Check whether a physical volume is registered ot the general backup registry.

Definition at line 144 of file BDSPhysicalVolumeInfoRegistry.cc.

References backupSearch.

Referenced by GetInfo(), and IsRegistered().

Here is the caller graph for this function:

◆ IsRegisteredToReadOutRegister()

G4bool BDSPhysicalVolumeInfoRegistry::IsRegisteredToReadOutRegister ( G4VPhysicalVolume *  physicalVolume)
private

Check whether a physical volume is registered to the read out registry.

Definition at line 135 of file BDSPhysicalVolumeInfoRegistry.cc.

References readOutRegister, and readOutSearch.

Referenced by GetInfo(), and IsRegistered().

Here is the caller graph for this function:

◆ IsRegisteredToTunnelRegister()

G4bool BDSPhysicalVolumeInfoRegistry::IsRegisteredToTunnelRegister ( G4VPhysicalVolume *  physicalVolume)
private

Definition at line 153 of file BDSPhysicalVolumeInfoRegistry.cc.

◆ RegisterExcludedPV()

void BDSPhysicalVolumeInfoRegistry::RegisterExcludedPV ( G4VPhysicalVolume *  physicalVolume)

Register a pointer to exclude from the search. If the registry is queried with one of these pointers, it immediately returns a nullptr without complaint. This registers the pointer to (hopefully small) member vector that is queried before the main search each time.

Definition at line 125 of file BDSPhysicalVolumeInfoRegistry.cc.

Referenced by BDSDetectorConstruction::BuildWorld().

Here is the caller graph for this function:

◆ RegisterInfo() [1/2]

void BDSPhysicalVolumeInfoRegistry::RegisterInfo ( const std::set< G4VPhysicalVolume * > &  physicalVolumes,
BDSPhysicalVolumeInfo info,
G4bool  isReadOutVolume = false,
G4bool  isTunnel = false 
)

Loop version of the same function above but for a set of pvs.

Definition at line 85 of file BDSPhysicalVolumeInfoRegistry.cc.

References RegisterInfo().

Here is the call graph for this function:

◆ RegisterInfo() [2/2]

void BDSPhysicalVolumeInfoRegistry::RegisterInfo ( G4VPhysicalVolume *  physicalVolume,
BDSPhysicalVolumeInfo info,
G4bool  isReadOutVolume = false,
G4bool  isTunnel = false 
)

Register an instance of logical volume info with the address of the logical volume, which is used as the key to access it. Optional isReadOutVolume flag means volume info will be stored in a separate register that will be searched first to minimise search time. If not found there, the main register will be searched. Optional flag isTunnel controls whether the info is stored to a separate registry just for tunnel segments (not so many so quicker look up, and / or doesn't pollute main registry -> slower).

Definition at line 51 of file BDSPhysicalVolumeInfoRegistry.cc.

References BDSPhysicalVolumeInfo::GetName(), IsRegistered(), and readOutRegister.

Referenced by BDSDetectorConstruction::PlaceBeamlineInWorld(), and RegisterInfo().

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

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
BDSPhysicalVolumeInfoRegistry const &  r 
)
friend

output stream

Definition at line 162 of file BDSPhysicalVolumeInfoRegistry.cc.

Field Documentation

◆ backupRegister

std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*> BDSPhysicalVolumeInfoRegistry::backupRegister
private

Definition at line 124 of file BDSPhysicalVolumeInfoRegistry.hh.

◆ backupSearch

BDSPVInfoIterator BDSPhysicalVolumeInfoRegistry::backupSearch
private

Search iterator.

Definition at line 115 of file BDSPhysicalVolumeInfoRegistry.hh.

Referenced by BDSPhysicalVolumeInfoRegistry(), GetInfo(), and IsRegisteredToBackupRegister().

◆ excludedVolumes

std::set<G4VPhysicalVolume*> BDSPhysicalVolumeInfoRegistry::excludedVolumes
private

Definition at line 126 of file BDSPhysicalVolumeInfoRegistry.hh.

◆ instance

BDSPhysicalVolumeInfoRegistry * BDSPhysicalVolumeInfoRegistry::instance = nullptr
staticprivate

The singleton instance.

Definition at line 120 of file BDSPhysicalVolumeInfoRegistry.hh.

Referenced by Instance(), and ~BDSPhysicalVolumeInfoRegistry().

◆ pvInfosForDeletion

std::set<BDSPhysicalVolumeInfo*> BDSPhysicalVolumeInfoRegistry::pvInfosForDeletion
private

Definition at line 128 of file BDSPhysicalVolumeInfoRegistry.hh.

◆ readOutRegister

std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*> BDSPhysicalVolumeInfoRegistry::readOutRegister
private

Registry is a map - note 'register' is a protected keyword.

Definition at line 123 of file BDSPhysicalVolumeInfoRegistry.hh.

Referenced by BDSPhysicalVolumeInfoRegistry(), IsRegisteredToReadOutRegister(), and RegisterInfo().

◆ readOutSearch

BDSPVInfoIterator BDSPhysicalVolumeInfoRegistry::readOutSearch
private

Search iterator.

Definition at line 114 of file BDSPhysicalVolumeInfoRegistry.hh.

Referenced by BDSPhysicalVolumeInfoRegistry(), GetInfo(), and IsRegisteredToReadOutRegister().

◆ tunnelRegister

std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*> BDSPhysicalVolumeInfoRegistry::tunnelRegister
private

Definition at line 125 of file BDSPhysicalVolumeInfoRegistry.hh.

◆ tunnelSearch

BDSPVInfoIterator BDSPhysicalVolumeInfoRegistry::tunnelSearch
private

Search iterator.

Definition at line 116 of file BDSPhysicalVolumeInfoRegistry.hh.

Referenced by GetInfo().


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