21#include <TGeoManager.h>
22#include <TGeoBoolNode.h>
33const int MucROOTGeo::m_kSeg[m_kPart] = {4, 8, 4};
34const int MucROOTGeo::m_kAbsorber[m_kPart] = {9, 9, 9};
35const int MucROOTGeo::m_kGap[m_kPart] = {8, 9, 8};
36const int MucROOTGeo::m_kPanel[m_kPart] = {3, 4, 3};
37const int MucROOTGeo::m_kBakelitePanel[m_kPart][m_kUpDown]= {3, 5, 4, 4, 3, 5};
43 for (
int part = 0; part < m_kPart; part++) {
44 for (
int seg = 0; seg < m_kSegMax; seg++) {
45 m_MucXY[part][seg] = 0;
46 m_MucZR[part][seg] = 0;
48 for (
int gap = 0; gap < m_kGapMax; gap++) {
49 m_NodeGap[part][seg][gap] = 0;
50 m_PhysicalGap[part][seg][gap] = 0;
51 m_MucXYGap[part][seg][gap] = 0;
52 m_MucZRGap[part][seg][gap] = 0;
54 for (
int strip = 0; strip < m_kStripMax; strip++) {
55 m_NodeStrip[part][seg][gap][strip] = 0;
56 m_PhysicalStrip[part][seg][gap][strip] = 0;
60 for (
int absorber = 0; absorber < m_kAbsorberMax; absorber++) {
61 m_NodeAbsorber[part][seg][absorber] = 0;
62 for (
int panel = 0; panel < m_kPanelMax; panel++) {
63 m_NodeAbsorberPanel[part][seg][absorber][panel] = 0;
64 m_PhysicalAbsorber[part][seg][absorber][panel] = 0;
73 m_gasChamberColor = 8;
103 cout <<
"MucROOTGeo::Init2DGeometry, ROOT Geometry not Initialized yet!" << endl;
108 Int_t mucColor = 1002;
109 Int_t mucLineColor = 15;
110 Int_t mucXYStyle = 1001;
111 Int_t mucZRStyle = 1001;
113 Int_t mucGapColor = 10;
114 Int_t mucGapStyle = 1001;
115 Int_t mucGapXYECStyle = 4000;
116 Int_t mucGapLineColor = 15;
118 Double_t
x = 0.0, y = 0.0, z = 0.0;
119 Double_t r = 0.0, phi = 0.0;
120 Double_t local[3] = {0.0, 0.0, 0.0};
121 Double_t master[3] = {0.0, 0.0, 0.0};
123 Double_t
P[300] = {0.0};
127 Int_t part = 0, seg = 0, gap = 0, strip = 0;
131 TGeoCompositeShape *mucShape = (TGeoCompositeShape*)
GetVolumeMuc()->GetShape();
134 TGeoBoolNode *mucBoolNode = mucShape->GetBoolNode();
135 TGeoBBox *mucOuterShape = (TGeoBBox*)mucBoolNode->GetLeftShape();
136 TGeoTube *mucInnerShape = (TGeoTube*)mucBoolNode->GetRightShape();
141 Double_t mucOuterR = mucOuterShape->GetDX();
142 Double_t mucInnerR = mucInnerShape->GetRmax() + 40.0;
148 Int_t xySegPointSeq[4] = {0,1,1,0};
149 for (seg = 0; seg <
GetSegNb(part); seg++) {
150 name = TString(
"MucBarrelSeg");
152 for (Int_t iPoint = 0; iPoint < 4; iPoint++) {
153 if (iPoint < 2) r = mucInnerR/TMath::Cos(TMath::Pi()/8.0);
154 else r = mucOuterR/TMath::Cos(TMath::Pi()/8.0);
155 phi = TMath::Pi()/8.0 * (2*seg-1 + 2*xySegPointSeq[iPoint]);
156 x = r * TMath::Cos(phi);
157 y = r * TMath::Sin(phi);
164 m_MucXY[part][seg]->SetFillColor(mucColor);
165 m_MucXY[part][seg]->SetFillStyle(mucXYStyle);
166 m_MucXY[part][seg]->SetLineColor(mucLineColor);
172 for (seg = 0; seg <
GetSegNb(part); seg++) {
173 for (Int_t iPoint = 0; iPoint < 4; iPoint++) {
174 if (iPoint == 0 || iPoint == 3 ) r = mucInnerR;
176 phi = TMath::Pi()/4.0 * seg;
178 x = r * TMath::Cos(phi);
179 y = r * TMath::Sin(phi);
181 TGeoVolume *volAbsorber = 0;
182 volAbsorber=
GetAbsorber(part, seg, 0)->GetVolume();
183 TGeoBBox *absorberShape = (TGeoBBox*)volAbsorber->GetShape();
184 if (seg == 2)cout<<
"in MucROOTGeo::Init2DGeometry() x,y,z = "<<absorberShape->GetDX()<<
" "<<absorberShape->GetDY()<<
" "<<absorberShape->GetDZ()<<endl;
185 Double_t dy = absorberShape->GetDY();
187 if (iPoint < 2) z = -dy;
194 if (seg == 2 || seg == 6) {
195 if (seg == 2) name = TString(
"MucBarrelUpSeg");
196 if (seg == 6) name = TString(
"MucBarrelDownSeg");
199 m_MucZR[part][seg]->SetFillColor(mucColor);
200 m_MucZR[part][seg]->SetFillStyle(mucZRStyle);
201 m_MucZR[part][seg]->SetLineColor(mucLineColor);
208 for (seg = 0; seg <
GetSegNb(part); seg++) {
209 for (gap = 0; gap <
GetGapNb(part); gap++) {
211 TGeoPhysicalNode *phyNode = 0;
214 TGeoBBox *gapShape = (TGeoBBox*)phyNode->GetShape();
215 Double_t dx = gapShape->GetDX();
216 Double_t dy = gapShape->GetDY();
217 Double_t dz = gapShape->GetDZ();
220 for (Int_t i = 0; i < 4; i++) {
240 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
241 for (Int_t j = 0; j < 3; j++)
P[3*i+j] = master[j];
244 name = TString(
"MucBarrelSeg");
246 name += TString(
"Gap");
249 m_MucXYGap[part][seg][gap] =
new BesPolygon2D(name, name, 4, &
P[0]);
250 m_MucXYGap[part][seg][gap]->SetFillColor(mucGapColor);
251 m_MucXYGap[part][seg][gap]->SetFillStyle(mucGapStyle);
252 m_MucXYGap[part][seg][gap]->SetLineColor(mucGapLineColor);
255 for (Int_t i = 0; i < 4; i++) {
275 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
276 for (Int_t j = 0; j < 3; j++)
P[3*i+j] = master[j];
279 if (seg == 2 || seg == 6) {
281 name = TString(
"MucBarrelUpSegGap");
285 name = TString(
"MucBarrelDownSegGap");
289 m_MucZRGap[part][seg][gap] =
new BesPolygon2D(name, name, 4, &
P[0]);
290 m_MucZRGap[part][seg][gap]->SetFillColor(mucGapColor);
291 m_MucZRGap[part][seg][gap]->SetFillStyle(mucGapStyle);
292 m_MucZRGap[part][seg][gap]->SetLineColor(mucGapLineColor);
297 for (part = 0; part <
GetPartNb(); part++) {
298 if (part == 1)
continue;
299 for (seg = 0; seg <
GetSegNb(part); seg++) {
303 for (gap = 0; gap <
GetGapNb(part); gap++) {
304 TGeoPhysicalNode *phyNode = 0;
307 Int_t ixyPoint = 0, izrPoint = 0;
311 TGeoCompositeShape *addPanelShape[4];
312 TGeoTrap *panelShape[4];
315 for (Int_t panel = nPanel-1; panel >= 0; panel--) {
316 if (panel == nPanel-1) addPanelShape[panel] = (TGeoCompositeShape*)
GetGap(part, seg, gap)->GetVolume()->GetShape();
317 else addPanelShape[panel] = (TGeoCompositeShape*)addPanelShape[panel+1]->GetBoolNode()->GetLeftShape();
319 panelShape[panel] = (TGeoTrap*)addPanelShape[panel]->GetBoolNode()->GetRightShape();
321 Double_t *localArb8Point, masterArb8Point[3*8];
322 localArb8Point = panelShape[panel]->GetVertices();
323 for (Int_t i = 0; i < 8; i++) {
324 local[0] = localArb8Point[2*i];
325 local[1] = localArb8Point[2*i+1];
326 if (i < 4) local[2] = panelShape[panel]->GetDz() * (-1.0);
327 else local[2] = panelShape[panel]->GetDz();
329 addPanelShape[panel]->GetBoolNode()->GetRightMatrix()->LocalToMaster(local, &master[0]);
331 for (Int_t j = 0; j < 3; j++) local[j] = master[j];
332 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
333 for (Int_t j = 0; j < 3; j++) {
334 masterArb8Point[3*i+j] = master[j];
340 Int_t xyPanelPointSeq[4] = {0, 3, 7, 4};
341 for (Int_t i = 0; i < 4; i++) {
342 for (Int_t j = 0; j < 3; j++) {
343 P[3*ixyPoint+j] = masterArb8Point[3*xyPanelPointSeq[i]+j];
349 Int_t xyPanelPointSeq[4] = {7, 4, 0, 3};
350 for (Int_t i = 0; i < 4; i++) {
351 for (Int_t j = 0; j < 3; j++) {
352 P[3*ixyPoint+j] = masterArb8Point[3*xyPanelPointSeq[i]+j];
360 Int_t zrPanelPointSeq[4] = {4, 7, 6, 5};
361 for (Int_t i = 0; i < 4; i++) {
362 for (Int_t j = 0; j < 3; j++) {
363 P[100+3*izrPoint+j] = masterArb8Point[3*zrPanelPointSeq[i]+j];
369 Int_t zrPanelPointSeq[4] = {6, 5, 4, 7};
370 for (Int_t i = 0; i < 4; i++) {
371 for (Int_t j = 0; j < 3; j++) {
372 P[100+3*izrPoint+j] = masterArb8Point[3*zrPanelPointSeq[i]+j];
379 if (part == 0) name = TString(
"MucEastEc");
380 else if (part == 2) name = TString(
"MucWestEc");
381 name += TString(
"Seg");
383 name += TString(
"Gap");
387 m_MucXYGap[part][seg][gap] =
new BesPolygon2D(name, name, ixyPoint, &
P[0]);
388 m_MucXYGap[part][seg][gap]->SetFillColor(mucGapColor);
389 m_MucXYGap[part][seg][gap]->SetFillStyle(mucGapXYECStyle);
390 m_MucXYGap[part][seg][gap]->SetLineColor(mucGapLineColor);
392 m_MucZRGap[part][seg][gap] =
new BesPolygon2D(name, name, izrPoint, &
P[100]);
393 m_MucZRGap[part][seg][gap]->SetFillColor(mucGapColor);
394 m_MucZRGap[part][seg][gap]->SetFillStyle(mucGapStyle);
395 m_MucZRGap[part][seg][gap]->SetLineColor(mucGapLineColor);
400 Double_t zrFirstAbsorberHeight = ((TGeoBBox*)
GetAbsorber(part, seg, 0)->GetVolume()->GetShape())->GetDZ()*2.0;
401 for (Int_t i = 0; i < 4; i++) {
402 for (Int_t j = 0; j < 3; j++) {
403 if ( (part == 0 && (seg == 0 || seg == 2)) || (part == 2 && (seg == 1 || seg == 3)) ) {
404 Int_t zrSegPointSeq[4] = {6, 7, 0, 1};
405 segP[3*iSegPoint+j] =
P[100+3*zrSegPointSeq[i]+j];
408 Int_t zrSegPointSeq[4] = {5, 4, 3, 2};
409 segP[3*iSegPoint+j] =
P[100+3*zrSegPointSeq[i]+j];
413 if (part == 0) segP[3*iSegPoint+j] -= zrFirstAbsorberHeight;
414 else if (part == 2) segP[3*iSegPoint+j] += zrFirstAbsorberHeight;
421 Double_t zrLastAbsorberHeight = ((TGeoBBox*)
GetAbsorber(part, seg, 8)->GetVolume()->GetShape())->GetDZ()*2.0;
422 for (Int_t i = 0; i < 4; i++) {
423 for (Int_t j = 0; j < 3; j++) {
424 if ( (part == 0 && (seg == 0 || seg == 2)) || (part == 2 && (seg == 1 || seg == 3)) ){
425 Int_t zrSegPointSeq[4] = {2, 3, 4, 5};
426 segP[3*iSegPoint+j] =
P[100+3*zrSegPointSeq[i]+j];
429 Int_t zrSegPointSeq[4] = {1, 0, 7, 6};
430 segP[3*iSegPoint+j] =
P[100+3*zrSegPointSeq[i]+j];
434 if (part == 0) segP[3*iSegPoint+j] += zrLastAbsorberHeight;
435 else if (part == 2) segP[3*iSegPoint+j] -= zrLastAbsorberHeight;
443 if (part == 0) name = TString(
"MucEastEc");
444 else if (part == 2) name = TString(
"MucWestEc");
445 name += TString(
"Seg");
447 m_MucZR[part][seg] =
new BesPolygon2D(name, name, iSegPoint, &segP[0]);
448 m_MucZR[part][seg]->SetFillColor(mucColor);
449 m_MucZR[part][seg]->SetFillStyle(mucZRStyle);
450 m_MucZR[part][seg]->SetLineColor(mucLineColor);
454 for (part = 0; part <
GetPartNb(); part++) {
455 for (seg = 0; seg <
GetSegNb(part); seg++) {
456 for (gap = 0; gap <
GetGapNb(part); gap++) {
457 for (strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
458 TGeoPhysicalNode *phyNode = 0;
460 TGeoBBox *stripShape = (TGeoBBox*)phyNode->GetShape();
461 Double_t dx = stripShape->GetDX();
462 Double_t dy = stripShape->GetDY();
463 Double_t dz = stripShape->GetDZ();
464 dz *= m_kStripZMuliple;
466 for (Int_t i = 0; i < 8; i++) {
510 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
511 for (Int_t j = 0; j < 3; j++)
P[3*i+j] = master[j];
514 name = TString(
"Muc Part");
516 name += TString(
" Seg");
518 name += TString(
" Gap");
520 name += TString(
" Strip");
523 m_Muc2DStrip[part][seg][gap][strip] =
new Muc2DStrip(name, name, 8, &
P[0], part, seg, gap, strip);
536 if (!m_Muc) std::cout <<
"m_Muc = 0" << std::endl;
539 for (
int part = 0; part <
GetPartNb(); part++) {
540 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
541 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
544 std::stringstream osnameGap;
545 osnameGap <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"G" << gap <<
"_" << gapCount;
546 m_NodeGap[part][seg][gap] =
GetNode( osnameGap.str() );
550 if (part==1&&seg==2) segment = 2;
551 std::stringstream osnameStripPlane;
552 osnameStripPlane <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"SP" <<
"_" <<
"0";
553 m_NodeStripPlane[part][seg][gap] =
GetNode( osnameStripPlane.str() );
554 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
555 std::stringstream osnameStrip;
557 osnameStrip <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" <<
"00" << strip <<
"_" << strip;
559 else if (strip < 100) {
560 osnameStrip <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" <<
"0" << strip <<
"_" << strip;
563 osnameStrip <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" << strip <<
"_" << strip;
566 m_NodeStrip[part][seg][gap][strip] =
GetNode( osnameStrip.str() );
572 int absorberCount = gapCount;
573 for (
int part = 0; part <
GetPartNb(); part++) {
574 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
575 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
576 std::stringstream osnameAbsorber;
577 osnameAbsorber <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"Ab" << absorber <<
"_" << absorberCount;
578 m_NodeAbsorber[part][seg][absorber] =
GetNode( osnameAbsorber.str() );
593 for (
int part = 0; part <
GetPartNb(); part++) {
594 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
595 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
596 m_NodeGap[part][seg][gap] = m_Muc->GetNode(gapCount);
599 m_NodeStripPlane[part][seg][gap] =
GetGap(part, seg, gap)->GetDaughter(0)->GetDaughter(0);
600 m_StripNum[part][seg][gap] =
GetStripPlane(part, seg, gap)->GetNdaughters();
602 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
603 m_NodeStrip[part][seg][gap][strip] =
GetStripPlane(part, seg, gap)->GetVolume()->GetNode(strip);
609 int absorberCount = gapCount;
610 for (
int part = 0; part <
GetPartNb(); part++) {
611 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
612 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
613 m_NodeAbsorber[part][seg][absorber] = m_Muc->GetNode( absorberCount );
631 m_Muc->SetLineColor(m_MucColor);
632 m_Muc->SetVisibility(0);
634 for (
int part = 0; part <
GetPartNb(); part++) {
635 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
636 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
647 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
655 for (
int sb = 0; sb < m_kSmallBlockMax; sb++){
664 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
665 GetVolumeStrip(part, seg, gap, strip)->SetLineColor(m_stripColor);
669 for (
int up = 0; up < 2; up ++){
673 if (part == 1 && seg == 2)seg_shift = 1;
674 for (
int panel = 0; panel < m_kPanel[part] + seg_shift; panel++) {
682 for (
int panel = 0; panel < m_kBakelitePanel[part][up] + seg_shift; panel++) {
683 for (
int bakelite = 0; bakelite < m_kBakelite; bakelite++) {
684 GetVolumeBakelite(part, seg, gap, up, panel, bakelite)->SetLineColor(m_bakeliteColor);
704 for (
int part = 0; part <
GetPartNb(); part++) {
705 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
706 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
707 GetGap(part, seg, gap)->SetVisibility(0);
708 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
709 GetStrip(part, seg, gap, strip)->SetVisibility(0);
720 m_Muc->SetLineColor(m_MucColor);
721 m_Muc->SetVisibility(0);
723 for (
int part = 0; part <
GetPartNb(); part++) {
724 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
725 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
736 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
740 GetVolumeBox(part, seg, gap)->SetLineColor(m_stripColor);
744 for (
int sb = 0; sb < m_kSmallBlockMax; sb++){
753 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
754 GetVolumeStrip(part, seg, gap, strip)->SetLineColor(m_stripColor);
758 for (
int up = 0; up < 2; up ++){
762 if (part == 1 && seg == 2)seg_shift = 1;
763 for (
int panel = 0; panel < m_kPanel[part] + seg_shift; panel++) {
770 for (
int panel = 0; panel < m_kBakelitePanel[part][up] + seg_shift; panel++) {
771 for (
int bakelite = 0; bakelite < m_kBakelite; bakelite++) {
772 GetVolumeBakelite(part, seg, gap, up, panel, bakelite)->SetLineColor(m_bakeliteColor);
794 for (
int part = 0; part <
GetPartNb(); part++) {
795 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
796 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
797 GetGap(part, seg, gap)->SetVisibility(0);
798 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
799 GetStrip(part, seg, gap, strip)->SetVisibility(0);
811 for (
int part = 0; part < m_kPart; part++) {
812 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
813 for (
int absorber = 0; absorber < m_kAbsorber[part]; absorber++) {
819 for (
int panel = 0; panel < m_kPanel[part]; panel++) {
825 for (
int gap = 0; gap < m_kGap[part]; gap++) {
826 if (part == 1 && seg > 2) {
828 GetGap(part, seg, gap)->SetVisibility(1);
832 GetGap(part, seg, gap)->SetVisibility(0);
834 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
854 for (
int part = 0; part < m_kPart; part++) {
855 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
856 for (
int absorber = 0; absorber < m_kAbsorber[part]; absorber++) {
858 if (seg < 3 || seg > 5)
GetVolumeAbsorber(part, seg, absorber)->SetVisibility(1);
862 for (
int panel = 0; panel < m_kPanel[part]; panel++) {
868 for (
int gap = 0; gap < m_kGap[part]; gap++) {
869 if (part == 1 && (seg < 3 || seg > 5)) {
871 GetGap(part, seg, gap)->SetVisibility(1);
875 GetGap(part, seg, gap)->SetVisibility(0);
877 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
898 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
899 for (
int absorber = 0; absorber < m_kAbsorber[part]; absorber++) {
903 for (
int gap = 0; gap < m_kGap[part]; gap++) {
905 GetGap(part, seg, gap)->SetVisibility(1);
914 if (gGeoManager == 0) std::cout <<
"Create gGeoManager first" << std::endl;
915 TGeoNode *
bes = gGeoManager->GetTopNode();
916 TGeoNode *muc =
bes->GetDaughter(3);
918 for (
int part = 0; part <
GetPartNb(); part++) {
919 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
920 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
921 TGeoNode *nodeGap =
GetGap(part, seg, gap);
922 m_PhysicalGap[part][seg][gap] = gGeoManager->MakePhysicalNode( TString(
"/") +
bes->GetName() +
923 TString(
"/") + muc->GetName() +
924 TString(
"/") + nodeGap->GetName() +
925 TString(
"/") + nodeGap->GetDaughter(0)->GetName());
927 m_PhysicalGap[part][seg][gap]->SetVisibility(0);
928 m_PhysicalGap[part][seg][gap]->SetIsVolAtt(kFALSE);
929 m_PhysicalGap[part][seg][gap]->SetLineColor(m_gapColor);
933 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
934 TGeoNode *nodeStrip =
GetStrip(part, seg, gap, strip);
935 m_PhysicalStrip[part][seg][gap][strip] = gGeoManager->MakePhysicalNode( TString(
"/") +
bes->GetName() +
936 TString(
"/") + muc->GetName() +
937 TString(
"/") + nodeGap->GetName() +
938 TString(
"/") + nodeGap->GetDaughter(0)->GetName() +
939 TString(
"/") + nodeStripPlane->GetName() +
940 TString(
"/") + nodeStrip->GetName() );
941 m_PhysicalStrip[part][seg][gap][strip]->SetVisibility(0);
942 m_PhysicalStrip[part][seg][gap][strip]->SetIsVolAtt(kFALSE);
943 m_PhysicalStrip[part][seg][gap][strip]->SetLineColor(m_stripColor);
949 for (
int part = 0; part <
GetPartNb(); part++) {
950 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
951 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
952 TGeoNode *nodeAbsorber =
GetAbsorber(part, seg, absorber);
954 m_PhysicalAbsorber[part][seg][absorber][0] = gGeoManager->MakePhysicalNode( TString(
"/") +
bes->GetName() +
955 TString(
"/") + muc->GetName() +
956 TString(
"/") + nodeAbsorber->GetName() );
957 m_PhysicalAbsorber[part][seg][absorber][0]->SetVisibility(0);
958 m_PhysicalAbsorber[part][seg][absorber][0]->SetIsVolAtt(kFALSE);
959 m_PhysicalAbsorber[part][seg][absorber][0]->SetLineColor(m_absorberColor);
984 if (gPad) view = (
BesView*)gPad->GetView();
987 for (
int part = 0; part <
GetPartNb(); part++) {
988 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
989 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
990 TGeoPhysicalNode *phyNode = 0;
993 phyNode->SetVisibility(0);
994 if ( (part == 1 && seg <= 8) ||
995 (part == 0 && seg <= 3) ||
996 (part == 2 && seg <= 3) ) {
1004 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
1005 for (
int panel = 0; panel < m_kPanelMax; panel++) {
1006 TGeoPhysicalNode *phyNode = 0;
1009 phyNode->SetVisibility(0);
1010 if ( (part == 1 && seg <= 8) ||
1011 (part == 0 && seg <= 3) ||
1012 (part == 2 && seg <= 3) ) {
1030 for (
int i = 0; i <
m_HitsArray->GetEntries(); i++) {
1031 TGeoPhysicalNode *phyNode = (TGeoPhysicalNode*)
m_HitsArray->At(i);
1032 phyNode->SetLineColor(m_stripColor);
1033 phyNode->SetVisibility(0);
1041 aStrip->
AddInfo(aStrip->GetTitle());
1048 for (
int i = 0; i < m_MucDigiCol->GetEntries(); i++) {
1055 TGeoPhysicalNode *phyNode = 0;
1060 aStrip = m_Muc2DStrip[part][seg][gap][strip];
1063 aStrip->
AddInfo(aStrip->GetTitle());
1066 sprintf(
data,
"Fired");
1080 if (gPad) view = (
BesView*)gPad->GetView();
1084 phyNode->SetVisibility(0);
1091 phyNode->SetVisibility(1);
1100 if (gPad) view = (
BesView*)gPad->GetView();
1102 for (
int i = 0; i <
m_HitsArray->GetEntries(); i++) {
1103 TGeoPhysicalNode *phyNode = (TGeoPhysicalNode*)
m_HitsArray->At(i);
1109 phyNode->SetVisibility(1);
1114 phyNode->SetVisibility(0);
1128 int seg = m_kSeg[part];
1135 int gap = m_kGap[part];
1142 int strip = m_StripNum[part][seg][gap];
1149 int absorber = m_kAbsorber[part];
1156 std::stringstream osname;
1157 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"Ab" << absorber;
1165 std::stringstream osname;
1166 osname <<
"VolumeSmallBlock" <<
"Gap" << gap <<
"SB" << sb;
1176 std::stringstream osname;
1177 osname <<
"logical" <<
"Muc" <<
"Part" << part <<
"Seg" << seg <<
"Absorber" << absorber <<
"Panel" << panel;
1185 std::stringstream osname;
1186 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"G" << gap;
1194 std::stringstream osname;
1195 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"G" << gap <<
"Al";
1203 std::stringstream osname;
1205 if (part ==1 && seg ==2) segment = 2;
1206 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"AlSf" <<up;
1215 if (part==1&&seg==2) segment = 2;
1216 std::stringstream osname;
1217 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"SP";
1225 std::stringstream osname;
1227 if (part == 1 && seg == 2) segment = 2;
1229 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" <<
"00" << strip;
1231 else if (strip<100){
1232 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" <<
"0" << strip;
1235 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" << strip;
1244 std::stringstream osname;
1246 if (part ==1 && seg ==2) segment = 2;
1247 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"R" << rpcUpDown <<
"Pn" << panel <<
"C";
1255 std::stringstream osname;
1257 if (part ==1 && seg ==2) segment = 2;
1258 osname <<
"l" <<
"Muc" <<
"P" << part%2 <<
"S" << segment <<
"G" << gap <<
"R" << rpcUpDown <<
"Pn" << panel <<
"GB";
1266 std::stringstream osname;
1268 if (part ==1 && seg ==2) segment = 2;
1269 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"R" << RpcUpDown <<
"Pn" << panel<<
"B" << bakelite;
1277 if (m_NodeAbsorber[part][seg][absorber] != 0) {
1278 return m_NodeAbsorber[part][seg][absorber];
1288 if (m_NodeAbsorberPanel[part][seg][absorber][panel] != 0) {
1289 return m_NodeAbsorberPanel[part][seg][absorber][panel];
1299 if (m_NodeGap[part][seg][gap] != 0) {
1300 return m_NodeGap[part][seg][gap];
1310 if (m_NodeStripPlane[part][seg][gap] != 0) {
1311 return m_NodeStripPlane[part][seg][gap];
1321 if (m_NodeStrip[part][seg][gap][strip] != 0) {
1322 return m_NodeStrip[part][seg][gap][strip];
1332 return m_PhysicalAbsorber[part][seg][absorber][panel];
1338 if (m_PhysicalGap[part][seg][gap] != 0) {
1339 return m_PhysicalGap[part][seg][gap];
1349 if (m_PhysicalStrip[part][seg][gap][strip] != 0) {
1350 return m_PhysicalStrip[part][seg][gap][strip];
1360 if (m_Muc2DStrip[part][seg][gap][strip])
return m_Muc2DStrip[part][seg][gap][strip];
1367 for (
int part = 0; part <
GetPartNb(); part++) {
1368 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
1369 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
1373 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
1379 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
1380 for (
int panel = 0; panel < m_kPanelMax; panel++) {
1395 if (part != 1)
return true;
1401 Int_t viewSeg = Int_t(viewPhi/45.0+0.5);
1402 Int_t upSeg = viewSeg+2;
1403 Int_t downSeg = viewSeg-2;
1404 if (upSeg < 0) upSeg += 8;
1405 else if (upSeg >= 8) upSeg -= 8;
1406 if (downSeg < 0) downSeg += 8;
1407 else if (downSeg >= 8) downSeg -= 8;
1409 if (seg == upSeg || seg == downSeg)
return true;
1416 if (input >= 360.0) {
1420 while (input >= 360.0);
1422 else if (input < 0.0) {
1426 while (input < 0.0);
1435 TString opt = option;
1438 if (!
m_2DGeoInit) cout <<
"MucROOTGeo::Draw2D(), 2D Geometry not initialized!" << endl;
1440 if (!view) cout <<
"MucROOTGeo::Draw(), BesView not found" << endl;
1444 for (Int_t part =
GetPartNb()-1; part >= 0; part--) {
1448 for (Int_t seg = 0; seg <
GetSegNb(part); seg++) {
1449 if (opt.Contains(
"XY")) {
1450 if (m_MucXY[part][seg]) m_MucXY[part][seg]->
Draw(
"");
1451 for (Int_t gap = 0; gap <
GetGapNb(part); gap++) {
1452 if (m_MucXYGap[part][seg][gap]) m_MucXYGap[part][seg][gap]->
Draw(
"");
1455 if (opt.Contains(
"ZR")) {
1456 if ( m_MucZR[part][seg] ) {
1458 m_MucZR[part][seg]->
Draw(
"");
1460 for (Int_t gap = 0; gap <
GetGapNb(part); gap++) {
1461 if (m_MucZRGap[part][seg][gap]) {
1462 if (part == 1) m_MucZRGap[part][seg][gap]->
SetRotatable(
true);
1463 m_MucZRGap[part][seg][gap]->
Draw(
"");
1472 for (Int_t part =
GetPartNb()-1; part >= 0; part--) {
1473 for (Int_t seg = 0; seg <
GetSegNb(part); seg++) {
1474 for (Int_t gap = 0; gap <
GetGapNb(part); gap++) {
1475 for (Int_t strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
1476 if (m_Muc2DStrip[part][seg][gap][strip]) {
1477 m_Muc2DStrip[part][seg][gap][strip]->
SetFired(
false);
1481 m_Muc2DStrip[part][seg][gap][strip]->
Draw(
"");
1496 if (!view) cout <<
"MucROOTGeo::DrawHits(), BesView not found" << endl;
1513 for (
int i = 0; i < m_MucDigiCol->GetEntries(); i++) {
1524 aStrip = m_Muc2DStrip[part][seg][gap][strip];
R__EXTERN BesEvent * gEvent
double P(RecMdcKalTrack *trk)
const TObjArray * GetMucDigiCol() const
void SetRotatable(Bool_t input)
virtual void Draw(Option_t *option="")
Bool_t GetVisMucHitsWest()
Bool_t GetVisMucHitsGlobal()
Bool_t GetVisMucHitsEast()
Bool_t GetVisMucHitsBarrel()
virtual void Draw(Option_t *option="")
virtual void AddInfo(TString info)
virtual void SetFired(bool status=true)
static int part(const Identifier &id)
static int gap(const Identifier &id)
static int seg(const Identifier &id)
static int strip(const Identifier &id)
TGeoVolume * GetVolumeMuc()
Get Muc volume;.
void SetQuarterVisible()
Set quater visible;.
TGeoVolume * GetVolumeStripPlane(int part, int seg, int gap)
Get strip plane volume;.
void Draw(Option_t *option)
Draw function.
void SetPhysicalNode()
Set the pointers to the physical nodes;.
int GetGapNb(int part)
Get number of gap on part;.
void SetDetector()
Set Detecor (what is detector depends on you)
void SetVolumeDefaultVis()
Set default visual attributes;.
TGeoVolume * GetVolumeGasChamber(int part, int seg, int gap, int panel, int gasChamber)
Get rpc gas chamber volume;
void SetHalfVisible()
Set half visible;.
int GetAbsorberNb(int part)
Get number of absorber on part;.
TGeoPhysicalNode * GetPhysicalStrip(int part, int seg, int gap, int strip)
Get strip physical node;.
TGeoVolume * GetVolumeBox(int part, int seg, int gap)
Get box volume;
TGeoVolume * GetVolumeBakelite(int part, int seg, int gap, int panel, int bakelite)
Get rpc bakelite volume;
TGeoVolume * GetVolumeGasBorder(int part, int seg, int gap, int panel, int gasChamber)
Get rpc gas border volume;
Double_t Range360(Double_t input)
Get input value 0~360.
void SetNode()
Set the pointers to theirs nodes;.
void SetVolumeMuc(TGeoVolume *vol)
Set Muc volume, while initializing from ROOT;.
TGeoVolume * GetVolumeAbsorberPanel(int part, int seg, int absorber, int panel)
Get absorber panel volume;
TGeoNode * GetAbsorber(int part, int seg, int absorber)
Get absorber node;
Bool_t IsZRVisible(int part, int seg)
Is a segment visible in ZR view.
void SetVisMucDetector()
Set Muc detector visibility;.
void SetAllVisible()
Set all visible;.
Int_t GetPart(TGeoPhysicalNode *phyNode)
Get part no of a physcial node.
int GetSegNb(int part)
Get number of segment on part;.
TGeoVolume * GetVolumeGap(int part, int seg, int gap)
Get gap volume;
int GetPartNb()
Get number of part;.
void SetHits()
Set all physicalNodes corresponding to digiCol;.
void SetNoEndVisible()
Set noend visible;.
TGeoVolume * GetVolumeBoxSurface(int part, int seg, int gap, int up)
Get box surface volume;
TGeoNode * GetGap(int part, int seg, int gap)
Get absorber node;
TGeoNode * GetStripPlane(int part, int seg, int gap)
Get box node;.
TGeoVolume * GetVolumeStrip(int part, int seg, int gap, int strip)
Get strip volume;
void SetVisMucHits()
Set Muc hits visibility;.
TGeoVolume * GetVolumeAbsorber(int part, int seg, int absorber)
Get absorber volume;
TGeoPhysicalNode * GetPhysicalGap(int part, int seg, int gap)
Get rpc gas chamber node;
TGeoNode * GetStrip(int part, int seg, int gap, int strip)
Get strip node;
TGeoPhysicalNode * GetPhysicalAbsorber(int part, int seg, int gap, int panel)
Get rpc gas chamber node;
void Init2DGeometry()
Initialize 2D Geometry.
void DrawHits(Option_t *option)
Draw 2D hits.
int GetStripNb(int part, int seg, int gap)
Get number of strip on gap;.
Muc2DStrip * Get2DStrip(int part, int seg, int gap, int strip)
Get Muc2DStrip;.
TGeoVolume * GetVolumeAbsorberSmallBlock(int gap, int sb)
Get absorber small block;.
TGeoNode * GetAbsorberPanel(int part, int seg, int absorber, int panel)
Get absorber panel node;
void InitFromGDML(const char *gdmlFile, const char *setupName)
Initialize ROOTGeo from GDML.
void InitFromROOT(TGeoVolume *vol)
Initialize ROOTGeo from TGeoVolume logicalMuc.
TGeoNode * GetNode(const std::string &nn)
Get a node(physical volume) by name;.
TGeoVolume * GetTopVolume()
Get the top(world) volume;.
TGeoVolume * GetLogicalVolume(const std::string &vn)
Get a logical volume by name;.
void ReadGdml(const char *gdmlFile, const char *setupName)
Initialize the instance of ROOTGeo.
TObjArray * m_DetectorsArray
TObjArray * m_2DHitsArray