BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EventDisplay/BesVisLib/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 "BesVisLib/SubDetectorROOTGeo.h"
17
18SubDetectorROOTGeo::SubDetectorROOTGeo() : m_ROOTGeoInit( 0 ), m_2DGeoInit( 0 ) {
19 // Default constructor.
20 m_DetectorsArray = new TObjArray();
21 m_HitsArray = new TObjArray();
22 m_2DHitsArray = new TObjArray();
23}
24
26 m_sxp.Finalize();
27 // Long Peixun's update: Add delete arrays code
28 delete m_DetectorsArray;
29 delete m_HitsArray;
30 delete m_2DHitsArray;
31}
32
33void SubDetectorROOTGeo::ReadGdml( const char* gdmlFile, const char* setupName ) {
34 m_config.SetURI( gdmlFile );
35 m_config.SetSetupName( setupName );
36 m_config.SetType( "ROOT" );
37
38 m_sxp.Configure( &m_config );
39 m_sxp.Initialize();
40 m_sxp.Run();
41
42 m_TopVolume = (TGeoVolume*)TGDMLProcessor::GetInstance()->GetWorldVolume();
43}
44
45TGeoVolume* SubDetectorROOTGeo::GetLogicalVolume( const std::string& vn ) {
46 TGeoVolume* lv = (TGeoVolume*)TGDMLProcessor::GetInstance()->GetLogicalVolume( vn );
47 return lv;
48}
49
50TGeoVolumeAssembly* SubDetectorROOTGeo::GetAssemblyVolume( const std::string& an ) {
51 TGeoVolumeAssembly* av =
52 (TGeoVolumeAssembly*)TGDMLProcessor::GetInstance()->GetAssemblyVolume( an );
53 return av;
54}
55
56TGeoNode* SubDetectorROOTGeo::GetNode( const std::string& nn ) {
57 TGeoNode* node = (TGeoNode*)TGDMLProcessor::GetInstance()->GetPhysicalVolume( nn );
58 return node;
59}
60
61TGeoPhysicalNode* SubDetectorROOTGeo::GetHit( int i ) {
62 if ( i < m_HitsArray->GetEntries() ) return (TGeoPhysicalNode*)m_HitsArray->At( i );
63 else return 0;
64}
65
67 for ( Int_t i = 0; i < m_DetectorsArray->GetEntries(); i++ )
68 {
69 TGeoPhysicalNode* pNode = (TGeoPhysicalNode*)m_DetectorsArray->At( i );
70 if ( pNode ) pNode->SetVisibility( 1 );
71 }
72}
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;.