3#include <TGeoManager.h>
4#include <TGeoMaterial.h>
40 if (!gGeoManager)
new TGeoManager(
"BesGeo",
"BesGeometry");
41 else gGeoManager-> ClearPhysicalNodes();
46 m_BeamPipeRMin = 31.5;
47 m_BeamPipeRMax = 35.8;
65 gGeoManager->SetVisOption(0);
66 gGeoManager->SetVisLevel(5);
68 TGeoIdentity *identity =
new TGeoIdentity();
70 TGeoMaterial *mat =
new TGeoMaterial(
"VOID",0,0,0);
71 mat->SetTransparency(20);
72 TGeoMedium *med =
new TGeoMedium(
"MED",1,mat);
73 m_Bes = gGeoManager->MakeBox(
"volBes", med, m_BesR, m_BesR, 0.5*m_BesZ);
75 TGeoVolume *topVolume =
new TGeoVolume();
76 gGeoManager->SetTopVolume(topVolume);
77 gGeoManager->SetTopVolume(m_Bes);
81 m_MdcROOTGeo->
InitFromGDML( (fPath + TString(
"Mdc.gdml")).Data(),
"Mdc" );
82 cout<<
"in BesGeometry construct mdc1"<<endl;
84 if (m_Mdc) cout <<
"Construct Mdc" << endl;
85 else cout <<
"Volume Mdc not found " << endl;
86 m_Bes->AddNode(m_Mdc, iChildNo, identity);
91 m_TofROOTGeo->
InitFromGDML( (fPath + TString(
"Tof.gdml")).Data(),
"Tof" );
92 cout<<
"construct tof"<<endl;
94 if (m_Tof) cout <<
"Construct Tof" << endl;
95 else cout <<
"Volume Tof not found " << endl;
96 m_Bes->AddNode(m_Tof, iChildNo, identity);
101 m_EmcROOTGeo->
InitFromGDML( (fPath + TString(
"Emc.gdml")).Data(),
"Emc" );
103 if (m_Emc) cout <<
"Construct Emc" << endl;
104 else cout <<
"Volume Emc not found " << endl;
105 m_Bes->AddNode(m_Emc, iChildNo, identity);
110 m_MucROOTGeo->
InitFromGDML( (fPath + TString(
"Muc.gdml")).Data(),
"Muc" );
112 if (m_Muc) cout <<
"Construct Muc" << endl;
113 else cout <<
"Volume Muc not found " << endl;
114 m_Bes->AddNode(m_Muc, iChildNo, identity);
118 Int_t beamPipeColor = 3;
119 m_BeamPipe = gGeoManager->MakeTube(
"volBeamPipe", med, m_BeamPipeRMin, m_BeamPipeRMax, m_BeamPipeZ);
120 m_BeamPipe->SetLineColor(beamPipeColor);
121 m_Bes->AddNode(m_BeamPipe, iChildNo, identity);
123 Int_t nDaughters = m_Bes->GetNodes()->GetEntries();
124 cout <<
"volBes contains " << nDaughters <<
" nodes : " << endl;
125 for (Int_t i = 0; i < nDaughters; i++) {
126 cout << i <<
" : " << m_Bes->GetNode(i)->GetName() << endl;
134 gGeoManager->SetVisOption(0);
135 gGeoManager->SetVisLevel(5);
138 m_BesR = ((TGeoBBox*)m_Bes->GetShape())->GetDX();
139 m_BesZ = ((TGeoBBox*)m_Bes->GetShape())->GetDZ()*2.0;
141 TGeoVolume *topVolume =
new TGeoVolume();
142 gGeoManager->SetTopVolume(topVolume);
143 gGeoManager->SetTopVolume(m_Bes);
145 Int_t nDaughters = m_Bes->GetNodes()->GetEntries();
154 TGeoNode *nodeMdc = m_Bes->GetNode(iChildNo);
155 if (nodeMdc) m_Mdc = nodeMdc->GetVolume();
164 TGeoNode *nodeTof = m_Bes->GetNode(iChildNo);
165 if (nodeTof) m_Tof = nodeTof->GetVolume();
174 TGeoNode *nodeEmc = m_Bes->GetNode(iChildNo);
175 if (nodeEmc) m_Emc = nodeEmc->GetVolume();
184 TGeoNode *nodeMuc = m_Bes->GetNode(iChildNo);
185 if (nodeMuc) m_Muc = nodeMuc->GetVolume();
193 TGeoNode *nodeBeamPipe = m_Bes->GetNode(iChildNo);
195 m_BeamPipe = nodeBeamPipe->GetVolume();
196 m_BeamPipe->SetLineColor(4);
206 gGeoManager->SetDrawExtraPaths();
207 gGeoManager->CloseGeometry();
208 gGeoManager->SetNsegments(20);
223 Double_t
P[3*4] = {0.0};
226 Double_t beamPipeCenter[3] = {0.0, 0.0, 0.0};
228 new BesCircle2D(
"BeamPipe",
"BeamPipe", m_BeamPipeRMin, m_BeamPipeRMax, &beamPipeCenter[0]);
230 for (Int_t i = 0; i < 4; i++) {
232 if (i == 0 || i == 3)
P[3*i+1] = -1.0*m_BeamPipeRMax;
233 else P[3*i+1] = m_BeamPipeRMax;
234 if (i == 0 || i == 1)
P[3*i+2] = -1.0*m_BeamPipeZ;
235 else P[3*i+2] = m_BeamPipeZ;
237 m_BeamPipeZR =
new BesPolygon2D(
"BeamPipe",
"BeamPipe", 4, &
P[0]);
240 if (!m_Bes) cout <<
"BesGeometry:InitGeometry, top volume m_Bes not found" << endl;
241 TGeoBBox *besShape = (TGeoBBox*)m_Bes->GetShape();
242 m_BesR = besShape->GetDX();
243 m_BesZ = besShape->GetDZ()*2.0;
244 for (Int_t i = 0; i < 4; i++) {
246 if (i == 0 || i == 3)
P[3*i+1] = -1.0*m_BesR;
247 else P[3*i+1] = m_BesR;
248 if (i == 0 || i == 1)
P[3*i+2] = -1.0*m_BesZ;
249 else P[3*i+2] = m_BesZ;
252 m_ZRPlaneOnXY =
new BesPolygon2D(
"ZRPlaneOnXY",
"ZRPlaneOnXY", 4, &
P[0]);
254 m_ZRPlaneOnXY->SetLineWidth(1);
255 m_ZRPlaneOnXY->SetLineStyle(3);
256 m_ZRPlaneOnXY->SetFillStyle(4000);
266 m_Bes->SetLineColor(2);
267 m_Bes->SetVisibility(0);
269 m_BeamPipe->SetLineColor(4);
270 m_BeamPipe->SetVisibility(0);
283 TString opt = option;
286 if ( opt.Contains(
"3D") ) {
289 else if ( opt.Contains(
"XY") ) {
292 else if ( opt.Contains(
"ZR") ) {
346 if (m_MdcROOTGeo) m_MdcROOTGeo->
Draw(
"XY");
347 if (m_TofROOTGeo) m_TofROOTGeo->
Draw(
"XY");
348 if (m_EmcROOTGeo) m_EmcROOTGeo->
Draw(
"XY");
349 if (m_MucROOTGeo) m_MucROOTGeo->
Draw(
"XY");
361 if (m_MdcROOTGeo) m_MdcROOTGeo->
Draw(
"ZR");
362 if (m_TofROOTGeo) m_TofROOTGeo->
Draw(
"ZR");
363 if (m_EmcROOTGeo) m_EmcROOTGeo->
Draw(
"ZR");
364 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)
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;.
TGeoVolume * GetVolumeEmc()
Get Emc volume;.
void Draw(Option_t *option)
Draw function.
void InitFromROOT(TGeoVolume *vol)
Initialize ROOTGeo from TGeoVolume logicalEmc.
void SetAllVisible()
Set all visible;.
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 SetPhysicalNode()
Set the pointers to the physical nodes;.
void SetAllVisible()
Set all visible;.
TGeoVolume * GetVolumeMdc()
Get Mdc volume;.
void InitFromGDML(const char *gdmlFile, const char *setupName)
Initialize ROOTGeo from GDML.
TGeoVolume * GetVolumeMuc()
Get Muc volume;.
void Draw(Option_t *option)
Draw function.
void SetPhysicalNode()
Set the pointers to the physical nodes;.
void SetVisMucDetector()
Set Muc detector visibility;.
void SetAllVisible()
Set all visible;.
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 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;.
void SetAllVisible()
Set all visible;.