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