3#include <TGeoManager.h>
4#include <TGeoMaterial.h>
12#include "BesVisLib/BesGeometry.h"
13#include "BesVisLib/BesCircle2D.h"
14#include "BesVisLib/BesPolygon2D.h"
15#include "BesVisLib/Mdc2DWire.h"
40 if (!gGeoManager)
new TGeoManager(
"BesGeo",
"BesGeometry");
41 else gGeoManager-> ClearPhysicalNodes();
46 m_BeamPipeRMin = 31.5;
47 m_BeamPipeRMax = 35.8;
49 m_BeamPipeColor = 922;
66 gGeoManager->SetVisOption(0);
67 gGeoManager->SetVisLevel(5);
69 TGeoIdentity *identity =
new TGeoIdentity();
71 TGeoMaterial *mat =
new TGeoMaterial(
"VOID",0,0,0);
72 mat->SetTransparency(20);
73 TGeoMedium *med =
new TGeoMedium(
"MED",1,mat);
74 m_Bes = gGeoManager->MakeBox(
"volBes", med, m_BesR, m_BesR, 0.5*m_BesZ);
76 TGeoVolume *topVolume =
new TGeoVolume();
77 gGeoManager->SetTopVolume(topVolume);
78 gGeoManager->SetTopVolume(m_Bes);
82 m_MdcROOTGeo->
InitFromGDML( (fPath + TString(
"Mdc.gdml")).Data(),
"Default" );
83 cout<<
"in BesGeometry construct mdc1"<<endl;
85 if (m_Mdc) cout <<
"Construct Mdc" << endl;
86 else cout <<
"Volume Mdc not found " << endl;
87 m_Bes->AddNode(m_Mdc, iChildNo, identity);
95 m_TofROOTGeo->
InitFromGDML( (fPath + TString(
"Tof_mrpc.gdml")).Data(),
"Default" );
97 m_TofROOTGeo->
InitFromGDML( (fPath + TString(
"Tof.gdml")).Data(),
"Default" );
99 cout<<
"construct tof"<<endl;
101 if (m_Tof) cout <<
"Construct Tof" << endl;
102 else cout <<
"Volume Tof not found " << endl;
103 m_Bes->AddNode(m_Tof, iChildNo, identity);
108 m_EmcROOTGeo->
InitFromGDML( (fPath + TString(
"Emc.gdml")).Data(),
"Default" );
110 if (m_Emc) cout <<
"Construct Emc" << endl;
111 else cout <<
"Volume Emc not found " << endl;
112 m_Bes->AddNode(m_Emc, iChildNo, identity);
117 m_MucROOTGeo->
InitFromGDML( (fPath + TString(
"Muc.gdml")).Data(),
"Default" );
119 if (m_Muc) cout <<
"Construct Muc" << endl;
120 else cout <<
"Volume Muc not found " << endl;
121 m_Bes->AddNode(m_Muc, iChildNo, identity);
125 Int_t beamPipeColor = m_BeamPipeColor;
126 m_BeamPipe = gGeoManager->MakeTube(
"volBeamPipe", med, m_BeamPipeRMin, m_BeamPipeRMax, m_BeamPipeZ);
127 m_BeamPipe->SetLineColor(beamPipeColor);
128 m_Bes->AddNode(m_BeamPipe, iChildNo, identity);
130 Int_t nDaughters = m_Bes->GetNodes()->GetEntries();
131 cout <<
"volBes contains " << nDaughters <<
" nodes : " << endl;
132 for (Int_t i = 0; i < nDaughters; i++) {
133 cout << i <<
" : " << m_Bes->GetNode(i)->GetName() << endl;
141 gGeoManager->SetVisOption(0);
142 gGeoManager->SetVisLevel(5);
145 m_BesR = ((TGeoBBox*)m_Bes->GetShape())->GetDX();
146 m_BesZ = ((TGeoBBox*)m_Bes->GetShape())->GetDZ()*2.0;
148 TGeoVolume *topVolume =
new TGeoVolume();
149 gGeoManager->SetTopVolume(topVolume);
150 gGeoManager->SetTopVolume(m_Bes);
152 Int_t nDaughters = m_Bes->GetNodes()->GetEntries();
161 TGeoNode *nodeMdc = m_Bes->GetNode(iChildNo);
162 if (nodeMdc) m_Mdc = nodeMdc->GetVolume();
171 TGeoNode *nodeTof = m_Bes->GetNode(iChildNo);
172 if (nodeTof) m_Tof = nodeTof->GetVolume();
181 TGeoNode *nodeEmc = m_Bes->GetNode(iChildNo);
182 if (nodeEmc) m_Emc = nodeEmc->GetVolume();
191 TGeoNode *nodeMuc = m_Bes->GetNode(iChildNo);
192 if (nodeMuc) m_Muc = nodeMuc->GetVolume();
200 TGeoNode *nodeBeamPipe = m_Bes->GetNode(iChildNo);
202 m_BeamPipe = nodeBeamPipe->GetVolume();
203 m_BeamPipe->SetLineColor(m_BeamPipeColor);
214 gGeoManager->SetDrawExtraPaths();
215 gGeoManager->CloseGeometry();
216 gGeoManager->SetNsegments(20);
226 m_phyBeamPipe = gGeoManager->MakePhysicalNode(TString(
"/") + m_Bes->GetName() + TString(
"_1/") + m_BeamPipe->GetName() + TString(
"_4"));
227 m_phyBeamPipe->SetVisibility(0);
228 m_phyBeamPipe->SetIsVolAtt(kFALSE);
229 m_phyBeamPipe->SetLineColor(m_BeamPipeColor);
239 Double_t
P[3*4] = {0.0};
242 Double_t beamPipeCenter[3] = {0.0, 0.0, 0.0};
244 new BesCircle2D(
"BeamPipe",
"BeamPipe", m_BeamPipeRMin, m_BeamPipeRMax, &beamPipeCenter[0]);
246 for (Int_t i = 0; i < 4; i++) {
248 if (i == 0 || i == 3)
P[3*i+1] = -1.0*m_BeamPipeRMax;
249 else P[3*i+1] = m_BeamPipeRMax;
250 if (i == 0 || i == 1)
P[3*i+2] = -1.0*m_BeamPipeZ;
251 else P[3*i+2] = m_BeamPipeZ;
253 m_BeamPipeZR =
new BesPolygon2D(
"BeamPipe",
"BeamPipe", 4, &
P[0]);
257 if (!m_Bes) cout <<
"BesGeometry:InitGeometry, top volume m_Bes not found" << endl;
258 TGeoBBox *besShape = (TGeoBBox*)m_Bes->GetShape();
259 m_BesR = besShape->GetDX();
260 m_BesZ = besShape->GetDZ()*2.0;
261 for (Int_t i = 0; i < 4; i++) {
263 if (i == 0 || i == 3)
P[3*i+1] = -1.0*m_BesR;
264 else P[3*i+1] = m_BesR;
265 if (i == 0 || i == 1)
P[3*i+2] = -1.0*m_BesZ;
266 else P[3*i+2] = m_BesZ;
269 m_ZRPlaneOnXY =
new BesPolygon2D(
"ZRPlaneOnXY",
"ZRPlaneOnXY", 4, &
P[0]);
271 m_ZRPlaneOnXY->SetLineWidth(1);
272 m_ZRPlaneOnXY->SetLineStyle(3);
273 m_ZRPlaneOnXY->SetFillStyle(4000);
283 m_Bes->SetLineColor(2);
284 m_Bes->SetVisibility(0);
286 m_BeamPipe->SetLineColor(m_BeamPipeColor);
287 m_BeamPipe->SetVisibility(0);
309 TString opt = option;
312 if ( opt.Contains(
"3D") ) {
315 else if ( opt.Contains(
"XY") ) {
318 else if ( opt.Contains(
"ZR") ) {
330 m_BeamPipe->AppendPad();
334 else m_phyBeamPipe->SetVisibility(0);
384 if (m_MdcROOTGeo) m_MdcROOTGeo->
Draw(
"XY");
385 if (m_TofROOTGeo) m_TofROOTGeo->
Draw(
"XY");
386 if (m_EmcROOTGeo) m_EmcROOTGeo->
Draw(
"XY");
387 if (m_MucROOTGeo) m_MucROOTGeo->
Draw(
"XY");
400 if (m_MdcROOTGeo) m_MdcROOTGeo->
Draw(
"ZR");
401 if (m_TofROOTGeo) m_TofROOTGeo->
Draw(
"ZR");
402 if (m_EmcROOTGeo) m_EmcROOTGeo->
Draw(
"ZR");
403 if (m_MucROOTGeo) m_MucROOTGeo->
Draw(
"ZR");
BesGeometry * gBesGeometry
ClassImp(BesGeometry) BesGeometry
double P(RecMdcKalTrack *trk)
virtual void Draw(Option_t *option="")
virtual void InitGeometry()
virtual void SetDefaultVis()
const char * GetFilename(const char *RunPeriod)
virtual void InitFromGDML(const TString fPath, bool mrpc=false, bool cgem=false)
virtual void SetPhysicalDefaultVis()
virtual void Draw(Option_t *option="3D")
virtual void InitFromROOT(TGeoVolume *volBes)
void SetRotatable(Bool_t input)
virtual void Draw(Option_t *option="")
EBESViewType GetViewType()
Bool_t GetVisZRPlaneOnXY()
void SetVisEmcDetector()
Set Emc detector visibility;.
void SetVisEmcHits()
Set Emc hits visibility;.
void SetPhysicalDefaultVis()
Set default physical node attributes;.
TGeoVolume * GetVolumeEmc()
Get Emc volume;.
void Draw(Option_t *option)
Draw function.
void InitFromROOT(TGeoVolume *vol)
Initialize ROOTGeo from TGeoVolume logicalEmc.
void InitFromGDML(const char *gdmlFile, const char *setupName)
Initialize ROOTGeo from GDML.
void SetPhysicalNode()
Set the pointers to the physical nodes;.
void Init2DGeometry()
Initialize 2D Geometry.
void InitFromROOT(TGeoVolume *vol)
Initialize ROOTGeo from TGeoVolume logicalMdc.
void Init2DGeometry()
Initialize 2D Geometry.
void Draw(Option_t *option)
Draw function.
void SetVisMdcHits()
Set Mdc hits visibility;.
void SetVisMdcDetector()
Set Mdc default detector visibility;.
void SetPhysicalDefaultVis()
Set default physical node attributes;.
void SetPhysicalNode()
Set the pointers to the physical nodes;.
TGeoVolume * GetVolumeMdc()
Get Mdc volume;.
void InitFromGDML(const char *gdmlFile, const char *setupName)
Initialize ROOTGeo from GDML.
TGeoVolume * GetVolumeMuc()
Get Muc volume;.
void SetPhysicalDefaultVis()
void Draw(Option_t *option)
Draw function.
void SetPhysicalNode()
Set the pointers to the physical nodes;.
void SetVisMucDetector()
Set Muc detector visibility;.
void SetVisMucHits()
Set Muc hits visibility;.
void Init2DGeometry()
Initialize 2D Geometry.
void InitFromGDML(const char *gdmlFile, const char *setupName)
Initialize ROOTGeo from GDML.
void InitFromROOT(TGeoVolume *vol)
Initialize ROOTGeo from TGeoVolume logicalMuc.
void SetChildNo(int childNo)
void InitFromROOT(TGeoVolume *vol)
Initialize ROOTGeo from TGeoVolume logicalTof.
void Draw(Option_t *option)
Draw function.
void SetPhysicalDefaultVis()
void InitFromGDML(const char *gdmlFile, const char *setupName)
Initialize ROOTGeo from GDML.
TGeoVolume * GetVolumeTof()
Get Tof volume;.
void SetVisTofDetector()
Set Tof detector visibility;.
void SetPhysicalNode()
Set the pointers to the physical nodes;.
void Init2DGeometry()
Initialize 2D Geometry.
void SetVisTofHits()
Set Tof hits visibility;.