26 void getXrange(
double dphi,
double radiusCornerOut,
double radiusCornerIn,
double MCPactiveArea,
int cas1,
int cas2,
double ylow,
double step,
double &x1,
double &x2);
27 double getX(TVector3 corner1, TVector3 corner2,
double yy);
28 int findSectorIn(
double y,
double dphi,
double radius,
double EVdrop,
double hthick);
29 int findSectorOut(
double y,
double dphi_rad,
double radiusCornerOut);
35 gROOT->Macro(
"$VMCWORKDIR/gconfig/rootlogon.C");
37 TString vmcWorkdir = getenv(
"VMCWORKDIR");
40 gSystem->Load(
"libGeoBase");
41 gSystem->Load(
"libParBase");
42 gSystem->Load(
"libBase");
43 gSystem->Load(
"libPndData");
44 gSystem->Load(
"libPassive");
45 gSystem->Load(
"libEve");
65 Double_t dphi = (180.-2.*pipehAngle)/bbnum*2.;
70 Double_t bbox_hlen = 0.5*(bbox_zdown - bbox_zup);
71 Double_t bbox_shift = bbox_zup + bbox_hlen;
90 const Int_t NpixTotal = Npix*Npix;
96 Double_t hgap = 0.5*(MCPsize - MCPactiveArea + MCPgap);
97 Double_t step = MCPactiveArea + 2.*hgap;
101 Double_t sob_shift = -bbox_hlen + bbox_shift - sob_len;
107 Double_t sob_angle = atan((5.*step-2.*hthick-EVoffset-EVdrop)/sob_len)/pi*180.;
108 Double_t sob_Rout = (radius + hthick + EVoffset + sob_len*tan(sob_angle/180.*pi));
110 Double_t bbSideGap = 0.5*( ((barwidth+2.*barhgap)*barnum) - (2.*radius*
sin((dphi-bbGapAngle)/180.*pi/2.)+2.*barhgap) );
111 Double_t bbX = 2.*radius*
sin((dphi-bbGapAngle)/180.*pi/2.)+2.*barhgap;
113 Double_t radiusCornerIn = (radius-hthick-EVdrop)/
cos(dphi/2./180.*pi);
114 Double_t radiusCornerOut = sob_Rout/
cos(dphi_rad/2.);
115 Double_t radiusMiddleSmall = radius-hthick-EVdrop;
117 cout<<
"radius = "<<radius<<
"rad corner in = "<< radiusCornerIn<<
", rad corner out = "<< radiusCornerOut<<endl; cout<<
"pixel gap = "<< PixelGap<<endl;
118 cout<<
"sob_angle = "<<sob_angle<<endl;
119 cout<<
"sob_Rout = "<<sob_Rout<<endl;
120 cout<<
"bbSideGap = "<<bbSideGap<<
", bbX+2.sidegap = "<<bbX+2.*bbSideGap<<
", 5*barwidth+5*2*bargap = "<<5.*barwidth+5.*2.*barhgap<<endl;
121 cout<<
", bbX = "<<bbX<<endl;
122 cout<<
"dphi = "<<dphi<<
", phi0 = "<<phi0<<endl;
130 Double_t pheight = 2.*phlength * tan(pangle/180.*pi);
132 Double_t sob_Rprizm = radius + hthick + poffset + pheight + EVoffset + (sob_len-2.*phlength)*tan(60./180.*pi);
134 cout<<
"prizm length = "<<phlength*2.<<endl;
135 cout<<
"prizm height = "<<2.*phlength * tan(pangle/180.*pi)<<endl;
142 TString fGeoFile= Form(
"../../geometry/dirc_l%d_p%d_mirrorGap_Mcp2a_updated_06_2013.root",fFocusingSystem, fprizm);
143 TFile*
fi =
new TFile(fGeoFile,
"RECREATE");
144 cout<<
"Output file = "<<fGeoFile<<endl;
149 Int_t nel, numed, nz;
153 FairGeoLoader*
geoLoad =
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
154 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
155 cout <<
"geoface setmediafile" << endl;
156 geoFace->setMediaFile(
"../../geometry/media_pnd.geo");
157 cout <<
"geoface readmedia" << endl;
158 geoFace->readMedia();
163 FairGeoMedia *
Media = geoFace->getMedia();
164 FairGeoBuilder *
geobuild=geoLoad->getGeoBuilder();
166 FairGeoMedium *DrcAir = Media->getMedium(
"air");
167 FairGeoMedium *DrcAirNoSens = Media->getMedium(
"DIRCairNoSens");
168 FairGeoMedium *DrcEpotek301_2 = Media->getMedium(
"Epotek301_2");
169 FairGeoMedium *DrcOpticalGrease = Media->getMedium(
"OpticalGrease");
170 FairGeoMedium *DrcCarbonFiber = Media->getMedium(
"DIRCcarbonFiber");
171 FairGeoMedium *DrcFusedSil = Media->getMedium(
"FusedSil");
172 FairGeoMedium *DrcMirror = Media->getMedium(
"Mirror");
173 FairGeoMedium *DrcMarcol82_7 = Media->getMedium(
"Marcol82_7");
174 FairGeoMedium *DrcNLAK33A = Media->getMedium(
"NLAK33A");
175 FairGeoMedium *DrcPhotocathode= Media->getMedium(
"Photocathode");
177 Int_t
nmed=geobuild->createMedium(DrcAir);
178 nmed=geobuild->createMedium(DrcAirNoSens);
179 nmed=geobuild->createMedium(DrcEpotek301_2);
180 nmed=geobuild->createMedium(DrcOpticalGrease);
181 nmed=geobuild->createMedium(DrcCarbonFiber);
182 nmed=geobuild->createMedium(DrcFusedSil);
183 nmed=geobuild->createMedium(DrcMirror);
184 nmed=geobuild->createMedium(DrcMarcol82_7);
185 nmed=geobuild->createMedium(DrcNLAK33A);
186 nmed=geobuild->createMedium(DrcPhotocathode);
190 if(fFocusingSystem == 0){
192 fSlabEnd = -bbox_hlen + bbox_shift + flen;
193 cout<<
"bar ends at = "<<fSlabEnd<<endl;
198 if (fFocusingSystem == 1){
207 cout<<
" DIRC a,b = "<<a<<
" "<<b<<endl;
220 len = b + 0.2 + b3 + 0.5;
222 cout<<
"DIRC len= "<<len<<endl;
224 fSlabEnd = -bbox_hlen + bbox_shift + len;
225 cout<<
"bar ends at = "<<fSlabEnd<<endl;
232 TGeoSphere* logicSphere=
new TGeoSphere(
"S",0.,r, 0. ,180.,0.,360.);
233 TGeoBBox* lBox =
new TGeoBBox(
"B", barwidth/2., hthick, b/2.);
234 TGeoTranslation *tr1 =
new TGeoTranslation(
"tr1", 0.,0., t);
235 tr1->RegisterYourself();
236 TGeoCompositeShape *cs =
new TGeoCompositeShape(
"cs",
"S*(B:tr1)");
237 TGeoVolume *lens1 =
new TGeoVolume(
"DrcLENS1Sensor",cs,
gGeoManager->GetMedium(
"FusedSil"));
238 lens1->SetLineColor(kRed-8);
239 lens1->SetTransparency(40);
245 fdz_lens1 = -(bbox_hlen)+len -(-r+b);
250 TGeoSphere* logicSphere2 =
new TGeoSphere(
"S2",0 ,r2, 0. ,180.,0.,360.);
251 TGeoBBox* lBox2 =
new TGeoBBox(
"B2", barwidth/2., hthick, b2/2.);
252 TGeoTranslation *tr2 =
new TGeoTranslation(
"tr2", 0.,0., t2);
253 tr2->RegisterYourself();
254 TGeoCompositeShape *cs2 =
new TGeoCompositeShape(
"cs2",
"(B2:tr2)-S2");
255 TGeoVolume *lens2 =
new TGeoVolume(
"DrcLENS2Sensor",cs2,
gGeoManager->GetMedium(
"NLAK33A"));
256 lens2->SetLineColor(kRed+2);
257 lens2->SetTransparency(40);
265 fdz_lens2 = -(bbox_hlen)+len -(-r2) -
b;
269 TGeoSphere* logicSphere3=
new TGeoSphere(
"S3",0.,r3, 0. ,180.,0.,360.);
270 TGeoBBox* lBox3 =
new TGeoBBox(
"B3", barwidth/2., hthick, b3/2.);
271 TGeoTranslation *tr3 =
new TGeoTranslation(
"tr3", 0.,0., t3);
272 tr3->RegisterYourself();
273 TGeoCompositeShape *cs3 =
new TGeoCompositeShape(
"cs3",
"S3*(B3:tr3)");
274 TGeoVolume *lens3 =
new TGeoVolume(
"DrcLENS3Sensor",cs3,
gGeoManager->GetMedium(
"NLAK33A"));
275 lens3->SetLineColor(kRed-6);
276 lens3->SetTransparency(40);
285 fdz_lens3 = -(bbox_hlen)+len -(-r3+b3) -b - b2/2. ;
291 if (fFocusingSystem == 2){
297 len = -130. + zpos + 1.;
303 Double_t focal_length = 2. * bbox_hlen + sob_len -
fabs(len) + len1;
304 Double_t mirror_radius = 2. * focal_length;
306 cout<<
" mirror radius: "<<mirror_radius<<endl;
311 TGeoSphere* logicSphere =
new TGeoSphere(
"S",0.,mirror_radius, 0. ,180.,0.,360.);
312 TGeoBBox* lBox =
new TGeoBBox(
"B", barwidth/2., hthick,
fabs(len1)/2.);
316 TGeoTranslation *tr1 =
new TGeoTranslation(
"tr1", 0.,0., t);
317 tr1->RegisterYourself();
318 TGeoCompositeShape *cs =
new TGeoCompositeShape(
"cs",
"S*(B:tr1)");
320 TGeoVolume *block1 =
new TGeoVolume(
"DrcBlock1",cs,
gGeoManager->GetMedium(
"FusedSil"));
321 block1->SetLineColor(kRed);
322 block1->SetTransparency(40);
325 Double_t shift1 = len1-mirror_radius;
326 shift1 += bbox_hlen-
fabs(len)-2.*mirr_hthick;
338 TGeoSphere* logicSphere2 =
new TGeoSphere(
"S2",0,mirror_radius, 0. ,180.,0.,360.);
339 TGeoBBox* lBox2 =
new TGeoBBox(
"B2", barwidth/2., hthick,
fabs(len2)/2.);
344 TGeoTranslation *tr2 =
new TGeoTranslation(
"tr2", 0.,0., t2);
345 tr2->RegisterYourself();
346 TGeoCompositeShape *cs2 =
new TGeoCompositeShape(
"cs2",
"(B2:tr2)-S2");
348 TGeoVolume *block2 =
new TGeoVolume(
"DrcBlock2",cs2,
gGeoManager->GetMedium(
"Mirror"));
349 block2->SetLineColor(kGreen);
350 block2->SetTransparency(40);
354 shift2 += bbox_hlen-
fabs(len)-2*mirr_hthick;
355 shift2 += len1 + gap;
374 fSlabEnd = -bbox_hlen + bbox_shift + flen;
375 cout<<
"bar ends at = "<<fSlabEnd<<endl;
380 if(fFocusingSystem == 3){
391 cout<<
"DIRC: len = "<<len<<endl;
393 cout<<
"length = "<< Lcyl<<
", angle = "<<Acyl/3.1415*180.<<
", translation = "<<Tcyl1<<endl;
394 cout<<
"lens 0.5*width = "<<hthick<<
", 0.5*thickness = "<< 0.5*Rcyl*(1.-
TMath::Cos(Acyl))<<
", 0.5*heigth = "<<Lcyl <<endl;
397 TGeoEltu* lCylinder =
new TGeoEltu(
"Cyl",Rcyl,Rcyl,Lcyl);
398 TGeoBBox* lCylBox =
new TGeoBBox(
"CylBox", hthick, hthick, Lcyl);
401 TGeoTranslation *trCyl1 =
new TGeoTranslation(
"trCyl", 0., Rcyl*
TMath::Cos(Acyl)+hthick, 0.);
402 trCyl1->RegisterYourself();
403 TGeoCompositeShape *llens1 =
new TGeoCompositeShape(
"llens1",
"Cyl*(CylBox:trCyl)");
404 TGeoVolume *CylLens1 =
new TGeoVolume(
"DrcLENS1Sensor",llens1,
gGeoManager->GetMedium(
"NLAK33A"));
405 CylLens1->SetLineColor(kRed-8);
406 CylLens1->SetTransparency(40);
408 fdz_lens1 = -(bbox_hlen - barWin_hthick) + len - (-Rcyl + Rcyl*(1.-
TMath::Cos(Acyl)));
411 TGeoTranslation *trCyl2 =
new TGeoTranslation(
"trCyl2", 0., Rcyl + Hcyl2 - hthick, 0.);
412 trCyl2->RegisterYourself();
413 TGeoCompositeShape *llens2 =
new TGeoCompositeShape(
"llens2",
"(CylBox:trCyl2) - Cyl");
414 TGeoVolume* CylLens2 =
new TGeoVolume(
"DrcLENS2Sensor", llens2,
gGeoManager->GetMedium(
"FusedSil"));
415 CylLens2->SetLineColor(kRed+2);
416 CylLens2->SetTransparency(40);
424 fdz_lens2 = -(bbox_hlen - barWin_hthick) + len + (hthick - Rcyl*(1.-
TMath::Cos(Acyl)) - Hcyl2);
425 fSlabEnd = -bbox_hlen + bbox_shift;
426 cout<<
"bar ends at = "<<fSlabEnd<<endl;
433 TGeoManager*
gGeoMan = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
435 TGeoBBox* lTop =
new TGeoBBox(500,500,300);
436 TGeoVolume*
top =
new TGeoVolume(
"DIRC", lTop,
gGeoManager->GetMedium(
"air"));
441 TGeoPcon*
shape =
new TGeoPcon(
"BarrelDIRCShape", 0, 360., 4);
442 shape->DefineSection(0, bbox_zdown, 35., 60.);
443 shape->DefineSection(1, bbox_zup, 35., 60.);
444 shape->DefineSection(2, bbox_zup - sob_len, 35., sob_Rout+poffset+pheight+EVoffset+1.);
445 shape->DefineSection(3, bbox_zup - sob_len - PDbaseLayer - EVgreaseLayer, 35., sob_Rout+poffset+pheight+EVoffset+1.);
446 vLocalMother =
new TGeoVolume(
"BarrelDIRC", shape,
gGeoManager->GetMedium(
"DIRCairNoSens"));
447 top->AddNode(vLocalMother, 0,0);
449 cout<<
"bbox length = "<<2.*(bbox_hlen-0.5*(boxgap+boxthick))<<
", prizm length = "<<2.*(phlength+0.5*(boxgap+boxthick))<<endl;
450 cout<<
"prizm shift = "<<-bbox_hlen+0.5*(boxgap+boxthick)-phlength<<endl;
455 logicbbL =
new TGeoBBox(
"logicbbL", 0.5*barnum*(barwidth+2.*barhgap)+bbSideGap+boxthick, hthick+boxgap+boxthick, bbox_hlen);
456 bbox =
new TGeoVolume(
"DrcBarBox", logicbbL,
gGeoManager->GetMedium(
"DIRCcarbonFiber"));
457 bbox->SetLineColor(30);
462 if(fFocusingSystem == 0 || fFocusingSystem == 1 || fFocusingSystem == 2){
463 logicbbS =
new TGeoBBox(
"logicbbS", 0.5*barnum*(barwidth+2.*barhgap)+bbSideGap, hthick+boxgap, bbox_hlen-barWin_hthick);
465 if(fFocusingSystem == 3){
466 logicbbS =
new TGeoBBox(
"logicbbS", 0.5*barnum*(barwidth+2.*barhgap)+bbSideGap, hthick+boxgap, bbox_hlen-barWin_hthick);
468 abox =
new TGeoVolume(
"DrcAirBox", logicbbS,
gGeoManager->GetMedium(
"DIRCairNoSens"));
469 if(fFocusingSystem == 0 || fFocusingSystem == 1 || fFocusingSystem == 2){
470 bbox->AddNode(abox, 1,
new TGeoCombiTrans(0., 0., barWin_hthick,
new TGeoRotation(0)));
472 if(fFocusingSystem == 3){
473 bbox->AddNode(abox, 1,
new TGeoCombiTrans(0., 0., barWin_hthick,
new TGeoRotation(0)));
475 abox->SetLineColor(19);
478 TGeoBBox* logicBarWin =
new TGeoBBox(
"logicBarWin", 0.5*barnum*(barwidth+2.*barhgap)+bbSideGap, hthick+boxgap, barWin_hthick);
479 TGeoVolume* barwin =
new TGeoVolume(
"DrcBarboxWindowSensor", logicBarWin,
gGeoManager->GetMedium(
"FusedSil"));
480 barwin->SetLineColor(kBlue-4);
481 bbox->AddNode(barwin, 1,
new TGeoCombiTrans(0.,0.,-bbox_hlen+barWin_hthick,
new TGeoRotation(0)));
492 TGeoBBox* logicEVgrease =
new TGeoBBox(
"logicEVgrease", 0.5*barnum*(barwidth+2.*barhgap)+bbSideGap, hthick+boxgap, EVgreaseLayer/2.);
493 TGeoVolume* evgrease =
new TGeoVolume(
"DrcEVgrease", logicEVgrease,
gGeoManager->GetMedium(
"OpticalGrease"));
494 evgrease->SetLineColor(kSpring);
497 Double_t dx_bbox, dy_bbox, dz_bbox, phi_curr;
499 for(Int_t
m = 0;
m < bbnum;
m ++){
500 phi_curr = (90. - phi0 - dphi*
m)/180.*pi;
501 if(
m > bbnum/2-1){ phi_curr = (90. - phi0 - dphi*
m - 2.*pipehAngle)/180.*pi; }
502 dx_bbox = radius *
cos(phi_curr);
503 dy_bbox = radius *
sin(phi_curr);
504 dz_bbox = bbox_shift;
506 TGeoRotation rot_bbox;
507 rot_bbox.RotateZ( -phi0 -
m*dphi - (TMath::Floor(2.*
m/bbnum))*(2.*pipehAngle));
508 vLocalMother->AddNode(bbox,
m+1,
new TGeoCombiTrans(dx_bbox, dy_bbox, dz_bbox,
new TGeoRotation(rot_bbox)));
509 vLocalMother->AddNode(evgrease,
m+1,
new TGeoCombiTrans(dx_bbox, dy_bbox, bbox_zup-EVgreaseLayer/2.,
new TGeoRotation(rot_bbox)));
512 cout<<
"bar width = "<<barwidth <<
", bar with gaps = "<<(bbX/barnum)<<endl;
513 cout<<
"barboxL width = "<<bbX/2.+boxgap+boxthick<<
", barboxS width = "<<bbX/2.+boxgap<<endl;
517 if(fFocusingSystem == 0 || fFocusingSystem == 1 || fFocusingSystem == 2){
518 logicBar =
new TGeoBBox(
"logicBar", barwidth/2., hthick, bbox_hlen-
fabs(len)/2.-mirr_hthick-barWin_hthick);
520 if(fFocusingSystem == 3){
521 logicBar =
new TGeoBBox(
"logicBar", barwidth/2., hthick, bbox_hlen-
fabs(len)/2.-mirr_hthick-barWin_hthick);
525 bar =
new TGeoVolume(
"DrcBarSensor",logicBar,
gGeoManager->GetMedium(
"FusedSil"));
526 bar->SetLineColor(kCyan-9);
527 bar->SetTransparency(60);
530 TGeoBBox* logicMirror =
new TGeoBBox(
"logicMirror", barwidth/2., hthick, mirr_hthick /2.);
531 TGeoVolume *mirr =
new TGeoVolume(
"DrcMirr", logicMirror,
gGeoManager->GetMedium(
"Mirror"));
532 mirr->SetLineColor(5);
535 TGeoBBox* logicBarGlue =
new TGeoBBox(
"logicBarGlue", barwidth/2., hthick, gluehthick);
536 TGeoVolume *barglue =
new TGeoVolume(
"DrcBarGlueSensor", logicBarGlue,
gGeoManager->GetMedium(
"Epotek301_2"));
537 barglue->SetLineColor(kSpring-5);
538 bar->AddNode(barglue, 1,
new TGeoCombiTrans(0., 0., 0.,
new TGeoRotation (0)));
542 for(Int_t j=0; j<barnum; j++){
543 dx = - (bbX/2.) - bbSideGap + (barwidth+2.*barhgap)/2. + j * (barwidth+2.*barhgap);
545 if(fFocusingSystem == 0 || fFocusingSystem == 1 || fFocusingSystem == 2){
546 dz_mirr = bbox_hlen - barWin_hthick - mirr_hthick;
547 dz_bar = len/2.-mirr_hthick;
549 if(fFocusingSystem == 3){
550 dz_mirr = bbox_hlen - barWin_hthick - mirr_hthick;
551 dz_bar = -mirr_hthick + len/2.;
553 if(fFocusingSystem == 1){
554 abox->AddNode(lens1, 1+j,
new TGeoCombiTrans(dx, dy, fdz_lens1,
new TGeoRotation (0)));
555 abox->AddNode(lens2, 1+j,
new TGeoCombiTrans(dx, dy, fdz_lens2,
new TGeoRotation (0)));
556 abox->AddNode(lens3, 1+j,
new TGeoCombiTrans(dx, dy, fdz_lens3,
new TGeoRotation (0)));
558 if(fFocusingSystem == 2){
559 abox->AddNode(block1, 1+j,
new TGeoCombiTrans(dx, dy, fdz_mirr1,
new TGeoRotation (0)));
560 abox->AddNode(block2, 1+j,
new TGeoCombiTrans(dx, dy, fdz_mirr2,
new TGeoRotation (0)));
562 if(fFocusingSystem == 3){
563 TGeoRotation rot_lens3;
564 rot_lens3.RotateZ(-90.);
565 rot_lens3.RotateY( 90.);
566 abox->AddNode(CylLens1, 1+j,
new TGeoCombiTrans(dx, dy, fdz_lens1,
new TGeoRotation(rot_lens3)));
567 abox->AddNode(CylLens2, 1+j,
new TGeoCombiTrans(dx, dy, fdz_lens1,
new TGeoRotation(rot_lens3)));
569 abox->AddNode(bar, 1+j,
new TGeoCombiTrans(dx, dy, dz_bar,
new TGeoRotation(0)));
570 if(fFocusingSystem != 2){
571 abox->AddNode(mirr, 1+j,
new TGeoCombiTrans(dx, dy, dz_mirr,
new TGeoRotation(0)));
580 TGeoPgon* logicEV1, * logicEV2, *logicEV3, * logicEV4;
581 cosFactor1 =
cos(pipehAngle/180.*pi)/
cos(dphi/180.*pi/2.);
582 dR = (radius+hthick+boxgap+boxthick)/
cos(dphi/2./180.*pi) - (radius-hthick);
583 xEV = (dR + sob_len*tan(sob_angle/180.*pi))/ (tan(sob_angle/180.*pi) + tan(sob_angleB/180.*pi));
584 if(sob_angleB == 90.){
585 logicEV1 =
new TGeoPgon(
"logicEV1", 93.6, 172.8, bbnum/2, 2);
586 logicEV1->DefineSection(0, 0., radiusMiddleSmall, sob_Rout);
587 logicEV1->DefineSection(1, sob_len, radiusMiddleSmall, (radius+hthick+boxgap+boxthick+EVoffset)/
cos(dphi/2./180.*pi));
588 logicEV2 =
new TGeoPgon(
"logicEV2", -86.4, 172.8, bbnum/2, 2);
589 logicEV2->DefineSection(0, 0., radiusMiddleSmall, sob_Rout);
590 logicEV2->DefineSection(1, sob_len, radiusMiddleSmall, (radius+hthick+boxgap+boxthick+EVoffset)/
cos(dphi/2./180.*pi));
591 logicEV3 =
new TGeoPgon(
"logicEV3", 86.4, 7.2, 1, 2);
592 logicEV3->DefineSection(0, 0., (radiusMiddleSmall)*cosFactor1, sob_Rout*cosFactor1);
593 logicEV3->DefineSection(1, sob_len, (radiusMiddleSmall)*cosFactor1, (radius+hthick+boxgap+boxthick+EVoffset)/
cos(dphi/2./180.*pi)*cosFactor1);
594 logicEV4 =
new TGeoPgon(
"logicEV4", -93.6, 7.2, 1, 2);
595 logicEV4->DefineSection(0, 0., (radiusMiddleSmall)*cosFactor1, sob_Rout*cosFactor1);
596 logicEV4->DefineSection(1, sob_len, (radiusMiddleSmall)*cosFactor1, (radius+hthick+boxgap+boxthick+EVoffset)/
cos(dphi/2./180.*pi)*cosFactor1);
599 if(sob_angleB != 90.){
600 logicEV1 =
new TGeoPgon(
"logicEV1", 93.6, 172.8, bbnum/2, 3);
601 logicEV1->DefineSection(0, 0., radius-hthick, radius-hthick+eps);
602 logicEV1->DefineSection(1, xEV, radius-hthick, sob_Rout - xEV*tan(sob_angle/180.*pi));
603 logicEV1->DefineSection(2, sob_len, radius-hthick, (radius+hthick+boxgap+boxthick)/
cos(dphi/2./180.*pi));
604 logicEV2 =
new TGeoPgon(
"logicEV2", -86.4, 172.8, bbnum/2, 3);
605 logicEV2->DefineSection(0, 0., radius-hthick, radius-hthick+eps);
606 logicEV2->DefineSection(1, xEV, radius-hthick, sob_Rout - xEV*tan(sob_angle/180.*pi));
607 logicEV2->DefineSection(2, sob_len, radius-hthick, (radius+hthick+boxgap+boxthick)/
cos(dphi/2./180.*pi));
608 logicEV3 =
new TGeoPgon(
"logicEV3", 86.4, 7.2, 1, 3);
609 logicEV3->DefineSection(0, 0., (radius-hthick)*cosFactor1, (radius-hthick+eps)*cosFactor1);
610 logicEV3->DefineSection(1, xEV, (radius-hthick)*cosFactor1, (sob_Rout - xEV*tan(sob_angle/180.*pi))*cosFactor1);
611 logicEV3->DefineSection(2, sob_len, (radius-hthick)*cosFactor1, (radius+hthick+boxgap+boxthick)/
cos(dphi/2./180.*pi)*cosFactor1);
612 logicEV4 =
new TGeoPgon(
"logicEV4", -93.6, 7.2, 1, 3);
613 logicEV4->DefineSection(0, 0., (radius-hthick)*cosFactor1, (radius-hthick+eps)*cosFactor1);
614 logicEV4->DefineSection(1, xEV, (radius-hthick)*cosFactor1, (sob_Rout - xEV*tan(sob_angle/180.*pi))*cosFactor1);
615 logicEV4->DefineSection(2, sob_len, (radius-hthick)*cosFactor1, (radius+hthick+boxgap+boxthick)/
cos(dphi/2./180.*pi)*cosFactor1);
618 TGeoCompositeShape *logicEV =
new TGeoCompositeShape(
"logicEV",
"logicEV1 + logicEV2 + logicEV3 + logicEV4");
619 TGeoVolume* baseEV =
new TGeoVolume(
"DrcEVSensor", logicEV,
gGeoManager->GetMedium(
"Marcol82_7"));
620 baseEV->SetLineColor(kMagenta+2);
621 baseEV->SetTransparency(50);
622 vLocalMother->AddNode(baseEV, 1,
new TGeoCombiTrans(0.,0.,sob_shift - EVgreaseLayer,
new TGeoRotation(0)));
629 TGeoPgon *logicPDbase1 =
new TGeoPgon(
"logicPDbase1", 90.+(phi0-dphi/2.), 180.-2.*(phi0-dphi/2.), bbnum/2, 2);
630 TGeoPgon *logicPDbase2 =
new TGeoPgon(
"logicPDbase2", -90.+(phi0-dphi/2.), 180.-2.*(phi0-dphi/2.), bbnum/2, 2);
631 TGeoPgon *logicPDbase3 =
new TGeoPgon(
"logicPDbase3", 90.-(phi0-dphi/2.), 2.*(phi0-dphi/2.) , 1, 2);
632 TGeoPgon *logicPDbase4 =
new TGeoPgon(
"logicPDbase4", -90.-(phi0-dphi/2.), 2.*(phi0-dphi/2.) , 1, 2);
633 Double_t rad_delta = (MCPsize-MCPactiveArea)/2./
cos(45./180.*pi);
634 if(sob_angleB == 90.){
635 logicPDbase1->DefineSection(0, 0., radiusMiddleSmall-rad_delta, sob_Rout);
636 logicPDbase1->DefineSection(1, PDbaseLayer, radiusMiddleSmall-rad_delta, sob_Rout);
637 logicPDbase2->DefineSection(0, 0., radiusMiddleSmall-rad_delta, sob_Rout);
638 logicPDbase2->DefineSection(1, PDbaseLayer, radiusMiddleSmall-rad_delta, sob_Rout);
639 logicPDbase3->DefineSection(0, 0., (radiusMiddleSmall)*cosFactor1-rad_delta, sob_Rout*cosFactor1);
640 logicPDbase3->DefineSection(1, PDbaseLayer, (radiusMiddleSmall)*cosFactor1-rad_delta, sob_Rout*cosFactor1);
641 logicPDbase4->DefineSection(0, 0., (radiusMiddleSmall)*cosFactor1-rad_delta, sob_Rout*cosFactor1);
642 logicPDbase4->DefineSection(1, PDbaseLayer, (radiusMiddleSmall)*cosFactor1-rad_delta, sob_Rout*cosFactor1);
655 TGeoCompositeShape *logicPDbase =
new TGeoCompositeShape(
"logicPDbase",
"logicPDbase1 + logicPDbase2 + logicPDbase3 + logicPDbase4");
656 TGeoVolume *pdbase =
new TGeoVolume(
"DrcPDbase", logicPDbase,
gGeoManager->GetMedium(
"DIRCcarbonFiber"));
657 pdbase->SetLineColor(kGreen-6);
658 if(sob_angleB == 90.){
659 vLocalMother->AddNode(pdbase, 1,
new TGeoCombiTrans(0., 0., sob_shift-EVgreaseLayer-PDbaseLayer,
new TGeoRotation(0)));
689 TGeoBBox* logicPD =
new TGeoBBox(
"logicPD", MCPactiveArea/2., MCPactiveArea/2., PDsensitiveThick/2.);
690 TGeoVolume *pixelholder =
new TGeoVolume(
"DrcPDSensor", logicPD,
gGeoManager->GetMedium(
"FusedSil"));
691 pixelholder->SetLineColor(kGreen+1);
694 TGeoBBox* logicPhCathode =
new TGeoBBox(
"logicPhCathode", MCPactiveArea/2., MCPactiveArea/2., PhCathodeThick/2.);
695 TGeoVolume *phcathode =
new TGeoVolume(
"DrcPhCathodeSensor", logicPhCathode,
gGeoManager->GetMedium(
"Photocathode"));
696 phcathode->SetLineColor(kGray+1);
699 TGeoBBox* logicWindow =
new TGeoBBox(
"logicWindow", MCPsize/2., MCPsize/2., PDwindowThick/2.);
700 TGeoVolume *window =
new TGeoVolume(
"DrcPDwindowSensor", logicWindow,
gGeoManager->GetMedium(
"FusedSil"));
701 window->SetLineColor(kBlue-4);
704 TGeoBBox* logicMCPgrease =
new TGeoBBox(
"logicMCPgrease", MCPsize/2., MCPsize/2., PDgreaseLayer/2.);
705 TGeoVolume *mcpgrease =
new TGeoVolume(
"DrcMcpGreaseSensor", logicMCPgrease,
gGeoManager->GetMedium(
"OpticalGrease"));
706 mcpgrease->SetLineColor(kSpring);
719 cout<<
"STEP = "<<step<<endl;
780 Int_t totalnumbering = 1;
783 for(Int_t
m = 0;
m < bbnum;
m ++){
784 phi_curr1 = (90. - phi0 - dphi*
m)/180.*pi;
785 if(
m > bbnum/2-1){ phi_curr1 = (90. - phi0 - dphi*
m - 2.*pipehAngle)/180.*pi; }
788 TGeoRotation rot_sector;
789 rot_sector.RotateZ( -phi0 -
m*dphi - (TMath::Floor(2.*
m/bbnum))*(2.*pipehAngle));
790 cout<<
"phi_curr1 = "<<phi_curr1/3.1415*180.<<endl;
792 cout<<
"rad corner out = "<<radiusCornerOut<<
", step = "<<step<<
", nrowMax = "<<Int_t((sob_Rout-radiusMiddleSmall)/step)<<endl;
793 for(Int_t nrow=0; nrow < Int_t((sob_Rout-radiusMiddleSmall)/step); nrow++){
794 sectorWidth = 2.* (radiusMiddleSmall + step*nrow) * tan(dphi_rad/2.);
796 nmcp = Int_t(sectorWidth/step);
797 cout<<
"tg(dphi_rad/2.)= "<<tan(dphi_rad/2.)<<
", nrow = "<<nrow<<
", 2.* (radiusMiddleSmall + step*nrow) = "<<2.* (radiusMiddleSmall + step*nrow)<<endl;
798 cout<<
"sector width = "<<sectorWidth<<
", nmcp = "<<nmcp<<
", nmcp%2 = "<<nmcp%2<<endl;
799 xpos = (radiusMiddleSmall + 0.5*MCPactiveArea + step*(nrow));
800 for(Int_t ny=0; ny<nmcp; ny++){
801 ypos = ((-Int_t(nmcp/2.) - 0.5*(nmcp%2))*step + (0.5+ny)*step);
802 location.SetXYZ(xpos,ypos,0.);
803 location.RotateZ(phi_curr1);
804 pdbase->AddNode(mcpgrease, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer/2.,
new TGeoRotation(rot_sector)));
805 pdbase->AddNode(window, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer-PDwindowThick/2.,
new TGeoRotation(rot_sector)));
806 pdbase->AddNode(phcathode, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer-PhCathodeThick/2.-PDwindowThick,
new TGeoRotation(rot_sector)));
807 pdbase->AddNode(pixelholder, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer-PhCathodeThick-PDwindowThick-PDsensitiveThick/2.,
new TGeoRotation(rot_sector)));
808 totalnumbering = totalnumbering + 1;
813 for(Int_t nrow=0; nrow < Int_t((sob_Rout-radiusMiddleSmall)/step); nrow++){
814 for(Int_t nadd = 0; nadd<2; nadd++){
815 xpos = (radiusMiddleSmall*cosFactor1 + 0.5*MCPactiveArea + step*(nrow));
816 location.SetXYZ(xpos,0.,0.);
817 location.RotateZ(pi/2.+pi*nadd);
818 pdbase->AddNode(mcpgrease, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer/2.,
new TGeoRotation(0)));
819 pdbase->AddNode(window, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer-PDwindowThick/2.,
new TGeoRotation(0)));
820 pdbase->AddNode(phcathode, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer-PhCathodeThick/2.-PDwindowThick,
new TGeoRotation(0)));
821 pdbase->AddNode(pixelholder, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer-PhCathodeThick-PDwindowThick-PDsensitiveThick/2.,
new TGeoRotation(0)));
822 totalnumbering = totalnumbering + 1;
828 top->CheckOverlaps(0.0001,
"");
838 TObjArray *listOfOverlaps =
gGeoManager->GetListOfOverlaps();
839 cout<<listOfOverlaps->GetEntries()<<endl;
840 listOfOverlaps->Print();
844 int findSectorIn(
double y,
double dphi_rad,
double radius,
double EVdrop,
double hthick){
846 EVcornerIn.SetXYZ((radius-EVdrop-hthick)/
cos(dphi_rad/2.),0.,0.);
848 for(Int_t
i=0;
i<4;
i++){
849 EVcornerIn.RotateZ(dphi_rad);
850 Y0[
i] = EVcornerIn.Y();
852 if(y <= Y0[0]){
return 1;}
853 if(y > Y0[0] && y <= Y0[1]){
return 2;}
854 if(y > Y0[1] && y <= Y0[2]){
return 3;}
855 if(y > Y0[2] && y <= Y0[3]){
return 4;}
856 if(y > Y0[3]){
return 5;}
860 int findSectorOut(
double y,
double dphi_rad,
double radiusCornerOut){
862 EVcorner.SetXYZ(radiusCornerOut,0.,0.);
864 for(Int_t
i=0;
i<4;
i++){
865 EVcorner.RotateZ(dphi_rad);
866 Y0[
i] = EVcorner.Y();
867 cout<<
"Y ["<<
i<<
"] = "<<Y0[
i]<<endl;
869 if(y <= Y0[0]){
return 1;}
870 if(y > Y0[0] && y <= Y0[1]){
return 2;}
871 if(y > Y0[1] && y <= Y0[2]){
return 3;}
872 if(y > Y0[2] && y <= Y0[3]){
return 4;}
873 if(y > Y0[3]){
return 5;}
877 bool getXrange(
double dphi,
double radiusCornerOut,
double radiusCornerIn,
double MCPactiveArea,
int cas1,
int cas2,
double ylow,
double step,
double &x1,
double &x2){
882 EVcorner.SetXYZ(radiusCornerOut,0.,0.);
883 TVector3 EVcorner1 = EVcorner;
884 TVector3 EVcorner2 = EVcorner;
886 EVcornerIn.SetXYZ(radiusCornerIn,0.,0.);
887 TVector3 EVcornerIn1 = EVcornerIn;
888 TVector3 EVcornerIn2 = EVcornerIn;
893 EVcornerIn2.RotateZ(dphi_rad);
894 xstart =
getX(EVcornerIn1, EVcornerIn2, ylow) + MCPactiveArea/2.;
897 EVcornerIn1.RotateZ(1.*dphi_rad);
898 EVcornerIn2.RotateZ(2.*dphi_rad);
899 xstart =
getX(EVcornerIn1, EVcornerIn2, ylow) + MCPactiveArea/2.;
902 EVcornerIn1.RotateZ(2.*dphi_rad);
903 EVcornerIn2.RotateZ(3.*dphi_rad);
904 xstart =
getX(EVcornerIn1, EVcornerIn2, ylow) + MCPactiveArea/2.;
907 EVcornerIn1.RotateZ(3.*dphi_rad);
908 EVcornerIn2.RotateZ(4.*dphi_rad);
909 xstart =
getX(EVcornerIn1, EVcornerIn2, ylow) + MCPactiveArea/2.;
912 EVcornerIn1.RotateZ(4.*dphi_rad);
913 EVcornerIn2.RotateZ(
pi/2.);
914 xstart =
getX(EVcornerIn1, EVcornerIn2, ylow) + MCPactiveArea/2.;
918 EVcorner2.RotateZ(dphi_rad);
919 xfinish =
getX(EVcorner1, EVcorner2, ylow+step) - MCPactiveArea/2.;
922 EVcorner1.RotateZ(1.*dphi_rad);
923 EVcorner2.RotateZ(2.*dphi_rad);
924 xfinish =
getX(EVcorner1, EVcorner2, ylow+step) - MCPactiveArea/2.;
927 EVcorner1.RotateZ(2.*dphi_rad);
928 EVcorner2.RotateZ(3.*dphi_rad);
929 xfinish =
getX(EVcorner1, EVcorner2, ylow+step) - MCPactiveArea/2.;
932 EVcorner1.RotateZ(3.*dphi_rad);
933 EVcorner2.RotateZ(4.*dphi_rad);
934 xfinish =
getX(EVcorner1, EVcorner2, ylow+step) - MCPactiveArea/2.;
937 EVcorner1.RotateZ(4.*dphi_rad);
938 EVcorner2.RotateZ(
pi/2.);
939 xfinish =
getX(EVcorner1, EVcorner2, ylow+step) - MCPactiveArea/2.;
941 if(xstart <= 0.){xstart = step/2.;}
942 if(xstart < step/2.){xstart = step/2.;}
943 if(xfinish <= 0.){xfinish = step/2.;}
947 cout<<
"-I- xstart = "<<xstart<<
", xfinish = "<<xfinish<<endl;
948 if(x1 != x2)
return true;
952 double getX(TVector3 corner1, TVector3 corner2,
double yy){
957 Double_t b = ( corner1.X()*corner2.Y() - corner1.Y()*corner2.X() ) / ( corner1.X() - corner2.X() );
958 Double_t k = ( corner1.Y() - corner2.Y() ) / ( corner1.X() - corner2.X() );
960 if(( yy - b )/k >= 0.)
return ( yy - b )/k;
961 if(( yy - b )/k < 0.)
return 0.;
static T ASin(const T &x)
friend F32vec4 cos(const F32vec4 &a)
friend F32vec4 sin(const F32vec4 &a)
TGeoManager * gGeoManager
FairGeoBuilder * geobuild
double eps(TVector3 v1, TVector3 v2)
int findSectorOut(double y, double dphi_rad, double radiusCornerOut)
friend F32vec4 fabs(const F32vec4 &a)
FairGeoInterface * geoFace
void getXrange(double dphi, double radiusCornerOut, double radiusCornerIn, double MCPactiveArea, int cas1, int cas2, double ylow, double step, double &x1, double &x2)
int findSectorIn(double y, double dphi, double radius, double EVdrop, double hthick)
double getX(TVector3 corner1, TVector3 corner2, double yy)
int createRootGeometry_DIRC_updated_06_2013(Int_t fFocusingSystem=0, Bool_t fprizm=kFALSE)