BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
DetectorDescription/ROOTGeo/ROOTGeo-00-00-15/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 <string>
11#include <iostream>
12
13#include "TGeoVolume.h"
14#include "TGeoNode.h"
15
16#include "ROOTGeo/SubDetectorROOTGeo.h"
17
19 : m_ROOTGeoInit(0)
20{
21 // Default constructor.
22 //m_sxp.Initialize();
23}
24
26{
27 m_sxp.Finalize();
28}
29
30void
31SubDetectorROOTGeo::ReadGdml( const char *gdmlFile, const char *setupName )
32{
33 m_config.SetURI( gdmlFile );
34 m_config.SetSetupName( setupName );
35 m_config.SetType ( "ROOT" );
36
37 m_sxp.Configure( &m_config );
38 m_sxp.Initialize();
39 m_sxp.Run();
40
41 m_TopVolume = (TGeoVolume*)TGDMLProcessor::GetInstance()->GetWorldVolume();
42 if (!m_TopVolume) std::cout << "Top Volume not found " << std::endl;
43}
44
45TGeoVolume* SubDetectorROOTGeo::GetLogicalVolume( const std::string& vn )
46{
47 TGeoVolume *lv = (TGeoVolume*)TGDMLProcessor::GetInstance()->GetLogicalVolume(vn);
48 if (!lv) std::cout << "Logical Volume " << vn << " not found " << std::endl;
49 return lv;
50}
51
52TGeoVolumeAssembly* SubDetectorROOTGeo::GetAssemblyVolume( const std::string& an )
53{
54 TGeoVolumeAssembly *av = (TGeoVolumeAssembly*)TGDMLProcessor::GetInstance()->GetAssemblyVolume(an);
55 if (!av) std::cout << "Assembly Volume " << an << " not found " << std::endl;
56 return av;
57}
58
59TGeoNode* SubDetectorROOTGeo::GetNode( const std::string& nn )
60{
61 TGeoNode *node = (TGeoNode*)TGDMLProcessor::GetInstance()->GetPhysicalVolume(nn);
62 if (!node) std::cout << "Physical Volume " << nn << " not found " << std::endl;
63 return node;
64}
65
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;.