BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EventDisplay/BesVisLib/BesVisLib-00-06-02/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 //Long Peixun's update: Add delete arrays code
32 delete m_DetectorsArray;
33 delete m_HitsArray;
34 delete m_2DHitsArray;
35}
36
37void
38SubDetectorROOTGeo::ReadGdml( const char *gdmlFile, const char *setupName )
39{
40 m_config.SetURI( gdmlFile );
41 m_config.SetSetupName( setupName );
42 m_config.SetType ( "ROOT" );
43
44 m_sxp.Configure( &m_config );
45 m_sxp.Initialize();
46 m_sxp.Run();
47
48 m_TopVolume = (TGeoVolume*)TGDMLProcessor::GetInstance()->GetWorldVolume();
49}
50
51TGeoVolume* SubDetectorROOTGeo::GetLogicalVolume( const std::string& vn )
52{
53 TGeoVolume *lv = (TGeoVolume*)TGDMLProcessor::GetInstance()->GetLogicalVolume(vn);
54 return lv;
55}
56
57TGeoVolumeAssembly* SubDetectorROOTGeo::GetAssemblyVolume( const std::string& an )
58{
59 TGeoVolumeAssembly *av = (TGeoVolumeAssembly*)TGDMLProcessor::GetInstance()->GetAssemblyVolume(an);
60 return av;
61}
62
63TGeoNode* SubDetectorROOTGeo::GetNode( const std::string& nn )
64{
65 TGeoNode *node = (TGeoNode*)TGDMLProcessor::GetInstance()->GetPhysicalVolume(nn);
66 return node;
67}
68
69TGeoPhysicalNode* SubDetectorROOTGeo::GetHit(int i)
70{
71 if (i < m_HitsArray->GetEntries())
72 return (TGeoPhysicalNode*)m_HitsArray->At(i);
73 else
74 return 0;
75}
76
78{
79 for (Int_t i = 0; i < m_DetectorsArray->GetEntries(); i++) {
80 TGeoPhysicalNode *pNode = (TGeoPhysicalNode*)m_DetectorsArray->At(i);
81 if (pNode) pNode->SetVisibility(1);
82 }
83}
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;.