00001 //$id$ 00002 /* 00003 * 2007/05/15 Miao He <hem@ihep.ac.cn> 00004 * Emc 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/EmcID.h" 00017 #include "G4Geo/EmcG4Geo.h" 00018 00019 EmcG4Geo* 00020 EmcG4Geo::m_pEmcG4Geo = 0L; 00021 00022 EmcG4Geo::EmcG4Geo() 00023 { 00024 string GdmlManagementPath = getenv("GDMLMANAGEMENTROOT"); 00025 if (GdmlManagementPath == "") cout << "EmcG4Geo::GdmlManagementPath not set!" << endl; 00026 string GdmlFile = GdmlManagementPath + string("/dat/Emc.gdml"); 00027 cout << "Construct Emc from GdmlFile " << GdmlFile << endl; 00028 InitFromGdml( GdmlFile.c_str(), "Emc" ); 00029 } 00030 00031 EmcG4Geo::~EmcG4Geo() 00032 { } 00033 00034 void 00035 EmcG4Geo::InitFromGdml( const char *gdmlFile, const char *setupName ) 00036 { 00037 ReadGdml(gdmlFile, setupName); 00038 m_TopVolume = GetLogicalVolume("logicalEMC"); 00039 if (!m_TopVolume) cout << "EmcG4Geo::InitFromGdml, m_TopVolume not found" << endl; 00040 else cout << "Emc TopVolume name " << m_TopVolume->GetName() << endl; 00041 SetDefaultVis(); 00042 00043 m_G4GeoInit = 1; 00044 } 00045 00046 void 00047 EmcG4Geo::SetDefaultVis() 00048 { 00049 } 00050 00051 EmcG4Geo* 00052 EmcG4Geo::Instance() 00053 { 00054 //Get a pointer to the single instance of EmcG4Geo 00055 if(!m_pEmcG4Geo) { 00056 m_pEmcG4Geo = new EmcG4Geo; 00057 //cout<<"in EmcG4Geo:: no EmcG4Geo now."<<m_pEmcG4Geo<<endl; 00058 } 00059 //cout<<"in EmcG4Geo:: get EmcG4Geo successfully."<<endl; 00060 return m_pEmcG4Geo; 00061 } 00062