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;
81 cout <<
"delete old MucROOTGeo" << endl;
82 for (
int part = 0; part <
GetPartNb(); part++)
84 for (
int seg = 0; seg <
GetSegNb(part); seg++)
86 for (
int gap = 0; gap <
GetGapNb(part); gap++)
88 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++)
90 delete m_Muc2DStrip[part][seg][gap][strip];
92 delete m_MucXYGap[part][seg][gap];
93 delete m_MucZRGap[part][seg][gap];
95 delete m_MucXY[part][seg];
96 delete m_MucZR[part][seg];
123 cout <<
"MucROOTGeo::Init2DGeometry, ROOT Geometry not Initialized yet!" << endl;
128 Int_t mucColor = 1002;
129 Int_t mucLineColor = 15;
130 Int_t mucXYStyle = 1001;
131 Int_t mucZRStyle = 1001;
133 Int_t mucGapColor = 10;
134 Int_t mucGapStyle = 1001;
135 Int_t mucGapXYECStyle = 4000;
136 Int_t mucGapLineColor = 15;
138 Double_t
x = 0.0,
y = 0.0, z = 0.0;
139 Double_t r = 0.0, phi = 0.0;
140 Double_t local[3] = {0.0, 0.0, 0.0};
141 Double_t master[3] = {0.0, 0.0, 0.0};
143 Double_t
P[300] = {0.0};
147 Int_t part = 0, seg = 0, gap = 0, strip = 0;
151 TGeoCompositeShape *mucShape = (TGeoCompositeShape*)
GetVolumeMuc()->GetShape();
155 TGeoBoolNode *mucBoolNode = mucShape->GetBoolNode();
156 TGeoCompositeShape *mucWithHoleShape = (TGeoCompositeShape*)mucBoolNode->GetLeftShape();
157 TGeoBoolNode *mucWithHoleBoolNode = mucWithHoleShape->GetBoolNode();
159 TGeoBBox *mucOuterShape = (TGeoBBox*)mucWithHoleBoolNode->GetLeftShape();
160 TGeoTube *mucInnerShape = (TGeoTube*)mucWithHoleBoolNode->GetRightShape();
166 Double_t mucOuterR = mucOuterShape->GetDX();
167 Double_t mucInnerR = mucInnerShape->GetRmax() + 40.0;
173 Int_t xySegPointSeq[4] = {0,1,1,0};
174 for (seg = 0; seg <
GetSegNb(part); seg++) {
175 name = TString(
"MucBarrelSeg");
177 for (Int_t iPoint = 0; iPoint < 4; iPoint++) {
178 if (iPoint < 2) r = mucInnerR/TMath::Cos(TMath::Pi()/8.0);
179 else r = mucOuterR/TMath::Cos(TMath::Pi()/8.0);
180 phi = TMath::Pi()/8.0 * (2*seg-1 + 2*xySegPointSeq[iPoint]);
181 x = r * TMath::Cos(phi);
182 y = r * TMath::Sin(phi);
189 m_MucXY[part][seg]->SetFillColor(mucColor);
190 m_MucXY[part][seg]->SetFillStyle(mucXYStyle);
191 m_MucXY[part][seg]->SetLineColor(mucLineColor);
197 for (seg = 0; seg <
GetSegNb(part); seg++) {
198 for (Int_t iPoint = 0; iPoint < 4; iPoint++) {
199 if (iPoint == 0 || iPoint == 3 ) r = mucInnerR;
201 phi = TMath::Pi()/4.0 * seg;
203 x = r * TMath::Cos(phi);
204 y = r * TMath::Sin(phi);
206 TGeoVolume *volAbsorber = 0;
207 volAbsorber=
GetAbsorber(part, seg, 0)->GetVolume();
208 TGeoBBox *absorberShape = (TGeoBBox*)volAbsorber->GetShape();
209 if (seg == 2)cout<<
"in MucROOTGeo::Init2DGeometry() x,y,z = "<<absorberShape->GetDX()<<
" "<<absorberShape->GetDY()<<
" "<<absorberShape->GetDZ()<<endl;
210 Double_t dy = absorberShape->GetDY();
212 if (iPoint < 2) z = -dy;
219 if (seg == 2 || seg == 6) {
220 if (seg == 2) name = TString(
"MucBarrelUpSeg");
221 if (seg == 6) name = TString(
"MucBarrelDownSeg");
224 m_MucZR[part][seg]->SetFillColor(mucColor);
225 m_MucZR[part][seg]->SetFillStyle(mucZRStyle);
226 m_MucZR[part][seg]->SetLineColor(mucLineColor);
233 for (seg = 0; seg <
GetSegNb(part); seg++) {
234 for (gap = 0; gap <
GetGapNb(part); gap++) {
236 TGeoPhysicalNode *phyNode = 0;
239 TGeoBBox *gapShape = (TGeoBBox*)phyNode->GetShape();
240 Double_t dx = gapShape->GetDX();
241 Double_t dy = gapShape->GetDY();
242 Double_t dz = gapShape->GetDZ();
245 for (Int_t i = 0; i < 4; i++) {
265 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
266 for (Int_t j = 0; j < 3; j++)
P[3*i+j] = master[j];
269 name = TString(
"MucBarrelSeg");
271 name += TString(
"Gap");
274 m_MucXYGap[part][seg][gap] =
new BesPolygon2D(name, name, 4, &
P[0]);
275 m_MucXYGap[part][seg][gap]->SetFillColor(mucGapColor);
276 m_MucXYGap[part][seg][gap]->SetFillStyle(mucGapStyle);
277 m_MucXYGap[part][seg][gap]->SetLineColor(mucGapLineColor);
280 for (Int_t i = 0; i < 4; i++) {
300 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
301 for (Int_t j = 0; j < 3; j++)
P[3*i+j] = master[j];
304 if (seg == 2 || seg == 6) {
306 name = TString(
"MucBarrelUpSegGap");
310 name = TString(
"MucBarrelDownSegGap");
314 m_MucZRGap[part][seg][gap] =
new BesPolygon2D(name, name, 4, &
P[0]);
315 m_MucZRGap[part][seg][gap]->SetFillColor(mucGapColor);
316 m_MucZRGap[part][seg][gap]->SetFillStyle(mucGapStyle);
317 m_MucZRGap[part][seg][gap]->SetLineColor(mucGapLineColor);
322 for (part = 0; part <
GetPartNb(); part++) {
323 if (part == 1)
continue;
324 for (seg = 0; seg <
GetSegNb(part); seg++) {
328 for (gap = 0; gap <
GetGapNb(part); gap++) {
329 TGeoPhysicalNode *phyNode = 0;
332 Int_t ixyPoint = 0, izrPoint = 0;
336 TGeoCompositeShape *addPanelShape[4];
337 TGeoTrap *panelShape[4];
340 for (Int_t panel = nPanel-1; panel >= 0; panel--) {
341 if (panel == nPanel-1) addPanelShape[panel] = (TGeoCompositeShape*)
GetGap(part, seg, gap)->GetVolume()->GetShape();
342 else addPanelShape[panel] = (TGeoCompositeShape*)addPanelShape[panel+1]->GetBoolNode()->GetLeftShape();
344 panelShape[panel] = (TGeoTrap*)addPanelShape[panel]->GetBoolNode()->GetRightShape();
346 Double_t *localArb8Point, masterArb8Point[3*8];
347 localArb8Point = panelShape[panel]->GetVertices();
348 for (Int_t i = 0; i < 8; i++) {
349 local[0] = localArb8Point[2*i];
350 local[1] = localArb8Point[2*i+1];
351 if (i < 4) local[2] = panelShape[panel]->GetDz() * (-1.0);
352 else local[2] = panelShape[panel]->GetDz();
354 addPanelShape[panel]->GetBoolNode()->GetRightMatrix()->LocalToMaster(local, &master[0]);
356 for (Int_t j = 0; j < 3; j++) local[j] = master[j];
357 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
358 for (Int_t j = 0; j < 3; j++) {
359 masterArb8Point[3*i+j] = master[j];
365 Int_t xyPanelPointSeq[4] = {0, 3, 7, 4};
366 for (Int_t i = 0; i < 4; i++) {
367 for (Int_t j = 0; j < 3; j++) {
368 P[3*ixyPoint+j] = masterArb8Point[3*xyPanelPointSeq[i]+j];
374 Int_t xyPanelPointSeq[4] = {7, 4, 0, 3};
375 for (Int_t i = 0; i < 4; i++) {
376 for (Int_t j = 0; j < 3; j++) {
377 P[3*ixyPoint+j] = masterArb8Point[3*xyPanelPointSeq[i]+j];
385 Int_t zrPanelPointSeq[4] = {4, 7, 6, 5};
386 for (Int_t i = 0; i < 4; i++) {
387 for (Int_t j = 0; j < 3; j++) {
388 P[100+3*izrPoint+j] = masterArb8Point[3*zrPanelPointSeq[i]+j];
394 Int_t zrPanelPointSeq[4] = {6, 5, 4, 7};
395 for (Int_t i = 0; i < 4; i++) {
396 for (Int_t j = 0; j < 3; j++) {
397 P[100+3*izrPoint+j] = masterArb8Point[3*zrPanelPointSeq[i]+j];
404 if (part == 0) name = TString(
"MucEastEc");
405 else if (part == 2) name = TString(
"MucWestEc");
406 name += TString(
"Seg");
408 name += TString(
"Gap");
412 m_MucXYGap[part][seg][gap] =
new BesPolygon2D(name, name, ixyPoint, &
P[0]);
413 m_MucXYGap[part][seg][gap]->SetFillColor(mucGapColor);
414 m_MucXYGap[part][seg][gap]->SetFillStyle(mucGapXYECStyle);
415 m_MucXYGap[part][seg][gap]->SetLineColor(mucGapLineColor);
417 m_MucZRGap[part][seg][gap] =
new BesPolygon2D(name, name, izrPoint, &
P[100]);
418 m_MucZRGap[part][seg][gap]->SetFillColor(mucGapColor);
419 m_MucZRGap[part][seg][gap]->SetFillStyle(mucGapStyle);
420 m_MucZRGap[part][seg][gap]->SetLineColor(mucGapLineColor);
425 Double_t zrFirstAbsorberHeight = ((TGeoBBox*)
GetAbsorber(part, seg, 0)->GetVolume()->GetShape())->GetDZ()*2.0;
426 for (Int_t i = 0; i < 4; i++) {
427 for (Int_t j = 0; j < 3; j++) {
428 if ( (part == 0 && (seg == 0 || seg == 2)) || (part == 2 && (seg == 1 || seg == 3)) ) {
429 Int_t zrSegPointSeq[4] = {6, 7, 0, 1};
430 segP[3*iSegPoint+j] =
P[100+3*zrSegPointSeq[i]+j];
433 Int_t zrSegPointSeq[4] = {5, 4, 3, 2};
434 segP[3*iSegPoint+j] =
P[100+3*zrSegPointSeq[i]+j];
438 if (part == 0) segP[3*iSegPoint+j] -= zrFirstAbsorberHeight;
439 else if (part == 2) segP[3*iSegPoint+j] += zrFirstAbsorberHeight;
446 Double_t zrLastAbsorberHeight = ((TGeoBBox*)
GetAbsorber(part, seg, 8)->GetVolume()->GetShape())->GetDZ()*2.0;
447 for (Int_t i = 0; i < 4; i++) {
448 for (Int_t j = 0; j < 3; j++) {
449 if ( (part == 0 && (seg == 0 || seg == 2)) || (part == 2 && (seg == 1 || seg == 3)) ){
450 Int_t zrSegPointSeq[4] = {2, 3, 4, 5};
451 segP[3*iSegPoint+j] =
P[100+3*zrSegPointSeq[i]+j];
454 Int_t zrSegPointSeq[4] = {1, 0, 7, 6};
455 segP[3*iSegPoint+j] =
P[100+3*zrSegPointSeq[i]+j];
459 if (part == 0) segP[3*iSegPoint+j] += zrLastAbsorberHeight;
460 else if (part == 2) segP[3*iSegPoint+j] -= zrLastAbsorberHeight;
468 if (part == 0) name = TString(
"MucEastEc");
469 else if (part == 2) name = TString(
"MucWestEc");
470 name += TString(
"Seg");
472 m_MucZR[part][seg] =
new BesPolygon2D(name, name, iSegPoint, &segP[0]);
473 m_MucZR[part][seg]->SetFillColor(mucColor);
474 m_MucZR[part][seg]->SetFillStyle(mucZRStyle);
475 m_MucZR[part][seg]->SetLineColor(mucLineColor);
479 for (part = 0; part <
GetPartNb(); part++) {
480 for (seg = 0; seg <
GetSegNb(part); seg++) {
481 for (gap = 0; gap <
GetGapNb(part); gap++) {
482 for (strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
483 TGeoPhysicalNode *phyNode = 0;
485 TGeoBBox *stripShape = (TGeoBBox*)phyNode->GetShape();
486 Double_t dx = stripShape->GetDX();
487 Double_t dy = stripShape->GetDY();
488 Double_t dz = stripShape->GetDZ();
489 dz *= m_kStripZMuliple;
491 for (Int_t i = 0; i < 8; i++) {
535 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
536 for (Int_t j = 0; j < 3; j++)
P[3*i+j] = master[j];
539 name = TString(
"Muc Part");
541 name += TString(
" Seg");
543 name += TString(
" Gap");
545 name += TString(
" Strip");
548 m_Muc2DStrip[part][seg][gap][strip] =
new Muc2DStrip(name, name, 8, &
P[0], part, seg, gap, strip);
561 if (!m_Muc) std::cout <<
"m_Muc = 0" << std::endl;
564 for (
int part = 0; part <
GetPartNb(); part++) {
565 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
566 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
569 std::stringstream osnameGap;
570 osnameGap <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"G" << gap <<
"_" << gapCount;
571 m_NodeGap[part][seg][gap] =
GetNode( osnameGap.str() );
575 if (part==1&&seg==2) segment = 2;
576 std::stringstream osnameStripPlane;
577 osnameStripPlane <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"SP" <<
"_" <<
"0";
578 m_NodeStripPlane[part][seg][gap] =
GetNode( osnameStripPlane.str() );
579 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
580 std::stringstream osnameStrip;
582 osnameStrip <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" <<
"00" << strip <<
"_" << strip;
584 else if (strip < 100) {
585 osnameStrip <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" <<
"0" << strip <<
"_" << strip;
588 osnameStrip <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" << strip <<
"_" << strip;
591 m_NodeStrip[part][seg][gap][strip] =
GetNode( osnameStrip.str() );
597 int absorberCount = gapCount;
598 for (
int part = 0; part <
GetPartNb(); part++) {
599 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
600 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
601 std::stringstream osnameAbsorber;
602 osnameAbsorber <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"Ab" << absorber <<
"_" << absorberCount;
603 m_NodeAbsorber[part][seg][absorber] =
GetNode( osnameAbsorber.str() );
618 for (
int part = 0; part <
GetPartNb(); part++) {
619 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
620 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
621 m_NodeGap[part][seg][gap] = m_Muc->GetNode(gapCount);
624 m_NodeStripPlane[part][seg][gap] =
GetGap(part, seg, gap)->GetDaughter(0)->GetDaughter(0);
625 m_StripNum[part][seg][gap] =
GetStripPlane(part, seg, gap)->GetNdaughters();
627 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
628 m_NodeStrip[part][seg][gap][strip] =
GetStripPlane(part, seg, gap)->GetVolume()->GetNode(strip);
634 int absorberCount = gapCount;
635 for (
int part = 0; part <
GetPartNb(); part++) {
636 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
637 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
638 m_NodeAbsorber[part][seg][absorber] = m_Muc->GetNode( absorberCount );
656 m_Muc->SetLineColor(m_MucColor);
657 m_Muc->SetVisibility(0);
659 for (
int part = 0; part <
GetPartNb(); part++) {
660 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
661 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
672 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
680 for (
int sb = 0; sb < m_kSmallBlockMax; sb++){
689 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
690 GetVolumeStrip(part, seg, gap, strip)->SetLineColor(m_stripColor);
694 for (
int up = 0; up < 2; up ++){
698 if (part == 1 && seg == 2)seg_shift = 1;
699 for (
int panel = 0; panel < m_kPanel[part] + seg_shift; panel++) {
707 for (
int panel = 0; panel < m_kBakelitePanel[part][up] + seg_shift; panel++) {
708 for (
int bakelite = 0; bakelite < m_kBakelite; bakelite++) {
709 GetVolumeBakelite(part, seg, gap, up, panel, bakelite)->SetLineColor(m_bakeliteColor);
729 for (
int part = 0; part <
GetPartNb(); part++) {
730 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
731 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
732 GetGap(part, seg, gap)->SetVisibility(0);
733 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
734 GetStrip(part, seg, gap, strip)->SetVisibility(0);
745 for (
int part = 0; part <
GetPartNb(); part++)
747 for (
int seg = 0; seg <
GetSegNb(part); seg++)
749 for (
int gap = 0; gap <
GetGapNb(part); gap++)
751 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++)
762 m_Muc->SetLineColor(m_MucColor);
763 m_Muc->SetVisibility(0);
765 for (
int part = 0; part <
GetPartNb(); part++) {
766 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
767 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
778 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
782 GetVolumeBox(part, seg, gap)->SetLineColor(m_stripColor);
786 for (
int sb = 0; sb < m_kSmallBlockMax; sb++){
795 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
796 GetVolumeStrip(part, seg, gap, strip)->SetLineColor(m_stripColor);
800 for (
int up = 0; up < 2; up ++){
804 if (part == 1 && seg == 2)seg_shift = 1;
805 for (
int panel = 0; panel < m_kPanel[part] + seg_shift; panel++) {
812 for (
int panel = 0; panel < m_kBakelitePanel[part][up] + seg_shift; panel++) {
813 for (
int bakelite = 0; bakelite < m_kBakelite; bakelite++) {
814 GetVolumeBakelite(part, seg, gap, up, panel, bakelite)->SetLineColor(m_bakeliteColor);
836 for (
int part = 0; part <
GetPartNb(); part++) {
837 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
838 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
839 GetGap(part, seg, gap)->SetVisibility(0);
840 for (
int strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
841 GetStrip(part, seg, gap, strip)->SetVisibility(0);
853 for (
int part = 0; part < m_kPart; part++) {
854 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
855 for (
int absorber = 0; absorber < m_kAbsorber[part]; absorber++) {
861 for (
int panel = 0; panel < m_kPanel[part]; panel++) {
867 for (
int gap = 0; gap < m_kGap[part]; gap++) {
868 if (part == 1 && seg > 2) {
870 GetGap(part, seg, gap)->SetVisibility(1);
874 GetGap(part, seg, gap)->SetVisibility(0);
876 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
896 for (
int part = 0; part < m_kPart; part++) {
897 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
898 for (
int absorber = 0; absorber < m_kAbsorber[part]; absorber++) {
900 if (seg < 3 || seg > 5)
GetVolumeAbsorber(part, seg, absorber)->SetVisibility(1);
904 for (
int panel = 0; panel < m_kPanel[part]; panel++) {
910 for (
int gap = 0; gap < m_kGap[part]; gap++) {
911 if (part == 1 && (seg < 3 || seg > 5)) {
913 GetGap(part, seg, gap)->SetVisibility(1);
917 GetGap(part, seg, gap)->SetVisibility(0);
919 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
940 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
941 for (
int absorber = 0; absorber < m_kAbsorber[part]; absorber++) {
945 for (
int gap = 0; gap < m_kGap[part]; gap++) {
947 GetGap(part, seg, gap)->SetVisibility(1);
956 if (gGeoManager == 0) std::cout <<
"Create gGeoManager first" << std::endl;
957 TGeoNode *
bes = gGeoManager->GetTopNode();
958 TGeoNode *muc =
bes->GetDaughter(3);
960 for (
int part = 0; part <
GetPartNb(); part++) {
961 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
962 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
963 TGeoNode *nodeGap =
GetGap(part, seg, gap);
964 m_PhysicalGap[part][seg][gap] = gGeoManager->MakePhysicalNode( TString(
"/") +
bes->GetName() +
965 TString(
"/") + muc->GetName() +
966 TString(
"/") + nodeGap->GetName() +
967 TString(
"/") + nodeGap->GetDaughter(0)->GetName());
969 m_PhysicalGap[part][seg][gap]->SetVisibility(0);
970 m_PhysicalGap[part][seg][gap]->SetIsVolAtt(kFALSE);
971 m_PhysicalGap[part][seg][gap]->SetLineColor(m_gapColor);
975 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
976 TGeoNode *nodeStrip =
GetStrip(part, seg, gap, strip);
977 m_PhysicalStrip[part][seg][gap][strip] = gGeoManager->MakePhysicalNode( TString(
"/") +
bes->GetName() +
978 TString(
"/") + muc->GetName() +
979 TString(
"/") + nodeGap->GetName() +
980 TString(
"/") + nodeGap->GetDaughter(0)->GetName() +
981 TString(
"/") + nodeStripPlane->GetName() +
982 TString(
"/") + nodeStrip->GetName() );
983 m_PhysicalStrip[part][seg][gap][strip]->SetVisibility(0);
984 m_PhysicalStrip[part][seg][gap][strip]->SetIsVolAtt(kFALSE);
985 m_PhysicalStrip[part][seg][gap][strip]->SetLineColor(m_stripColor);
991 for (
int part = 0; part <
GetPartNb(); part++) {
992 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
993 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
994 TGeoNode *nodeAbsorber =
GetAbsorber(part, seg, absorber);
996 m_PhysicalAbsorber[part][seg][absorber][0] = gGeoManager->MakePhysicalNode( TString(
"/") +
bes->GetName() +
997 TString(
"/") + muc->GetName() +
998 TString(
"/") + nodeAbsorber->GetName() );
999 m_PhysicalAbsorber[part][seg][absorber][0]->SetVisibility(0);
1000 m_PhysicalAbsorber[part][seg][absorber][0]->SetIsVolAtt(kFALSE);
1001 m_PhysicalAbsorber[part][seg][absorber][0]->SetLineColor(m_absorberColor);
1026 if (gPad) view =
dynamic_cast<BesView*
>(gPad->GetView());
1029 for (
int part = 0; part <
GetPartNb(); part++) {
1030 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
1031 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
1032 TGeoPhysicalNode *phyNode = 0;
1035 phyNode->SetVisibility(0);
1036 if ( (part == 1 && seg <= 8) ||
1037 (part == 0 && seg <= 3) ||
1038 (part == 2 && seg <= 3) ) {
1046 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
1047 for (
int panel = 0; panel < m_kPanelMax; panel++) {
1048 TGeoPhysicalNode *phyNode = 0;
1051 phyNode->SetVisibility(0);
1052 if ( (part == 1 && seg <= 8) ||
1053 (part == 0 && seg <= 3) ||
1054 (part == 2 && seg <= 3) ) {
1072 for (
int i = 0; i <
m_HitsArray->GetEntries(); i++) {
1073 TGeoPhysicalNode *phyNode = (TGeoPhysicalNode*)
m_HitsArray->At(i);
1074 phyNode->SetLineColor(m_stripColor);
1075 phyNode->SetVisibility(0);
1083 aStrip->
AddInfo(aStrip->GetTitle());
1094 if (m_MucDigiCol) NDigiCol = m_MucDigiCol->GetEntries();
1098 for (
int i = 0; i < NDigiCol; i++) {
1109 aStrip = m_Muc2DStrip[part][seg][gap][strip];
1112 aStrip->
AddInfo(aStrip->GetTitle());
1129 if (gPad) view =
dynamic_cast<BesView*
>(gPad->GetView());
1133 phyNode->SetVisibility(0);
1140 phyNode->SetVisibility(1);
1149 if (gPad) view =
dynamic_cast<BesView*
>(gPad->GetView());
1151 for (
int i = 0; i <
m_HitsArray->GetEntries(); i++) {
1152 TGeoPhysicalNode *phyNode = (TGeoPhysicalNode*)
m_HitsArray->At(i);
1158 phyNode->SetVisibility(1);
1161 phyNode->SetLineColor(922);
1163 phyNode->SetVisibility(0);
1176 return m_kSeg[part];
1182 return m_kGap[part];
1188 return m_StripNum[part][seg][gap];
1194 return m_kAbsorber[part];
1200 std::stringstream osname;
1201 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"Ab" << absorber;
1209 std::stringstream osname;
1210 osname <<
"VolumeSmallBlock" <<
"Gap" << gap <<
"SB" << sb;
1220 std::stringstream osname;
1221 osname <<
"logical" <<
"Muc" <<
"Part" << part <<
"Seg" << seg <<
"Absorber" << absorber <<
"Panel" << panel;
1229 std::stringstream osname;
1230 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"G" << gap;
1238 std::stringstream osname;
1239 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"G" << gap <<
"Al";
1247 std::stringstream osname;
1249 if (part ==1 && seg ==2) segment = 2;
1250 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"AlSf" <<up;
1259 if (part==1&&seg==2) segment = 2;
1260 std::stringstream osname;
1261 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"SP";
1269 std::stringstream osname;
1271 if (part == 1 && seg == 2) segment = 2;
1273 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" <<
"00" << strip;
1275 else if (strip<100){
1276 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" <<
"0" << strip;
1279 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" << strip;
1288 std::stringstream osname;
1290 if (part ==1 && seg ==2) segment = 2;
1291 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"R" << rpcUpDown <<
"Pn" << panel <<
"C";
1299 std::stringstream osname;
1301 if (part ==1 && seg ==2) segment = 2;
1302 osname <<
"l" <<
"Muc" <<
"P" << part%2 <<
"S" << segment <<
"G" << gap <<
"R" << rpcUpDown <<
"Pn" << panel <<
"GB";
1310 std::stringstream osname;
1312 if (part ==1 && seg ==2) segment = 2;
1313 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"R" << RpcUpDown <<
"Pn" << panel<<
"B" << bakelite;
1321 if (m_NodeAbsorber[part][seg][absorber] != 0) {
1322 return m_NodeAbsorber[part][seg][absorber];
1332 if (m_NodeAbsorberPanel[part][seg][absorber][panel] != 0) {
1333 return m_NodeAbsorberPanel[part][seg][absorber][panel];
1343 if (m_NodeGap[part][seg][gap] != 0) {
1344 return m_NodeGap[part][seg][gap];
1354 if (m_NodeStripPlane[part][seg][gap] != 0) {
1355 return m_NodeStripPlane[part][seg][gap];
1365 if (m_NodeStrip[part][seg][gap][strip] != 0) {
1366 return m_NodeStrip[part][seg][gap][strip];
1376 return m_PhysicalAbsorber[part][seg][absorber][panel];
1382 if (m_PhysicalGap[part][seg][gap] != 0) {
1383 return m_PhysicalGap[part][seg][gap];
1393 if (m_PhysicalStrip[part][seg][gap][strip] != 0) {
1394 return m_PhysicalStrip[part][seg][gap][strip];
1404 if (m_Muc2DStrip[part][seg][gap][strip])
return m_Muc2DStrip[part][seg][gap][strip];
1411 for (
int part = 0; part <
GetPartNb(); part++) {
1412 for (
int seg = 0; seg <
GetSegNb(part); seg++) {
1413 for (
int gap = 0; gap <
GetGapNb(part); gap++) {
1417 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
1423 for (
int absorber = 0; absorber <
GetAbsorberNb(part); absorber++) {
1424 for (
int panel = 0; panel < m_kPanelMax; panel++) {
1439 if (part != 1)
return true;
1445 Int_t viewSeg = Int_t(viewPhi/45.0+0.5);
1446 Int_t upSeg = viewSeg+2;
1447 Int_t downSeg = viewSeg-2;
1448 if (upSeg < 0) upSeg += 8;
1449 else if (upSeg >= 8) upSeg -= 8;
1450 if (downSeg < 0) downSeg += 8;
1451 else if (downSeg >= 8) downSeg -= 8;
1453 if (seg == upSeg || seg == downSeg)
return true;
1460 if (input >= 360.0) {
1464 while (input >= 360.0);
1466 else if (input < 0.0) {
1470 while (input < 0.0);
1479 TString opt = option;
1482 if (!
m_2DGeoInit) cout <<
"MucROOTGeo::Draw2D(), 2D Geometry not initialized!" << endl;
1484 if (!view) cout <<
"MucROOTGeo::Draw(), BesView not found" << endl;
1488 for (Int_t part =
GetPartNb()-1; part >= 0; part--) {
1492 for (Int_t seg = 0; seg <
GetSegNb(part); seg++) {
1493 if (opt.Contains(
"XY")) {
1494 if (m_MucXY[part][seg]) m_MucXY[part][seg]->
Draw(
"");
1495 for (Int_t gap = 0; gap <
GetGapNb(part); gap++) {
1496 if (m_MucXYGap[part][seg][gap]) m_MucXYGap[part][seg][gap]->
Draw(
"");
1499 if (opt.Contains(
"ZR")) {
1500 if ( m_MucZR[part][seg] ) {
1502 m_MucZR[part][seg]->
Draw(
"");
1504 for (Int_t gap = 0; gap <
GetGapNb(part); gap++) {
1505 if (m_MucZRGap[part][seg][gap]) {
1506 if (part == 1) m_MucZRGap[part][seg][gap]->
SetRotatable(
true);
1507 m_MucZRGap[part][seg][gap]->
Draw(
"");
1516 for (Int_t part =
GetPartNb()-1; part >= 0; part--) {
1517 for (Int_t seg = 0; seg <
GetSegNb(part); seg++) {
1518 for (Int_t gap = 0; gap <
GetGapNb(part); gap++) {
1519 for (Int_t strip = 0; strip <
GetStripNb(part, seg, gap); strip++) {
1520 if (m_Muc2DStrip[part][seg][gap][strip]) {
1521 m_Muc2DStrip[part][seg][gap][strip]->
SetFired(
false);
1525 m_Muc2DStrip[part][seg][gap][strip]->
Draw(
"");
1540 if (!view) cout <<
"MucROOTGeo::DrawHits(), BesView not found" << endl;
R__EXTERN BesEvent * gEvent
double P(RecMdcKalTrack *trk)
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
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 SetPhysicalDefaultVis()
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