BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSPhysicalVolumeInfoRegistry.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
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;
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
95 friend std::ostream& operator<< (std::ostream &out, BDSPhysicalVolumeInfoRegistry const &r);
96
97private:
100
102 G4bool IsRegistered(G4VPhysicalVolume* physicalVolume);
103
105 G4bool IsRegisteredToReadOutRegister(G4VPhysicalVolume* physicalVolume);
106
108 G4bool IsRegisteredToBackupRegister(G4VPhysicalVolume* physicalVolume);
109
110 // Check whether a physical volume is registered ot the tunnel registry
111 G4bool IsRegisteredToTunnelRegister(G4VPhysicalVolume* physicalVolume);
112
114 BDSPVInfoIterator readOutSearch;
115 BDSPVInfoIterator backupSearch;
116 BDSPVInfoIterator tunnelSearch;
118
121
123 std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*> readOutRegister;
124 std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*> backupRegister;
125 std::map<G4VPhysicalVolume*, BDSPhysicalVolumeInfo*> tunnelRegister;
126 std::set<G4VPhysicalVolume*> excludedVolumes;
127
128 std::set<BDSPhysicalVolumeInfo*> pvInfosForDeletion;
129};
130
131
132
133
134
135
136#endif
A registry of physical volume info instances that can be searched.
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.
BDSPVInfoIterator readOutSearch
Search iterator.
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.