Geant4-11
G4tgbVolumeMgr.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4tgbVolumeMgr
27//
28// Class description:
29//
30// Class to manage volumes: G4VSolids, G4LogicalVolumes, G4VPhysicalVolumes.
31// It is a singleton, accesed always through calls to GetInstance().
32
33// Author: P.Arce, CIEMAT (November 2007)
34// --------------------------------------------------------------------
35#ifndef G4tgbVolumeMgr_hh
36#define G4tgbVolumeMgr_hh 1
37
38#include "globals.hh"
39
40#include <string>
41#include <vector>
42#include <map>
43
44#include "G4VSolid.hh"
45#include "G4LogicalVolume.hh"
46#include "G4VPhysicalVolume.hh"
47
48class G4tgbVolume;
49class G4tgrVolume;
51
52using G4mssvol = std::map<G4String, G4tgbVolume*>;
53using G4mmssol = std::multimap<G4String, G4VSolid*>;
54using G4mmslv = std::multimap<G4String, G4LogicalVolume*>;
55using G4mmspv = std::multimap<G4String, G4VPhysicalVolume*>;
56using G4mlvlv = std::map<G4LogicalVolume*, G4LogicalVolume*>;
57using G4mpvpv = std::map<G4VPhysicalVolume*, G4VPhysicalVolume*>;
58
60{
61 public:
62
65
67 // Get the only instance
68
69 void AddTextFile(const G4String& fname);
71
72 void CopyVolumes();
73 // Build a G4tgbVolume per each G4tgbVolume
74
75 G4tgbVolume* FindVolume(const G4String& volname);
76 // Find a G4tgbVolume by name
77
78 void RegisterMe(const G4tgbVolume* vol);
79 // Register a G4tgbVolume
80 void RegisterMe(const G4VSolid* solid);
81 // Register a G4VSolid
82 void RegisterMe(const G4LogicalVolume* lv);
83 // Register a G4LogicalVolume
84 void RegisterMe(const G4VPhysicalVolume* pv);
85 // Register a G4VPhysicalVolume
86 void RegisterChildParentLVs(const G4LogicalVolume* logvol,
87 const G4LogicalVolume* parentLV);
88 // Register a child and its parent LV
89
91 // Find if solid already exists, comparing the name and all parameters
92 // (could be checked before creating it, but it would be quite
93 // complicated, because it would have to compare the parameters, and
94 // they depend on the type of solid)
95
97 const G4bool bExists = false);
98 // Find a G4LogicalVolume if it already exists
99
101 const G4bool bExists = false);
102 // Find a G4VPhysicalVolume if it already exists
103
105 // Get the top PV in the hierarchy tree: calls topLV, because
106 // physicalvolumes are not placed until geometry is initialized
107
109 // Get the top LV in the hierarchy tree
110
111 void BuildPhysVolTree();
112
113 // Dumping methods
114
115 void DumpSummary();
116 void DumpG4LogVolTree();
117 void DumpG4LogVolLeaf(const G4LogicalVolume* lv, unsigned int leafDepth);
118 void DumpG4PhysVolTree();
119 void DumpG4PhysVolLeaf(const G4VPhysicalVolume* pv, unsigned int leafDepth);
120 void DumpG4SolidList();
121
122 const std::multimap<G4String, G4VSolid*>& GetSolids() const
123 {
124 return theSolids;
125 }
127 {
129 }
131 {
132 return theDetectorBuilder;
133 }
134
135 private:
136
138
140 // Map of G4tgbVolume's: G4String is the G4tgbVolume name,
141 // G4tgbVolume* the pointer to it.
142
144 // Solids container
145
147 // Logical volume container
149 // Physical volume container
150
152 // Logical volume tree for navigation (from parent to children):
153 // first is parent, then child
155 // Logical volume tree for inverse navigation (from children to parent):
156 // first is child, then parent
157
159 // Physical volume tree for navigation (from parent to children):
160 // first is parent, then child
162 // Physical volume tree for inverse navigation (from children to parents):
163 // first is child, then parent
164
166};
167
168#endif
bool G4bool
Definition: G4Types.hh:86
std::multimap< G4String, G4VSolid * > G4mmssol
std::map< G4VPhysicalVolume *, G4VPhysicalVolume * > G4mpvpv
std::map< G4String, G4tgbVolume * > G4mssvol
std::map< G4LogicalVolume *, G4LogicalVolume * > G4mlvlv
std::multimap< G4String, G4VPhysicalVolume * > G4mmspv
std::multimap< G4String, G4LogicalVolume * > G4mmslv
G4LogicalVolume * FindG4LogVol(const G4String &theName, const G4bool bExists=false)
G4tgbVolume * FindVolume(const G4String &volname)
G4tgbDetectorBuilder * GetDetectorBuilder() const
void AddTextFile(const G4String &fname)
G4VSolid * FindG4Solid(const G4String &name)
static G4ThreadLocal G4tgbVolumeMgr * theInstance
void RegisterMe(const G4tgbVolume *vol)
const std::multimap< G4String, G4VSolid * > & GetSolids() const
static G4tgbVolumeMgr * GetInstance()
G4mssvol theVolumeList
void DumpG4PhysVolTree()
void DumpG4PhysVolLeaf(const G4VPhysicalVolume *pv, unsigned int leafDepth)
G4VPhysicalVolume * ReadAndConstructDetector()
void SetDetectorBuilder(G4tgbDetectorBuilder *db)
G4tgbDetectorBuilder * theDetectorBuilder
G4LogicalVolume * GetTopLogVol()
void DumpG4LogVolLeaf(const G4LogicalVolume *lv, unsigned int leafDepth)
G4VPhysicalVolume * GetTopPhysVol()
void RegisterChildParentLVs(const G4LogicalVolume *logvol, const G4LogicalVolume *parentLV)
G4VPhysicalVolume * FindG4PhysVol(const G4String &theName, const G4bool bExists=false)
const char * name(G4int ptype)
string fname
Definition: test.py:308
#define G4ThreadLocal
Definition: tls.hh:77