ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4tgbVolumeMgr.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4tgbVolumeMgr.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 //
28 //
29 // class G4tgbVolume
30 //
31 // Class description:
32 //
33 // Class to manage volumes: G4VSolids, G4LogicalVolumes, G4VPhysicalVolumes.
34 // It is a singleton, accesed always through calls to GetInstance().
35 
36 // History:
37 // - Created. P.Arce, CIEMAT (November 2007)
38 // -------------------------------------------------------------------------
39 
40 #ifndef G4tgbVolumeMgr_h
41 #define G4tgbVolumeMgr_h
42 
43 #include "globals.hh"
44 
45 #include <string>
46 #include <vector>
47 #include <map>
48 
49 #include "G4VSolid.hh"
50 #include "G4LogicalVolume.hh"
51 #include "G4VPhysicalVolume.hh"
52 
53 class G4tgbVolume;
54 class G4tgrVolume;
56 
57 typedef std::map< G4String, G4tgbVolume* > G4mssvol;
58 typedef std::multimap< G4String, G4VSolid* > G4mmssol;
59 typedef std::multimap< G4String, G4LogicalVolume* > G4mmslv;
60 typedef std::multimap< G4String, G4VPhysicalVolume* > G4mmspv;
61 typedef std::map< G4LogicalVolume*, G4LogicalVolume* > G4mlvlv;
62 typedef std::map< G4VPhysicalVolume*, G4VPhysicalVolume* > G4mpvpv;
63 
64 //----------------------------------------------------------------------------
66 {
67  public: // with description
68 
71 
72  static G4tgbVolumeMgr* GetInstance();
73  // Get the only instance
74 
75  void AddTextFile( const G4String& fname );
77 
78  void CopyVolumes();
79  // Build a G4tgbVolume per each G4tgbVolume
80 
81  G4tgbVolume* FindVolume( const G4String& volname);
82  // Find a G4tgbVolume by name
83 
84  void RegisterMe( const G4tgbVolume* vol );
85  // Register a G4tgbVolume
86  void RegisterMe( const G4VSolid* solid );
87  // Register a G4VSolid
88  void RegisterMe( const G4LogicalVolume* lv );
89  // Register a G4LogicalVolume
90  void RegisterMe( const G4VPhysicalVolume* pv );
91  // Register a G4VPhysicalVolume
92  void RegisterChildParentLVs( const G4LogicalVolume* logvol,
93  const G4LogicalVolume* parentLV );
94  // Register a child and its parent LV
95 
96  G4VSolid* FindG4Solid( const G4String& name );
97  // Find if solid already exists, comparing the name and all parameters
98  // (could be checked before creating it, but it would be quite
99  // complicated, because it would have to compare the parameters, and
100  // they depend on the type of solid)
101 
102  G4LogicalVolume* FindG4LogVol( const G4String& theName,
103  const G4bool bExists = 0 );
104  // Find a G4LogicalVolume if it already exists
105 
106  G4VPhysicalVolume* FindG4PhysVol( const G4String& theName,
107  const G4bool bExists = 0 );
108  // Find a G4VPhysicalVolume if it already exists
109 
111  // Get the top PV in the hierarchy tree: calls topLV, because
112  // physicalvolumes are not placed until geometry is initialized
113 
115  // Get the top LV in the hierarchy tree
116 
117  void BuildPhysVolTree();
118 
119  // Dumping methods
120 
121  void DumpSummary();
122  void DumpG4LogVolTree();
123  void DumpG4LogVolLeaf(const G4LogicalVolume* lv, unsigned int leafDepth);
124  void DumpG4PhysVolTree();
125  void DumpG4PhysVolLeaf(const G4VPhysicalVolume* pv, unsigned int leafDepth);
126  void DumpG4SolidList();
127 
128  public: // without description
129 
130  const std::multimap< G4String, G4VSolid* >& GetSolids() const
131  { return theSolids; }
133  { theDetectorBuilder = db; }
135  { return theDetectorBuilder; }
136 
137  private:
138 
140 
142  // Map of G4tgbVolume's: G4String is the G4tgbVolume name,
143  // G4tgbVolume* the pointer to it.
144 
146  // Solids container
147 
149  // Logical volume container
151  // Physical volume container
152 
154  // Logical volume tree for navigation (from parent to children):
155  // first is parent, then child
157  // Logical volume tree for inverse navigation (from children to parent):
158  // first is child, then parent
159 
161  // Physical volume tree for navigation (from parent to children):
162  // first is parent, then child
164  // Physical volume tree for inverse navigation (from children to parents):
165  // first is child, then parent
166 
168 };
169 
170 #endif