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"
42 if (!gGeoManager)
new TGeoManager(
"BesGeo",
"BesGeometry");
43 else gGeoManager-> ClearPhysicalNodes();
48 m_BeamPipeRMin = 31.5;
49 m_BeamPipeRMax = 35.8;
51 m_BeamPipeColor = 922;
69 gGeoManager->SetVisOption(0);
70 gGeoManager->SetVisLevel(5);
72 TGeoIdentity *identity =
new TGeoIdentity();
74 TGeoMaterial *mat =
new TGeoMaterial(
"VOID",0,0,0);
75 mat->SetTransparency(20);
76 TGeoMedium *med =
new TGeoMedium(
"MED",1,mat);
77 m_Bes = gGeoManager->MakeBox(
"volBes", med, m_BesR, m_BesR, 0.5*m_BesZ);
79 TGeoVolume *topVolume =
new TGeoVolume();
80 gGeoManager->SetTopVolume(topVolume);
81 gGeoManager->SetTopVolume(m_Bes);
87 m_CgemROOTGeo->
InitFromGDML((fPath + TString(
"Cgem.gdml")).Data(),
"Default");
93 m_MdcROOTGeo->
InitFromGDML( (fPath + TString(
"Mdc.gdml")).Data(),
"Default" );
94 cout<<
"in BesGeometry construct mdc1"<<endl;
96 if (m_Mdc) cout <<
"Construct Mdc" << endl;
97 else cout <<
"Volume Mdc not found " << endl;
98 m_Bes->AddNode(m_Mdc, iChildNo, identity);
106 m_TofROOTGeo->
InitFromGDML( (fPath + TString(
"Tof_mrpc.gdml")).Data(),
"Default" );
108 m_TofROOTGeo->
InitFromGDML( (fPath + TString(
"Tof.gdml")).Data(),
"Default" );
110 cout<<
"construct tof"<<endl;
112 if (m_Tof) cout <<
"Construct Tof" << endl;
113 else cout <<
"Volume Tof not found " << endl;
114 m_Bes->AddNode(m_Tof, iChildNo, identity);
119 m_EmcROOTGeo->
InitFromGDML( (fPath + TString(
"Emc.gdml")).Data(),
"Default" );
121 if (m_Emc) cout <<
"Construct Emc" << endl;
122 else cout <<
"Volume Emc not found " << endl;
123 m_Bes->AddNode(m_Emc, iChildNo, identity);
128 m_MucROOTGeo->
InitFromGDML( (fPath + TString(
"Muc.gdml")).Data(),
"Default" );
130 if (m_Muc) cout <<
"Construct Muc" << endl;
131 else cout <<
"Volume Muc not found " << endl;
132 m_Bes->AddNode(m_Muc, iChildNo, identity);
136 Int_t beamPipeColor = m_BeamPipeColor;
137 m_BeamPipe = gGeoManager->MakeTube(
"volBeamPipe", med, m_BeamPipeRMin, m_BeamPipeRMax, m_BeamPipeZ);
138 m_BeamPipe->SetLineColor(beamPipeColor);
139 m_Bes->AddNode(m_BeamPipe, iChildNo, identity);
145 m_Bes->AddNode(m_Cgem, iChildNo, identity);
149 delete m_CgemROOTGeo;
153 Int_t nDaughters = m_Bes->GetNodes()->GetEntries();
154 cout <<
"volBes contains " << nDaughters <<
" nodes : " << endl;
155 for (Int_t i = 0; i < nDaughters; i++) {
156 cout << i <<
" : " << m_Bes->GetNode(i)->GetName() << endl;
164 gGeoManager->SetVisOption(0);
165 gGeoManager->SetVisLevel(5);
168 m_BesR = ((TGeoBBox*)m_Bes->GetShape())->GetDX();
169 m_BesZ = ((TGeoBBox*)m_Bes->GetShape())->GetDZ()*2.0;
171 TGeoVolume *topVolume =
new TGeoVolume();
172 gGeoManager->SetTopVolume(topVolume);
173 gGeoManager->SetTopVolume(m_Bes);
175 Int_t nDaughters = m_Bes->GetNodes()->GetEntries();
183 TGeoNode* nodeCgem = m_Bes->GetNode(5);
187 m_Cgem = nodeCgem->GetVolume();
192 m_MdcROOTGeo =
new MdcROOTGeo(Bool_t(nodeCgem));
193 TGeoNode *nodeMdc = m_Bes->GetNode(iChildNo);
194 if (nodeMdc) m_Mdc = nodeMdc->GetVolume();
203 TGeoNode *nodeTof = m_Bes->GetNode(iChildNo);
204 if (nodeTof) m_Tof = nodeTof->GetVolume();
213 TGeoNode *nodeEmc = m_Bes->GetNode(iChildNo);
214 if (nodeEmc) m_Emc = nodeEmc->GetVolume();
223 TGeoNode *nodeMuc = m_Bes->GetNode(iChildNo);
224 if (nodeMuc) m_Muc = nodeMuc->GetVolume();
232 TGeoNode *nodeBeamPipe = m_Bes->GetNode(iChildNo);
234 m_BeamPipe = nodeBeamPipe->GetVolume();
235 m_BeamPipe->SetLineColor(m_BeamPipeColor);
246 gGeoManager->SetDrawExtraPaths();
247 gGeoManager->CloseGeometry();
248 gGeoManager->SetNsegments(20);
259 m_phyBeamPipe = gGeoManager->MakePhysicalNode(TString(
"/") + m_Bes->GetName() + TString(
"_1/") + m_BeamPipe->GetName() + TString(
"_4"));
260 m_phyBeamPipe->SetVisibility(0);
261 m_phyBeamPipe->SetIsVolAtt(kFALSE);
262 m_phyBeamPipe->SetLineColor(m_BeamPipeColor);
273 Double_t
P[3*4] = {0.0};
276 Double_t beamPipeCenter[3] = {0.0, 0.0, 0.0};
278 new BesCircle2D(
"BeamPipe",
"BeamPipe", m_BeamPipeRMin, m_BeamPipeRMax, &beamPipeCenter[0]);
280 for (Int_t i = 0; i < 4; i++) {
282 if (i == 0 || i == 3)
P[3*i+1] = -1.0*m_BeamPipeRMax;
283 else P[3*i+1] = m_BeamPipeRMax;
284 if (i == 0 || i == 1)
P[3*i+2] = -1.0*m_BeamPipeZ;
285 else P[3*i+2] = m_BeamPipeZ;
287 m_BeamPipeZR =
new BesPolygon2D(
"BeamPipe",
"BeamPipe", 4, &
P[0]);
291 if (!m_Bes) cout <<
"BesGeometry:InitGeometry, top volume m_Bes not found" << endl;
292 TGeoBBox *besShape = (TGeoBBox*)m_Bes->GetShape();
293 m_BesR = besShape->GetDX();
294 m_BesZ = besShape->GetDZ()*2.0;
295 for (Int_t i = 0; i < 4; i++) {
297 if (i == 0 || i == 3)
P[3*i+1] = -1.0*m_BesR;
298 else P[3*i+1] = m_BesR;
299 if (i == 0 || i == 1)
P[3*i+2] = -1.0*m_BesZ;
300 else P[3*i+2] = m_BesZ;
303 m_ZRPlaneOnXY =
new BesPolygon2D(
"ZRPlaneOnXY",
"ZRPlaneOnXY", 4, &
P[0]);
305 m_ZRPlaneOnXY->SetLineWidth(1);
306 m_ZRPlaneOnXY->SetLineStyle(3);
307 m_ZRPlaneOnXY->SetFillStyle(4000);
317 m_Bes->SetLineColor(2);
318 m_Bes->SetVisibility(0);
320 m_BeamPipe->SetLineColor(m_BeamPipeColor);
321 m_BeamPipe->SetVisibility(0);
345 TString opt = option;
348 if ( opt.Contains(
"3D") ) {
351 else if ( opt.Contains(
"XY") ) {
354 else if ( opt.Contains(
"ZR") ) {
366 m_BeamPipe->AppendPad();
370 else m_phyBeamPipe->SetVisibility(0);
427 if (m_MdcROOTGeo) m_MdcROOTGeo->
Draw(
"XY");
428 if (m_TofROOTGeo) m_TofROOTGeo->
Draw(
"XY");
429 if (m_EmcROOTGeo) m_EmcROOTGeo->
Draw(
"XY");
430 if (m_MucROOTGeo) m_MucROOTGeo->
Draw(
"XY");
431 if (m_CgemROOTGeo) m_CgemROOTGeo->
Draw(
"XY");
444 if (m_CgemROOTGeo) m_CgemROOTGeo->
Draw(
"ZR");
445 if (m_MdcROOTGeo) m_MdcROOTGeo->
Draw(
"ZR");
446 if (m_TofROOTGeo) m_TofROOTGeo->
Draw(
"ZR");
447 if (m_EmcROOTGeo) m_EmcROOTGeo->
Draw(
"ZR");
448 if (m_MucROOTGeo) m_MucROOTGeo->
Draw(
"ZR");
458 if (view && m_CgemROOTGeo)
460 m_CgemROOTGeo->
DrawUF(layer);
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 DrawCgemUF(int layer)
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 InitFromROOT(TGeoVolume *vol)
TGeoVolume * GetVolumeCgem() const
void SetPhysicalDefaultVis()
void Draw(Option_t *option)
void DrawUF(int layer, Option_t *option="")
void InitFromGDML(const char *gdmlFile, const char *setupName)
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;.