Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4tgrVolumeMgr.hh
이 파일의 문서화 페이지로 가기
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: G4tgrVolumeMgr.hh 66872 2013-01-15 01:25:57Z japost $
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"
50 #include "G4tgrRotationMatrix.hh"
51 
52 #include <map>
53 
54 typedef std::map< G4String, G4tgrSolid* > G4mapssol;
55 typedef std::map< G4String, G4tgrVolume* > G4mapsvol;
56 typedef 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 
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 
126  G4tgrVolumeMgr();
127  ~G4tgrVolumeMgr();
128 
129  private:
130 
132  // Map of G4tgrSolid's: G4String is the G4tgrSolid name,
133  // G4tgrSolid* the pointer to it
134 
136  // Map of G4tgrVolume's: G4String is the G4tgrVolume name,
137  // G4tgrVolume* the pointer to it
138 
140  // Hierarchy tree of G4tgrVolume's: G4String is the name
141  // of the parent G4tgrVolume, G4tgrPlace* the pointers to children
142 
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
const XML_Char * name
Definition: expat.h:151
std::vector< G4tgrIsotope * > theHgIsotList
static G4ThreadLocal G4tgrVolumeMgr * theInstance
void RegisterMe(G4tgrRotationMatrix *rm)
G4mapsvol theG4tgrVolumeMap
std::vector< G4tgrVolume * > theG4tgrVolumeList
std::vector< G4tgrVolume * > FindVolumes(const G4String &volname, G4bool exists)
void DumpVolumeLeaf(const G4tgrVolume *vol, unsigned int copyNo, unsigned int leafDepth)
void RegisterMe(G4tgrPlace *pl)
std::vector< G4tgrMaterial * > GetMaterialList()
G4mapssol theG4tgrSolidMap
G4tgrSolid * CreateSolid(const std::vector< G4String > &wl, G4bool bVOLUtag)
std::map< G4String, G4tgrSolid * > G4mapssol
void RegisterParentChild(const G4String &parentName, const G4tgrPlace *pl)
std::map< G4String, G4tgrVolume * > G4mapsvol
#define G4ThreadLocal
Definition: tls.hh:69
const G4mapssol & GetSolidMap()
const G4tgrVolume * GetTopVolume()
std::vector< G4tgrRotationMatrix * > GetRotMList()
void UnRegisterMe(G4tgrSolid *vol)
const G4mapsvol & GetVolumeMap()
bool G4bool
Definition: G4Types.hh:79
std::multimap< G4String, const G4tgrPlace * > G4mmapspl
std::vector< G4tgrPlace * > theG4tgrPlaceList
std::vector< G4tgrRotationMatrix * > theHgRotMList
void RegisterMe(G4tgrIsotope *iso)
std::vector< G4tgrIsotope * > GetIsotopeList()
Float_t mat
std::vector< G4tgrMaterial * > theHgMateList
G4tgrSolid * FindSolid(const G4String &name, G4bool exists=false)
void RegisterMe(G4tgrSolid *vol)
void RegisterMe(G4tgrElement *ele)
std::vector< G4tgrVolume * > GetVolumeList()
void RegisterMe(G4tgrMaterial *mat)
std::pair< G4mmapspl::iterator, G4mmapspl::iterator > GetChildren(const G4String &name)
const G4mmapspl & GetVolumeTree()
G4mmapspl theG4tgrVolumeTree
std::vector< G4tgrElement * > GetElementList()
static G4tgrVolumeMgr * GetInstance()
G4tgrVolume * FindVolume(const G4String &volname, G4bool exists=false)
std::vector< G4tgrPlace * > GetDetPlaceList()
std::vector< G4tgrElement * > theHgElemList
static const G4double ele