BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
EventDisplay/BesVisLib/BesVisLib-00-04-03/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
17
19 : m_ROOTGeoInit(0),
20 m_2DGeoInit(0)
21{
22 // Default constructor.
23 m_DetectorsArray = new TObjArray();
24 m_HitsArray = new TObjArray();
25 m_2DHitsArray = new TObjArray();
26}
27
29{
30 m_sxp.Finalize();
31}
32
33void
34SubDetectorROOTGeo::ReadGdml( const char *gdmlFile, const char *setupName )
35{
36 m_config.SetURI( gdmlFile );
37 m_config.SetSetupName( setupName );
38 m_config.SetType ( "ROOT" );
39
40 m_sxp.Configure( &m_config );
41 m_sxp.Initialize();
42 m_sxp.Run();
43
44 m_TopVolume = (TGeoVolume*)TGDMLProcessor::GetInstance()->GetWorldVolume();
45}
46
47TGeoVolume* SubDetectorROOTGeo::GetLogicalVolume( const std::string& vn )
48{
49 TGeoVolume *lv = (TGeoVolume*)TGDMLProcessor::GetInstance()->GetLogicalVolume(vn);
50 return lv;
51}
52
53TGeoVolumeAssembly* SubDetectorROOTGeo::GetAssemblyVolume( const std::string& an )
54{
55 TGeoVolumeAssembly *av = (TGeoVolumeAssembly*)TGDMLProcessor::GetInstance()->GetAssemblyVolume(an);
56 return av;
57}
58
59TGeoNode* SubDetectorROOTGeo::GetNode( const std::string& nn )
60{
61 TGeoNode *node = (TGeoNode*)TGDMLProcessor::GetInstance()->GetPhysicalVolume(nn);
62 return node;
63}
64
65TGeoPhysicalNode* SubDetectorROOTGeo::GetHit(int i)
66{
67 if (i < m_HitsArray->GetEntries())
68 return (TGeoPhysicalNode*)m_HitsArray->At(i);
69 else
70 return 0;
71}
72
74{
75 for (Int_t i = 0; i < m_DetectorsArray->GetEntries(); i++) {
76 TGeoPhysicalNode *pNode = (TGeoPhysicalNode*)m_DetectorsArray->At(i);
77 if (pNode) pNode->SetVisibility(1);
78 }
79}
TGeoNode * GetNode(const std::string &nn)
Get a node(physical volume) by name;.
virtual TGeoPhysicalNode * GetHit(int i)
Get ith hit in HitsArray;.
TGeoVolume * GetLogicalVolume(const std::string &vn)
Get a logical volume by name;.
virtual void SetDetectorOn()
Set all physicalNodes in m_DeteorsArray visible;.
void ReadGdml(const char *gdmlFile, const char *setupName)
Initialize the instance of ROOTGeo.
TGeoVolumeAssembly * GetAssemblyVolume(const std::string &an)
Get an assembly by name;.