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) Royal Holloway,
3University of London 2001 - 2023.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef BDSPHYSICALVOLUMEINFOREGISTRY_H
20#define BDSPHYSICALVOLUMEINFOREGISTRY_H
21
22#include "globals.hh" // geant4 globals / types
23
24#include <iterator>
25#include <map>
26#include <set>
27
28class G4VPhysicalVolume;
31
32typedef std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*>::iterator BDSPVInfoIterator;
33typedef std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*>::const_iterator BDSPVInfoIteratorConst;
34
57{
58public:
61
65
73 void RegisterInfo(G4VPhysicalVolume* physicalVolume,
75 G4bool isReadOutVolume = false,
76 G4bool isTunnel = false);
77
79 void RegisterInfo(const std::set<G4VPhysicalVolume*>& physicalVolumes,
81 G4bool isReadOutVolume = false,
82 G4bool isTunnel = false);
83
86 BDSPhysicalVolumeInfo* GetInfo(G4VPhysicalVolume* logicalVolume,
87 G4bool isTunnel = false);
88
93 void RegisterExcludedPV(G4VPhysicalVolume* physicalVolume);
94
97 void RegisterPVsForOutput(const BDSBeamlineElement* element,
98 const std::set<G4VPhysicalVolume*>& physicalVolumes);
99
101 friend std::ostream& operator<< (std::ostream &out, BDSPhysicalVolumeInfoRegistry const &r);
102
104 const std::set<G4VPhysicalVolume*>* PVsForBeamlineElement(BDSBeamlineElement* element) const;
105
106private:
109
111 G4bool IsRegistered(G4VPhysicalVolume* physicalVolume);
112
114 G4bool IsRegisteredToReadOutRegister(G4VPhysicalVolume* physicalVolume);
115
117 G4bool IsRegisteredToBackupRegister(G4VPhysicalVolume* physicalVolume);
118
119 // Check whether a physical volume is registered ot the tunnel registry
120 G4bool IsRegisteredToTunnelRegister(G4VPhysicalVolume* physicalVolume);
121
123 BDSPVInfoIterator readOutSearch;
124 BDSPVInfoIterator backupSearch;
125 BDSPVInfoIterator tunnelSearch;
127
130
132 std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*> readOutRegister;
133 std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*> backupRegister;
134 std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*> tunnelRegister;
135 std::set<G4VPhysicalVolume*> excludedVolumes;
136
137 std::set<BDSPhysicalVolumeInfo*> pvInfosForDeletion;
138
141 std::map<const BDSBeamlineElement*, std::set<G4VPhysicalVolume*> > pvsForAGivenElement;
142};
143
144
145
146
147
148
149#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.