Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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//
27// $Id$
28//
29//
30// class G4tgbVolume
31//
32// Class description:
33//
34// Class to manage volumes: G4VSolids, G4LogicalVolumes, G4VPhysicalVolumes.
35// It is a singleton, accesed always through calls to GetInstance().
36
37// History:
38// - Created. P.Arce, CIEMAT (November 2007)
39// -------------------------------------------------------------------------
40
41#ifndef G4tgbVolumeMgr_h
42#define G4tgbVolumeMgr_h
43
44#include "globals.hh"
45
46#include <string>
47#include <vector>
48#include <map>
49
50#include "G4VSolid.hh"
51#include "G4LogicalVolume.hh"
52#include "G4VPhysicalVolume.hh"
53
54class G4tgbVolume;
55class G4tgrVolume;
57
58typedef std::map< G4String, G4tgbVolume* > G4mssvol;
59typedef std::multimap< G4String, G4VSolid* > G4mmssol;
60typedef std::multimap< G4String, G4LogicalVolume* > G4mmslv;
61typedef std::multimap< G4String, G4VPhysicalVolume* > G4mmspv;
62typedef std::map< G4LogicalVolume*, G4LogicalVolume* > G4mlvlv;
63typedef std::map< G4VPhysicalVolume*, G4VPhysicalVolume* > G4mpvpv;
64
65//----------------------------------------------------------------------------
67{
68 public: // with description
69
72
73 static G4tgbVolumeMgr* GetInstance();
74 // Get the only instance
75
76 void AddTextFile( const G4String& fname );
78
79 void CopyVolumes();
80 // Build a G4tgbVolume per each G4tgbVolume
81
82 G4tgbVolume* FindVolume( const G4String& volname);
83 // Find a G4tgbVolume by name
84
85 void RegisterMe( const G4tgbVolume* vol );
86 // Register a G4tgbVolume
87 void RegisterMe( const G4VSolid* solid );
88 // Register a G4VSolid
89 void RegisterMe( const G4LogicalVolume* lv );
90 // Register a G4LogicalVolume
91 void RegisterMe( const G4VPhysicalVolume* pv );
92 // Register a G4VPhysicalVolume
93 void RegisterChildParentLVs( const G4LogicalVolume* logvol,
94 const G4LogicalVolume* parentLV );
95 // Register a child and its parent LV
96
97 G4VSolid* FindG4Solid( const G4String& name );
98 // Find if solid already exists, comparing the name and all parameters
99 // (could be checked before creating it, but it would be quite
100 // complicated, because it would have to compare the parameters, and
101 // they depend on the type of solid)
102
103 G4LogicalVolume* FindG4LogVol( const G4String& theName,
104 const G4bool bExists = 0 );
105 // Find a G4LogicalVolume if it already exists
106
108 const G4bool bExists = 0 );
109 // Find a G4VPhysicalVolume if it already exists
110
112 // Get the top PV in the hierarchy tree: calls topLV, because
113 // physicalvolumes are not placed until geometry is initialized
114
116 // Get the top LV in the hierarchy tree
117
118 void BuildPhysVolTree();
119
120 // Dumping methods
121
122 void DumpSummary();
123 void DumpG4LogVolTree();
124 void DumpG4LogVolLeaf(const G4LogicalVolume* lv, unsigned int leafDepth);
125 void DumpG4PhysVolTree();
126 void DumpG4PhysVolLeaf(const G4VPhysicalVolume* pv, unsigned int leafDepth);
127 void DumpG4SolidList();
128
129 public: // without description
130
131 const std::multimap< G4String, G4VSolid* >& GetSolids() const
132 { return theSolids; }
134 { theDetectorBuilder = db; }
136 { return theDetectorBuilder; }
137
138 private:
139
140 static G4tgbVolumeMgr* theInstance;
141
142 G4mssvol theVolumeList;
143 // Map of G4tgbVolume's: G4String is the G4tgbVolume name,
144 // G4tgbVolume* the pointer to it.
145
146 G4mmssol theSolids;
147 // Solids container
148
149 G4mmslv theLVs;
150 // Logical volume container
151 G4mmspv thePVs;
152 // Physical volume container
153
154 G4mlvlv theLVTree;
155 // Logical volume tree for navigation (from parent to children):
156 // first is parent, then child
157 G4mlvlv theLVInvTree;
158 // Logical volume tree for inverse navigation (from children to parent):
159 // first is child, then parent
160
161 G4mpvpv thePVTree;
162 // Physical volume tree for navigation (from parent to children):
163 // first is parent, then child
164 G4mpvpv thePVInvTree;
165 // Physical volume tree for inverse navigation (from children to parents):
166 // first is child, then parent
167
168 G4tgbDetectorBuilder* theDetectorBuilder;
169};
170
171#endif
bool G4bool
Definition: G4Types.hh:67
std::multimap< G4String, G4VPhysicalVolume * > G4mmspv
std::map< G4LogicalVolume *, G4LogicalVolume * > G4mlvlv
std::map< G4VPhysicalVolume *, G4VPhysicalVolume * > G4mpvpv
std::multimap< G4String, G4VSolid * > G4mmssol
std::map< G4String, G4tgbVolume * > G4mssvol
std::multimap< G4String, G4LogicalVolume * > G4mmslv
G4tgbVolume * FindVolume(const G4String &volname)
G4LogicalVolume * FindG4LogVol(const G4String &theName, const G4bool bExists=0)
G4tgbDetectorBuilder * GetDetectorBuilder() const
void AddTextFile(const G4String &fname)
G4VSolid * FindG4Solid(const G4String &name)
void RegisterMe(const G4tgbVolume *vol)
const std::multimap< G4String, G4VSolid * > & GetSolids() const
static G4tgbVolumeMgr * GetInstance()
void DumpG4PhysVolTree()
void DumpG4PhysVolLeaf(const G4VPhysicalVolume *pv, unsigned int leafDepth)
G4VPhysicalVolume * ReadAndConstructDetector()
G4VPhysicalVolume * FindG4PhysVol(const G4String &theName, const G4bool bExists=0)
void SetDetectorBuilder(G4tgbDetectorBuilder *db)
G4LogicalVolume * GetTopLogVol()
void DumpG4LogVolLeaf(const G4LogicalVolume *lv, unsigned int leafDepth)
G4VPhysicalVolume * GetTopPhysVol()
void RegisterChildParentLVs(const G4LogicalVolume *logvol, const G4LogicalVolume *parentLV)