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");
63 Double_t dphi = (180.-2.*pipehAngle)/bbnum*2.;
68 Double_t bbox_hlen = 0.5*(bbox_zdown - bbox_zup);
69 Double_t bbox_shift = bbox_zup + bbox_hlen;
88 const Int_t NpixTotal = Npix*Npix;
94 Double_t hgap = 0.5*(MCPsize - MCPactiveArea + MCPgap);
95 Double_t step = MCPactiveArea + 2.*hgap;
99 Double_t sob_shift = -bbox_hlen + bbox_shift - sob_len;
105 Double_t sob_angle = atan((5.*step-2.*hthick-EVoffset-EVdrop)/sob_len)/pi*180.;
106 Double_t sob_Rout = (radius + hthick + EVoffset + sob_len*tan(sob_angle/180.*pi));
108 Double_t bbAngle = ( 180. - 2.*pipehAngle - bbGap/radius/pi*180.*(bbnum/2.-1.) )/(bbnum/2.);
111 Double_t radiusCornerIn = (radius-hthick-EVdrop)/
cos(dphi/2./180.*pi);
112 Double_t radiusCornerOut = sob_Rout/
cos(dphi_rad/2.);
113 Double_t radiusMiddleSmall = radius-hthick-EVdrop;
115 cout<<
"radius = "<<radius<<
"rad corner in = "<< radiusCornerIn<<
", rad corner out = "<< radiusCornerOut<<endl; cout<<
"pixel gap = "<< PixelGap<<endl;
116 cout<<
"sob_angle = "<<sob_angle<<endl;
117 cout<<
"sob_Rout = "<<sob_Rout<<endl;
118 cout<<
"bbAngle = "<<bbAngle<<
", bbX = "<<bbX<<endl;
119 cout<<
"dphi = "<<dphi<<
", phi0 = "<<phi0<<endl;
127 Double_t pheight = 2.*phlength * tan(pangle/180.*pi);
129 Double_t sob_Rprizm = radius + hthick + poffset + pheight + EVoffset + (sob_len-2.*phlength)*tan(60./180.*pi);
131 cout<<
"prizm length = "<<phlength*2.<<endl;
132 cout<<
"prizm height = "<<2.*phlength * tan(pangle/180.*pi)<<endl;
139 TString fGeoFile= Form(
"../../geometry/dirc_l%d_p%d_mirrorGap_Mcp2a_GG_PC_correctedEVsensor.root",fFocusingSystem, fprizm);
140 TFile*
fi =
new TFile(fGeoFile,
"RECREATE");
141 cout<<
"Output file = "<<fGeoFile<<endl;
146 Int_t nel, numed, nz;
150 FairGeoLoader*
geoLoad =
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
151 FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
152 cout <<
"geoface setmediafile" << endl;
153 geoFace->setMediaFile(
"../../geometry/media_pnd.geo");
154 cout <<
"geoface readmedia" << endl;
155 geoFace->readMedia();
160 FairGeoMedia *
Media = geoFace->getMedia();
161 FairGeoBuilder *
geobuild=geoLoad->getGeoBuilder();
163 FairGeoMedium *DrcAir = Media->getMedium(
"air");
164 FairGeoMedium *DrcAirNoSens = Media->getMedium(
"DIRCairNoSens");
165 FairGeoMedium *DrcEpotek301_2 = Media->getMedium(
"Epotek301_2");
166 FairGeoMedium *DrcOpticalGrease = Media->getMedium(
"OpticalGrease");
167 FairGeoMedium *DrcCarbonFiber = Media->getMedium(
"DIRCcarbonFiber");
168 FairGeoMedium *DrcFusedSil = Media->getMedium(
"FusedSil");
169 FairGeoMedium *DrcMirror = Media->getMedium(
"Mirror");
170 FairGeoMedium *DrcMarcol82_7 = Media->getMedium(
"Marcol82-7");
171 FairGeoMedium *DrcNLAK33A = Media->getMedium(
"NLAK33A");
172 FairGeoMedium *DrcPhotocathode= Media->getMedium(
"Photocathode");
174 Int_t
nmed=geobuild->createMedium(DrcAir);
175 nmed=geobuild->createMedium(DrcAirNoSens);
176 nmed=geobuild->createMedium(DrcEpotek301_2);
177 nmed=geobuild->createMedium(DrcOpticalGrease);
178 nmed=geobuild->createMedium(DrcCarbonFiber);
179 nmed=geobuild->createMedium(DrcFusedSil);
180 nmed=geobuild->createMedium(DrcMirror);
181 nmed=geobuild->createMedium(DrcMarcol82_7);
182 nmed=geobuild->createMedium(DrcNLAK33A);
183 nmed=geobuild->createMedium(DrcPhotocathode);
187 if(fFocusingSystem == 0){
189 fSlabEnd = -bbox_hlen + bbox_shift + flen;
190 cout<<
"bar ends at = "<<fSlabEnd<<endl;
195 if (fFocusingSystem == 1){
204 cout<<
" DIRC a,b = "<<a<<
" "<<b<<endl;
217 len = b + 0.2 + b3 + 0.5;
219 cout<<
"DIRC len= "<<len<<endl;
221 fSlabEnd = -bbox_hlen + bbox_shift + len;
222 cout<<
"bar ends at = "<<fSlabEnd<<endl;
229 TGeoSphere* logicSphere=
new TGeoSphere(
"S",0.,r, 0. ,180.,0.,360.);
230 TGeoBBox* lBox =
new TGeoBBox(
"B", (bbX/barnum)/2-bargap, hthick, b/2.);
231 TGeoTranslation *tr1 =
new TGeoTranslation(
"tr1", 0.,0., t);
232 tr1->RegisterYourself();
233 TGeoCompositeShape *cs =
new TGeoCompositeShape(
"cs",
"S*(B:tr1)");
234 TGeoVolume *lens1 =
new TGeoVolume(
"DrcLENS1Sensor",cs,
gGeoManager->GetMedium(
"FusedSil"));
235 lens1->SetLineColor(kRed-8);
236 lens1->SetTransparency(40);
242 fdz_lens1 = -(bbox_hlen)+len -(-r+b);
247 TGeoSphere* logicSphere2 =
new TGeoSphere(
"S2",0 ,r2, 0. ,180.,0.,360.);
248 TGeoBBox* lBox2 =
new TGeoBBox(
"B2", (bbX/barnum)/2.-bargap, hthick, b2/2.);
249 TGeoTranslation *tr2 =
new TGeoTranslation(
"tr2", 0.,0., t2);
250 tr2->RegisterYourself();
251 TGeoCompositeShape *cs2 =
new TGeoCompositeShape(
"cs2",
"(B2:tr2)-S2");
252 TGeoVolume *lens2 =
new TGeoVolume(
"DrcLENS2Sensor",cs2,
gGeoManager->GetMedium(
"NLAK33A"));
253 lens2->SetLineColor(kRed+2);
254 lens2->SetTransparency(40);
262 fdz_lens2 = -(bbox_hlen)+len -(-r2) -
b;
266 TGeoSphere* logicSphere3=
new TGeoSphere(
"S3",0.,r3, 0. ,180.,0.,360.);
267 TGeoBBox* lBox3 =
new TGeoBBox(
"B3", (bbX/barnum)/2-bargap, hthick, b3/2.);
268 TGeoTranslation *tr3 =
new TGeoTranslation(
"tr3", 0.,0., t3);
269 tr3->RegisterYourself();
270 TGeoCompositeShape *cs3 =
new TGeoCompositeShape(
"cs3",
"S3*(B3:tr3)");
271 TGeoVolume *lens3 =
new TGeoVolume(
"DrcLENS3Sensor",cs3,
gGeoManager->GetMedium(
"NLAK33A"));
272 lens3->SetLineColor(kRed-6);
273 lens3->SetTransparency(40);
282 fdz_lens3 = -(bbox_hlen)+len -(-r3+b3) -b - b2/2. ;
288 if (fFocusingSystem == 2){
294 len = -130. + zpos + 1.;
300 Double_t focal_length = 2. * bbox_hlen + sob_len -
fabs(len) + len1;
301 Double_t mirror_radius = 2. * focal_length;
303 cout<<
" mirror radius: "<<mirror_radius<<endl;
308 TGeoSphere* logicSphere =
new TGeoSphere(
"S",0.,mirror_radius, 0. ,180.,0.,360.);
309 TGeoBBox* lBox =
new TGeoBBox(
"B", (bbX/barnum)/2-bargap, hthick,
fabs(len1)/2.);
313 TGeoTranslation *tr1 =
new TGeoTranslation(
"tr1", 0.,0., t);
314 tr1->RegisterYourself();
315 TGeoCompositeShape *cs =
new TGeoCompositeShape(
"cs",
"S*(B:tr1)");
317 TGeoVolume *block1 =
new TGeoVolume(
"DrcBlock1",cs,
gGeoManager->GetMedium(
"FusedSil"));
318 block1->SetLineColor(kRed);
319 block1->SetTransparency(40);
322 Double_t shift1 = len1-mirror_radius;
323 shift1 += bbox_hlen-
fabs(len)-2.*mirr_hthick;
335 TGeoSphere* logicSphere2 =
new TGeoSphere(
"S2",0,mirror_radius, 0. ,180.,0.,360.);
336 TGeoBBox* lBox2 =
new TGeoBBox(
"B2", (bbX/barnum)/2-bargap, hthick,
fabs(len2)/2.);
341 TGeoTranslation *tr2 =
new TGeoTranslation(
"tr2", 0.,0., t2);
342 tr2->RegisterYourself();
343 TGeoCompositeShape *cs2 =
new TGeoCompositeShape(
"cs2",
"(B2:tr2)-S2");
345 TGeoVolume *block2 =
new TGeoVolume(
"DrcBlock2",cs2,
gGeoManager->GetMedium(
"Mirror"));
346 block2->SetLineColor(kGreen);
347 block2->SetTransparency(40);
351 shift2 += bbox_hlen-
fabs(len)-2*mirr_hthick;
352 shift2 += len1 + gap;
371 fSlabEnd = -bbox_hlen + bbox_shift + flen;
372 cout<<
"bar ends at = "<<fSlabEnd<<endl;
377 if(fFocusingSystem == 3){
383 Double_t Lcyl = (bbX/barnum)/2.-bargap;
388 cout<<
"DIRC: len = "<<len<<endl;
390 cout<<
"length = "<< Lcyl<<
", angle = "<<Acyl/3.1415*180.<<
", translation = "<<Tcyl1<<endl;
391 cout<<
"lens 0.5*width = "<<hthick<<
", 0.5*thickness = "<< 0.5*Rcyl*(1.-
TMath::Cos(Acyl))<<
", 0.5*heigth = "<<Lcyl <<endl;
394 TGeoEltu* lCylinder =
new TGeoEltu(
"Cyl",Rcyl,Rcyl,Lcyl);
395 TGeoBBox* lCylBox =
new TGeoBBox(
"CylBox", hthick, hthick, Lcyl);
398 TGeoTranslation *trCyl1 =
new TGeoTranslation(
"trCyl", 0., Rcyl*
TMath::Cos(Acyl)+hthick, 0.);
399 trCyl1->RegisterYourself();
400 TGeoCompositeShape *llens1 =
new TGeoCompositeShape(
"llens1",
"Cyl*(CylBox:trCyl)");
401 TGeoVolume *CylLens1 =
new TGeoVolume(
"DrcLENS1Sensor",llens1,
gGeoManager->GetMedium(
"NLAK33A"));
402 CylLens1->SetLineColor(kRed-8);
403 CylLens1->SetTransparency(40);
405 fdz_lens1 = -(bbox_hlen-barWin_hthick) + len - (-Rcyl + Rcyl*(1.-
TMath::Cos(Acyl)));
408 TGeoTranslation *trCyl2 =
new TGeoTranslation(
"trCyl2", 0., Rcyl + Hcyl2 - hthick, 0.);
409 trCyl2->RegisterYourself();
410 TGeoCompositeShape *llens2 =
new TGeoCompositeShape(
"llens2",
"(CylBox:trCyl2) - Cyl");
411 TGeoVolume* CylLens2 =
new TGeoVolume(
"DrcLENS2Sensor", llens2,
gGeoManager->GetMedium(
"FusedSil"));
412 CylLens2->SetLineColor(kRed+2);
413 CylLens2->SetTransparency(40);
421 fdz_lens2 = -(bbox_hlen-barWin_hthick) + len + (hthick - Rcyl*(1.-
TMath::Cos(Acyl)) - Hcyl2);
422 fSlabEnd = -bbox_hlen + bbox_shift;
423 cout<<
"bar ends at = "<<fSlabEnd<<endl;
430 TGeoManager*
gGeoMan = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
432 TGeoBBox* lTop =
new TGeoBBox(500,500,300);
433 TGeoVolume*
top =
new TGeoVolume(
"DIRC", lTop,
gGeoManager->GetMedium(
"air"));
438 TGeoPcon*
shape =
new TGeoPcon(
"BarrelDIRCShape", 0, 360., 4);
439 shape->DefineSection(0, bbox_zdown, 35., 60.);
440 shape->DefineSection(1, bbox_zup, 35., 60.);
441 shape->DefineSection(2, bbox_zup - sob_len, 35., sob_Rout+poffset+pheight+EVoffset+1.);
442 shape->DefineSection(3, bbox_zup - sob_len - PDbaseLayer - EVgreaseLayer, 35., sob_Rout+poffset+pheight+EVoffset+1.);
443 vLocalMother =
new TGeoVolume(
"BarrelDIRC", shape,
gGeoManager->GetMedium(
"DIRCairNoSens"));
444 top->AddNode(vLocalMother, 0,0);
446 cout<<
"bbox length = "<<2.*(bbox_hlen-0.5*(boxgap+boxthick))<<
", prizm length = "<<2.*(phlength+0.5*(boxgap+boxthick))<<endl;
447 cout<<
"prizm shift = "<<-bbox_hlen+0.5*(boxgap+boxthick)-phlength<<endl;
452 logicbbL =
new TGeoBBox(
"logicbbL", bbX/2.+boxthick, hthick+boxgap+boxthick, bbox_hlen);
453 bbox =
new TGeoVolume(
"DrcBarBox", logicbbL,
gGeoManager->GetMedium(
"DIRCcarbonFiber"));
454 bbox->SetLineColor(30);
459 if(fFocusingSystem == 0 || fFocusingSystem == 1 || fFocusingSystem == 2){
460 logicbbS =
new TGeoBBox(
"logicbbS", bbX/2., hthick+boxgap, bbox_hlen-barWin_hthick);
462 if(fFocusingSystem == 3){
463 logicbbS =
new TGeoBBox(
"logicbbS", bbX/2., hthick+boxgap, bbox_hlen-barWin_hthick);
465 abox =
new TGeoVolume(
"DrcAirBox", logicbbS,
gGeoManager->GetMedium(
"DIRCairNoSens"));
466 if(fFocusingSystem == 0 || fFocusingSystem == 1 || fFocusingSystem == 2){
467 bbox->AddNode(abox, 1,
new TGeoCombiTrans(0., 0., barWin_hthick,
new TGeoRotation(0)));
469 if(fFocusingSystem == 3){
470 bbox->AddNode(abox, 1,
new TGeoCombiTrans(0., 0., barWin_hthick,
new TGeoRotation(0)));
472 abox->SetLineColor(19);
475 TGeoBBox* logicBarWin =
new TGeoBBox(
"logicBarWin", bbX/2., hthick+boxgap, barWin_hthick);
476 TGeoVolume* barwin =
new TGeoVolume(
"DrcBarboxWindowSensor", logicBarWin,
gGeoManager->GetMedium(
"FusedSil"));
477 barwin->SetLineColor(kBlue-4);
478 bbox->AddNode(barwin, 1,
new TGeoCombiTrans(0.,0.,-bbox_hlen+barWin_hthick,
new TGeoRotation(0)));
489 TGeoBBox* logicEVgrease =
new TGeoBBox(
"logicEVgrease", bbX/2., hthick+boxgap, EVgreaseLayer/2.);
490 TGeoVolume* evgrease =
new TGeoVolume(
"DrcEVgrease", logicEVgrease,
gGeoManager->GetMedium(
"OpticalGrease"));
491 evgrease->SetLineColor(kSpring);
494 Double_t dx_bbox, dy_bbox, dz_bbox, phi_curr;
496 for(Int_t
m = 0;
m < bbnum;
m ++){
497 phi_curr = (90. - phi0 - dphi*
m)/180.*pi;
498 if(
m > bbnum/2-1){ phi_curr = (90. - phi0 - dphi*
m - 2.*pipehAngle)/180.*pi; }
499 dx_bbox = radius *
cos(phi_curr);
500 dy_bbox = radius *
sin(phi_curr);
501 dz_bbox = bbox_shift;
503 TGeoRotation rot_bbox;
504 rot_bbox.RotateZ( -phi0 -
m*dphi - (TMath::Floor(2.*
m/bbnum))*(2.*pipehAngle));
505 vLocalMother->AddNode(bbox,
m+1,
new TGeoCombiTrans(dx_bbox, dy_bbox, dz_bbox,
new TGeoRotation(rot_bbox)));
506 vLocalMother->AddNode(evgrease,
m+1,
new TGeoCombiTrans(dx_bbox, dy_bbox, bbox_zup-EVgreaseLayer/2.,
new TGeoRotation(rot_bbox)));
509 cout<<
"bar width = "<<2.*(((bbX/barnum)/2.)-bargap) <<
", bar with gaps = "<<(bbX/barnum)<<endl;
510 cout<<
"barboxL width = "<<bbX/2.+boxgap+boxthick<<
", barboxS width = "<<bbX/2.+boxgap<<endl;
514 if(fFocusingSystem == 0 || fFocusingSystem == 1 || fFocusingSystem == 2){
515 logicBar =
new TGeoBBox(
"logicBar", ((bbX/barnum)/2.)-bargap, hthick, bbox_hlen-
fabs(len)/2.-mirr_hthick-barWin_hthick);
517 if(fFocusingSystem == 3){
518 logicBar =
new TGeoBBox(
"logicBar", ((bbX/barnum)/2.)-bargap, hthick, bbox_hlen-
fabs(len)/2.-mirr_hthick-barWin_hthick);
522 bar =
new TGeoVolume(
"DrcBarSensor",logicBar,
gGeoManager->GetMedium(
"FusedSil"));
523 bar->SetLineColor(kCyan-9);
524 bar->SetTransparency(60);
527 TGeoBBox* logicMirror =
new TGeoBBox(
"logicMirror", bbX/barnum/2.-bargap, hthick, mirr_hthick /2.);
528 TGeoVolume *mirr =
new TGeoVolume(
"DrcMirr", logicMirror,
gGeoManager->GetMedium(
"Mirror"));
529 mirr->SetLineColor(5);
532 TGeoBBox* logicBarGlue =
new TGeoBBox(
"logicBarGlue", bbX/barnum/2.-bargap, hthick, gluehthick);
533 TGeoVolume *barglue =
new TGeoVolume(
"DrcBarGlueSensor", logicBarGlue,
gGeoManager->GetMedium(
"Epotek301_2"));
534 barglue->SetLineColor(kSpring-5);
535 bar->AddNode(barglue, 1,
new TGeoCombiTrans(0., 0., 0.,
new TGeoRotation (0)));
539 for(Int_t j=0; j<barnum; j++){
540 dx = - (bbX/2.) + (bbX/barnum)/2. + j * (bbX/barnum);
542 if(fFocusingSystem == 0 || fFocusingSystem == 1 || fFocusingSystem == 2){
543 dz_mirr = bbox_hlen - barWin_hthick - mirr_hthick;
544 dz_bar = len/2.-mirr_hthick;
546 if(fFocusingSystem == 3){
547 dz_mirr = bbox_hlen - barWin_hthick -
fabs(len)/2. - mirr_hthick;
548 dz_bar = -mirr_hthick;
550 if(fFocusingSystem == 1){
551 abox->AddNode(lens1, 1+j,
new TGeoCombiTrans(dx, dy, fdz_lens1,
new TGeoRotation (0)));
552 abox->AddNode(lens2, 1+j,
new TGeoCombiTrans(dx, dy, fdz_lens2,
new TGeoRotation (0)));
553 abox->AddNode(lens3, 1+j,
new TGeoCombiTrans(dx, dy, fdz_lens3,
new TGeoRotation (0)));
555 if(fFocusingSystem == 2){
556 abox->AddNode(block1, 1+j,
new TGeoCombiTrans(dx, dy, fdz_mirr1,
new TGeoRotation (0)));
557 abox->AddNode(block2, 1+j,
new TGeoCombiTrans(dx, dy, fdz_mirr2,
new TGeoRotation (0)));
559 if(fFocusingSystem == 3){
560 TGeoRotation rot_lens3;
561 rot_lens3.RotateZ(-90.);
562 rot_lens3.RotateY( 90.);
563 abox->AddNode(CylLens1, 1+j,
new TGeoCombiTrans(dx, dy, fdz_lens1,
new TGeoRotation(rot_lens3)));
564 abox->AddNode(CylLens2, 1+j,
new TGeoCombiTrans(dx, dy, fdz_lens1,
new TGeoRotation(rot_lens3)));
566 abox->AddNode(bar, 1+j,
new TGeoCombiTrans(dx, dy, dz_bar,
new TGeoRotation(0)));
567 if(fFocusingSystem != 2){
568 abox->AddNode(mirr, 1+j,
new TGeoCombiTrans(dx, dy, dz_mirr,
new TGeoRotation(0)));
577 TGeoPgon* logicEV1, * logicEV2, *logicEV3, * logicEV4;
578 cosFactor1 =
cos(pipehAngle/180.*pi)/
cos(dphi/180.*pi/2.);
579 dR = (radius+hthick+boxgap+boxthick)/
cos(dphi/2./180.*pi) - (radius-hthick);
580 xEV = (dR + sob_len*tan(sob_angle/180.*pi))/ (tan(sob_angle/180.*pi) + tan(sob_angleB/180.*pi));
581 if(sob_angleB == 90.){
582 logicEV1 =
new TGeoPgon(
"logicEV1", 93.6, 172.8, bbnum/2, 2);
583 logicEV1->DefineSection(0, 0., radiusMiddleSmall, sob_Rout);
584 logicEV1->DefineSection(1, sob_len, radiusMiddleSmall, (radius+hthick+boxgap+boxthick+EVoffset)/
cos(dphi/2./180.*pi));
585 logicEV2 =
new TGeoPgon(
"logicEV2", -86.4, 172.8, bbnum/2, 2);
586 logicEV2->DefineSection(0, 0., radiusMiddleSmall, sob_Rout);
587 logicEV2->DefineSection(1, sob_len, radiusMiddleSmall, (radius+hthick+boxgap+boxthick+EVoffset)/
cos(dphi/2./180.*pi));
588 logicEV3 =
new TGeoPgon(
"logicEV3", 86.4, 7.2, 1, 2);
589 logicEV3->DefineSection(0, 0., (radiusMiddleSmall)*cosFactor1, sob_Rout*cosFactor1);
590 logicEV3->DefineSection(1, sob_len, (radiusMiddleSmall)*cosFactor1, (radius+hthick+boxgap+boxthick+EVoffset)/
cos(dphi/2./180.*pi)*cosFactor1);
591 logicEV4 =
new TGeoPgon(
"logicEV4", -93.6, 7.2, 1, 2);
592 logicEV4->DefineSection(0, 0., (radiusMiddleSmall)*cosFactor1, sob_Rout*cosFactor1);
593 logicEV4->DefineSection(1, sob_len, (radiusMiddleSmall)*cosFactor1, (radius+hthick+boxgap+boxthick+EVoffset)/
cos(dphi/2./180.*pi)*cosFactor1);
596 if(sob_angleB != 90.){
597 logicEV1 =
new TGeoPgon(
"logicEV1", 93.6, 172.8, bbnum/2, 3);
598 logicEV1->DefineSection(0, 0., radius-hthick, radius-hthick+eps);
599 logicEV1->DefineSection(1, xEV, radius-hthick, sob_Rout - xEV*tan(sob_angle/180.*pi));
600 logicEV1->DefineSection(2, sob_len, radius-hthick, (radius+hthick+boxgap+boxthick)/
cos(dphi/2./180.*pi));
601 logicEV2 =
new TGeoPgon(
"logicEV2", -86.4, 172.8, bbnum/2, 3);
602 logicEV2->DefineSection(0, 0., radius-hthick, radius-hthick+eps);
603 logicEV2->DefineSection(1, xEV, radius-hthick, sob_Rout - xEV*tan(sob_angle/180.*pi));
604 logicEV2->DefineSection(2, sob_len, radius-hthick, (radius+hthick+boxgap+boxthick)/
cos(dphi/2./180.*pi));
605 logicEV3 =
new TGeoPgon(
"logicEV3", 86.4, 7.2, 1, 3);
606 logicEV3->DefineSection(0, 0., (radius-hthick)*cosFactor1, (radius-hthick+eps)*cosFactor1);
607 logicEV3->DefineSection(1, xEV, (radius-hthick)*cosFactor1, (sob_Rout - xEV*tan(sob_angle/180.*pi))*cosFactor1);
608 logicEV3->DefineSection(2, sob_len, (radius-hthick)*cosFactor1, (radius+hthick+boxgap+boxthick)/
cos(dphi/2./180.*pi)*cosFactor1);
609 logicEV4 =
new TGeoPgon(
"logicEV4", -93.6, 7.2, 1, 3);
610 logicEV4->DefineSection(0, 0., (radius-hthick)*cosFactor1, (radius-hthick+eps)*cosFactor1);
611 logicEV4->DefineSection(1, xEV, (radius-hthick)*cosFactor1, (sob_Rout - xEV*tan(sob_angle/180.*pi))*cosFactor1);
612 logicEV4->DefineSection(2, sob_len, (radius-hthick)*cosFactor1, (radius+hthick+boxgap+boxthick)/
cos(dphi/2./180.*pi)*cosFactor1);
615 TGeoCompositeShape *logicEV =
new TGeoCompositeShape(
"logicEV",
"logicEV1 + logicEV2 + logicEV3 + logicEV4");
616 TGeoVolume* baseEV =
new TGeoVolume(
"DrcEVSensor", logicEV,
gGeoManager->GetMedium(
"FusedSil"));
617 baseEV->SetLineColor(kMagenta+2);
618 baseEV->SetTransparency(50);
619 vLocalMother->AddNode(baseEV, 1,
new TGeoCombiTrans(0.,0.,sob_shift - EVgreaseLayer,
new TGeoRotation(0)));
622 TGeoPgon *logicPDbase1 =
new TGeoPgon(
"logicPDbase1", 93.6, 172.8, bbnum/2, 2);
623 TGeoPgon *logicPDbase2 =
new TGeoPgon(
"logicPDbase2", -86.4, 172.8, bbnum/2, 2);
624 TGeoPgon *logicPDbase3 =
new TGeoPgon(
"logicPDbase3", 86.4, 7.2, 1, 2);
625 TGeoPgon *logicPDbase4 =
new TGeoPgon(
"logicPDbase4", -93.6, 7.2, 1, 2);
626 Double_t rad_delta = (MCPsize-MCPactiveArea)/2./
cos(45./180.*pi);
627 if(sob_angleB == 90.){
628 logicPDbase1->DefineSection(0, 0., radiusMiddleSmall-rad_delta, sob_Rout);
629 logicPDbase1->DefineSection(1, PDbaseLayer, radiusMiddleSmall-rad_delta, sob_Rout);
630 logicPDbase2->DefineSection(0, 0., radiusMiddleSmall-rad_delta, sob_Rout);
631 logicPDbase2->DefineSection(1, PDbaseLayer, radiusMiddleSmall-rad_delta, sob_Rout);
632 logicPDbase3->DefineSection(0, 0., (radiusMiddleSmall)*cosFactor1-rad_delta, sob_Rout*cosFactor1);
633 logicPDbase3->DefineSection(1, PDbaseLayer, (radiusMiddleSmall)*cosFactor1-rad_delta, sob_Rout*cosFactor1);
634 logicPDbase4->DefineSection(0, 0., (radiusMiddleSmall)*cosFactor1-rad_delta, sob_Rout*cosFactor1);
635 logicPDbase4->DefineSection(1, PDbaseLayer, (radiusMiddleSmall)*cosFactor1-rad_delta, sob_Rout*cosFactor1);
648 TGeoCompositeShape *logicPDbase =
new TGeoCompositeShape(
"logicPDbase",
"logicPDbase1 + logicPDbase2 + logicPDbase3 + logicPDbase4");
649 TGeoVolume *pdbase =
new TGeoVolume(
"DrcPDbase", logicPDbase,
gGeoManager->GetMedium(
"DIRCcarbonFiber"));
650 pdbase->SetLineColor(kGreen-6);
651 if(sob_angleB == 90.){
652 vLocalMother->AddNode(pdbase, 1,
new TGeoCombiTrans(0., 0., sob_shift-EVgreaseLayer-PDbaseLayer,
new TGeoRotation(0)));
682 TGeoBBox* logicPD =
new TGeoBBox(
"logicPD", MCPactiveArea/2., MCPactiveArea/2., PDsensitiveThick/2.);
683 TGeoVolume *pixelholder =
new TGeoVolume(
"DrcPDSensor", logicPD,
gGeoManager->GetMedium(
"FusedSil"));
684 pixelholder->SetLineColor(kGreen+1);
687 TGeoBBox* logicPhCathode =
new TGeoBBox(
"logicPhCathode", MCPactiveArea/2., MCPactiveArea/2., PhCathodeThick/2.);
688 TGeoVolume *phcathode =
new TGeoVolume(
"DrcPhCathodeSensor", logicPhCathode,
gGeoManager->GetMedium(
"Photocathode"));
689 phcathode->SetLineColor(kGray+1);
692 TGeoBBox* logicWindow =
new TGeoBBox(
"logicWindow", MCPsize/2., MCPsize/2., PDwindowThick/2.);
693 TGeoVolume *window =
new TGeoVolume(
"DrcPDwindowSensor", logicWindow,
gGeoManager->GetMedium(
"FusedSil"));
694 window->SetLineColor(kBlue-4);
697 TGeoBBox* logicMCPgrease =
new TGeoBBox(
"logicMCPgrease", MCPsize/2., MCPsize/2., PDgreaseLayer/2.);
698 TGeoVolume *mcpgrease =
new TGeoVolume(
"DrcMcpGreaseSensor", logicMCPgrease,
gGeoManager->GetMedium(
"OpticalGrease"));
699 mcpgrease->SetLineColor(kSpring);
712 cout<<
"STEP = "<<step<<endl;
773 Int_t totalnumbering = 1;
776 for(Int_t
m = 0;
m < bbnum;
m ++){
777 phi_curr1 = (90. - phi0 - dphi*
m)/180.*pi;
778 if(
m > bbnum/2-1){ phi_curr1 = (90. - phi0 - dphi*
m - 2.*pipehAngle)/180.*pi; }
781 TGeoRotation rot_sector;
782 rot_sector.RotateZ( -phi0 -
m*dphi - (TMath::Floor(2.*
m/bbnum))*(2.*pipehAngle));
783 cout<<
"phi_curr1 = "<<phi_curr1/3.1415*180.<<endl;
785 cout<<
"rad corner out = "<<radiusCornerOut<<
", step = "<<step<<
", nrowMax = "<<Int_t((sob_Rout-radiusMiddleSmall)/step)<<endl;
786 for(Int_t nrow=0; nrow < Int_t((sob_Rout-radiusMiddleSmall)/step); nrow++){
787 sectorWidth = 2.* (radiusMiddleSmall + step*nrow) * tan(dphi_rad/2.);
789 nmcp = Int_t(sectorWidth/step);
790 cout<<
"tg(dphi_rad/2.)= "<<tan(dphi_rad/2.)<<
", nrow = "<<nrow<<
", 2.* (radiusMiddleSmall + step*nrow) = "<<2.* (radiusMiddleSmall + step*nrow)<<endl;
791 cout<<
"sector width = "<<sectorWidth<<
", nmcp = "<<nmcp<<
", nmcp%2 = "<<nmcp%2<<endl;
792 xpos = (radiusMiddleSmall + 0.5*MCPactiveArea + step*(nrow));
793 for(Int_t ny=0; ny<nmcp; ny++){
794 ypos = ((-Int_t(nmcp/2.) - 0.5*(nmcp%2))*step + (0.5+ny)*step);
795 location.SetXYZ(xpos,ypos,0.);
796 location.RotateZ(phi_curr1);
797 pdbase->AddNode(mcpgrease, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer/2.,
new TGeoRotation(rot_sector)));
798 pdbase->AddNode(window, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer-PDwindowThick/2.,
new TGeoRotation(rot_sector)));
799 pdbase->AddNode(phcathode, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer-PhCathodeThick/2.-PDwindowThick,
new TGeoRotation(rot_sector)));
800 pdbase->AddNode(pixelholder, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer-PhCathodeThick-PDwindowThick-PDsensitiveThick/2.,
new TGeoRotation(rot_sector)));
801 totalnumbering = totalnumbering + 1;
806 for(Int_t nrow=0; nrow < Int_t((sob_Rout-radiusMiddleSmall)/step); nrow++){
807 for(Int_t nadd = 0; nadd<2; nadd++){
808 xpos = (radiusMiddleSmall*cosFactor1 + 0.5*MCPactiveArea + step*(nrow));
809 location.SetXYZ(xpos,0.,0.);
810 location.RotateZ(pi/2.+pi*nadd);
811 pdbase->AddNode(mcpgrease, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer/2.,
new TGeoRotation(0)));
812 pdbase->AddNode(window, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer-PDwindowThick/2.,
new TGeoRotation(0)));
813 pdbase->AddNode(phcathode, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer-PhCathodeThick/2.-PDwindowThick,
new TGeoRotation(0)));
814 pdbase->AddNode(pixelholder, totalnumbering,
new TGeoCombiTrans(location.X(), location.Y(), PDbaseLayer-PDgreaseLayer-PhCathodeThick-PDwindowThick-PDsensitiveThick/2.,
new TGeoRotation(0)));
815 totalnumbering = totalnumbering + 1;
821 top->CheckOverlaps(0.0001,
"");
830 TObjArray *listOfOverlaps =
gGeoManager->GetListOfOverlaps();
831 cout<<listOfOverlaps->GetEntries()<<endl;
832 listOfOverlaps->Print();
836 int findSectorIn(
double y,
double dphi_rad,
double radius,
double EVdrop,
double hthick){
838 EVcornerIn.SetXYZ((radius-EVdrop-hthick)/
cos(dphi_rad/2.),0.,0.);
840 for(Int_t
i=0;
i<4;
i++){
841 EVcornerIn.RotateZ(dphi_rad);
842 Y0[
i] = EVcornerIn.Y();
844 if(y <= Y0[0]){
return 1;}
845 if(y > Y0[0] && y <= Y0[1]){
return 2;}
846 if(y > Y0[1] && y <= Y0[2]){
return 3;}
847 if(y > Y0[2] && y <= Y0[3]){
return 4;}
848 if(y > Y0[3]){
return 5;}
854 EVcorner.SetXYZ(radiusCornerOut,0.,0.);
856 for(Int_t
i=0;
i<4;
i++){
857 EVcorner.RotateZ(dphi_rad);
858 Y0[
i] = EVcorner.Y();
859 cout<<
"Y ["<<
i<<
"] = "<<Y0[
i]<<endl;
861 if(y <= Y0[0]){
return 1;}
862 if(y > Y0[0] && y <= Y0[1]){
return 2;}
863 if(y > Y0[1] && y <= Y0[2]){
return 3;}
864 if(y > Y0[2] && y <= Y0[3]){
return 4;}
865 if(y > Y0[3]){
return 5;}
869 bool getXrange(
double dphi,
double radiusCornerOut,
double radiusCornerIn,
double MCPactiveArea,
int cas1,
int cas2,
double ylow,
double step,
double &x1,
double &x2){
874 EVcorner.SetXYZ(radiusCornerOut,0.,0.);
875 TVector3 EVcorner1 = EVcorner;
876 TVector3 EVcorner2 = EVcorner;
878 EVcornerIn.SetXYZ(radiusCornerIn,0.,0.);
879 TVector3 EVcornerIn1 = EVcornerIn;
880 TVector3 EVcornerIn2 = EVcornerIn;
885 EVcornerIn2.RotateZ(dphi_rad);
886 xstart =
getX(EVcornerIn1, EVcornerIn2, ylow) + MCPactiveArea/2.;
889 EVcornerIn1.RotateZ(1.*dphi_rad);
890 EVcornerIn2.RotateZ(2.*dphi_rad);
891 xstart =
getX(EVcornerIn1, EVcornerIn2, ylow) + MCPactiveArea/2.;
894 EVcornerIn1.RotateZ(2.*dphi_rad);
895 EVcornerIn2.RotateZ(3.*dphi_rad);
896 xstart =
getX(EVcornerIn1, EVcornerIn2, ylow) + MCPactiveArea/2.;
899 EVcornerIn1.RotateZ(3.*dphi_rad);
900 EVcornerIn2.RotateZ(4.*dphi_rad);
901 xstart =
getX(EVcornerIn1, EVcornerIn2, ylow) + MCPactiveArea/2.;
904 EVcornerIn1.RotateZ(4.*dphi_rad);
905 EVcornerIn2.RotateZ(
pi/2.);
906 xstart =
getX(EVcornerIn1, EVcornerIn2, ylow) + MCPactiveArea/2.;
910 EVcorner2.RotateZ(dphi_rad);
911 xfinish =
getX(EVcorner1, EVcorner2, ylow+step) - MCPactiveArea/2.;
914 EVcorner1.RotateZ(1.*dphi_rad);
915 EVcorner2.RotateZ(2.*dphi_rad);
916 xfinish =
getX(EVcorner1, EVcorner2, ylow+step) - MCPactiveArea/2.;
919 EVcorner1.RotateZ(2.*dphi_rad);
920 EVcorner2.RotateZ(3.*dphi_rad);
921 xfinish =
getX(EVcorner1, EVcorner2, ylow+step) - MCPactiveArea/2.;
924 EVcorner1.RotateZ(3.*dphi_rad);
925 EVcorner2.RotateZ(4.*dphi_rad);
926 xfinish =
getX(EVcorner1, EVcorner2, ylow+step) - MCPactiveArea/2.;
929 EVcorner1.RotateZ(4.*dphi_rad);
930 EVcorner2.RotateZ(
pi/2.);
931 xfinish =
getX(EVcorner1, EVcorner2, ylow+step) - MCPactiveArea/2.;
933 if(xstart <= 0.){xstart = step/2.;}
934 if(xstart < step/2.){xstart = step/2.;}
935 if(xfinish <= 0.){xfinish = step/2.;}
939 cout<<
"-I- xstart = "<<xstart<<
", xfinish = "<<xfinish<<endl;
940 if(x1 != x2)
return true;
944 double getX(TVector3 corner1, TVector3 corner2,
double yy){
949 Double_t b = ( corner1.X()*corner2.Y() - corner1.Y()*corner2.X() ) / ( corner1.X() - corner2.X() );
950 Double_t k = ( corner1.Y() - corner2.Y() ) / ( corner1.X() - corner2.X() );
952 if(( yy - b )/k >= 0.)
return ( yy - b )/k;
953 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
int createRootGeometry_DIRC(Int_t fFocusingSystem=0, Bool_t fprizm=kFALSE)
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)