54 for (Int_t
i=0;
i< 16;
i++){
58 vertBox[
i] = (-vert[3] - spaces);
60 else if (
i==8 ||
i==9)
62 vertBox[
i] = (-vert[11] - spaces);
64 else if (
i==7 ||
i==15)
66 vertBox[
i] = (-vert[
i-1] - spaces);
68 else if (
i==2 ||
i==10)
70 vertBox[
i] = (-vert[
i+1] - spaces);
74 vertBox[
i] = (vert[
i] + spaces);
79 for (Int_t
i=0;
i< 16;
i++){
83 vertSub[
i] = (vertBox[
i]*2 - spacesSub);
85 else if (
i==8 ||
i==9)
87 vertSub[
i] = (vertBox[
i]*2 - spacesSub);
89 else if (
i==7 ||
i==15)
91 vertSub[
i] = (vertBox[
i]*2 - spacesSub);
93 else if (
i==2 ||
i==10)
95 vertSub[
i] = (vertBox[
i]*2 - spacesSub);
99 vertSub[
i] = (vertBox[
i]*2 + spacesSub);
105 for (Int_t
i=0;
i< 16;
i++){
110 else if (
i==8 ||
i==9)
114 else if (
i==7 ||
i==15)
116 vertQuar[
i] = (vertSub[
i]*9 - spacesSub);
118 else if (
i==2 ||
i==10)
129 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
132 gSystem->Load(
"libGeoBase");
133 gSystem->Load(
"libParBase");
134 gSystem->Load(
"libBase");
135 gSystem->Load(
"libPndData");
136 gSystem->Load(
"libPassive");
139 TFile*
fi =
new TFile(outfile,
"RECREATE");
141 FairGeoLoader*
geoLoad =
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
142 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
143 geoFace->setMediaFile(
"../../geometry/media_pnd.geo");
144 geoFace->readMedia();
147 FairGeoMedia *
Media = geoFace->getMedia();
155 Int_t
nmed=geobuild->createMedium(CbmMediumAir);
156 nmed=geobuild->createMedium(CbmMediumPWO);
157 nmed=geobuild->createMedium(CbmMediumCarbon);
158 nmed=geobuild->createMedium(CbmMediumAluminium);
160 TGeoManager*
gGeoMan = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
166 TGeoVolume *
top =
new TGeoVolumeAssembly(
"Emc4");
168 gGeoMan->SetTopVolume(top);
206 cout<<
"-----------------------------------------------> Quarter VOLUME " <<endl;
207 name =
"QuarterShape";
208 QuarterShape =
new TGeoArb8(name,dz,vertQuar);
210 name =
"Quarter4Vol";
213 QuarterVol =
new TGeoVolumeAssembly(name);
216 name =
"SubunitShape";
217 SubunitShape =
new TGeoArb8(name,dz,vertSub);
223 name1 =
"SubunitVol1";
224 name2 =
"SubunitVol2";
225 name3 =
"SubunitVol3";
226 name4 =
"SubunitVol4";
227 name5 =
"SubunitVol5";
228 name6 =
"SubunitVol6";
229 name7 =
"SubunitVol7";
230 name8 =
"SubunitVol8";
231 name9 =
"SubunitVol9";
232 SubunitVol =
new TGeoVolumeAssembly(name);
233 SubunitVol1 =
new TGeoVolumeAssembly(name1);
234 SubunitVol2 =
new TGeoVolumeAssembly(name2);
235 SubunitVol3 =
new TGeoVolumeAssembly(name3);
236 SubunitVol4 =
new TGeoVolumeAssembly(name4);
237 SubunitVol5 =
new TGeoVolumeAssembly(name5);
238 SubunitVol6 =
new TGeoVolumeAssembly(name6);
239 SubunitVol7 =
new TGeoVolumeAssembly(name7);
240 SubunitVol8 =
new TGeoVolumeAssembly(name8);
241 SubunitVol9 =
new TGeoVolumeAssembly(name9);
245 BoxShape =
new TGeoArb8(name,dz,vertBox);
250 BoxVol =
new TGeoVolumeAssembly(name);
263 BoxVol1 =
new TGeoVolumeAssembly(name1);
264 BoxVol2 =
new TGeoVolumeAssembly(name2);
265 BoxVol3 =
new TGeoVolumeAssembly(name3);
266 BoxVol4 =
new TGeoVolumeAssembly(name4);
274 cout <<
"----------------> BOX number: " <<
b <<endl;
276 trBox =
new TGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox, 0.);
277 rotBox =
new TGeoRotation();
282 trBox =
new TGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox, 0.);
283 rotBox =
new TGeoRotation();
288 trBox =
new TGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox, 0.);
289 rotBox =
new TGeoRotation();
294 trBox =
new TGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox, 0.);
295 rotBox =
new TGeoRotation();
299 TGeoCombiTrans* trrotBox=
new TGeoCombiTrans(trBox,rotBox);
304 trrotBox->SetName(name);
305 trrotBox->RegisterYourself();
307 SubunitVol->AddNode(BoxVol,
b,trrotBox);
313 trrotBox->SetName(name);
314 trrotBox->RegisterYourself();
316 SubunitVol1->AddNode(BoxVol,
b,trrotBox);
320 trrotBox->SetName(name);
321 trrotBox->RegisterYourself();
323 SubunitVol2->AddNode(BoxVol1,
b,trrotBox);
327 trrotBox->SetName(name);
328 trrotBox->RegisterYourself();
330 SubunitVol3->AddNode(BoxVol3,
b,trrotBox);
331 SubunitVol9->AddNode(BoxVol4,
b,trrotBox);
335 trrotBox->SetName(name);
336 trrotBox->RegisterYourself();
338 SubunitVol4->AddNode(BoxVol,
b,trrotBox);
342 trrotBox->SetName(name);
343 trrotBox->RegisterYourself();
345 SubunitVol5->AddNode(BoxVol1,
b,trrotBox);
349 trrotBox->SetName(name);
350 trrotBox->RegisterYourself();
352 SubunitVol6->AddNode(BoxVol,
b,trrotBox);
353 SubunitVol8->AddNode(BoxVol2,
b,trrotBox);
357 trrotBox->SetName(name);
358 trrotBox->RegisterYourself();
360 SubunitVol7->AddNode(BoxVol2,
b,trrotBox);
364 name =
"CrystalShape";
365 CrystalShape =
new TGeoArb8(name,dz,vert);
369 CrystalVol =
new TGeoVolume(name,CrystalShape,gGeoMan->GetMedium(medium));
374 CrystalVol->SetLineColor(5);
377 cout <<
" -----> CRYSTAL number: "<< k << endl;
379 trCrystal =
new TGeoTranslation(tr/2.+0.5*kSpaceInBox,tr/2.+0.5*kSpaceInBox,0.);
380 rotCrystal =
new TGeoRotation() ;
382 trCrystal=
new TGeoTranslation(-tr/2.-0.5*kSpaceInBox,-tr/2.-0.5*kSpaceInBox,0.);
383 rotCrystal =
new TGeoRotation();
384 rotCrystal.RotateZ(180.);
386 trCrystal=
new TGeoTranslation(-tr/2.-0.5*kSpaceInBox,tr/2.+0.5*kSpaceInBox,0.);
387 rotCrystal =
new TGeoRotation();
388 rotCrystal.RotateZ(90.);
390 trCrystal=
new TGeoTranslation(tr/2.+0.5*kSpaceInBox,-tr/2.-0.5*kSpaceInBox,0.);
391 rotCrystal =
new TGeoRotation() ;
392 rotCrystal.RotateZ(270.);
395 TGeoCombiTrans* trrotCrystal=
new TGeoCombiTrans(trCrystal,rotCrystal);
399 trrotCrystal->SetName(name);
400 trrotCrystal->RegisterYourself();
402 BoxVol->AddNode(CrystalVol,k,trrotCrystal);
406 trrotCrystal->SetName(name);
407 trrotCrystal->RegisterYourself();
409 BoxVol1->AddNode(CrystalVol,k,trrotCrystal);
413 trrotCrystal->SetName(name);
414 trrotCrystal->RegisterYourself();
416 BoxVol2->AddNode(CrystalVol,k,trrotCrystal);
420 trrotCrystal->SetName(name);
421 trrotCrystal->RegisterYourself();
423 BoxVol3->AddNode(CrystalVol,k,trrotCrystal);
425 if (k==0 || k==2 || k==3) {
427 trrotCrystal->SetName(name);
428 trrotCrystal->RegisterYourself();
430 BoxVol4->AddNode(CrystalVol,k,trrotCrystal);
447 if (
row==3 &&
col==3) flag=0;
448 if (
row==3 &&
col==2) flag=0;
449 if (
row==2 &&
col==3) flag=0;
452 if (
row==0 &&
col==0) flag=10;
453 if (
row==0 &&
col==3) flag=-1;
454 if (
row==1 &&
col==3) flag=-2;
455 if (
row==2 &&
col==2) flag=-3;
456 if (
row==3 &&
col==0) flag=-4;
457 if (
row==3 &&
col==1) flag=-5;
463 cout<<
"----------------------------> 16 CRYSTALS SUBUNIT No: " << jj <<endl;
465 rotSub =
new TGeoRotation();
478 Double_t addShiftX=FrontFaceToOffPoint*tan_alpha1;
481 Double_t addShiftY=FrontFaceToOffPoint*tan_alpha2;
486 trSub =
new TGeoTranslation(ShiftX, ShiftY, 0.);
488 TGeoCombiTrans* thAngle=
new TGeoCombiTrans(trSub,rotSub);
492 thAngle->SetName(name);
493 thAngle->RegisterYourself();
497 QuarterVol->AddNode(SubunitVol,jj,thAngle);
501 QuarterVol->AddNode(SubunitVol9,jj,thAngle);
505 QuarterVol->AddNode(SubunitVol4,jj,thAngle);
506 QuarterVol->AddNode(SubunitVol5,jj,thAngle);
510 QuarterVol->AddNode(SubunitVol1,jj,thAngle);
511 QuarterVol->AddNode(SubunitVol2,jj,thAngle);
515 QuarterVol->AddNode(SubunitVol4,jj,thAngle);
516 QuarterVol->AddNode(SubunitVol6,jj,thAngle);
517 QuarterVol->AddNode(SubunitVol3,jj,thAngle);
521 QuarterVol->AddNode(SubunitVol1,jj,thAngle);
522 QuarterVol->AddNode(SubunitVol6,jj,thAngle);
523 QuarterVol->AddNode(SubunitVol7,jj,thAngle);
527 QuarterVol->AddNode(SubunitVol1,jj,thAngle);
528 QuarterVol->AddNode(SubunitVol8,jj,thAngle);
535 trQuar =
new TGeoTranslation(0.5*sizeOfQuar,0.5*sizeOfQuar,0.);
536 rotQuar =
new TGeoRotation();
538 TGeoCombiTrans*
trrotQuar=
new TGeoCombiTrans(trQuar,rotQuar);
540 trrotQuar->SetName(name);
541 trrotQuar->RegisterYourself();
549 trrotQuar->ReflectX(1);
551 top->AddNode(QuarterVol,1,trrotQuar);
553 for (Int_t q=1; q<=3; q++){
558 reflection.ReflectY(1);
559 reflection.ReflectX(1);
560 ttt =
new TGeoTranslation(-0.5*sizeOfQuar,-0.5*sizeOfQuar,0.);
563 reflection.ReflectY(1);
564 reflection.ReflectX(1);
565 reflection.ReflectX(1);
566 ttt =
new TGeoTranslation(0.5*sizeOfQuar,-0.5*sizeOfQuar,0.);
569 reflection.ReflectX(1);
570 reflection.ReflectX(1);
571 ttt =
new TGeoTranslation(0.5*sizeOfQuar,0.5*sizeOfQuar,0.);
574 top->AddNode(QuarterVol,q+1,
new TGeoCombiTrans(ttt,reflection));
577 gGeoMan->CloseGeometry();
const Double_t kSpaceInSub
TGeoTranslation trCrystal
const Double_t kSpaceSubGlue
FairGeoMedium * CbmMediumCarbon
Double_t FrontFaceToOffPoint
FairGeoMedium * CbmMediumAluminium
FairGeoBuilder * geobuild
TGeoCombiTrans reflection
FairGeoMedium * CbmMediumAir
const Double_t kAlveoleThickness
TGeoCombiTrans * trrotQuar
FairGeoMedium * CbmMediumPWO
FairGeoInterface * geoFace
const Int_t kNumOfCrystals
const Int_t kNumOfQuarters