BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSPhysicalVolumeInfoRegistry.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef BDSPHYSICALVOLUMEINFOREGISTRY_H
19#define BDSPHYSICALVOLUMEINFOREGISTRY_H
20
21#include "globals.hh" // geant4 globals / types
22
23#include <iterator>
24#include <map>
25#include <set>
26
27class G4VPhysicalVolume;
30
31typedef std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*>::iterator BDSPVInfoIterator;
32typedef std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*>::const_iterator BDSPVInfoIteratorConst;
33
56{
57public:
60
64
72 void RegisterInfo(G4VPhysicalVolume* physicalVolume,
74 G4bool isReadOutVolume = false,
75 G4bool isTunnel = false);
76
78 void RegisterInfo(const std::set<G4VPhysicalVolume*>& physicalVolumes,
80 G4bool isReadOutVolume = false,
81 G4bool isTunnel = false);
82
85 BDSPhysicalVolumeInfo* GetInfo(G4VPhysicalVolume* logicalVolume,
86 G4bool isTunnel = false);
87
92 void RegisterExcludedPV(G4VPhysicalVolume* physicalVolume);
93
96 void RegisterPVsForOutput(const BDSBeamlineElement* element,
97 const std::set<G4VPhysicalVolume*>& physicalVolumes);
98
100 friend std::ostream& operator<< (std::ostream &out, BDSPhysicalVolumeInfoRegistry const &r);
101
103 const std::set<G4VPhysicalVolume*>* PVsForBeamlineElement(BDSBeamlineElement* element) const;
104
105private:
108
110 G4bool IsRegistered(G4VPhysicalVolume* physicalVolume);
111
113 G4bool IsRegisteredToReadOutRegister(G4VPhysicalVolume* physicalVolume);
114
116 G4bool IsRegisteredToBackupRegister(G4VPhysicalVolume* physicalVolume);
117
118 // Check whether a physical volume is registered ot the tunnel registry
119 G4bool IsRegisteredToTunnelRegister(G4VPhysicalVolume* physicalVolume);
120
122 BDSPVInfoIterator readOutSearch;
123 BDSPVInfoIterator backupSearch;
124 BDSPVInfoIterator tunnelSearch;
126
129
131 std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*> readOutRegister;
132 std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*> backupRegister;
133 std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*> tunnelRegister;
134 std::set<G4VPhysicalVolume*> excludedVolumes;
135
136 std::set<BDSPhysicalVolumeInfo*> pvInfosForDeletion;
137
140 std::map<const BDSBeamlineElement*, std::set<G4VPhysicalVolume*> > pvsForAGivenElement;
141};
142
143
144
145
146
147
148#endif
A class that holds a fully constructed BDSAcceleratorComponent as well as any information relevant to...
A registry of physical volume info instances that can be searched.
void RegisterPVsForOutput(const BDSBeamlineElement *element, const std::set< G4VPhysicalVolume * > &physicalVolumes)
friend std::ostream & operator<<(std::ostream &out, BDSPhysicalVolumeInfoRegistry const &r)
output stream
BDSPVInfoIterator tunnelSearch
Search iterator.
BDSPhysicalVolumeInfoRegistry()
Default constructor is private as singleton.
G4bool IsRegisteredToReadOutRegister(G4VPhysicalVolume *physicalVolume)
Check whether a physical volume is registered to the read out registry.
static BDSPhysicalVolumeInfoRegistry * instance
The singleton instance.
void RegisterExcludedPV(G4VPhysicalVolume *physicalVolume)
BDSPhysicalVolumeInfo * GetInfo(G4VPhysicalVolume *logicalVolume, G4bool isTunnel=false)
G4bool IsRegistered(G4VPhysicalVolume *physicalVolume)
Check whether a physical volume is registered at all.
BDSPVInfoIterator backupSearch
Search iterator.
const std::set< G4VPhysicalVolume * > * PVsForBeamlineElement(BDSBeamlineElement *element) const
Access a set of volumes registered for the placement of a beamline element.
BDSPVInfoIterator readOutSearch
Search iterator.
std::map< const BDSBeamlineElement *, std::set< G4VPhysicalVolume * > > pvsForAGivenElement
void RegisterInfo(G4VPhysicalVolume *physicalVolume, BDSPhysicalVolumeInfo *info, G4bool isReadOutVolume=false, G4bool isTunnel=false)
std::map< G4VPhysicalVolume *, BDSPhysicalVolumeInfo * > readOutRegister
Registry is a map - note 'register' is a protected keyword.
static BDSPhysicalVolumeInfoRegistry * Instance()
Singleton accessor.
G4bool IsRegisteredToBackupRegister(G4VPhysicalVolume *physicalVolume)
Check whether a physical volume is registered ot the general backup registry.
A class holding any information pertaining to a particular physical volume in a BDSIM geant4 model.