20#include <TGeoManager.h>
24const int MucROOTGeo::m_kSeg[m_kPart] = {4, 8, 4};
25const int MucROOTGeo::m_kAbsorber[m_kPart] = {9, 9, 9};
26const int MucROOTGeo::m_kGap[m_kPart] = {8, 9, 8};
27const int MucROOTGeo::m_kPanel[m_kPart] = {4, 3, 4};
32 for (
int part = 0; part < m_kPart; part++) {
33 for (
int seg = 0; seg < m_kSegMax; seg++) {
34 for (
int gap = 0; gap < m_kGapMax; gap++) {
35 m_NodeGap[part][seg][gap] = 0;
36 m_PhysicalGap[part][seg][gap] = 0;
39 for (
int strip = 0; strip < m_kStripMax; strip++) {
40 m_NodeStrip[part][seg][gap][strip] = 0;
41 m_PhysicalStrip[part][seg][gap][strip] = 0;
47 string GdmlManagementPath = getenv(
"GDMLMANAGEMENTROOT");
49 string GdmlFile = GdmlManagementPath + string(
"/dat/Muc.gdml");
51 cout <<
"GdmlFile " << GdmlFile << endl;
75 if(!m_Muc) std::cout <<
"m_Muc = 0" << std::endl;
78 for (
int part = 0; part < m_kPart; part++) {
79 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
80 for (
int gap = 0; gap < m_kGap[part]; gap++) {
84 std::stringstream osnameGap;
85 osnameGap <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"G" << gap <<
"_" << gapCount;
86 m_NodeGap[part][seg][gap] =
GetNode( osnameGap.str() );
91 std::stringstream osnameBox;
92 osnameBox <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"G" << gap <<
"Al" <<
"_" <<
"0";
94 TGeoNode *temp =
GetNode( osnameBox.str() );
96 int segment = 0;
if(part==1&&seg==2) segment = 2;
97 std::stringstream osnameStripPlane;
98 osnameStripPlane <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"SP" <<
"_" <<
"0";
99 m_NodeStripPlane[part][seg][gap] =
GetNode( osnameStripPlane.str() );
101 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
102 std::stringstream osnameStrip;
104 osnameStrip <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" <<
"00" << strip <<
"_" << strip;
106 else if(strip < 100) {
107 osnameStrip <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" <<
"0" << strip <<
"_" << strip;
110 osnameStrip <<
"pv_" <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"s" << strip <<
"_" << strip;
113 m_NodeStrip[part][seg][gap][strip] =
GetNode( osnameStrip.str() );
125 int absorberColor = 2;
127 int gasChamberColor = 8;
128 int bakeliteColor = 8;
131 m_Muc->SetLineColor(mucColor);
132 m_Muc->SetVisibility(0);
134 for (
int part = 0; part < m_kPart; part++) {
135 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
136 for (
int absorber = 0; absorber < m_kAbsorber[part]; absorber++) {
140 for (
int panel = 0; panel < m_kPanel[part]; panel++) {
147 for (
int gap = 0; gap < m_kGap[part]; gap++) {
153 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
158 for (
int panel = 0; panel < m_kPanel[part]; panel++) {
159 for(
int bakelite = 0; bakelite < m_kBakelite; bakelite++) {
163 for (
int gasChamber = 0; gasChamber < m_kGasChamber; gasChamber++) {
172 for (
int part = 0; part < m_kPart; part++) {
173 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
174 for (
int gap = 0; gap < m_kGap[part]; gap++) {
175 GetGap(part, seg, gap)->SetVisibility(0);
176 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
177 GetStrip(part, seg, gap, strip)->SetVisibility(0);
189 for (
int part = 0; part < m_kPart; part++) {
190 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
191 for (
int absorber = 0; absorber < m_kAbsorber[part]; absorber++) {
197 for (
int panel = 0; panel < m_kPanel[part]; panel++) {
203 for (
int gap = 0; gap < m_kGap[part]; gap++) {
205 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
209 for (
int panel = 0; panel < m_kPanel[part]; panel++) {
210 for(
int bakelite = 0; bakelite < m_kBakelite; bakelite++) {
213 for (
int gasChamber = 0; gasChamber < m_kGasChamber; gasChamber++) {
221 for (
int part = 0; part < m_kPart; part++) {
222 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
223 for (
int gap = 0; gap < m_kGap[part]; gap++) {
224 GetGap(part, seg, gap)->SetVisibility(1);
225 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
226 GetStrip(part, seg, gap, strip)->SetVisibility(0);
236 for (
int part = 0; part < m_kPart; part++) {
237 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
238 for (
int absorber = 0; absorber < m_kAbsorber[part]; absorber++) {
244 for (
int panel = 0; panel < m_kPanel[part]; panel++) {
250 for (
int gap = 0; gap < m_kGap[part]; gap++) {
251 if (part == 1 && seg > 2) {
253 GetGap(part, seg, gap)->SetVisibility(1);
257 GetGap(part, seg, gap)->SetVisibility(0);
259 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
263 for (
int panel = 0; panel < m_kPanel[part]; panel++) {
264 for (
int bakelite = 0; bakelite < m_kBakelite; bakelite++) {
265 if ((part != 1 && seg > 0 && seg < 3) || (part == 1 && seg > 2))
GetVolumeBakelite(part, seg, gap, panel, bakelite)->SetVisibility(1);
267 for (
int gasChamber = 0; gasChamber < m_kGasChamber; gasChamber++) {
268 if ((part != 1 && seg > 0 && seg < 3) || (part == 1 && seg > 2))
GetVolumeGasChamber(part, seg, gap, panel, gasChamber)->SetVisibility(1);
282 if (gGeoManager == 0) std::cout <<
"Create gGeoManager first" << std::endl;
283 TGeoNode *
bes = gGeoManager->GetTopNode();
286 for (
int part = 0; part < m_kPart; part++) {
287 for (
int seg = 0; seg < m_kSeg[part]; seg++) {
288 for (
int gap = 0; gap < m_kGap[part]; gap++) {
289 TGeoNode *nodeGap =
GetGap(part, seg, gap);
290 m_PhysicalGap[part][seg][gap] = gGeoManager->MakePhysicalNode( TString(
"/") +
bes->GetName() +
291 TString(
"/") + muc->GetName() +
292 TString(
"/") + nodeGap->GetName() +
293 TString(
"/") + nodeGap->GetDaughter(0)->GetName());
294 m_PhysicalGap[part][seg][gap]->SetVisibility(0);
295 m_PhysicalGap[part][seg][gap]->SetIsVolAtt(kFALSE);
307 for (
int strip = 0; strip < m_StripNum[part][seg][gap]; strip++) {
308 TGeoNode *nodeStrip =
GetStrip(part, seg, gap, strip);
309 m_PhysicalStrip[part][seg][gap][strip] = gGeoManager->MakePhysicalNode( TString(
"/") +
bes->GetName() +
310 TString(
"/") + muc->GetName() +
311 TString(
"/") + nodeGap->GetName() +
312 TString(
"/") + nodeGap->GetDaughter(0)->GetName() +
313 TString(
"/") + nodeStripPlane->GetName() +
314 TString(
"/") + nodeStrip->GetName() );
315 m_PhysicalStrip[part][seg][gap][strip]->SetVisibility(0);
316 m_PhysicalStrip[part][seg][gap][strip]->SetIsVolAtt(kFALSE);
317 m_PhysicalStrip[part][seg][gap][strip]->SetLineColor(stripColor);
334 int seg = m_kSeg[part];
341 int gap = m_kGap[part];
348 int strip = m_StripNum[part][seg][gap];
355 std::stringstream osname;
356 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"Ab" << absorber;
364 float thickness = 0.0;
367 thickness = 2.0*((TGeoBBox*)vol->GetShape())->GetDZ();
376 std::stringstream osname;
377 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"Ab" << absorber <<
"Pn" << panel;
385 std::stringstream osname;
386 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"G" << gap;
394 std::stringstream osname;
395 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << seg <<
"G" << gap <<
"Al";
403 int segment = 0;
if(part==1&&seg==2) segment = 2;
404 std::stringstream osname;
405 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" << segment <<
"G" << gap <<
"SP";
413 std::stringstream osname;
415 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" <<
"0" <<
"G" << gap <<
"s" <<
"00" << strip;
418 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" <<
"0" <<
"G" << gap <<
"s" <<
"0" << strip;
421 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" <<
"0" <<
"G" << gap <<
"s" << strip;
430 std::stringstream osname;
431 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" <<
"0" <<
"G" << gap <<
"R" << gasChamber <<
"Pn" << panel <<
"C";
439 std::stringstream osname;
440 osname <<
"l" <<
"Muc" <<
"P" << part <<
"S" <<
"0" <<
"G" << gap <<
"R" << panel <<
"B" << bakelite;
448 if (m_NodeGap[part][seg][gap] != 0) {
449 return m_NodeGap[part][seg][gap];
452 std::cout <<
"Node: " <<
"Part" << part <<
"Seg" << seg <<
"Gap" << gap <<
" not found" << std::endl;
473 if (m_NodeStripPlane[part][seg][gap] != 0) {
474 return m_NodeStripPlane[part][seg][gap];
477 std::cout <<
"Node: " <<
"Part" << part <<
"Seg" << seg <<
"Gap" << gap <<
"StripPlane" <<
" not found" << std::endl;
485 if (m_NodeStrip[part][seg][gap][strip] != 0) {
486 return m_NodeStrip[part][seg][gap][strip];
489 std::cout <<
"Node: " <<
"Part" << part <<
"Seg" <<
"0" <<
"Gap" << gap <<
"Strip" << strip <<
" not found" << std::endl;
497 if (m_PhysicalGap[part][seg][gap] != 0) {
498 return m_PhysicalGap[part][seg][gap];
501 std::cout <<
"PhysicalNode: " <<
"Part" << part <<
"Seg" << seg <<
"Gap" << gap <<
" not found" << std::endl;
521 if (m_PhysicalStrip[part][seg][gap][strip] != 0) {
522 return m_PhysicalStrip[part][seg][gap][strip];
525 std::cout <<
"PhysicalNode: " <<
"Part" << part <<
"Seg" << seg <<
"Gap" << gap <<
"Strip" << strip <<
" not found" << std::endl;
void SetQuarterVisible()
Set quater visible;.
TGeoVolume * GetVolumeStripPlane(int part, int seg, int gap)
Get strip plane volume;.
void SetPhysicalNode()
Set the pointers to the physical nodes;.
float GetAbsorberThickness(int part, int seg, int absorber)
Get thickness of an absorber;.
TGeoVolume * GetVolumeAluminumBox(int part, int seg, int gap)
Get box volume;
TGeoVolume * GetVolumeGasChamber(int part, int seg, int gap, int panel, int gasChamber)
Get rpc gas chamber volume;
TGeoPhysicalNode * GetPhysicalStrip(int part, int seg, int gap, int strip)
Get strip physical node;.
TGeoVolume * GetVolumeBakelite(int part, int seg, int gap, int panel, int bakelite)
Get rpc bakelite volume;
void SetNode()
Set the pointers to theirs nodes;.
TGeoVolume * GetVolumeAbsorberPanel(int part, int seg, int absorber, int panel)
Get absorber panel volume;
void SetAllVisible()
Set all visible;.
TGeoVolume * GetVolumeGap(int part, int seg, int gap)
Get gap volume;
int GetSegNum(int part)
Get number of segment on part;.
TGeoNode * GetGap(int part, int seg, int gap)
Get absorber node;
TGeoNode * GetStripPlane(int part, int seg, int gap)
Get box node;.
void SetDefaultVis()
Set default visual attributes;.
TGeoVolume * GetVolumeStrip(int part, int seg, int gap, int strip)
Get strip volume;
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;
int GetStripNum(int part, int seg, int gap)
Get number of strip on gap;.
int GetPartNum()
Get number of part;.
void InitFromGdml(const char *gdmlFile, const char *setupName)
Initialize the instance of ROOTGeo.
int GetGapNum(int part)
Get number of gap on part;.
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.