3 #include "TGeoCompositeShape.h"
4 #include "TGeoManager.h"
5 #include "TGeoMaterial.h"
6 #include "TGeoMedium.h"
7 #include "TGeoMatrix.h"
10 #include "TGeoVolume.h"
15 #include "TVirtualPad.h"
48 Double_t AF[11] = {2.121, 2.118, 2.117, 2.117, 2.117, 2.119, 2.122, 2.123, 2.123, 2.125, 2.125};
49 Double_t BF[11] = {2.128, 2.128, 2.128, 2.128, 2.128, 2.128, 2.128, 2.128, 2.128, 2.128, 2.128};
50 Double_t CF[11] = {2.127, 2.139, 2.151, 2.160, 2.169, 2.178, 2.186, 2.191, 2.195, 2.200, 2.202};
51 Double_t AR[11] = {2.904, 2.878, 2.836, 2.790, 2.735, 2.672, 2.623, 2.570, 2.514, 2.470, 2.435};
52 Double_t BR[11] = {2.875, 2.875, 2.875, 2.722, 2.722, 2.722, 2.547, 2.547, 2.547, 2.442, 2.442};
53 Double_t CR[11] = {2.912, 2.907, 2.881, 2.845, 2.801, 2.747, 2.699, 2.651, 2.600, 2.556, 2.523};
81 gSystem->Load(
"libGeom");
82 gSystem->Load(
"libGeoBase");
83 gSystem->Load(
"libParBase");
84 gSystem->Load(
"libBase");
85 gSystem->Load(
"libPndData");
86 gSystem->Load(
"libPassive");
89 FairGeoLoader*
geoLoad =
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
90 FairGeoInterface*
geoFace = geoLoad->getGeoInterface();
91 geoFace->setMediaFile(
"media_pnd.geo");
95 FairGeoMedia*
Media = geoFace->getMedia();
96 FairGeoBuilder*
geobuild = geoLoad->getGeoBuilder();
98 FairGeoMedium* PWO = Media->getMedium(
"PWO");
99 FairGeoMedium* Prepreg = Media->getMedium(
"Prepreg");
100 FairGeoMedium* VM2000 = Media->getMedium(
"VM2000");
101 FairGeoMedium*
ABS = Media->getMedium(
"ABS");
102 FairGeoMedium* Polyurethane = Media->getMedium(
"Polyurethane");
103 FairGeoMedium* Aluminum = Media->getMedium(
"Aluminum");
104 geobuild->createMedium(PWO);
105 geobuild->createMedium(Prepreg);
106 geobuild->createMedium(VM2000);
107 geobuild->createMedium(ABS);
108 geobuild->createMedium(Polyurethane);
109 geobuild->createMedium(Aluminum);
112 geoMan = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
113 TGeoVolume *
top =
new TGeoVolumeAssembly(
"BarrelEMC");
114 geoMan->SetTopVolume(top);
117 for (Int_t
i = 0;
i < 11;
i++) {
127 for (Int_t
i = 0;
i < 11;
i++) {
132 l = 20. + thickness*2;
134 af =
AF[
i] - (
AR[
i] -
AF[
i]) * dl / 20. + thickness * 2;
135 bf =
BF[
i] - (
BR[
i] -
BF[
i]) * dl / 20. + thickness * 2;
136 cf =
CF[
i] - (
CR[
i] -
CF[
i]) * dl / 20. + thickness * 2;
137 ar =
AR[
i] + (
AR[
i] -
AF[
i]) * dl / 20. + thickness * 2;
138 br =
BR[
i] + (
BR[
i] -
BF[
i]) * dl / 20. + thickness * 2;
139 cr =
CR[
i] + (
CR[
i] -
CF[
i]) * dl / 20. + thickness * 2;
141 TGeoTrap* wrapping_L_out =
create_trap(TString::Format(
"wrapping%d_L_out",
i+1),
142 1, af, bf, cf, ar, br, cr, l);
143 TGeoTrap* wrapping_R_out =
create_trap(TString::Format(
"wrapping%d_R_out",
i+1),
144 -1, af, bf, cf, ar, br, cr, l);
148 l = 20. + thickness*2;
150 af =
AF[
i] - (
AR[
i] -
AF[
i]) * dl / 20. + thickness * 2;
151 bf =
BF[
i] - (
BR[
i] -
BF[
i]) * dl / 20. + thickness * 2;
152 cf =
CF[
i] - (
CR[
i] -
CF[
i]) * dl / 20. + thickness * 2;
153 ar =
AR[
i] + (
AR[
i] -
AF[
i]) * dl / 20. + thickness * 2;
154 br =
BR[
i] + (
BR[
i] -
BF[
i]) * dl / 20. + thickness * 2;
155 cr =
CR[
i] + (
CR[
i] -
CF[
i]) * dl / 20. + thickness * 2;
157 TGeoTrap* wrapping_L_in =
create_trap(TString::Format(
"wrapping%d_L_in",
i+1),
158 1, af, bf, cf, ar, br, cr, l);
159 TGeoTrap* wrapping_R_in =
create_trap(TString::Format(
"wrapping%d_R_in",
i+1),
160 -1, af, bf, cf, ar, br, cr, l);
163 wrappings_L[
i] =
new TGeoCompositeShape(TString::Format(
"wrapping%d_L",
i+1),
164 TString::Format(
"wrapping%d_L_out - wrapping%d_L_in",
i+1,
i+1));
165 wrappings_R[
i] =
new TGeoCompositeShape(TString::Format(
"wrapping%d_R",
i+1),
166 TString::Format(
"wrapping%d_R_out - wrapping%d_R_in",
i+1,
i+1));
176 TGeoVolumeAssembly* Slice =
new TGeoVolumeAssembly(
"Slice");
178 TGeoVolumeAssembly* Slice_target =
new TGeoVolumeAssembly(
"Slice_target");
180 for (Int_t
i = 0;
i < 1;
i++) {
181 double theta = 360./16 *
i;
182 TGeoRotation*
rot =
new TGeoRotation(TString::Format(
"rot_slice_%d",
i),
183 90, theta, 90, 90+theta, 0, 0);
184 if (
i == 0 ||
i == 8) top->AddNode(Slice_target,
i+1, rot);
185 else top->AddNode(Slice,
i+1, rot);
205 TFile*
f =
new TFile(
"emc_module12_2018v1.root",
"recreate");
211 TGeoVolumeAssembly* SuperModule1 =
new TGeoVolumeAssembly(
"SuperModule1");
212 TGeoVolumeAssembly* SuperModule2 =
new TGeoVolumeAssembly(
"SuperModule2");
213 TGeoVolumeAssembly* SuperModule3 =
new TGeoVolumeAssembly(
"SuperModule3");
214 TGeoVolumeAssembly* SuperModule4 =
new TGeoVolumeAssembly(
"SuperModule4");
215 TGeoVolumeAssembly* SuperModule5 =
new TGeoVolumeAssembly(
"SuperModule5");
216 TGeoVolumeAssembly* SuperModule6 =
new TGeoVolumeAssembly(
"SuperModule6");
217 TGeoVolumeAssembly* SuperModule7 =
new TGeoVolumeAssembly(
"SuperModule7");
227 vol->AddNode(SuperModule1, 1);
228 vol->AddNode(SuperModule2, 1);
229 vol->AddNode(SuperModule3, 1);
230 vol->AddNode(SuperModule4, 1);
231 vol->AddNode(SuperModule5, 1);
232 vol->AddNode(SuperModule6, 1);
233 vol->AddNode(SuperModule7, 1);
237 TGeoVolume* FrontLogement =
new TGeoVolume(
"Front-Logement", front_logement,
geoMan->GetMedium(
"Polyurethane"));
238 FrontLogement->SetLineColor(kBlue);
239 TGeoTranslation* mat_logement =
new TGeoTranslation(
"mat-Front-Logement", 0., 0., 36.9);
240 vol->AddNode(FrontLogement, 1, mat_logement);
243 TGeoVolume* FrontAlPlate =
new TGeoVolume(
"Front-Al-Plate", front_al_plate,
geoMan->GetMedium(
"Aluminum"));
244 FrontAlPlate->SetLineColor(kDarkTerrain);
245 TGeoTranslation* mat_al_plate =
new TGeoTranslation(
"mat-Front-Al-Plate", 0., 0., 36.9);
246 vol->AddNode(FrontAlPlate, 1, mat_al_plate);
250 TGeoVolumeAssembly* SuperModule1 =
new TGeoVolumeAssembly(
"SuperModule1_Target");
251 TGeoVolumeAssembly* SuperModule2 =
new TGeoVolumeAssembly(
"SuperModule2_Target");
252 TGeoVolumeAssembly* SuperModule3 =
new TGeoVolumeAssembly(
"SuperModule3_Target");
253 TGeoVolumeAssembly* SuperModule4 =
new TGeoVolumeAssembly(
"SuperModule4_Target");
254 TGeoVolumeAssembly* SuperModule5 =
new TGeoVolumeAssembly(
"SuperModule5_Target");
255 TGeoVolumeAssembly* SuperModule6 =
new TGeoVolumeAssembly(
"SuperModule6_Target");
256 TGeoVolumeAssembly* SuperModule7 =
new TGeoVolumeAssembly(
"SuperModule7_Target");
266 vol->AddNode(SuperModule1, 1);
267 vol->AddNode(SuperModule2, 1);
268 vol->AddNode(SuperModule3, 1);
269 vol->AddNode(SuperModule4, 1);
270 vol->AddNode(SuperModule5, 1);
271 vol->AddNode(SuperModule6, 1);
272 vol->AddNode(SuperModule7, 1);
277 TGeoTranslation* traLogement =
new TGeoTranslation(
"traLogement", 0., 0., 36.9);
278 traLogement->RegisterYourself();
279 TGeoTube* holeLogement =
new TGeoTube(
"holeLogement", 0., 7.6, 100.);
280 TGeoRotation* rotHoleLogement =
new TGeoRotation(
"rotHoleLogement", 90, 0, 0, 0, 90, 270);
281 TGeoCombiTrans* matHoleLogement =
new TGeoCombiTrans(
"matHoleLogement", 0., 0., 3.7, rotHoleLogement);
282 matHoleLogement->RegisterYourself();
283 TGeoCompositeShape* front_logement_target =
284 new TGeoCompositeShape(
"front_logement_target",
"front_logement:traLogement - holeLogement:matHoleLogement");
285 TGeoVolume* FrontLogement =
new TGeoVolume(
"Front-Logement-Target", front_logement_target,
geoMan->GetMedium(
"Polyurethane"));
286 FrontLogement->SetLineColor(kBlue);
287 vol->AddNode(FrontLogement, 1);
291 TGeoTranslation* traAlPlate =
new TGeoTranslation(
"traAlPlate", 0., 0., 36.9);
292 traAlPlate->RegisterYourself();
293 TGeoTube* holeAlPlate =
new TGeoTube(
"holeAlPlate", 0., 7.6, 100.);
294 TGeoRotation* rotHoleAlPlate =
new TGeoRotation(
"rotHoleAlPlate", 90, 0, 0, 0, 90, 270);
295 TGeoCombiTrans* matHoleAlPlate =
new TGeoCombiTrans(
"matHoleAlPlate", 0., 0., 3.7, rotHoleAlPlate);
296 matHoleAlPlate->RegisterYourself();
297 TGeoCompositeShape* front_al_plate_target =
298 new TGeoCompositeShape(
"front_al_plate_target",
"front_al_plate:traAlPlate - holeAlPlate:matHoleAlPlate");
299 TGeoVolume* FrontAlPlate =
new TGeoVolume(
"Front-Al-Plate-Target", front_al_plate_target,
geoMan->GetMedium(
"Aluminum"));
300 FrontAlPlate->SetLineColor(kDarkTerrain);
301 vol->AddNode(FrontAlPlate, 1);
306 TGeoVolumeAssembly* Module7m =
new TGeoVolumeAssembly(
"Module7-");
308 vol->AddNode(Module7m, 1);
311 TGeoVolumeAssembly* Module6m =
new TGeoVolumeAssembly(
"Module6-");
313 vol->AddNode(Module6m, 1);
315 TGeoVolumeAssembly* Module5m =
new TGeoVolumeAssembly(
"Module5-");
317 vol->AddNode(Module5m, 1);
319 TGeoVolumeAssembly* Module4m =
new TGeoVolumeAssembly(
"Module4-");
321 vol->AddNode(Module4m, 1);
324 TGeoVolumeAssembly* Module3m =
new TGeoVolumeAssembly(
"Module3-");
326 vol->AddNode(Module3m, 1);
328 TGeoVolumeAssembly* Module2m =
new TGeoVolumeAssembly(
"Module2-");
330 vol->AddNode(Module2m, 1);
332 TGeoVolumeAssembly* Module1m =
new TGeoVolumeAssembly(
"Module1-");
334 vol->AddNode(Module1m, 1);
337 TGeoVolumeAssembly* Module1p =
new TGeoVolumeAssembly(
"Module1+");
339 vol->AddNode(Module1p, 1);
341 TGeoVolumeAssembly* Module2p =
new TGeoVolumeAssembly(
"Module2+");
343 vol->AddNode(Module2p, 1);
345 TGeoVolumeAssembly* Module3p =
new TGeoVolumeAssembly(
"Module3+");
347 vol->AddNode(Module3p, 1);
350 TGeoVolumeAssembly* Module4p =
new TGeoVolumeAssembly(
"Module4+");
352 vol->AddNode(Module4p, 1);
354 TGeoVolumeAssembly* Module5p =
new TGeoVolumeAssembly(
"Module5+");
356 vol->AddNode(Module5p, 1);
358 TGeoVolumeAssembly* Module6p =
new TGeoVolumeAssembly(
"Module6+");
360 vol->AddNode(Module6p, 1);
363 TGeoVolumeAssembly* Module7p =
new TGeoVolumeAssembly(
"Module7+");
365 vol->AddNode(Module7p, 1);
367 TGeoVolumeAssembly* Module8p =
new TGeoVolumeAssembly(
"Module8+");
369 vol->AddNode(Module8p, 1);
371 TGeoVolumeAssembly* Module9p =
new TGeoVolumeAssembly(
"Module9+");
373 vol->AddNode(Module9p, 1);
376 TGeoVolumeAssembly* Module10p =
new TGeoVolumeAssembly(
"Module10+");
378 vol->AddNode(Module10p, 1);
380 TGeoVolumeAssembly* Module11p =
new TGeoVolumeAssembly(
"Module11+");
382 vol->AddNode(Module11p, 1);
388 TGeoVolume* Crystal1;
389 TGeoVolume* Crystal2;
390 TGeoVolume* Wrapping1;
391 TGeoVolume* Wrapping2;
392 TGeoVolume* FrontInsert1;
393 TGeoVolume* FrontInsert2;
394 TGeoVolume* Alveole1;
395 TGeoVolume* Alveole2;
399 Int_t nCrystals = (
id == 11) ? 3 : 4;
400 char char_sign = (sign > 0) ?
'p' :
'm';
401 char char_type1 = (sign > 0) ?
'R' :
'L';
402 char char_type2 = (sign > 0) ?
'L' :
'R';
404 Int_t j_start = (
id-1) * 4;
405 Int_t j_end = j_start + nCrystals;
406 for (Int_t
i = 0;
i < 5;
i++) {
407 for(Int_t j = j_start; j < j_end; j++) {
409 if (
id == 1 && (0 <
i &&
i < 4))
continue;
412 TString crystal_name1 = TString::Format(
"Crystal-%d%c-%c%d",
id, char_sign, char_type1, j-j_start+1);
413 TString crystal_name2 = TString::Format(
"Crystal-%d%c-%c%d",
id, char_sign, char_type2, j-j_start+1);
414 TString wrapping_name1 = TString::Format(
"Wrapping-%d%c-%c%d",
id, char_sign, char_type1, j-j_start+1);
415 TString wrapping_name2 = TString::Format(
"Wrapping-%d%c-%c%d",
id, char_sign, char_type2, j-j_start+1);
416 TString front_insert_name1 = TString::Format(
"FrontInsert-%d%c-%c%d",
id, char_sign, char_type1, j-j_start+1);
417 TString front_insert_name2 = TString::Format(
"FrontInsert-%d%c-%c%d",
id, char_sign, char_type2, j-j_start+1);
418 TString alveole_name1 = TString::Format(
"Alveole-%d%c-%c%d",
id, char_sign, char_type1, j-j_start+1);
419 TString alveole_name2 = TString::Format(
"Alveole-%d%c-%c%d",
id, char_sign, char_type2, j-j_start+1);
421 Crystal1 =
new TGeoVolume(crystal_name1,
crystals_L[
id-1],
geoMan->GetMedium(
"PWO"));
422 Crystal2 =
new TGeoVolume(crystal_name2,
crystals_R[
id-1],
geoMan->GetMedium(
"PWO"));
423 Wrapping1 =
new TGeoVolume(wrapping_name1,
wrappings_L[
id-1],
geoMan->GetMedium(
"VM2000"));
424 Wrapping2 =
new TGeoVolume(wrapping_name2,
wrappings_R[
id-1],
geoMan->GetMedium(
"VM2000"));
431 Crystal1 =
new TGeoVolume(crystal_name1,
crystals_R[
id-1],
geoMan->GetMedium(
"PWO"));
432 Crystal2 =
new TGeoVolume(crystal_name2,
crystals_L[
id-1],
geoMan->GetMedium(
"PWO"));
433 Wrapping1 =
new TGeoVolume(wrapping_name1,
wrappings_R[
id-1],
geoMan->GetMedium(
"VM2000"));
434 Wrapping2 =
new TGeoVolume(wrapping_name2,
wrappings_L[
id-1],
geoMan->GetMedium(
"VM2000"));
440 Crystal1->SetLineColor(kCyan);
441 Crystal2->SetLineColor(kCyan);
442 Wrapping1->SetLineColor(kViolet);
443 Wrapping2->SetLineColor(kViolet);
444 FrontInsert1->SetLineColor(kWhite);
445 FrontInsert2->SetLineColor(kWhite);
446 Alveole1->SetLineColor(kYellow);
447 Alveole2->SetLineColor(kYellow);
450 TGeoHMatrix* mat1_crystal;
451 TGeoHMatrix* mat2_crystal;
460 mat1_crystal->SetName(TString::Format(
"mat-crystal-%d%c-%c%d",
id, char_sign, char_type1, j-j_start+1));
461 mat2_crystal->SetName(TString::Format(
"mat-crystal-%d%c-%c%d",
id, char_sign, char_type2, j-j_start+1));
463 TGeoHMatrix* mat1_front_insert;
464 TGeoHMatrix* mat2_front_insert;
473 mat1_front_insert->SetName(TString::Format(
"mat-front-insert-%d%c-%c%d",
id, char_sign, char_type1, j-j_start+1));
474 mat2_front_insert->SetName(TString::Format(
"mat-front-insert-%d%c-%c%d",
id, char_sign, char_type2, j-j_start+1));
476 TGeoHMatrix* mat1_alveole;
477 TGeoHMatrix* mat2_alveole;
490 mat1_alveole->SetName(TString::Format(
"mat-alveole-%d%c-%c%d",
id, char_sign, char_type1, j-j_start+1));
491 mat2_alveole->SetName(TString::Format(
"mat-alveole-%d%c-%c%d",
id, char_sign, char_type2, j-j_start+1));
495 vol->AddNode(Alveole1,
i+1, mat1_alveole);
496 vol->AddNode(Alveole2,
i+1, mat2_alveole);
497 vol->AddNode(FrontInsert1,
i+1, mat1_front_insert);
498 vol->AddNode(FrontInsert2,
i+1, mat2_front_insert);
499 vol->AddNode(Wrapping1,
i+1, mat1_crystal);
500 vol->AddNode(Wrapping2,
i+1, mat2_crystal);
501 vol->AddNode(Crystal1,
i+1, mat1_crystal);
502 vol->AddNode(Crystal2,
i+1, mat2_crystal);
508 for (Int_t type = 0; type < 4; type++) {
511 Double_t module_gap[] = {0.12, 0.25, 0.3, 0.33};
517 if (type == 0 || type == 2) nModule = 3;
521 for (Int_t iModule = 0; iModule < nModule; iModule++) {
522 for (Int_t iAlveole = 0; iAlveole < 3; iAlveole++) {
523 for (Int_t iCrystal = 0; iCrystal < 4; iCrystal++) {
525 if (type == 0 || type == 2) module_id = 3 - iModule;
526 else module_id = iModule + 4;
527 Int_t alveole_id = iModule * 3 + iAlveole + 1;
528 Int_t crystal_id = iCrystal + 1;
530 if (module_id == 1 && iAlveole > 0)
break;
531 if (module_id == 7 && iAlveole > 1)
break;
532 if (module_id == 7 && iAlveole == 1 && iCrystal > 2)
break;
536 if (type == 0 || type == 3) crystal =
crystals_L[alveole_id-1];
542 if (iAlveole == 0) gap = module_gap[iModule];
559 TVector3 center2pivot;
560 TVector3 vertices[8];
563 trans_z -= (gap + bf) /
TMath::Cos(trans_theta);
564 center2pivot = -vertices[1];
566 else if (type == 1) {
567 trans_z += (gap + bf) /
TMath::Cos(trans_theta);
568 center2pivot = -vertices[2];
570 else if (type == 2) {
571 trans_z -= (gap + bf) /
TMath::Cos(trans_theta);
572 center2pivot = -vertices[2];
575 trans_z += (gap + bf) /
TMath::Cos(trans_theta);
576 center2pivot = -vertices[1];
582 else if (type == 1) {
587 else if (type == 2) {
596 center2pivot.RotateY(trans_theta);
598 if (type == 0 || type == 1)
599 pivot = TVector3(57.+0.112126393, -0.068, trans_z + 3.7);
601 pivot = TVector3(57., 0, trans_z + 3.7);
602 TVector3 center = pivot + center2pivot;
606 TGeoRotation* crystal_rot;
613 else if (type == 1) {
617 else if (type == 1) {
626 crystal_rot =
new TGeoRotation(
627 TString::Format(
"rot-%d%c-%c%d",
628 alveole_id, avleole_sign, crystal_type, crystal_id),
629 90, 270, 180-trans_theta_deg, 180, 90+trans_theta_deg, 0);
631 else if (type == 1) {
632 crystal_rot =
new TGeoRotation(
633 TString::Format(
"rot-%d%c-%c%d",
634 alveole_id, avleole_sign, crystal_type, crystal_id),
635 90, 90, trans_theta_deg, 0, 90+trans_theta_deg, 0);
637 else if (type == 2) {
638 crystal_rot =
new TGeoRotation(
639 TString::Format(
"rot-%d%c-%c%d",
640 alveole_id, avleole_sign, crystal_type, crystal_id),
641 90, 270, 180-trans_theta_deg, 180, 90+trans_theta_deg, 0);
644 crystal_rot =
new TGeoRotation(
645 TString::Format(
"rot-%d%c-%c%d",
646 alveole_id, avleole_sign, crystal_type, crystal_id),
647 90, 90, trans_theta_deg, 0, 90+trans_theta_deg, 0);
649 crystal_rot->RegisterYourself();
651 TGeoCombiTrans* crystal_ctrans =
new TGeoCombiTrans(TString::Format(
"trans-%d%c-%c%d",
652 alveole_id, avleole_sign, crystal_type, crystal_id),
653 center.X(), center.Y(), center.Z(), crystal_rot);
664 if (type == 0 || type == 2)
665 trans_theta +=
theta;
667 trans_theta -=
theta;
682 Double_t alpha_alveole[] = {3.862213309, 3.945818621, 4.028979744, 4.11168967, 4.193941577};
683 Double_t theta_alveole[] = {0, 4.416394688, 4.416838877, 4.417290073, 4.417748093};
685 for (Int_t
i = 0;
i < 5;
i++) {
686 theta += theta_alveole[
i];
687 TGeoRotation
rot(TString::Format(
"rot_alveole_row_%d",
i),
688 90, 360-theta, 90, 90-theta, 0, 0);
690 TGeoTranslation tra1(-57., 0, 0);
691 TGeoRotation
rot1(
"rot1_row2", 90, 360-alpha_alveole[
i], 90, 90-alpha_alveole[i], 0, 0);
692 TGeoTranslation tra2(57., 0, 0);
700 TGeoTrap* front_inserts_L_out[11];
701 TGeoTrap* front_inserts_R_out[11];
702 for (Int_t
i = 0;
i < 11;
i++) {
705 dl = 0.0065 + 0.00001;
719 front_inserts_L_out[
i] =
create_trap(TString::Format(
"front_insert_%d_L_out",
i+1),
720 1, af, bf, cf, ar, br, cr, l);
721 front_inserts_R_out[
i] =
create_trap(TString::Format(
"front_insert_%d_R_out",
i+1),
722 -1, af, bf, cf, ar, br, cr, l);
724 TGeoTube* big_hole =
new TGeoTube(
"front_insert_big_hole", 0., 0.6, 0.151);
725 TGeoTube* small_hole =
new TGeoTube(
"front_insert_small_hole", 0., 0.2, 0.151);
726 TGeoTranslation* trans_big_hole_L =
new TGeoTranslation(
"trans_front_insert_big_hole_L", -0.13, 0.13, 0.);
727 trans_big_hole_L->RegisterYourself();
728 TGeoTranslation* trans_small_hole_L =
new TGeoTranslation(
"trans_front_insert_small_hole_L", 0.67, -0.67, 0.);
729 trans_small_hole_L->RegisterYourself();
730 TGeoTranslation* trans_big_hole_R =
new TGeoTranslation(
"trans_front_insert_big_hole_R", 0.13, 0.13, 0.);
731 trans_big_hole_R->RegisterYourself();
732 TGeoTranslation* trans_small_hole_R =
new TGeoTranslation(
"trans_front_insert_small_hole_R", -0.67, -0.67, 0.);
733 trans_small_hole_R->RegisterYourself();
735 front_inserts_L[
i] =
new TGeoCompositeShape(TString::Format(
"front_insert_%d_L",
i+1),
736 TString::Format(
"front_insert_%d_L_out - front_insert_big_hole:trans_front_insert_big_hole_L",
i+1));
738 front_inserts_R[
i] =
new TGeoCompositeShape(TString::Format(
"front_insert_%d_R",
i+1),
739 TString::Format(
"front_insert_%d_R_out - front_insert_big_hole:trans_front_insert_big_hole_R",
i+1));
745 for (Int_t
i = 0;
i < 11;
i++) {
748 TGeoTrap* front_insert = front_inserts_L_out[
i];
750 TVector3 vertices[8];
752 TVector3 ccry_to_v0cry = vertices[0];
753 TVector3 v0cry_to_v4ins = TVector3(0., 0., -(0.0065 + 0.00001));
755 TVector3 v4ins_to_cins = -vertices[4];
756 TVector3 ccry_to_cins = ccry_to_v0cry + v0cry_to_v4ins + v4ins_to_cins;
762 front_insert = front_inserts_R_out[
i];
765 TVector3 ccry_to_v3cry = vertices[3];
766 TVector3 v3cry_to_v7ins = TVector3(0., 0., -(0.0065 + 0.00001));
768 TVector3 v7ins_to_cins = -vertices[7];
769 ccry_to_cins = ccry_to_v3cry + v3cry_to_v7ins + v7ins_to_cins;
784 TGeoTrap* alveoles_L_out[43];
785 TGeoTrap* alveoles_R_out[43];
787 Double_t top_plane_height[] = {21.773, 20.559, 16.696, 12.582};
788 Double_t top_plane_angle[] = {88.574, 110.433, 131.197, 147.2625};
789 for (Int_t iModule = 0; iModule < 4; iModule++) {
790 for (Int_t iAlveole = 0; iAlveole < 3; iAlveole++) {
791 for (Int_t iCrystal = 0; iCrystal < 4; iCrystal++) {
792 Int_t module_id = iModule + 4;
793 Int_t alveole_id = iModule * 3 + iAlveole + 1;
794 Int_t crystal_id = iCrystal + 1;
796 if (module_id == 1 && iAlveole > 0)
break;
797 if (module_id == 7 && iAlveole > 1)
break;
798 if (module_id == 7 && iAlveole == 1 && iCrystal > 2)
break;
800 Double_t l, dlr_i, af, bf, cf, ar, br, cr;
813 cf =
CF[0] - (
CR[0] -
CF[0]) * dlf / 20.
814 + (thickness + gap_phi - safety) /
TMath::Cos(theta_c) + thickness + gap_phi -
safety;
822 cr =
CR[0] + (
CR[0] -
CF[0]) * dlr / 20.
823 + (thickness + gap_phi - safety) /
TMath::Cos(theta_c) + thickness + gap_phi -
safety;
826 TGeoTrap* alveole_L_out =
create_trap(TString::Format(
"alveole%d_L_out", i+1),
827 1, af, bf, cf, ar, br, cr, l, i);
828 TGeoTrap* alveole_R_out =
create_trap(TString::Format(
"alveole%d_R_out", i+1),
829 -1, af, bf, cf, ar, br, cr, l, i);
830 alveoles_L_out[
i] = alveole_L_out;
831 alveoles_R_out[
i] = alveole_R_out;
835 if (iAlveole == 0 && iCrystal == 0) {
836 height = top_plane_height[iModule];
839 TVector3 vertices[8];
843 (vertices[4].Y()-vertices[0].Y())/l*(dlf+height);
844 Double_t z_c = vertices[0].Z() + height + dlf;
845 TVector3 h0(0., y_c1, z_c);
846 TVector3 c2center(0, 0, 100.);
847 c2center.RotateX(-theta_top_plane/180*
TMath::Pi());
848 TVector3 center_c = h0 + c2center;
849 TGeoRotation* rot_top_plane =
new TGeoRotation(
850 TString::Format(
"rot_top_plane_%d", i+1), 90, 0, 90+theta_top_plane, 90, theta_top_plane, 90);
851 TGeoCombiTrans* cmb_top_plane =
new TGeoCombiTrans(TString::Format(
"cmb_top_plane_%d", i+1),
852 center_c.X(), center_c.Y(), center_c.Z(), rot_top_plane);
853 cmb_top_plane->RegisterYourself();
855 TGeoBBox* top_box =
new TGeoBBox(
856 TString::Format(
"cut_box_%d", i+1), 100., 100., 100.);
858 height = height - (bf+(br-bf)/l*(height+dlf))/
864 h0.SetXYZ(vertices[2].
X(), vertices[2].
Y(), vertices[2].
Z() + dlf - 0.158);
865 c2center.SetXYZ(0., 0., -100.);
867 center_c = h0 + c2center;
868 TGeoRotation* rot_bottom_plane_left_minus =
new TGeoRotation(
869 TString::Format(
"rot_bottom_plane_left_minus_%d", i+1), 90-4, 0, 90, 90, 4, 180);
870 TGeoCombiTrans* cmb_bottom_plane_left_minus =
new TGeoCombiTrans(TString::Format(
"cmb_bottom_plane_left_minus_%d", i+1),
871 center_c.X(), center_c.Y(), center_c.Z(), rot_bottom_plane_left_minus);
872 cmb_bottom_plane_left_minus->RegisterYourself();
876 h0.SetXYZ(vertices[2].
X(), vertices[2].
Y(), vertices[2].
Z() + dlf - 0.158);
877 c2center.SetXYZ(0., 0., -100.);
879 center_c = h0 + c2center;
880 TGeoRotation* rot_bottom_plane_right_minus =
new TGeoRotation(
881 TString::Format(
"rot_bottom_plane_right_minus_%d", i+1), 90-4, 0, 90, 90, 4, 180);
882 TGeoCombiTrans* cmb_bottom_plane_right_minus =
new TGeoCombiTrans(TString::Format(
"cmb_bottom_plane_right_minus_%d", i+1),
883 center_c.X(), center_c.Y(), center_c.Z(), rot_bottom_plane_right_minus);
884 cmb_bottom_plane_right_minus->RegisterYourself();
888 h0.SetXYZ(vertices[1].
X(), vertices[1].
Y(), vertices[1].
Z() + dlf - 0.158);
889 c2center.SetXYZ(0., 0., -100.);
891 center_c = h0 + c2center;
892 TGeoRotation* rot_bottom_plane_left_plus =
new TGeoRotation(
893 TString::Format(
"rot_bottom_plane_left_plus_%d", i+1), 90+4, 0, 90, 90, 4, 0);
894 TGeoCombiTrans* cmb_bottom_plane_left_plus =
new TGeoCombiTrans(TString::Format(
"cmb_bottom_plane_left_plus_%d", i+1),
895 center_c.X(), center_c.Y(), center_c.Z(), rot_bottom_plane_left_plus);
896 cmb_bottom_plane_left_plus->RegisterYourself();
900 h0.SetXYZ(vertices[1].
X(), vertices[1].
Y(), vertices[1].
Z() + dlf - 0.158);
901 c2center.SetXYZ(0., 0., -100.);
903 center_c = h0 + c2center;
904 TGeoRotation* rot_bottom_plane_right_plus =
new TGeoRotation(
905 TString::Format(
"rot_bottom_plane_right_plus_%d", i+1), 90+4, 0, 90, 90, 4, 0);
906 TGeoCombiTrans* cmb_bottom_plane_right_plus =
new TGeoCombiTrans(TString::Format(
"cmb_bottom_plane_right_plus_%d", i+1),
907 center_c.X(), center_c.Y(), center_c.Z(), rot_bottom_plane_right_plus);
908 cmb_bottom_plane_right_plus->RegisterYourself();
919 TGeoTrap* alveole_L_in =
create_trap(TString::Format(
"alveole%d_L_in", i+1),
920 1, af, bf, cf, ar, br, cr, l, i);
921 TGeoTrap* alveole_R_in =
create_trap(TString::Format(
"alveole%d_R_in", i+1),
922 -1, af, bf, cf, ar, br, cr, l, i);
926 alveoles_L_minus[
i] =
new TGeoCompositeShape(TString::Format(
"alveole%d_L", i+1),
927 TString::Format(
"alveole%d_L_out - alveole%d_L_in - cut_box_%d:cmb_top_plane_%d - cut_box_%d:cmb_bottom_plane_left_minus_%d", i+1, i+1, i+1, i+1, i+1, i+1));
928 alveoles_R_minus[
i] =
new TGeoCompositeShape(TString::Format(
"alveole%d_R", i+1),
929 TString::Format(
"alveole%d_R_out - alveole%d_R_in - cut_box_%d:cmb_top_plane_%d - cut_box_%d:cmb_bottom_plane_right_minus_%d", i+1, i+1, i+1, i+1, i+1, i+1));
931 alveoles_L_plus[
i] =
new TGeoCompositeShape(TString::Format(
"alveole%d_L", i+1),
932 TString::Format(
"alveole%d_L_out - alveole%d_L_in - cut_box_%d:cmb_top_plane_%d - cut_box_%d:cmb_bottom_plane_left_plus_%d", i+1, i+1, i+1, i+1, i+1, i+1));
933 alveoles_R_plus[
i] =
new TGeoCompositeShape(TString::Format(
"alveole%d_R", i+1),
934 TString::Format(
"alveole%d_R_out - alveole%d_R_in - cut_box_%d:cmb_top_plane_%d - cut_box_%d:cmb_bottom_plane_right_plus_%d", i+1, i+1, i+1, i+1, i+1, i+1));
942 for (Int_t type = 0; type < 4; type++) {
944 const Double_t alveole_gap = 0.09 - 2*thickness - 2*gap_z + 2*
safety;
946 0.12 - thickness - gap_z +
safety,
947 0.25 - 2*thickness - 2*gap_z + 2*
safety,
948 0.3 - 2*thickness - 2*gap_z + 2*
safety,
949 0.33 - 2*thickness - 2*gap_z + 2*safety
955 if (type == 0 || type == 2) nModule = 3;
958 for (Int_t iModule = 0; iModule < nModule; iModule++) {
959 for (Int_t iAlveole = 0; iAlveole < 3; iAlveole++) {
960 for (Int_t iCrystal = 0; iCrystal < 4; iCrystal++) {
962 if (type == 0 || type == 2) module_id = 3 - iModule;
963 else module_id = iModule + 4;
964 Int_t alveole_id = iModule * 3 + iAlveole + 1;
965 Int_t crystal_id = iCrystal + 1;
967 if (module_id == 1 && iAlveole > 0)
break;
968 if (module_id == 7 && iAlveole > 1)
break;
969 if (module_id == 7 && iAlveole == 1 && iCrystal > 2)
break;
973 if (type == 0 || type == 3) crystal = alveoles_L_out[
i];
974 else crystal = alveoles_R_out[
i];
979 if (iAlveole == 0) gap = module_gap[iModule];
983 TVector3 pivot2center;
984 TVector3 vertices[8];
989 pivot2center = -vertices[1];
991 else if (type == 1) {
993 pivot2center = -vertices[2];
995 else if (type == 2) {
997 pivot2center = -vertices[2];
1001 pivot2center = -vertices[1];
1007 else if (type == 1) {
1012 else if (type == 2) {
1022 if (type == 0 || type == 1)
1023 pivot = TVector3(57.+0.112126393-dlf,
1024 -2*safety-(gap_phi+thickness-safety),
1027 pivot = TVector3(57.-dlf, -(gap_phi+thickness-safety),
1029 TVector3 center = pivot + pivot2center;
1032 TGeoRotation* crystal_rot;
1039 else if (type == 1) {
1043 else if (type == 1) {
1052 crystal_rot =
new TGeoRotation(
1053 TString::Format(
"rot-alveole-%d%c-%c%d",
1054 alveole_id, avleole_sign, crystal_type, crystal_id),
1055 90, 270, 180, 180, 90, 0);
1057 else if (type == 1) {
1058 crystal_rot =
new TGeoRotation(
1059 TString::Format(
"rot-alveole-%d%c-%c%d",
1060 alveole_id, avleole_sign, crystal_type, crystal_id),
1061 90, 90, 0, 0, 90, 0);
1063 else if (type == 2) {
1064 crystal_rot =
new TGeoRotation(
1065 TString::Format(
"rot-alveole-%d%c-%c%d",
1066 alveole_id, avleole_sign, crystal_type, crystal_id),
1067 90, 270, 180, 180, 90, 0);
1070 crystal_rot =
new TGeoRotation(
1071 TString::Format(
"rot-alveole-%d%c-%c%d",
1072 alveole_id, avleole_sign, crystal_type, crystal_id),
1073 90, 90, 0, 0, 90, 0);
1075 crystal_rot->RegisterYourself();
1078 TGeoCombiTrans* crystal_ctrans =
1079 new TGeoCombiTrans(TString::Format(
"trans-alveole-%d%c-%c%d",
1080 alveole_id, avleole_sign, crystal_type, crystal_id),
1081 center.X(), center.Y(), center.Z(), crystal_rot);
1122 TVector3 v21(x21, y21, z21);
1138 trap =
new TGeoTrap(name, dz, theta, phi, h1, bl1, tl1, alpha1,
1139 h2, bl2, tl2, alpha2);
1141 trap =
new TGeoTrap(name, dz, theta, 180-phi, h1, bl1, tl1, -alpha1,
1142 h2, bl2, tl2, -alpha2);
1159 TVector3 v21(x21, y21, z21);
1175 trap =
new TGeoTrap(name, dz, theta, phi, h1, bl1, tl1, alpha1,
1176 h2, bl2, tl2, alpha2);
1178 trap =
new TGeoTrap(name, dz, theta, 180-phi, h1, bl1, tl1, -alpha1,
1179 h2, bl2, tl2, -alpha2);
1187 for (Int_t
i = 0;
i < 8;
i++) {
1188 for (Int_t j = 0; j < 2; j++) {
1189 xy[
i][j] = *(p + off);
1193 for (Int_t
i = 0;
i < 8;
i++) {
1195 points[
i].SetXYZ(xy[
i][0], xy[i][1], -trap->GetDz());
1198 points[
i].SetXYZ(xy[
i][0], xy[i][1], trap->GetDz());
1216 TVector3
n(0., 0., 1.);
1219 TFile*
f =
new TFile(filename,
"recreate");
1220 TTree*
t =
new TTree(
"raytrace",
"raytrace");
1222 t->Branch(
"x", &_x,
"x/D");
1223 t->Branch(
"y", &_y,
"y/D");
1224 t->Branch(
"z", &_z,
"z/D");
1228 Int_t unit = (Int_t)(nx*ny/100);
1229 if (count % unit == 0) {
1230 cout << count / unit <<
"% procecced" << endl;
1232 geoMan->InitTrack(
x,
y, zmin, n.X(), n.Y(), n.Z());
1233 while (!geoMan->IsOutside()) {
1234 geoMan->FindNextBoundaryAndStep(10000., kTRUE);
1235 _x = geoMan->GetCurrentPoint()[0];
1236 _y = geoMan->GetCurrentPoint()[1];
1237 _z = geoMan->GetCurrentPoint()[2];
1260 TVector3
n(1., 0., 0.);
1263 TFile*
f =
new TFile(filename,
"recreate");
1264 TTree*
t =
new TTree(
"raytrace",
"raytrace");
1266 t->Branch(
"x", &_x,
"x/D");
1267 t->Branch(
"y", &_y,
"y/D");
1268 t->Branch(
"z", &_z,
"z/D");
1272 Int_t unit = (Int_t)(ny*nz/100);
1273 if (count % unit == 0) {
1274 cout << count / unit <<
"% proceeded" << endl;
1276 geoMan->InitTrack(xmin,
y,
z, n.X(), n.Y(), n.Z());
1278 geoMan->FindNextBoundaryAndStep();
1279 _x = geoMan->GetCurrentPoint()[0];
1280 _y = geoMan->GetCurrentPoint()[1];
1281 _z = geoMan->GetCurrentPoint()[2];
1283 }
while (_x < 1000 && _x > -1000);
TGeoMatrix * matrices_alveole_minus_right[28]
TGeoTranslation * matrices_fe2cry_left[11]
int main(int argc, char **argv)
void get_trap_vertices(TGeoTrap *, TVector3 *points)
TGeoCombiTrans * matrices_plus_left[43]
TGeoMatrix * matrices_alveole_plus_right[43]
TGeoTrap * crystals_L[11]
TGeoMatrix * matrices_alveole_plus_left[43]
void CalculateCrystalMatricesZ()
TGeoCompositeShape * wrappings_R[11]
void ConstructModule(TGeoVolume *vol, Int_t id, Int_t sign, Bool_t is_target=kFALSE)
TGeoTrap * create_trap(TString name, Int_t type, Double_t af, Double_t bf, Double_t cf, Double_t ar, Double_t br, Double_t cr, Double_t l)
void raytrace_z(TGeoManager *geom, TString filename)
TGeoMatrix * matrices_alveole_minus_left[28]
TGeoCompositeShape * alveoles_R_plus[43]
void CreateAlveoleShapesAndMatricesZ()
void ConstructSlice(TGeoVolume *vol)
TGeoCompositeShape * wrappings_L[11]
void CreateFrontInsertShapesAndMatricesZ()
FairGeoBuilder * geobuild
TGeoCompositeShape * alveoles_L_minus[28]
TGeoTranslation * matrices_crystal2alveole_L[11]
void raytrace_x(TGeoManager *geom, TString filename)
TGeoCompositeShape * front_inserts_L[11]
void CalculateCrystalMatricesPhi()
TGeoCompositeShape * alveoles_R_minus[28]
TGeoCombiTrans * matrices_minus_right[28]
TGeoCompositeShape * front_inserts_R[11]
TGeoMatrix * matrices_phi[5]
TGeoTranslation * matrices_fe2cry_right[11]
TGeoCombiTrans * matrices_plus_right[43]
TGeoTranslation * matrices_crystal2alveole_R[11]
void ConstructTargetSlice(TGeoVolume *vol)
TGeoCompositeShape * alveoles_L_plus[43]
FairGeoInterface * geoFace
TGeoCombiTrans * matrices_minus_left[28]
Double_t crystal_theta[44]
TGeoTrap * crystals_R[11]
void ConstructSuperModule(TGeoVolume *vol, Int_t id, Bool_t is_target=kFALSE)