Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4tgrVolumeMgr.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 G4tgrVolumeMgr
31//
32// Class description:
33//
34// Class to manage the detector units. It is a singleton.
35
36// History:
37// - Created. P.Arce, CIEMAT (November 2007)
38// -------------------------------------------------------------------------
39
40#ifndef G4tgrVolumeMgr_h
41#define G4tgrVolumeMgr_h
42
43#include "globals.hh"
44#include "G4tgrSolid.hh"
45#include "G4tgrVolume.hh"
46#include "G4tgrPlace.hh"
47#include "G4tgrIsotope.hh"
48#include "G4tgrElement.hh"
49#include "G4tgrMaterial.hh"
51
52#include <map>
53
54typedef std::map< G4String, G4tgrSolid* > G4mapssol;
55typedef std::map< G4String, G4tgrVolume* > G4mapsvol;
56typedef std::multimap< G4String, const G4tgrPlace* > G4mmapspl;
57
58//----------------------------------------------------------------------------
60{
61 public: // with description
62
63 static G4tgrVolumeMgr* GetInstance();
64 // Get the only instance
65
66 G4tgrSolid* CreateSolid( const std::vector<G4String>& wl, G4bool bVOLUtag );
67
68 void RegisterParentChild( const G4String& parentName,
69 const G4tgrPlace* pl );
70 // Add to theG4tgrVolumeTree
71
72 G4tgrSolid* FindSolid( const G4String& name, G4bool exists = false );
73 // Find a G4tgrSolid with name 'name'. If it is not found:
74 // if exists is true, exit; if exists is false, return 0
75
76 G4tgrVolume* FindVolume( const G4String& volname, G4bool exists = false );
77 // Find a G4tgrVolume with name 'volname'. If it is not found:
78 // if exists is true, exit; if exists is false, return 0
79
80 std::vector<G4tgrVolume*> FindVolumes( const G4String& volname,
81 G4bool exists );
82 // Find all G4tgrVolume's with name 'volname'. '*' can be used in the
83 // name to mean 'any character' or 'any substring'. If it is not found:
84 // if exists is true, exit; if exists is false, return 0
85
86 const G4tgrVolume* GetTopVolume();
87 // Find the top of the volume tree
88
89 std::pair<G4mmapspl::iterator, G4mmapspl::iterator>
90 GetChildren( const G4String& name );
91 // Find the list of G4tgrPlace children of G4tgrVolume 'name'
92
93 void DumpSummary();
94 // Dump summary
95 void DumpVolumeTree();
96 // Dump to cout the tree of G4tgrVolume's
97 void DumpVolumeLeaf( const G4tgrVolume* vol, unsigned int copyNo,
98 unsigned int leafDepth);
99 // Dump a G4tgrVolume indicating its copy no
100 // and its depth (number of ancestors)
101
102 void RegisterMe( G4tgrSolid* vol);
103 void UnRegisterMe( G4tgrSolid* vol );
104 void RegisterMe( G4tgrVolume* vol);
105 void UnRegisterMe( G4tgrVolume* vol );
106 void RegisterMe( G4tgrPlace* pl ) { theG4tgrPlaceList.push_back( pl ); }
107 void RegisterMe( G4tgrIsotope* iso ) { theHgIsotList.push_back( iso ); }
108 void RegisterMe( G4tgrElement* ele ) { theHgElemList.push_back( ele ); }
109 void RegisterMe( G4tgrMaterial* mat ) { theHgMateList.push_back( mat ); }
110 void RegisterMe( G4tgrRotationMatrix* rm ) { theHgRotMList.push_back(rm); }
111
112 // Accessors
113
114 const G4mapssol& GetSolidMap() {return theG4tgrSolidMap;}
115 const G4mapsvol& GetVolumeMap() {return theG4tgrVolumeMap;}
116 const G4mmapspl& GetVolumeTree() {return theG4tgrVolumeTree;}
117 std::vector<G4tgrVolume*> GetVolumeList() {return theG4tgrVolumeList;}
118 std::vector<G4tgrPlace*> GetDetPlaceList() {return theG4tgrPlaceList;}
119 std::vector<G4tgrIsotope*> GetIsotopeList() {return theHgIsotList;}
120 std::vector<G4tgrElement*> GetElementList() {return theHgElemList;}
121 std::vector<G4tgrMaterial*> GetMaterialList() {return theHgMateList;}
122 std::vector<G4tgrRotationMatrix*> GetRotMList() {return theHgRotMList;}
123
124 private:
125
128
129 private:
130
131 G4mapssol theG4tgrSolidMap;
132 // Map of G4tgrSolid's: G4String is the G4tgrSolid name,
133 // G4tgrSolid* the pointer to it
134
135 G4mapsvol theG4tgrVolumeMap;
136 // Map of G4tgrVolume's: G4String is the G4tgrVolume name,
137 // G4tgrVolume* the pointer to it
138
139 G4mmapspl theG4tgrVolumeTree;
140 // Hierarchy tree of G4tgrVolume's: G4String is the name
141 // of the parent G4tgrVolume, G4tgrPlace* the pointers to children
142
143 static G4tgrVolumeMgr* theInstance;
144
145 std::vector<G4tgrVolume*> theG4tgrVolumeList;
146 std::vector<G4tgrPlace*> theG4tgrPlaceList;
147 std::vector<G4tgrIsotope*> theHgIsotList;
148 std::vector<G4tgrElement*> theHgElemList;
149 std::vector<G4tgrMaterial*> theHgMateList;
150 std::vector<G4tgrRotationMatrix*> theHgRotMList;
151};
152
153#endif
bool G4bool
Definition: G4Types.hh:67
std::map< G4String, G4tgrVolume * > G4mapsvol
std::multimap< G4String, const G4tgrPlace * > G4mmapspl
std::map< G4String, G4tgrSolid * > G4mapssol
std::vector< G4tgrVolume * > FindVolumes(const G4String &volname, G4bool exists)
G4tgrVolume * FindVolume(const G4String &volname, G4bool exists=false)
G4tgrSolid * FindSolid(const G4String &name, G4bool exists=false)
std::vector< G4tgrElement * > GetElementList()
void RegisterParentChild(const G4String &parentName, const G4tgrPlace *pl)
void RegisterMe(G4tgrElement *ele)
void RegisterMe(G4tgrIsotope *iso)
const G4mapsvol & GetVolumeMap()
void RegisterMe(G4tgrMaterial *mat)
const G4mapssol & GetSolidMap()
std::vector< G4tgrVolume * > GetVolumeList()
void RegisterMe(G4tgrPlace *pl)
void DumpVolumeLeaf(const G4tgrVolume *vol, unsigned int copyNo, unsigned int leafDepth)
void RegisterMe(G4tgrSolid *vol)
const G4tgrVolume * GetTopVolume()
void UnRegisterMe(G4tgrSolid *vol)
const G4mmapspl & GetVolumeTree()
G4tgrSolid * CreateSolid(const std::vector< G4String > &wl, G4bool bVOLUtag)
void RegisterMe(G4tgrRotationMatrix *rm)
static G4tgrVolumeMgr * GetInstance()
std::pair< G4mmapspl::iterator, G4mmapspl::iterator > GetChildren(const G4String &name)
std::vector< G4tgrRotationMatrix * > GetRotMList()
std::vector< G4tgrIsotope * > GetIsotopeList()
std::vector< G4tgrPlace * > GetDetPlaceList()
std::vector< G4tgrMaterial * > GetMaterialList()