Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // G4tgbVolumeMgr 27 // 28 // Class description: 29 // 30 // Class to manage volumes: G4VSolids, G4Logic 31 // It is a singleton, accesed always through c 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 48 class G4tgbVolume; 49 class G4tgrVolume; 50 class G4tgbDetectorBuilder; 51 52 using G4mssvol = std::map<G4String, G4tgbVolum 53 using G4mmssol = std::multimap<G4String, G4VSo 54 using G4mmslv = std::multimap<G4String, G4Logi 55 using G4mmspv = std::multimap<G4String, G4VPhy 56 using G4mlvlv = std::map<G4LogicalVolume*, G4L 57 using G4mpvpv = std::map<G4VPhysicalVolume*, G 58 59 class G4tgbVolumeMgr 60 { 61 public: 62 63 G4tgbVolumeMgr(); 64 ~G4tgbVolumeMgr(); 65 66 static G4tgbVolumeMgr* GetInstance(); 67 // Get the only instance 68 69 void AddTextFile(const G4String& fname); 70 G4VPhysicalVolume* ReadAndConstructDetecto 71 72 void CopyVolumes(); 73 // Build a G4tgbVolume per each G4tgbVol 74 75 G4tgbVolume* FindVolume(const G4String& vo 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* p 85 // Register a G4VPhysicalVolume 86 void RegisterChildParentLVs(const G4Logica 87 const G4Logica 88 // Register a child and its parent LV 89 90 G4VSolid* FindG4Solid(const G4String& name 91 // Find if solid already exists, compari 92 // (could be checked before creating it, 93 // complicated, because it would have to 94 // they depend on the type of solid) 95 96 G4LogicalVolume* FindG4LogVol(const G4Stri 97 const G4bool 98 // Find a G4LogicalVolume if it already 99 100 G4VPhysicalVolume* FindG4PhysVol(const G4S 101 const G4b 102 // Find a G4VPhysicalVolume if it alread 103 104 G4VPhysicalVolume* GetTopPhysVol(); 105 // Get the top PV in the hierarchy tree: 106 // physicalvolumes are not placed until 107 108 G4LogicalVolume* GetTopLogVol(); 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 G4LogicalVolum 118 void DumpG4PhysVolTree(); 119 void DumpG4PhysVolLeaf(const G4VPhysicalVo 120 void DumpG4SolidList(); 121 122 const std::multimap<G4String, G4VSolid*>& 123 { 124 return theSolids; 125 } 126 void SetDetectorBuilder(G4tgbDetectorBuild 127 { 128 theDetectorBuilder = db; 129 } 130 G4tgbDetectorBuilder* GetDetectorBuilder() 131 { 132 return theDetectorBuilder; 133 } 134 135 private: 136 137 static G4ThreadLocal G4tgbVolumeMgr* theIn 138 139 G4mssvol theVolumeList; 140 // Map of G4tgbVolume's: G4String is the 141 // G4tgbVolume* the pointer to it. 142 143 G4mmssol theSolids; 144 // Solids container 145 146 G4mmslv theLVs; 147 // Logical volume container 148 G4mmspv thePVs; 149 // Physical volume container 150 151 G4mlvlv theLVTree; 152 // Logical volume tree for navigation (f 153 // first is parent, then child 154 G4mlvlv theLVInvTree; 155 // Logical volume tree for inverse navig 156 // first is child, then parent 157 158 G4mpvpv thePVTree; 159 // Physical volume tree for navigation ( 160 // first is parent, then child 161 G4mpvpv thePVInvTree; 162 // Physical volume tree for inverse navi 163 // first is child, then parent 164 165 G4tgbDetectorBuilder* theDetectorBuilder = 166 }; 167 168 #endif 169