/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/EventDisplay/BesVisLib/BesVisLib-00-04-04/src/SubDetectorROOTGeo.cxx

Go to the documentation of this file.
00001 //$id$
00002 /*
00003  *    2004/12/9    Zhengyun You      Peking University
00004  *                 ROOT Geometry for Bes sub-detector in event display and reconstruction.
00005  *
00006  */
00007 
00008 using namespace std;
00009 
00010 #include <string>
00011 #include <iostream>
00012 
00013 #include "TGeoVolume.h"
00014 #include "TGeoNode.h"
00015 
00016 #include "BesVisLib/SubDetectorROOTGeo.h"
00017 
00018 SubDetectorROOTGeo::SubDetectorROOTGeo()
00019         : m_ROOTGeoInit(0),
00020         m_2DGeoInit(0)
00021 {
00022     // Default constructor.
00023     m_DetectorsArray = new TObjArray();
00024     m_HitsArray      = new TObjArray();
00025     m_2DHitsArray    = new TObjArray();
00026 }
00027 
00028 SubDetectorROOTGeo::~SubDetectorROOTGeo()
00029 {
00030     m_sxp.Finalize();
00031 }
00032 
00033 void
00034 SubDetectorROOTGeo::ReadGdml( const char *gdmlFile, const char *setupName )
00035 {
00036     m_config.SetURI( gdmlFile );
00037     m_config.SetSetupName( setupName );
00038     m_config.SetType ( "ROOT" );
00039 
00040     m_sxp.Configure( &m_config );
00041     m_sxp.Initialize();
00042     m_sxp.Run();
00043 
00044     m_TopVolume = (TGeoVolume*)TGDMLProcessor::GetInstance()->GetWorldVolume();
00045 }
00046 
00047 TGeoVolume* SubDetectorROOTGeo::GetLogicalVolume( const std::string& vn )
00048 {
00049     TGeoVolume *lv = (TGeoVolume*)TGDMLProcessor::GetInstance()->GetLogicalVolume(vn);
00050     return lv;
00051 }
00052 
00053 TGeoVolumeAssembly* SubDetectorROOTGeo::GetAssemblyVolume( const std::string& an )
00054 {
00055     TGeoVolumeAssembly *av = (TGeoVolumeAssembly*)TGDMLProcessor::GetInstance()->GetAssemblyVolume(an);
00056     return av;
00057 }
00058 
00059 TGeoNode* SubDetectorROOTGeo::GetNode( const std::string& nn )
00060 {
00061     TGeoNode *node = (TGeoNode*)TGDMLProcessor::GetInstance()->GetPhysicalVolume(nn);
00062     return node;
00063 }
00064 
00065 TGeoPhysicalNode* SubDetectorROOTGeo::GetHit(int i)
00066 {
00067     if (i < m_HitsArray->GetEntries())
00068         return (TGeoPhysicalNode*)m_HitsArray->At(i);
00069     else
00070         return 0;
00071 }
00072 
00073 void SubDetectorROOTGeo::SetDetectorOn()
00074 {
00075     for (Int_t i = 0; i < m_DetectorsArray->GetEntries(); i++) {
00076         TGeoPhysicalNode *pNode = (TGeoPhysicalNode*)m_DetectorsArray->At(i);
00077         if (pNode) pNode->SetVisibility(1);
00078     }
00079 }

Generated on Tue Nov 29 22:58:01 2016 for BOSS_7.0.2 by  doxygen 1.4.7