00001 //$id$ 00002 /* 00003 * 2005/10/30 Zhengyun You Peking University 00004 * Muc Geometry General for Simulation 00005 * inherit from class SubDetectorG4Geo 00006 */ 00007 00008 using namespace std; 00009 00010 #include <string> 00011 #include <iostream> 00012 #include <sstream> 00013 #include <vector> 00014 #include <iomanip> 00015 00016 #include "Identifier/MucID.h" 00017 #include "G4Geo/MucG4Geo.h" 00018 00019 00020 MucG4Geo* 00021 MucG4Geo::m_pMucG4Geo = 0L; 00022 00023 00024 MucG4Geo::MucG4Geo() 00025 { 00026 string GdmlManagementPath = getenv("GDMLMANAGEMENTROOT"); 00027 if (GdmlManagementPath == "") cout << "MucG4Geo::GdmlManagementPath not set" << endl; 00028 string GdmlFile = GdmlManagementPath + string("/dat/Muc.gdml"); 00029 cout << "Construct Muc from GdmlFile " << GdmlFile << endl; 00030 InitFromGdml( GdmlFile.c_str(), "Muc" ); 00031 } 00032 00033 MucG4Geo::~MucG4Geo() 00034 { } 00035 00036 void 00037 MucG4Geo::InitFromGdml( const char *gdmlFile, const char *setupName ) 00038 { 00039 ReadGdml(gdmlFile, setupName); 00040 m_TopVolume = GetLogicalVolume("logicalMuc"); 00041 if (!m_TopVolume) cout << "MucG4Geo::InitFromGdml, m_TopVolume not found" << endl; 00042 else cout << "Muc TopVolume name " << m_TopVolume->GetName() << endl; 00043 SetDefaultVis(); 00044 00045 m_G4GeoInit = 1; 00046 } 00047 00048 void 00049 MucG4Geo::SetDefaultVis() 00050 { 00051 //std::cout << "begin of set defaultvis" << std::endl; 00052 00053 //std::cout << "end of set defaultvis" << std::endl; 00054 } 00055 00056 MucG4Geo* 00057 MucG4Geo::Instance() 00058 { 00059 //Get a pointer to the single instance of MucG4Geo 00060 if(!m_pMucG4Geo){ 00061 m_pMucG4Geo = new MucG4Geo; 00062 //cout<<"in MucG4Geo:: no MucG4Geo now."<<m_pMucG4Geo<<endl; 00063 00064 } 00065 //cout<<"in MucG4Geo:: get MucG4Geo successfully."<<endl; 00066 return m_pMucG4Geo; 00067 }