Adds a custom block of OuterWall+LiSc+Support ribs for a given distance along z. Ensures consistency in implementation throughout the z.
373 {
374 TString blockName = "block";
375 blockName += block_number;
376
377 int ribColor = 15;
378
379 double wz = (z2 - z1);
380 double slX = (
wx(z2) -
wx(z1)) / 2 / wz;
381 double slY = (
wy(z2) -
wy(z1)) / 2 / wz;
382
383 double dZ =
384 (cell_thickness_z - rib_thickness) / 2;
385
386 double tX = 0;
387 double tY = 0;
388 double tZ = 0;
390
392 TString nameOuterWall = (TString)outer_wall->GetName() + "_" + blockName;
393 TGeoVolume* TOW =
395 wx(z1) + 2 * (wall_thickness + lisc_thickness_start),
396 wx(z2) + 2 * (wall_thickness + lisc_thickness_end),
397 wy(z1) + 2 * (wall_thickness + lisc_thickness_start),
398 wy(z2) + 2 * (wall_thickness + lisc_thickness_end),
400 outer_wall->AddNode(TOW, 0, new TGeoTranslation(0, 0, z_shift));
401
403 std::vector<TGeoVolume*> vLongitRibX(nx);
404 std::vector<TGeoVolume*> vLongitRibY(ny);
405
406 double z1_x_thickness_1 =
407 wx(z1 + rib_thickness) + 2 * (wall_thickness + lisc_thickness_start);
408 double z1_x_thickness_2 =
409 wx(z1 + cell_thickness_z) + 2 * (wall_thickness + lisc_thickness_start);
410
411 double z1_x1_Step = (z1_x_thickness_1 -
nx * rib_thickness) / (nx + 1);
412 double z1_x2_Step = (z1_x_thickness_2 -
nx * rib_thickness) / (nx + 1);
413
414 double z1_y_thickness_1 =
415 wy(z1 + rib_thickness) + 2 * (wall_thickness + lisc_thickness_start);
416 double z1_y_thickness_2 =
417 wy(z1 + cell_thickness_z) + 2 * (wall_thickness + lisc_thickness_start);
418
419 double z1_y1_Step = (z1_y_thickness_1 -
ny * rib_thickness) / (ny + 1);
420 double z1_y2_Step = (z1_y_thickness_2 -
ny * rib_thickness) / (ny + 1);
421
422 double z1_x1, z1_x2, z1_y1, z1_y2;
423
424 z1_x1 = z1_x_thickness_1 / 2;
425 z1_x2 = z1_x_thickness_2 / 2;
426
427 z1_y1 = z1_y_thickness_1 / 2 - lisc_thickness_start;
428 z1_y2 = z1_y_thickness_2 / 2 - lisc_thickness_end;
429
430 for (
int i = 0;
i <
nx;
i++) {
431 z1_x1 = z1_x1 - z1_x1_Step;
432 z1_x2 = z1_x2 - z1_x2_Step;
433
435 name.Form(
"vLongitRibX_%s_phi%d", blockName.Data(),
437 vLongitRibX.at(i) =
438 GeoSideObj(name, dZ, rib_thickness, lisc_thickness_start, rib_thickness,
439 lisc_thickness_end, z1_x2 - z1_x1, z1_y2 - z1_y1, ribColor,
441
442 z1_x1 = z1_x1 - rib_thickness;
443 z1_x2 = z1_x2 - rib_thickness;
444 }
445
446 z1_y1 = z1_y_thickness_1 / 2;
447 z1_y2 = z1_y_thickness_2 / 2;
448
449 z1_x1 = z1_x_thickness_1 / 2 - lisc_thickness_start;
450 z1_x2 = z1_x_thickness_2 / 2 - lisc_thickness_end;
451
452 for (
int i = 0;
i <
ny;
i++) {
453 z1_y1 = z1_y1 - z1_y1_Step;
454 z1_y2 = z1_y2 - z1_y2_Step;
455
457 name.Form(
"vLongitRibY_%s_phi%d", blockName.Data(),
460 name, dZ, lisc_thickness_start, rib_thickness, lisc_thickness_end,
461 rib_thickness, z1_x2 - z1_x1, z1_y2 - z1_y1, ribColor,
supportMedIn);
462 z1_y1 = z1_y1 - rib_thickness;
463 z1_y2 = z1_y2 - rib_thickness;
464 }
465
467
468 name =
"CornerRib_L_" + blockName +
"_id";
469 TGeoVolumeAssembly* CornerRib_L =
471 lisc_thickness_end, dZ, slX, slY, ribColor,
supportMedIn);
472 name =
"CornerRib_R_" + blockName +
"_id";
473 TGeoVolumeAssembly* CornerRib_R =
475 lisc_thickness_end, dZ, slY, slX, ribColor,
supportMedIn);
476
477 const int nZSteps =
478 static_cast<int>(std::floor((z2 - z1) / cell_thickness_z)) + 1;
479 for (int iz = 0; iz < nZSteps; ++iz) {
480 const double zi = z1 + iz * cell_thickness_z;
481 if (zi >= z2) break;
482 int Zlayer = static_cast<int>(zi) / cell_thickness_z + 1;
483
485 TString nameVR("");
486 nameVR.Form("VetoVerticalRib_z%d", static_cast<int>(zi));
488 nameVR, lisc_thickness_start, rib_thickness,
489 wx(zi) + 2 * wall_thickness,
490 wx(zi + rib_thickness) + 2 * wall_thickness,
491 wy(zi) + 2 * wall_thickness,
492 wy(zi + rib_thickness) + 2 * wall_thickness, ribColor,
supportMedIn);
493 tZ = z_shift - wz / 2 + zi - z1 + rib_thickness / 2;
494
495 vertical_rib->AddNode(TVR, 0, new TGeoTranslation(0, 0, tZ));
496
497 if (z2 - zi < cell_thickness_z) continue;
498
499 tX =
wx(zi + rib_thickness) / 2 + wall_thickness;
500 tY =
wy(zi + rib_thickness) / 2 + wall_thickness;
501 tZ = tZ + cell_thickness_z / 2;
502
504 longitudinal_rib->AddNode(
505 CornerRib_L,
makeId(zi, tX, tY),
506 new TGeoCombiTrans(tX, tY, tZ, new TGeoRotation("r", 0, 0, 0)));
507 longitudinal_rib->AddNode(
508 CornerRib_L,
makeId(zi, -tX, -tY),
509 new TGeoCombiTrans(-tX, -tY, tZ, new TGeoRotation("r", 0, 0, 180)));
510 longitudinal_rib->AddNode(
511 CornerRib_R,
makeId(zi, -tX, tY),
512 new TGeoCombiTrans(-tX, tY, tZ, new TGeoRotation("r", 0, 0, 90)));
513 longitudinal_rib->AddNode(
514 CornerRib_R,
makeId(zi, tX, -tY),
515 new TGeoCombiTrans(tX, -tY, tZ, new TGeoRotation("r", 0, 0, 270)));
516
517 double zi_x_thickness_1 =
518 wx(zi + rib_thickness) + 2 * (wall_thickness + lisc_thickness_start);
519 double zi_x_thickness_2 =
520 wx(zi + cell_thickness_z) + 2 * (wall_thickness + lisc_thickness_start);
521
522 double zi_x1_Step = (zi_x_thickness_1 -
nx * rib_thickness) / (nx + 1);
523 double zi_x2_Step = (zi_x_thickness_2 -
nx * rib_thickness) / (nx + 1);
524
525 double zi_y_thickness_1 =
526 wy(zi + rib_thickness) + 2 * (wall_thickness + lisc_thickness_start);
527 double zi_y_thickness_2 =
528 wy(zi + cell_thickness_z) + 2 * (wall_thickness + lisc_thickness_start);
529
530 double zi_y1_Step = (zi_y_thickness_1 -
ny * rib_thickness) / (ny + 1);
531 double zi_y2_Step = (zi_y_thickness_2 -
ny * rib_thickness) / (ny + 1);
532
533 double zi_x1, zi_x2, zi_y1, zi_y2;
534
535 zi_x1 = zi_x_thickness_1 / 2 - lisc_thickness_start;
536 zi_x2 = zi_x_thickness_2 / 2 - lisc_thickness_start;
537
538 zi_y1 = zi_y_thickness_1 / 2;
539 zi_y2 = zi_y_thickness_2 / 2;
540
542 name.Form(
"LiSc_S4_%d",
liscId(
"LiSc_S4", block_number, Zlayer, 0, 0));
543 TGeoVolume* LiSc_S4 =
545 zi_y2_Step - lisc_thickness_end, lisc_thickness_start,
546 lisc_thickness_end, zi_y2_Step - zi_y1_Step,
547 zi_x2 - zi_x1, kMagenta - 10,
vetoMed,
true);
548 lisc->AddNode(LiSc_S4,
liscId(
"LiSc_S4", block_number, Zlayer, 0, 1),
549 new TGeoCombiTrans(zi_x1, -(zi_y1 - zi_y1_Step), tZ,
550 new TGeoRotation("r", 0, 0, 0)));
551 lisc->AddNode(LiSc_S4,
liscId(
"LiSc_S4", block_number, Zlayer, 0, 2),
552 new TGeoCombiTrans(-zi_x1, (zi_y1 - zi_y1_Step), tZ,
553 new TGeoRotation("r", 0, 0, 180)));
554
556 name.Form(
"LiSc_S6_%d",
liscId(
"LiSc_S6", block_number, Zlayer, ny, 0));
557 TGeoVolume* LiSc_S6 =
559 zi_y2_Step - lisc_thickness_end, lisc_thickness_start,
560 lisc_thickness_end, zi_y2_Step - zi_y1_Step,
561 zi_x2 - zi_x1, kMagenta - 10,
vetoMed,
true);
562 lisc->AddNode(LiSc_S6,
liscId(
"LiSc_S6", block_number, Zlayer, ny, 1),
563 new TGeoCombiTrans(zi_x1, (zi_y1 - zi_y1_Step), tZ,
564 new TGeoRotation("r", 0, 0, 0)));
565 lisc->AddNode(LiSc_S6,
liscId(
"LiSc_S6", block_number, Zlayer, ny, 2),
566 new TGeoCombiTrans(-zi_x1, -(zi_y1 - zi_y1_Step), tZ,
567 new TGeoRotation("r", 0, 0, 180)));
568
569 for (
int i = 0;
i <
ny;
i++) {
570 zi_y1 = zi_y1 - zi_y1_Step;
571 zi_y2 = zi_y2 - zi_y2_Step;
572
573 longitudinal_rib->AddNode(
574 vLongitRibY.at(i),
makeId(zi, zi_x1, zi_y1),
575 new TGeoCombiTrans(zi_x1, (zi_y1 - rib_thickness), tZ,
576 new TGeoRotation("r", 0, 0, 0)));
577 longitudinal_rib->AddNode(
578 vLongitRibY.at(i),
makeId(zi, -zi_x1, -zi_y1),
579 new TGeoCombiTrans(-zi_x1, -(zi_y1 - rib_thickness), tZ,
580 new TGeoRotation("r", 0, 0, 180)));
581
582 if (i > 0) {
584 name.Form(
"LiScY_%d",
liscId(
"LiScY", block_number, Zlayer, i, 0));
585 TGeoVolume* LiScY =
586 GeoSideObj(name, dZ, lisc_thickness_start, zi_y1_Step,
587 lisc_thickness_end, zi_y2_Step, zi_x2 - zi_x1,
588 zi_y2 - zi_y1, kMagenta - 10,
vetoMed,
true);
589 lisc->AddNode(LiScY,
liscId(
"LiScY", block_number, Zlayer, i, 1),
590 new TGeoCombiTrans(zi_x1, zi_y1, tZ,
591 new TGeoRotation("r", 0, 0, 0)));
592 lisc->AddNode(LiScY,
liscId(
"LiScY", block_number, Zlayer, i, 2),
593 new TGeoCombiTrans(-zi_x1, -zi_y1, tZ,
594 new TGeoRotation("r", 0, 0, 180)));
595 }
596
597 zi_y1 = zi_y1 - rib_thickness;
598 zi_y2 = zi_y2 - rib_thickness;
599 }
600
601 zi_x1 = zi_x_thickness_1 / 2;
602 zi_x2 = zi_x_thickness_2 / 2;
603
604 zi_y1 = zi_y_thickness_1 / 2 - lisc_thickness_start;
605 zi_y2 = zi_y_thickness_2 / 2 - lisc_thickness_start;
606
608 name.Form(
"LiSc_S3_%d",
liscId(
"LiSc_S3", block_number, Zlayer, 0, 0));
609
611 name, dZ, 0,
612 zi_x1_Step - lisc_thickness_start - rib_thickness / sqrt(2),
613 zi_x2_Step - lisc_thickness_end - rib_thickness / sqrt(2),
614 lisc_thickness_start, lisc_thickness_end,
615 zi_x2_Step - zi_x1_Step - rib_thickness / 2, zi_y2 - zi_y1,
617 lisc->AddNode(LiSc_S3,
liscId(
"LiSc_S3", block_number, Zlayer, 0, 1),
618 new TGeoCombiTrans(-(zi_x1 - zi_x1_Step), zi_y1, tZ,
619 new TGeoRotation("r", 0, 0, 0)));
620 lisc->AddNode(LiSc_S3,
liscId(
"LiSc_S3", block_number, Zlayer, 0, 2),
621 new TGeoCombiTrans((zi_x1 - zi_x1_Step), -zi_y1, tZ,
622 new TGeoRotation("r", 0, 0, 180)));
623
625 name.Form(
"LiSc_S5_%d",
liscId(
"LiSc_S5", block_number, Zlayer, nx, 0));
626
628 name, dZ, 1,
629 zi_x1_Step - lisc_thickness_start - rib_thickness / sqrt(2),
630 zi_x2_Step - lisc_thickness_end - rib_thickness / sqrt(2),
631 lisc_thickness_start, lisc_thickness_end,
632 zi_x2_Step - zi_x1_Step - rib_thickness / 2, zi_y2 - zi_y1,
634 lisc->AddNode(LiSc_S5,
liscId(
"LiSc_S5", block_number, Zlayer, nx, 1),
635 new TGeoCombiTrans((zi_x1 - zi_x1_Step), zi_y1, tZ,
636 new TGeoRotation("r", 0, 0, 0)));
637 lisc->AddNode(LiSc_S5,
liscId(
"LiSc_S5", block_number, Zlayer, nx, 2),
638 new TGeoCombiTrans(-(zi_x1 - zi_x1_Step), -zi_y1, tZ,
639 new TGeoRotation("r", 0, 0, 180)));
640
641 for (
int i = 0;
i <
nx;
i++) {
642 zi_x1 = zi_x1 - zi_x1_Step;
643 zi_x2 = zi_x2 - zi_x2_Step;
644
645 longitudinal_rib->AddNode(
646 vLongitRibX.at(i),
makeId(zi, zi_x1, zi_y1),
647 new TGeoCombiTrans((zi_x1 - rib_thickness), zi_y1, tZ,
648 new TGeoRotation("r", 0, 0, 0)));
649 longitudinal_rib->AddNode(
650 vLongitRibX.at(i),
makeId(zi, -zi_x1, -zi_y1),
651 new TGeoCombiTrans(-(zi_x1 - rib_thickness), -zi_y1, tZ,
652 new TGeoRotation("r", 0, 0, 180)));
653
654 if (i > 0) {
656 name.Form(
"LiScX_%d",
liscId(
"LiScX", block_number, Zlayer, i, 0));
657 TGeoVolume* LiScX =
658 GeoSideObj(name, dZ, zi_x1_Step, lisc_thickness_start, zi_x2_Step,
659 lisc_thickness_end, zi_x2 - zi_x1, zi_y2 - zi_y1,
661 lisc->AddNode(LiScX,
liscId(
"LiScX", block_number, Zlayer, i, 1),
662 new TGeoCombiTrans(zi_x1, zi_y1, tZ,
663 new TGeoRotation("r", 0, 0, 0)));
664 lisc->AddNode(LiScX,
liscId(
"LiScX", block_number, Zlayer, i, 2),
665 new TGeoCombiTrans(-zi_x1, -zi_y1, tZ,
666 new TGeoRotation("r", 0, 0, 180)));
667 }
668
669 zi_x1 = zi_x1 - rib_thickness;
670 zi_x2 = zi_x2 - rib_thickness;
671 }
672 }
673}
TGeoVolume * GeoTrapezoidHollow(TString xname, Double_t thick, Double_t wz, Double_t wX_start, Double_t wX_end, Double_t wY_start, Double_t wY_end, Int_t color, TGeoMedium *material, Bool_t sens)
TGeoVolumeAssembly * GeoCornerRib(const TString &xname, double rib_thickness, double lt1, double lt2, double dz, double slopeX, double slopeY, Int_t color, TGeoMedium *material, Bool_t sens)
int makeId(double z, double x, double y)
TGeoVolume * GeoCornerLiSc1(const TString &xname, double dz, bool isClockwise, double a1, double a2, double b1, double b2, double dA, double dB, Int_t color, TGeoMedium *material, Bool_t sens)
double wy(double z)
slope along the length (y)
TGeoVolume * GeoCornerLiSc2(const TString &xname, double dz, bool isClockwise, double a1, double a2, double b1, double b2, double dA, double dB, Int_t color, TGeoMedium *material, Bool_t sens)
TGeoMedium * supportMedIn
int liscId(const TString &ShapeTypeName, int block_number, int Zlayer, int number, int position)
TGeoVolume * GeoSideObj(const TString &xname, double dz, double a1, double b1, double a2, double b2, double dA, double dB, Int_t color, TGeoMedium *material, Bool_t sens)
double wx(double z)
slope along the width (x)