BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
DetectorDescription/ROOTGeo/src/SubDetectorROOTGeo.cxx
Go to the documentation of this file.
1//$id$
2/*
3 * 2004/12/9 Zhengyun You Peking University
4 * ROOT Geometry for Bes sub-detector in event display and reconstruction.
5 *
6 */
7
8using namespace std;
9
10#include <iostream>
11#include <string>
12
13#include "TGeoNode.h"
14#include "TGeoVolume.h"
15
16#include "ROOTGeo/SubDetectorROOTGeo.h"
17
19 // Default constructor.
20 // m_sxp.Initialize();
21}
22
24
25void SubDetectorROOTGeo::ReadGdml( const char* gdmlFile, const char* setupName ) {
26 m_config.SetURI( gdmlFile );
27 m_config.SetSetupName( setupName );
28 m_config.SetType( "ROOT" );
29
30 m_sxp.Configure( &m_config );
31 m_sxp.Initialize();
32 m_sxp.Run();
33
34 m_TopVolume = (TGeoVolume*)TGDMLProcessor::GetInstance()->GetWorldVolume();
35 if ( !m_TopVolume ) std::cout << "Top Volume not found " << std::endl;
36}
37
38TGeoVolume* SubDetectorROOTGeo::GetLogicalVolume( const std::string& vn ) {
39 TGeoVolume* lv = (TGeoVolume*)TGDMLProcessor::GetInstance()->GetLogicalVolume( vn );
40 if ( !lv ) std::cout << "Logical Volume " << vn << " not found " << std::endl;
41 return lv;
42}
43
44TGeoVolumeAssembly* SubDetectorROOTGeo::GetAssemblyVolume( const std::string& an ) {
45 TGeoVolumeAssembly* av =
46 (TGeoVolumeAssembly*)TGDMLProcessor::GetInstance()->GetAssemblyVolume( an );
47 if ( !av ) std::cout << "Assembly Volume " << an << " not found " << std::endl;
48 return av;
49}
50
51TGeoNode* SubDetectorROOTGeo::GetNode( const std::string& nn ) {
52 TGeoNode* node = (TGeoNode*)TGDMLProcessor::GetInstance()->GetPhysicalVolume( nn );
53 if ( !node ) std::cout << "Physical Volume " << nn << " not found " << std::endl;
54 return node;
55}
TGeoNode * GetNode(const std::string &nn)
Get a node(physical volume) by name;.
TGeoVolume * GetLogicalVolume(const std::string &vn)
Get a logical volume by name;.
void ReadGdml(const char *gdmlFile, const char *setupName)
Initialize the instance of ROOTGeo.
TGeoVolumeAssembly * GetAssemblyVolume(const std::string &an)
Get an assembly by name;.