00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef G4tgbVolumeMgr_h
00042 #define G4tgbVolumeMgr_h
00043
00044 #include "globals.hh"
00045
00046 #include <string>
00047 #include <vector>
00048 #include <map>
00049
00050 #include "G4VSolid.hh"
00051 #include "G4LogicalVolume.hh"
00052 #include "G4VPhysicalVolume.hh"
00053
00054 class G4tgbVolume;
00055 class G4tgrVolume;
00056 class G4tgbDetectorBuilder;
00057
00058 typedef std::map< G4String, G4tgbVolume* > G4mssvol;
00059 typedef std::multimap< G4String, G4VSolid* > G4mmssol;
00060 typedef std::multimap< G4String, G4LogicalVolume* > G4mmslv;
00061 typedef std::multimap< G4String, G4VPhysicalVolume* > G4mmspv;
00062 typedef std::map< G4LogicalVolume*, G4LogicalVolume* > G4mlvlv;
00063 typedef std::map< G4VPhysicalVolume*, G4VPhysicalVolume* > G4mpvpv;
00064
00065
00066 class G4tgbVolumeMgr
00067 {
00068 public:
00069
00070 G4tgbVolumeMgr();
00071 ~G4tgbVolumeMgr();
00072
00073 static G4tgbVolumeMgr* GetInstance();
00074
00075
00076 void AddTextFile( const G4String& fname );
00077 G4VPhysicalVolume* ReadAndConstructDetector();
00078
00079 void CopyVolumes();
00080
00081
00082 G4tgbVolume* FindVolume( const G4String& volname);
00083
00084
00085 void RegisterMe( const G4tgbVolume* vol );
00086
00087 void RegisterMe( const G4VSolid* solid );
00088
00089 void RegisterMe( const G4LogicalVolume* lv );
00090
00091 void RegisterMe( const G4VPhysicalVolume* pv );
00092
00093 void RegisterChildParentLVs( const G4LogicalVolume* logvol,
00094 const G4LogicalVolume* parentLV );
00095
00096
00097 G4VSolid* FindG4Solid( const G4String& name );
00098
00099
00100
00101
00102
00103 G4LogicalVolume* FindG4LogVol( const G4String& theName,
00104 const G4bool bExists = 0 );
00105
00106
00107 G4VPhysicalVolume* FindG4PhysVol( const G4String& theName,
00108 const G4bool bExists = 0 );
00109
00110
00111 G4VPhysicalVolume* GetTopPhysVol();
00112
00113
00114
00115 G4LogicalVolume* GetTopLogVol();
00116
00117
00118 void BuildPhysVolTree();
00119
00120
00121
00122 void DumpSummary();
00123 void DumpG4LogVolTree();
00124 void DumpG4LogVolLeaf(const G4LogicalVolume* lv, unsigned int leafDepth);
00125 void DumpG4PhysVolTree();
00126 void DumpG4PhysVolLeaf(const G4VPhysicalVolume* pv, unsigned int leafDepth);
00127 void DumpG4SolidList();
00128
00129 public:
00130
00131 const std::multimap< G4String, G4VSolid* >& GetSolids() const
00132 { return theSolids; }
00133 void SetDetectorBuilder( G4tgbDetectorBuilder* db )
00134 { theDetectorBuilder = db; }
00135 G4tgbDetectorBuilder* GetDetectorBuilder() const
00136 { return theDetectorBuilder; }
00137
00138 private:
00139
00140 static G4tgbVolumeMgr* theInstance;
00141
00142 G4mssvol theVolumeList;
00143
00144
00145
00146 G4mmssol theSolids;
00147
00148
00149 G4mmslv theLVs;
00150
00151 G4mmspv thePVs;
00152
00153
00154 G4mlvlv theLVTree;
00155
00156
00157 G4mlvlv theLVInvTree;
00158
00159
00160
00161 G4mpvpv thePVTree;
00162
00163
00164 G4mpvpv thePVInvTree;
00165
00166
00167
00168 G4tgbDetectorBuilder* theDetectorBuilder;
00169 };
00170
00171 #endif