|
||||
File indexing completed on 2025-01-18 09:59:10
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4tgbVolumeMgr 0027 // 0028 // Class description: 0029 // 0030 // Class to manage volumes: G4VSolids, G4LogicalVolumes, G4VPhysicalVolumes. 0031 // It is a singleton, accesed always through calls to GetInstance(). 0032 0033 // Author: P.Arce, CIEMAT (November 2007) 0034 // -------------------------------------------------------------------- 0035 #ifndef G4tgbVolumeMgr_hh 0036 #define G4tgbVolumeMgr_hh 1 0037 0038 #include "globals.hh" 0039 0040 #include <string> 0041 #include <vector> 0042 #include <map> 0043 0044 #include "G4VSolid.hh" 0045 #include "G4LogicalVolume.hh" 0046 #include "G4VPhysicalVolume.hh" 0047 0048 class G4tgbVolume; 0049 class G4tgrVolume; 0050 class G4tgbDetectorBuilder; 0051 0052 using G4mssvol = std::map<G4String, G4tgbVolume*>; 0053 using G4mmssol = std::multimap<G4String, G4VSolid*>; 0054 using G4mmslv = std::multimap<G4String, G4LogicalVolume*>; 0055 using G4mmspv = std::multimap<G4String, G4VPhysicalVolume*>; 0056 using G4mlvlv = std::map<G4LogicalVolume*, G4LogicalVolume*>; 0057 using G4mpvpv = std::map<G4VPhysicalVolume*, G4VPhysicalVolume*>; 0058 0059 class G4tgbVolumeMgr 0060 { 0061 public: 0062 0063 G4tgbVolumeMgr(); 0064 ~G4tgbVolumeMgr(); 0065 0066 static G4tgbVolumeMgr* GetInstance(); 0067 // Get the only instance 0068 0069 void AddTextFile(const G4String& fname); 0070 G4VPhysicalVolume* ReadAndConstructDetector(); 0071 0072 void CopyVolumes(); 0073 // Build a G4tgbVolume per each G4tgbVolume 0074 0075 G4tgbVolume* FindVolume(const G4String& volname); 0076 // Find a G4tgbVolume by name 0077 0078 void RegisterMe(const G4tgbVolume* vol); 0079 // Register a G4tgbVolume 0080 void RegisterMe(const G4VSolid* solid); 0081 // Register a G4VSolid 0082 void RegisterMe(const G4LogicalVolume* lv); 0083 // Register a G4LogicalVolume 0084 void RegisterMe(const G4VPhysicalVolume* pv); 0085 // Register a G4VPhysicalVolume 0086 void RegisterChildParentLVs(const G4LogicalVolume* logvol, 0087 const G4LogicalVolume* parentLV); 0088 // Register a child and its parent LV 0089 0090 G4VSolid* FindG4Solid(const G4String& name); 0091 // Find if solid already exists, comparing the name and all parameters 0092 // (could be checked before creating it, but it would be quite 0093 // complicated, because it would have to compare the parameters, and 0094 // they depend on the type of solid) 0095 0096 G4LogicalVolume* FindG4LogVol(const G4String& theName, 0097 const G4bool bExists = false); 0098 // Find a G4LogicalVolume if it already exists 0099 0100 G4VPhysicalVolume* FindG4PhysVol(const G4String& theName, 0101 const G4bool bExists = false); 0102 // Find a G4VPhysicalVolume if it already exists 0103 0104 G4VPhysicalVolume* GetTopPhysVol(); 0105 // Get the top PV in the hierarchy tree: calls topLV, because 0106 // physicalvolumes are not placed until geometry is initialized 0107 0108 G4LogicalVolume* GetTopLogVol(); 0109 // Get the top LV in the hierarchy tree 0110 0111 void BuildPhysVolTree(); 0112 0113 // Dumping methods 0114 0115 void DumpSummary(); 0116 void DumpG4LogVolTree(); 0117 void DumpG4LogVolLeaf(const G4LogicalVolume* lv, unsigned int leafDepth); 0118 void DumpG4PhysVolTree(); 0119 void DumpG4PhysVolLeaf(const G4VPhysicalVolume* pv, unsigned int leafDepth); 0120 void DumpG4SolidList(); 0121 0122 const std::multimap<G4String, G4VSolid*>& GetSolids() const 0123 { 0124 return theSolids; 0125 } 0126 void SetDetectorBuilder(G4tgbDetectorBuilder* db) 0127 { 0128 theDetectorBuilder = db; 0129 } 0130 G4tgbDetectorBuilder* GetDetectorBuilder() const 0131 { 0132 return theDetectorBuilder; 0133 } 0134 0135 private: 0136 0137 static G4ThreadLocal G4tgbVolumeMgr* theInstance; 0138 0139 G4mssvol theVolumeList; 0140 // Map of G4tgbVolume's: G4String is the G4tgbVolume name, 0141 // G4tgbVolume* the pointer to it. 0142 0143 G4mmssol theSolids; 0144 // Solids container 0145 0146 G4mmslv theLVs; 0147 // Logical volume container 0148 G4mmspv thePVs; 0149 // Physical volume container 0150 0151 G4mlvlv theLVTree; 0152 // Logical volume tree for navigation (from parent to children): 0153 // first is parent, then child 0154 G4mlvlv theLVInvTree; 0155 // Logical volume tree for inverse navigation (from children to parent): 0156 // first is child, then parent 0157 0158 G4mpvpv thePVTree; 0159 // Physical volume tree for navigation (from parent to children): 0160 // first is parent, then child 0161 G4mpvpv thePVInvTree; 0162 // Physical volume tree for inverse navigation (from children to parents): 0163 // first is child, then parent 0164 0165 G4tgbDetectorBuilder* theDetectorBuilder = nullptr; 0166 }; 0167 0168 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |