BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcG4Geo.cxx
Go to the documentation of this file.
1//$id$
2/*
3 * 2007/05/15 Miao He <hem@ihep.ac.cn>
4 * Emc Geometry General for Simulation
5 * inherit from class SubDetectorG4Geo
6 */
7
8using namespace std;
9
10#include <iomanip>
11#include <iostream>
12#include <sstream>
13#include <string>
14#include <vector>
15
16#include "G4Geo/EmcG4Geo.h"
17#include "Identifier/EmcID.h"
18
19EmcG4Geo* EmcG4Geo::m_pEmcG4Geo = 0L;
20
22 string GdmlManagementPath = getenv( "GDMLMANAGEMENTDATAROOT" );
23 if ( GdmlManagementPath == "" ) cout << "EmcG4Geo::GdmlManagementPath not set!" << endl;
24 string GdmlFile = GdmlManagementPath + string( "/dat/Emc.gdml" );
25 cout << "EmcG4Geo: Construct Emc from GdmlFile " << GdmlFile << endl;
26 InitFromGdml( GdmlFile.c_str(), "Emc" );
27}
28
30
31void EmcG4Geo::InitFromGdml( const char* gdmlFile, const char* setupName ) {
32 ReadGdml( gdmlFile, setupName );
33 m_TopVolume = GetLogicalVolume( "logicalEMC" );
34 if ( !m_TopVolume ) cout << "EmcG4Geo::InitFromGdml, m_TopVolume not found" << endl;
35 else cout << "Emc TopVolume name " << m_TopVolume->GetName() << endl;
37
38 m_G4GeoInit = 1;
39}
40
42
44 // Get a pointer to the single instance of EmcG4Geo
45 if ( !m_pEmcG4Geo )
46 {
47 m_pEmcG4Geo = new EmcG4Geo;
48 // cout<<"in EmcG4Geo:: no EmcG4Geo now."<<m_pEmcG4Geo<<endl;
49 }
50 // cout<<"in EmcG4Geo:: get EmcG4Geo successfully."<<endl;
51 return m_pEmcG4Geo;
52}
static EmcG4Geo * Instance()
Get a pointer to the single instance of EmcG4Geo.
Definition EmcG4Geo.cxx:43
~EmcG4Geo()
Destructor.
Definition EmcG4Geo.cxx:29
void SetDefaultVis()
Set default visual attributes;.
Definition EmcG4Geo.cxx:41
void InitFromGdml(const char *gdmlFile, const char *setupName)
Initialize the instance of G4Geo.
Definition EmcG4Geo.cxx:31
EmcG4Geo()
Constructor.
Definition EmcG4Geo.cxx:21
void ReadGdml(const char *gdmlFile, const char *setupName)
Initialize the instance of G4Geo.
G4LogicalVolume * GetLogicalVolume(const std::string &vn)
Get a logical volume by name;.