71 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
74 gSystem->Load(
"libGeoBase");
75 gSystem->Load(
"libParBase");
76 gSystem->Load(
"libBase");
77 gSystem->Load(
"libPndData");
78 gSystem->Load(
"libPassive");
83 TFile*
fi =
new TFile(outfile,
"RECREATE");
85 FairGeoLoader*
geoLoad =
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
86 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
87 geoFace->setMediaFile(
"../../geometry/media_pnd.geo");
91 FairGeoMedia *
Media = geoFace->getMedia();
92 FairGeoBuilder *
geobuild=geoLoad->getGeoBuilder();
94 FairGeoMedium *medab = Media->getMedium(
"HYPdiamond");
95 Int_t nmedGe=geobuild->createMedium(medab);
98 FairGeoMedium *medsci = Media->getMedium(
"HYPsilicon");
99 Int_t nmedsci=geobuild->createMedium(medsci);
101 FairGeoMedium *medcar = Media->getMedium(
"HYPcarbon");
102 Int_t nmedC=geobuild->createMedium(medcar);
106 TGeoManager*
gGeoMan = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
108 TGeoVolume *
top =
new TGeoVolumeAssembly(
"hypst");
110 gGeoMan->SetTopVolume(top);
112 TGeoVolume *complex =
new TGeoVolumeAssembly(
"complex");
113 TGeoVolume *outer =
new TGeoVolumeAssembly(
"outer");
114 TGeoVolume *inner =
new TGeoVolumeAssembly(
"inner");
117 const Int_t
max = 80;
151 Int_t NbOfLayers = 20;
153 Double_t lt = fAbsorberThickness + fGapThickness;
163 TGeoRotation*
rot =
new TGeoRotation();
164 TGeoRotation* rotO =
new TGeoRotation();
165 TGeoRotation*
rot2 =
new TGeoRotation();
169 TGeoVolume *BoxAsmb[4];
172 TGeoVolume *LayAsmb[80];
185 LayO =
new TGeoBBox(
"stglOTile",side ,side ,0.03);
187 LayAO =
new TGeoVolume(
"stglSi",LayO, gGeoMan->GetMedium(
"HYPsilicon"));
189 LayI =
new TGeoBBox(
"stglITile",side ,side ,0.03);
191 LayAI =
new TGeoVolume(
"stglSi",LayI, gGeoMan->GetMedium(
"HYPsilicon"));
214 Double_t dx_bbox, dy_bbox, dz_bbox, phi_curr;
216 for(Int_t
m = 0;
m < 20;
m ++){
218 phi_curr = (
m+1)*(18*pi)/180.;
219 rotO->SetAngles(0,0,0);
221 rotO->RotateZ( -(
m)*18);
223 dx_bbox = 9.5*
sin(phi_curr);
224 dy_bbox = 9.5*
cos(phi_curr);
227 inner->AddNode(LayAO,
m+80,
new TGeoCombiTrans(dx_bbox, dy_bbox, 0,
new TGeoRotation (*rotO)));
231 Double_t dx_bboxa, dy_bboxa, dz_bboxa, phi_curra;
233 for(Int_t it = 0; it < 24; it ++){
235 phi_curra = (it+1)*((2*ang)*
pi)/180.;
236 rotO->SetAngles(0,0,0);
238 rotO->RotateZ( -(it)*(2*ang));
240 dx_bboxa = 13.5*
sin(phi_curra);
241 dy_bboxa = 13.5*
cos(phi_curra);
244 outer->AddNode(LayAI, it+100,
new TGeoCombiTrans(dx_bboxa, dy_bboxa, 0,
new TGeoRotation (*rotO)));
252 TGeoVolume *LaySi[80];
253 TGeoVolume *LayAb[80];
258 for(
int i=0;
i<4;
i++){
261 rot->SetAngles(0,0,0);
262 rot2->SetAngles(0,0,0);
264 rot->RotateZ((-1*
i)*90.0);
265 rot2->RotateZ(-1*
i*90.0);
268 v2 =
new TVector3(
rotate(TVector3((stsyz/2)-hole,stsyz/2,0.),rot2));
269 sprintf(tempname,
"stgQuad%d",
i+1);
270 sprintf(name4,
"transQuad%d",
i+1);
272 TGeoCombiTrans* trc5 =
new TGeoCombiTrans(v2->x(), v2->y(), v2->z(),
273 new TGeoRotation (*rot));
274 trc5->SetName(name4);
275 trc5->RegisterYourself();
277 BoxAsmb[
d]=
new TGeoVolumeAssembly(tempname);
278 complex->AddNode(BoxAsmb[d],0,trc5);
283 string tmaterial[4]={
"HYPdiamond",
"HYPdiamond",
"beryllium",
"aluminium"};
285 char tmplay[100],tmplayb[100],tmpAbs[100], tmpGap[100],tmpVAbs[100], tmpVGap[100];
288 Double_t firstPosition = -0.5*SecTargThick + 0.5*LayThick;
291 Double_t firstLength = 0.5*SecTargSizeYZ + lengthpar;
294 Double_t lastLength = SecTargSizeYZ;
298 TVector3 vecAbs,vecGap;
304 Double_t fStartPosition = firstPosition;
305 Double_t fHalfLayThick = 0.5*LayThick;
307 Double_t fHalfLengthFirst = 0.5 * firstLength;
308 Double_t fHalfLengthIncr = 0.5 *(lastLength-firstLength)/NbOfLayers;
309 Double_t fHalfLastLength = 0.5*lastLength;
311 Double_t param[6]={fStartPosition,fHalfLayThick,fSpacing,fHalfLengthFirst,
312 fHalfLengthIncr,fHalfLastLength};
319 for(Int_t
i=0;
i<20;
i++)
330 v_Pos.SetY(-v_Pos.y());
332 v_Pos.SetZ(-v_Pos.z());
346 zla[
i]= fAbsorberThickness/2;
351 vecAbs.SetZ(-fGapThickness/2.0);
361 zlg[
i]= fGapThickness/2.0;
366 vecGap.SetZ(fAbsorberThickness/2);
382 for(Int_t j=0; j<4;j++)
387 for(Int_t k=0; k<20; k++)
395 sprintf(tmplay,
"stgLay%d",k);
396 sprintf(tmpAbs,
"stgBlAb%d",k);
397 sprintf(tmpGap,
"stgBlSi%d",k);
398 sprintf(tmpVAbs,
"stglAb%d",k);
399 sprintf(tmpVGap,
"stglSi%d",k);
401 sprintf(name,
"transAb%d",k);
402 sprintf(name1,
"transSi%d",k);
403 sprintf(name2,
"transLay%d",k);
405 LayAsmb[
t]=
new TGeoVolumeAssembly(tmplay);
411 BoxAb[
t] =
new TGeoBBox(tmpAbs,da[k],ha[k],zla[k]);
412 LayAb[
t] =
new TGeoVolume(tmpVAbs,BoxAb[t],gGeoMan->GetMedium(
"HYPdiamond"));
413 BoxSi[
t] =
new TGeoBBox(tmpGap,dg[k],hg[k],zlg[k]);
414 LaySi[
t] =
new TGeoVolume(tmpVGap,BoxSi[t],gGeoMan->GetMedium(
"HYPsilicon"));
415 LaySi[
t]->SetLineColor(kPink);
416 LayAb[
t]->SetLineColor(kYellow);
419 TGeoCombiTrans*
trc1 =
new TGeoCombiTrans(xa[k],ya[k],za[k],
new TGeoRotation ());
421 trc1->RegisterYourself();
422 LayAsmb[
t]->AddNode(LayAb[t],k, trc1);
425 if(k<2||(k==5||k==10||k==15)){
426 TGeoCombiTrans*
trc2 =
new TGeoCombiTrans(xg[k],yg[k],zg[k],
new TGeoRotation ());
427 trc2->SetName(name1);
428 trc2->RegisterYourself();
429 LayAsmb[
t]->AddNode(LaySi[t],k, trc2);
430 TGeoCombiTrans*
trc3 =
new TGeoCombiTrans(xl[k],yl[k],zl[k],
new TGeoRotation ());
431 trc3->SetName(name2);
432 trc3->RegisterYourself();
433 BoxAsmb[j]->AddNode(LayAsmb[t],k,trc3);
442 for(Int_t k=20; k<36; k++)
450 sprintf(tmplay,
"stgLay%d",k);
451 sprintf(tmpAbs,
"stgBlAb%d",k);
452 sprintf(tmpGap,
"stgBlSi%d",k);
453 sprintf(tmpVAbs,
"stglAb%d",k);
454 sprintf(tmpVGap,
"stglSi%d",k);
456 sprintf(name,
"transAb%d",k);
457 sprintf(name1,
"transSi%d",k);
458 sprintf(name2,
"transLay%d",k);
460 LayAsmb[
t]=
new TGeoVolumeAssembly(tmplay);
466 BoxAb[
t] =
new TGeoBBox(tmpAbs,da[k-20],ha[k-20],zla[k-20]);
467 LayAb[
t] =
new TGeoVolume(tmpVAbs,BoxAb[k],gGeoMan->GetMedium(
"HYPdiamond"));
468 BoxSi[
t] =
new TGeoBBox(tmpGap,dg[k-20],hg[k-20],zlg[k-20]);
469 LaySi[
t] =
new TGeoVolume(tmpVGap,BoxSi[t],gGeoMan->GetMedium(
"HYPsilicon"));
470 LaySi[
t]->SetLineColor(kPink);
471 LayAb[
t]->SetLineColor(kYellow);
475 TGeoCombiTrans* trc1 =
new TGeoCombiTrans(xa[k-20],ya[k-20],za[k-20],
new TGeoRotation ());
477 trc1->RegisterYourself();
478 LayAsmb[
t]->AddNode(LayAb[t],k, trc1);
481 if(k<22||(k==25||k==30||k==35)){
483 TGeoCombiTrans* trc2 =
new TGeoCombiTrans(xg[k-20],yg[k-20],zg[k-20],
new TGeoRotation ());
484 trc2->SetName(name1);
485 trc2->RegisterYourself();
486 LayAsmb[
t]->AddNode(LaySi[t],k, trc2);
489 TGeoCombiTrans* trc3 =
new TGeoCombiTrans(xl[k-20],yl[k-20],zl[k-20],
new TGeoRotation ());
490 trc3->SetName(name2);
491 trc3->RegisterYourself();
492 BoxAsmb[j]->AddNode(LayAsmb[t],k,trc3);
501 for(Int_t k=40; k<56; k++)
509 sprintf(tmplay,
"stgLay%d",k);
510 sprintf(tmpAbs,
"stgBlAb%d",k);
511 sprintf(tmpGap,
"stgBlSi%d",k);
512 sprintf(tmpVAbs,
"stglAb%d",k);
513 sprintf(tmpVGap,
"stglSi%d",k);
515 sprintf(name,
"transAb%d",k);
516 sprintf(name1,
"transSi%d",k);
517 sprintf(name2,
"transLay%d",k);
519 LayAsmb[
t]=
new TGeoVolumeAssembly(tmplay);
525 BoxAb[
t] =
new TGeoBBox(tmpAbs,da[k-40],ha[k-40],zla[k-40]);
526 LayAb[
t] =
new TGeoVolume(tmpVAbs,BoxAb[t],gGeoMan->GetMedium(
"HYPdiamond"));
527 BoxSi[
t] =
new TGeoBBox(tmpGap,dg[k-40],hg[k-40],zlg[k-40]);
528 LaySi[
t] =
new TGeoVolume(tmpVGap,BoxSi[t],gGeoMan->GetMedium(
"HYPsilicon"));
529 LaySi[
t]->SetLineColor(kPink);
530 LayAb[
t]->SetLineColor(kYellow);
536 TGeoCombiTrans* trc1 =
new TGeoCombiTrans(xa[k-40],ya[k-40],za[k-40],
new TGeoRotation ());
538 trc1->RegisterYourself();
539 LayAsmb[
t]->AddNode(LayAb[t],k, trc1);
541 if(k<42||(k==45||k==50||k==55)){
543 TGeoCombiTrans* trc2 =
new TGeoCombiTrans(xg[k-40],yg[k-40],zg[k-40],
new TGeoRotation ());
544 trc2->SetName(name1);
545 trc2->RegisterYourself();
546 LayAsmb[
t]->AddNode(LaySi[t],k, trc2);
549 TGeoCombiTrans* trc3 =
new TGeoCombiTrans(xl[k-40],yl[k-40],zl[k-40],
new TGeoRotation ());
550 trc3->SetName(name2);
551 trc3->RegisterYourself();
552 BoxAsmb[j]->AddNode(LayAsmb[t],k,trc3);
561 for(Int_t k=60; k<76; k++)
569 sprintf(tmplay,
"stgLay%d",k);
570 sprintf(tmpAbs,
"stgBlAb%d",k);
571 sprintf(tmpGap,
"stgBlSi%d",k);
572 sprintf(tmpVAbs,
"stglAb%d",k);
573 sprintf(tmpVGap,
"stglSi%d",k);
575 sprintf(name,
"transAb%d",k);
576 sprintf(name1,
"transSi%d",k);
577 sprintf(name2,
"transLay%d",k);
579 LayAsmb[
t]=
new TGeoVolumeAssembly(tmplay);
585 BoxAb[
t] =
new TGeoBBox(tmpAbs,da[k-60],ha[k-60],zla[k-60]);
586 LayAb[
t] =
new TGeoVolume(tmpVAbs,BoxAb[t],gGeoMan->GetMedium(
"HYPdiamond"));
587 BoxSi[
t] =
new TGeoBBox(tmpGap,dg[k-60],hg[k-60],zlg[k-60]);
588 LaySi[
t] =
new TGeoVolume(tmpVGap,BoxSi[t],gGeoMan->GetMedium(
"HYPsilicon"));
589 LaySi[
t]->SetLineColor(kPink);
590 LayAb[
t]->SetLineColor(kYellow);
594 TGeoCombiTrans* trc1 =
new TGeoCombiTrans(xa[k-60],ya[k-60],za[k-60],
new TGeoRotation ());
596 trc1->RegisterYourself();
597 LayAsmb[
t]->AddNode(LayAb[t],k, trc1);
600 if(k<62||(k==65||k==70||k==75)){
602 TGeoCombiTrans* trc2 =
new TGeoCombiTrans(xg[k-60],yg[k-60],zg[k-60],
new TGeoRotation ());
603 trc2->SetName(name1);
604 trc2->RegisterYourself();
605 LayAsmb[
t]->AddNode(LaySi[t],k, trc2);
609 TGeoCombiTrans* trc3 =
new TGeoCombiTrans(xl[k-60],yl[k-60],zl[k-60],
new TGeoRotation ());
610 trc3->SetName(name2);
611 trc3->RegisterYourself();
612 BoxAsmb[j]->AddNode(LayAsmb[t],k,trc3);
623 pipe =
new TGeoTube(
"stghypPipe",0.69,0.7,10.);
624 hyppipe =
new TGeoVolume(
"stglpipe",pipe,gGeoMan->GetMedium(
"HYPcarbon"));
626 TGeoCombiTrans* trc4 =
new TGeoCombiTrans(0., 0., 0.,
new TGeoRotation ());
628 trc4->SetName(
"transpipe");
629 trc4->RegisterYourself();
631 TGeoCombiTrans* trc6 =
new TGeoCombiTrans(0., 0., 0.,
new TGeoRotation ());
633 trc6->SetName(
"transouter");
634 trc6->RegisterYourself();
636 TGeoCombiTrans* trc7 =
new TGeoCombiTrans(0., 0., 0.,
new TGeoRotation ());
638 trc7->SetName(
"transinner");
639 trc7->RegisterYourself();
641 complex->AddNode(hyppipe, 0,trc4);
642 complex->AddNode(outer, 0,trc6);
643 complex->AddNode(inner, 0,trc7);
646 top->AddNode(complex,0,
new TGeoCombiTrans(0., 0., -55.5,
new TGeoRotation ()));
648 gGeoMan->CloseGeometry();
static T ASin(const T &x)
friend F32vec4 cos(const F32vec4 &a)
TVector3 ComputeDimensions(const int copyNo, Double_t *par)
friend F32vec4 sin(const F32vec4 &a)
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Double_t const fAbsorberThickness
FairGeoBuilder * geobuild
TVector3 rotate(TVector3 vec, TGeoRotation *rotma)
FairGeoInterface * geoFace
TVector3 ComputeTransformation(const int copyNo, Double_t *par)