51 for (Int_t
i=0;
i< 16;
i++){
55 vertBox[
i] = (-vert[3] - spaces);
57 else if (
i==8 ||
i==9)
59 vertBox[
i] = (-vert[11] - spaces);
61 else if (
i==7 ||
i==15)
63 vertBox[
i] = (-vert[
i-1] - spaces);
65 else if (
i==2 ||
i==10)
67 vertBox[
i] = (-vert[
i+1] - spaces);
71 vertBox[
i] = (vert[
i] + spaces);
76 for (Int_t
i=0;
i< 16;
i++){
80 vertSub[
i] = (vertBox[
i]*2 - spacesSub);
82 else if (
i==8 ||
i==9)
84 vertSub[
i] = (vertBox[
i]*2 - spacesSub);
86 else if (
i==7 ||
i==15)
88 vertSub[
i] = (vertBox[
i]*2 - spacesSub);
90 else if (
i==2 ||
i==10)
92 vertSub[
i] = (vertBox[
i]*2 - spacesSub);
96 vertSub[
i] = (vertBox[
i]*2 + spacesSub);
102 for (Int_t
i=0;
i< 16;
i++){
107 else if (
i==8 ||
i==9)
111 else if (
i==7 ||
i==15)
113 vertQuar[
i] = (vertSub[
i]*9 - spacesSub);
115 else if (
i==2 ||
i==10)
126 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
129 gSystem->Load(
"libGeoBase");
130 gSystem->Load(
"libParBase");
131 gSystem->Load(
"libBase");
132 gSystem->Load(
"libPndData");
133 gSystem->Load(
"libPassive");
136 TFile*
fi =
new TFile(outfile,
"RECREATE");
138 FairGeoLoader*
geoLoad =
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
139 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
140 geoFace->setMediaFile(
"../../geometry/media_pnd.geo");
141 geoFace->readMedia();
144 FairGeoMedia *
Media = geoFace->getMedia();
152 Int_t
nmed=geobuild->createMedium(CbmMediumAir);
153 nmed=geobuild->createMedium(CbmMediumPWO);
154 nmed=geobuild->createMedium(CbmMediumCarbon);
155 nmed=geobuild->createMedium(CbmMediumAluminium);
157 TGeoManager*
gGeoMan = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
164 TGeoVolume *
top =
new TGeoVolumeAssembly(
"Emc4");
166 gGeoMan->SetTopVolume(top);
203 cout<<
"-----------------------------------------------> Quarter VOLUME " <<endl;
204 name =
"QuarterShape";
205 QuarterShape =
new TGeoArb8(name,dz,vertQuar);
207 name =
"Quarter4Vol";
210 QuarterVol =
new TGeoVolumeAssembly(name);
213 name =
"SubunitShape";
214 SubunitShape =
new TGeoArb8(name,dz,vertSub);
220 name1 =
"SubunitVol1";
221 name2 =
"SubunitVol2";
222 name3 =
"SubunitVol3";
223 name4 =
"SubunitVol4";
224 name5 =
"SubunitVol5";
225 name6 =
"SubunitVol6";
226 name7 =
"SubunitVol7";
227 name8 =
"SubunitVol8";
228 name9 =
"SubunitVol9";
229 SubunitVol =
new TGeoVolumeAssembly(name);
230 SubunitVol1 =
new TGeoVolumeAssembly(name1);
231 SubunitVol2 =
new TGeoVolumeAssembly(name2);
232 SubunitVol3 =
new TGeoVolumeAssembly(name3);
233 SubunitVol4 =
new TGeoVolumeAssembly(name4);
234 SubunitVol5 =
new TGeoVolumeAssembly(name5);
235 SubunitVol6 =
new TGeoVolumeAssembly(name6);
236 SubunitVol7 =
new TGeoVolumeAssembly(name7);
237 SubunitVol8 =
new TGeoVolumeAssembly(name8);
238 SubunitVol9 =
new TGeoVolumeAssembly(name9);
242 BoxShape =
new TGeoArb8(name,dz,vertBox);
248 BoxVol =
new TGeoVolumeAssembly(name);
261 BoxVol1 =
new TGeoVolumeAssembly(name1);
262 BoxVol2 =
new TGeoVolumeAssembly(name2);
263 BoxVol3 =
new TGeoVolumeAssembly(name3);
264 BoxVol4 =
new TGeoVolumeAssembly(name4);
273 cout <<
"----------------> BOX number: " <<
b <<endl;
275 trBox =
new TGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox, 0.);
276 rotBox =
new TGeoRotation();
277 rotBox.RotateX(0.465518);
278 rotBox.RotateY(-0.465518);
281 trBox =
new TGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox, 0.);
282 rotBox =
new TGeoRotation();
283 rotBox.RotateX(-0.465518);
284 rotBox.RotateY(0.465518);
287 trBox =
new TGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox, 0.);
288 rotBox =
new TGeoRotation();
289 rotBox.RotateX(-0.465518);
290 rotBox.RotateY(-0.465518);
293 trBox =
new TGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox, 0.);
294 rotBox =
new TGeoRotation();
295 rotBox.RotateX(0.465518);
296 rotBox.RotateY(0.465518);
298 TGeoCombiTrans* trrotBox=
new TGeoCombiTrans(trBox,rotBox);
302 trrotBox->SetName(name);
303 trrotBox->RegisterYourself();
305 SubunitVol->AddNode(BoxVol,
b,trrotBox);
310 trrotBox->SetName(name);
311 trrotBox->RegisterYourself();
313 SubunitVol1->AddNode(BoxVol,
b,trrotBox);
317 trrotBox->SetName(name);
318 trrotBox->RegisterYourself();
320 SubunitVol2->AddNode(BoxVol1,
b,trrotBox);
324 trrotBox->SetName(name);
325 trrotBox->RegisterYourself();
327 SubunitVol3->AddNode(BoxVol3,
b,trrotBox);
328 SubunitVol9->AddNode(
BoxVol4,
b,trrotBox);
332 trrotBox->SetName(name);
333 trrotBox->RegisterYourself();
335 SubunitVol4->AddNode(BoxVol,
b,trrotBox);
339 trrotBox->SetName(name);
340 trrotBox->RegisterYourself();
342 SubunitVol5->AddNode(BoxVol1,
b,trrotBox);
346 trrotBox->SetName(name);
347 trrotBox->RegisterYourself();
349 SubunitVol6->AddNode(BoxVol,
b,trrotBox);
350 SubunitVol8->AddNode(BoxVol2,
b,trrotBox);
354 trrotBox->SetName(name);
355 trrotBox->RegisterYourself();
357 SubunitVol7->AddNode(BoxVol2,
b,trrotBox);
361 name =
"CrystalShape";
362 CrystalShape =
new TGeoArb8(name,dz,vert);
366 CrystalVol =
new TGeoVolume(name,CrystalShape,gGeoMan->GetMedium(medium));
371 CrystalVol->SetLineColor(5);
374 cout <<
" -----> CRYSTAL number: "<< k << endl;
376 trCrystal =
new TGeoTranslation(tr/2.+0.5*kSpaceInBox,tr/2.+0.5*kSpaceInBox,0.);
377 rotCrystal =
new TGeoRotation() ;
379 trCrystal=
new TGeoTranslation(-tr/2.-0.5*kSpaceInBox,-tr/2.-0.5*kSpaceInBox,0.);
380 rotCrystal =
new TGeoRotation();
381 rotCrystal.RotateZ(180.);
383 trCrystal=
new TGeoTranslation(-tr/2.-0.5*kSpaceInBox,tr/2.+0.5*kSpaceInBox,0.);
384 rotCrystal =
new TGeoRotation();
385 rotCrystal.RotateZ(90.);
387 trCrystal=
new TGeoTranslation(tr/2.+0.5*kSpaceInBox,-tr/2.-0.5*kSpaceInBox,0.);
388 rotCrystal =
new TGeoRotation() ;
389 rotCrystal.RotateZ(270.);
391 TGeoCombiTrans* trrotCrystal=
new TGeoCombiTrans(trCrystal,rotCrystal);
395 trrotCrystal->SetName(name);
396 trrotCrystal->RegisterYourself();
398 BoxVol->AddNode(CrystalVol,k,trrotCrystal);
402 trrotCrystal->SetName(name);
403 trrotCrystal->RegisterYourself();
405 BoxVol1->AddNode(CrystalVol,k,trrotCrystal);
409 trrotCrystal->SetName(name);
410 trrotCrystal->RegisterYourself();
412 BoxVol2->AddNode(CrystalVol,k,trrotCrystal);
416 trrotCrystal->SetName(name);
417 trrotCrystal->RegisterYourself();
419 BoxVol3->AddNode(CrystalVol,k,trrotCrystal);
421 if (k==0 || k==2 || k==3) {
423 trrotCrystal->SetName(name);
424 trrotCrystal->RegisterYourself();
426 BoxVol4->AddNode(CrystalVol,k,trrotCrystal);
442 if (
row==3 &&
col==3) flag=0;
443 if (
row==3 &&
col==2) flag=0;
444 if (
row==2 &&
col==3) flag=0;
447 if (
row==0 &&
col==0) flag=10;
448 if (
row==0 &&
col==3) flag=-1;
449 if (
row==1 &&
col==3) flag=-2;
450 if (
row==2 &&
col==2) flag=-3;
451 if (
row==3 &&
col==0) flag=-4;
452 if (
row==3 &&
col==1) flag=-5;
457 cout<<
"----------------------------> 16 CRYSTALS SUBUNIT No: " << jj <<endl;
459 rotSub =
new TGeoRotation();
466 rotSub.RotateX(RotToZeroSubX);
467 rotSub.RotateY(RotToZeroSubY);
470 Double_t addShiftX=FrontFaceToOffPoint*tan_alpha1;
473 Double_t addShiftY=FrontFaceToOffPoint*tan_alpha2;
478 trSub =
new TGeoTranslation(ShiftX, ShiftY, 0.);
480 TGeoCombiTrans* thAngle=
new TGeoCombiTrans(trSub,rotSub);
484 thAngle->SetName(name);
485 thAngle->RegisterYourself();
489 QuarterVol->AddNode(SubunitVol,jj,thAngle);
493 QuarterVol->AddNode(SubunitVol4,jj,thAngle);
494 QuarterVol->AddNode(SubunitVol5,jj,thAngle);
498 QuarterVol->AddNode(SubunitVol1,jj,thAngle);
499 QuarterVol->AddNode(SubunitVol2,jj,thAngle);
503 QuarterVol->AddNode(SubunitVol4,jj,thAngle);
504 QuarterVol->AddNode(SubunitVol6,jj,thAngle);
505 QuarterVol->AddNode(SubunitVol3,jj,thAngle);
509 QuarterVol->AddNode(SubunitVol1,jj,thAngle);
510 QuarterVol->AddNode(SubunitVol6,jj,thAngle);
511 QuarterVol->AddNode(SubunitVol7,jj,thAngle);
515 QuarterVol->AddNode(SubunitVol1,jj,thAngle);
516 QuarterVol->AddNode(SubunitVol8,jj,thAngle);
520 QuarterVol->AddNode(SubunitVol9,jj,thAngle);
528 trQuar =
new TGeoTranslation(0.5*sizeOfQuar,0.5*sizeOfQuar,0.);
529 rotQuar =
new TGeoRotation();
531 TGeoCombiTrans*
trrotQuar=
new TGeoCombiTrans(trQuar,rotQuar);
533 trrotQuar->SetName(name);
534 trrotQuar->RegisterYourself();
542 trrotQuar->ReflectX(1);
544 top->AddNode(QuarterVol,1,trrotQuar);
546 for (Int_t q=1; q<=3; q++){
551 reflection.ReflectY(1);
552 reflection.ReflectX(1);
553 ttt =
new TGeoTranslation(-0.5*sizeOfQuar,-0.5*sizeOfQuar,0.);
556 reflection.ReflectY(1);
557 reflection.ReflectX(1);
558 reflection.ReflectX(1);
559 ttt =
new TGeoTranslation(0.5*sizeOfQuar,-0.5*sizeOfQuar,0.);
562 reflection.ReflectX(1);
563 reflection.ReflectX(1);
564 ttt =
new TGeoTranslation(0.5*sizeOfQuar,0.5*sizeOfQuar,0.);
567 top->AddNode(QuarterVol,q+1,
new TGeoCombiTrans(ttt,reflection));
570 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