BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
A registry of physical volume info instances that can be searched. More...
#include <BDSPhysicalVolumeInfoRegistry.hh>
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. | |
BDSPhysicalVolumeInfo * | GetInfo (G4VPhysicalVolume *logicalVolume, G4bool isTunnel=false) |
void | RegisterExcludedPV (G4VPhysicalVolume *physicalVolume) |
void | RegisterPVsForOutput (const BDSBeamlineElement *element, const std::set< G4VPhysicalVolume * > &physicalVolumes) |
const std::set< G4VPhysicalVolume * > * | PVsForBeamlineElement (BDSBeamlineElement *element) const |
Access a set of volumes registered for the placement of a beamline element. | |
Static Public Member Functions | |
static BDSPhysicalVolumeInfoRegistry * | Instance () |
Singleton accessor. | |
Private Member Functions | |
BDSPhysicalVolumeInfoRegistry () | |
Default constructor is private as singleton. | |
G4bool | IsRegistered (G4VPhysicalVolume *physicalVolume) |
Check whether a physical volume is registered at all. | |
G4bool | IsRegisteredToReadOutRegister (G4VPhysicalVolume *physicalVolume) |
Check whether a physical volume is registered to the read out registry. | |
G4bool | IsRegisteredToBackupRegister (G4VPhysicalVolume *physicalVolume) |
Check whether a physical volume is registered ot the general backup registry. | |
G4bool | IsRegisteredToTunnelRegister (G4VPhysicalVolume *physicalVolume) |
Private Attributes | |
std::map< G4VPhysicalVolume *, BDSPhysicalVolumeInfo * > | readOutRegister |
Registry is a map - note 'register' is a protected keyword. | |
std::map< G4VPhysicalVolume *, BDSPhysicalVolumeInfo * > | backupRegister |
std::map< G4VPhysicalVolume *, BDSPhysicalVolumeInfo * > | tunnelRegister |
std::set< G4VPhysicalVolume * > | excludedVolumes |
std::set< BDSPhysicalVolumeInfo * > | pvInfosForDeletion |
std::map< const BDSBeamlineElement *, std::set< G4VPhysicalVolume * > > | pvsForAGivenElement |
BDSPVInfoIterator | readOutSearch |
Search iterator. | |
BDSPVInfoIterator | backupSearch |
Search iterator. | |
BDSPVInfoIterator | tunnelSearch |
Search iterator. | |
Static Private Attributes | |
static BDSPhysicalVolumeInfoRegistry * | instance = nullptr |
The singleton instance. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, BDSPhysicalVolumeInfoRegistry const &r) |
output stream | |
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
Definition at line 56 of file BDSPhysicalVolumeInfoRegistry.hh.
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.
|
private |
Default constructor is private as singleton.
Definition at line 38 of file BDSPhysicalVolumeInfoRegistry.cc.
References backupSearch, readOutRegister, and readOutSearch.
Referenced by Instance().
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().
|
static |
Singleton accessor.
Definition at line 31 of file BDSPhysicalVolumeInfoRegistry.cc.
References BDSPhysicalVolumeInfoRegistry(), and instance.
Referenced by BDSAcceleratorModel::BDSAcceleratorModel(), BDSTrajectoryPoint::BDSTrajectoryPoint(), BDSDetectorConstruction::BuildWorld(), BDSOutputROOTEventModel::Fill(), BDSOutputROOTEventTrajectory::FillIndividualTrajectory(), BDSDetectorConstruction::PlaceBeamlineInWorld(), BDSSDApertureImpacts::ProcessHits(), BDSSDEnergyDeposition::ProcessHits(), BDSSDCollimator::ProcessHitsOrdered(), and BDSSDEnergyDeposition::ProcessHitsTrack().
|
private |
Check whether a physical volume is registered at all.
Definition at line 136 of file BDSPhysicalVolumeInfoRegistry.cc.
References IsRegisteredToBackupRegister(), and IsRegisteredToReadOutRegister().
Referenced by RegisterInfo().
|
private |
Check whether a physical volume is registered ot the general backup registry.
Definition at line 150 of file BDSPhysicalVolumeInfoRegistry.cc.
References backupSearch.
Referenced by GetInfo(), and IsRegistered().
|
private |
Check whether a physical volume is registered to the read out registry.
Definition at line 141 of file BDSPhysicalVolumeInfoRegistry.cc.
References readOutRegister, and readOutSearch.
Referenced by GetInfo(), and IsRegistered().
|
private |
Definition at line 159 of file BDSPhysicalVolumeInfoRegistry.cc.
const std::set< G4VPhysicalVolume * > * BDSPhysicalVolumeInfoRegistry::PVsForBeamlineElement | ( | BDSBeamlineElement * | element | ) | const |
Access a set of volumes registered for the placement of a beamline element.
Definition at line 180 of file BDSPhysicalVolumeInfoRegistry.cc.
References pvsForAGivenElement.
Referenced by BDSOutputROOTEventModel::Fill().
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().
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().
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().
void BDSPhysicalVolumeInfoRegistry::RegisterPVsForOutput | ( | const BDSBeamlineElement * | element, |
const std::set< G4VPhysicalVolume * > & | physicalVolumes | ||
) |
Register a set of PVs with respect to a beamline element for the purpose of providing this information in the output. Not for memory management.
Definition at line 130 of file BDSPhysicalVolumeInfoRegistry.cc.
References pvsForAGivenElement.
Referenced by BDSDetectorConstruction::PlaceBeamlineInWorld().
|
friend |
output stream
Definition at line 168 of file BDSPhysicalVolumeInfoRegistry.cc.
|
private |
Definition at line 133 of file BDSPhysicalVolumeInfoRegistry.hh.
|
private |
Search iterator.
Definition at line 124 of file BDSPhysicalVolumeInfoRegistry.hh.
Referenced by BDSPhysicalVolumeInfoRegistry(), GetInfo(), and IsRegisteredToBackupRegister().
|
private |
Definition at line 135 of file BDSPhysicalVolumeInfoRegistry.hh.
|
staticprivate |
The singleton instance.
Definition at line 129 of file BDSPhysicalVolumeInfoRegistry.hh.
Referenced by Instance(), and ~BDSPhysicalVolumeInfoRegistry().
|
private |
Definition at line 137 of file BDSPhysicalVolumeInfoRegistry.hh.
|
private |
This map is kept not for memory management, but for keeping a record of PVs for each beamline element placed. This information can be written to the output.
Definition at line 141 of file BDSPhysicalVolumeInfoRegistry.hh.
Referenced by PVsForBeamlineElement(), and RegisterPVsForOutput().
|
private |
Registry is a map - note 'register' is a protected keyword.
Definition at line 132 of file BDSPhysicalVolumeInfoRegistry.hh.
Referenced by BDSPhysicalVolumeInfoRegistry(), IsRegisteredToReadOutRegister(), and RegisterInfo().
|
private |
Search iterator.
Definition at line 123 of file BDSPhysicalVolumeInfoRegistry.hh.
Referenced by BDSPhysicalVolumeInfoRegistry(), GetInfo(), and IsRegisteredToReadOutRegister().
|
private |
Definition at line 134 of file BDSPhysicalVolumeInfoRegistry.hh.
|
private |
Search iterator.
Definition at line 125 of file BDSPhysicalVolumeInfoRegistry.hh.
Referenced by GetInfo().