1818#include < TGeoMedium.h>
1919#include < TGeoBBox.h>
2020#include < TGeoMatrix.h>
21+ #include < Framework/Logger.h>
2122#include < cmath>
2223#include < iostream>
2324#include < vector>
@@ -41,12 +42,12 @@ TGeoMedium* FT3Module::AluminumMed = nullptr;
4142
4243void FT3Module::initialize_materials ()
4344{
44-
45+ LOG (debug) << " FT3Module: initialize_materials " ;
4546 if (siliconMat) {
4647 return ;
4748 }
4849
49- TGeoManager* gGeoManager = gGeoManager ;
50+ TGeoManager* geoManager = gGeoManager ;
5051
5152 auto * itsH = new TGeoElement (" FT3_H" , " Hydrogen" , 1 , 1.00794 );
5253 auto * itsC = new TGeoElement (" FT3_C" , " Carbon" , 6 , 12.0107 );
@@ -73,6 +74,7 @@ void FT3Module::initialize_materials()
7374
7475 AluminumMat = new TGeoMaterial (" Aluminum" , 26.98 , 13 , 2.7 );
7576 AluminumMed = new TGeoMedium (" Aluminum" , 5 , AluminumMat);
77+ LOG (debug) << " FT3Module: done initialize_materials" ;
7678}
7779
7880double calculate_y_circle (double x, double radius)
@@ -83,7 +85,8 @@ double calculate_y_circle(double x, double radius)
8385void FT3Module::create_layout (double mZ , int layerNumber, int direction, double Rin, double Rout, double overlap, const std::string& face, const std::string& layout_type, TGeoVolume* motherVolume)
8486{
8587
86- TGeoManager* gGeoManager = gGeoManager ;
88+ LOG (debug) << " FT3Module: create_layout - Layer " << layerNumber << " , Direction " << direction << " , Face " << face;
89+ TGeoManager* geoManager = gGeoManager ;
8790
8891 FT3Module::initialize_materials ();
8992
@@ -479,70 +482,70 @@ void FT3Module::create_layout(double mZ, int layerNumber, int direction, double
479482 if (sensor_width == 2.5 ) {
480483 // silicon
481484 std::string sensor_name = " FT3sensor_front_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
482- sensor = gGeoManager ->MakeBox (sensor_name.c_str (), siliconMed, active_width / 2 , active_height / 2 , silicon_thickness / 2 );
485+ sensor = geoManager ->MakeBox (sensor_name.c_str (), siliconMed, active_width / 2 , active_height / 2 , silicon_thickness / 2 );
483486 sensor->SetLineColor (SiColor);
484487 sensor->SetFillColorAlpha (SiColor, 0.4 );
485488 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (active_x_shift_sensor + x_offset, y + y_offset, mZ + z_offset - epoxy_thickness - kapton_thickness - copper_thickness - epoxy_thickness - silicon_thickness / 2 ));
486489
487490 std::string inactive_name = " FT3inactive_front_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
488- sensor = gGeoManager ->MakeBox (inactive_name.c_str (), siliconMed, (sensor_width - active_width) / 2 , sensor_height / 2 , silicon_thickness / 2 );
491+ sensor = geoManager ->MakeBox (inactive_name.c_str (), siliconMed, (sensor_width - active_width) / 2 , sensor_height / 2 , silicon_thickness / 2 );
489492 sensor->SetLineColor (kRed );
490493 sensor->SetFillColorAlpha (kRed , 1.0 );
491494 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (x_offset + inactive_x_shift, y + y_offset, mZ + z_offset - epoxy_thickness - kapton_thickness - copper_thickness - epoxy_thickness - silicon_thickness / 2 ));
492495
493496 } else {
494497
495498 std::string sensor_name = " FT3sensor_front_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
496- sensor = gGeoManager ->MakeBox (sensor_name.c_str (), siliconMed, active_width / 2 , sensor_height / 2 , silicon_thickness / 2 );
499+ sensor = geoManager ->MakeBox (sensor_name.c_str (), siliconMed, active_width / 2 , sensor_height / 2 , silicon_thickness / 2 );
497500 sensor->SetLineColor (SiColor);
498501 sensor->SetFillColorAlpha (SiColor, 0.4 );
499502 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (x_offset + x + inactive_width / 2 , y + y_offset, mZ + z_offset - epoxy_thickness - kapton_thickness - copper_thickness - epoxy_thickness - silicon_thickness / 2 ));
500503
501504 std::string inactive_name_left = " FT3inactive_left_front_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
502- sensor = gGeoManager ->MakeBox (inactive_name_left.c_str (), siliconMed, inactive_width / 2 , sensor_height / 2 , silicon_thickness / 2 );
505+ sensor = geoManager ->MakeBox (inactive_name_left.c_str (), siliconMed, inactive_width / 2 , sensor_height / 2 , silicon_thickness / 2 );
503506 sensor->SetLineColor (kRed );
504507 sensor->SetFillColorAlpha (kRed , 1.0 );
505508 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (x_offset + inactive_x_shift_left, y + y_offset, mZ + z_offset - epoxy_thickness - kapton_thickness - copper_thickness - epoxy_thickness - silicon_thickness / 2 ));
506509
507510 std::string inactive_name_right = " FT3inactive_right_front_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
508- sensor = gGeoManager ->MakeBox (inactive_name_right.c_str (), siliconMed, inactive_width / 2 , sensor_height / 2 , silicon_thickness / 2 );
511+ sensor = geoManager ->MakeBox (inactive_name_right.c_str (), siliconMed, inactive_width / 2 , sensor_height / 2 , silicon_thickness / 2 );
509512 sensor->SetLineColor (kRed );
510513 sensor->SetFillColorAlpha (kRed , 1.0 );
511514 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (x_offset + inactive_x_shift_right, y + y_offset, mZ + z_offset - epoxy_thickness - kapton_thickness - copper_thickness - epoxy_thickness - silicon_thickness / 2 ));
512515 }
513516
514517 // silicon-to-FPC epoxy glue
515518 std::string glue_up_name = " FT3glue_up_front_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
516- sensor = gGeoManager ->MakeBox (glue_up_name.c_str (), epoxyMed, sensor_width / 2 , sensor_height / 2 , epoxy_thickness / 2 );
519+ sensor = geoManager ->MakeBox (glue_up_name.c_str (), epoxyMed, sensor_width / 2 , sensor_height / 2 , epoxy_thickness / 2 );
517520 sensor->SetLineColor (kBlue );
518521 sensor->SetFillColorAlpha (kBlue , 1.0 );
519522 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (x_offset + active_x_shift, y + y_offset, mZ + z_offset - epoxy_thickness - kapton_thickness - copper_thickness - epoxy_thickness / 2 ));
520523
521524 if (r_squared < R_material_threshold * R_material_threshold) {
522525 std::string alu_name = " FT3aluminum_front_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
523- sensor = gGeoManager ->MakeBox (alu_name.c_str (), AluminumMed, sensor_width / 2 , sensor_height / 2 , copper_thickness / 2 );
526+ sensor = geoManager ->MakeBox (alu_name.c_str (), AluminumMed, sensor_width / 2 , sensor_height / 2 , copper_thickness / 2 );
524527 sensor->SetLineColor (kBlack );
525528 sensor->SetFillColorAlpha (kBlack , 0.4 );
526529 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (active_x_shift + x_offset, y + y_offset, mZ + z_offset - epoxy_thickness - kapton_thickness - copper_thickness / 2 ));
527530
528531 } else {
529532 std::string copper_name = " FT3copper_front_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
530- sensor = gGeoManager ->MakeBox (copper_name.c_str (), copperMed, sensor_width / 2 , sensor_height / 2 , copper_thickness / 2 );
533+ sensor = geoManager ->MakeBox (copper_name.c_str (), copperMed, sensor_width / 2 , sensor_height / 2 , copper_thickness / 2 );
531534 sensor->SetLineColor (kBlack );
532535 sensor->SetFillColorAlpha (kBlack , 0.4 );
533536 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (active_x_shift + x_offset, y + y_offset, mZ + z_offset - epoxy_thickness - kapton_thickness - copper_thickness / 2 ));
534537 }
535538
536539 // kapton
537540 std::string fpc_name = " FT3fpc_front_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
538- sensor = gGeoManager ->MakeBox (fpc_name.c_str (), kaptonMed, sensor_width / 2 , sensor_height / 2 , kapton_thickness / 2 );
541+ sensor = geoManager ->MakeBox (fpc_name.c_str (), kaptonMed, sensor_width / 2 , sensor_height / 2 , kapton_thickness / 2 );
539542 sensor->SetLineColor (kGreen );
540543 sensor->SetFillColorAlpha (kGreen , 0.4 );
541544 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (active_x_shift + x_offset, y + y_offset, mZ + z_offset - epoxy_thickness - kapton_thickness / 2 ));
542545
543546 // FPC-to-support epoxy glue
544547 std::string glue_down_name = " FT3glue_down_front_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
545- sensor = gGeoManager ->MakeBox (glue_down_name.c_str (), epoxyMed, sensor_width / 2 , sensor_height / 2 , epoxy_thickness / 2 );
548+ sensor = geoManager ->MakeBox (glue_down_name.c_str (), epoxyMed, sensor_width / 2 , sensor_height / 2 , epoxy_thickness / 2 );
546549 sensor->SetLineColor (kBlue );
547550 sensor->SetFillColorAlpha (kBlue , 1.0 );
548551 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (x_offset + active_x_shift, y + y_offset, mZ + z_offset - epoxy_thickness / 2 ));
@@ -612,73 +615,73 @@ void FT3Module::create_layout(double mZ, int layerNumber, int direction, double
612615
613616 // FPC-to-support epoxy glue
614617 std::string glue_down_name = " FT3glue_down_back_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
615- sensor = gGeoManager ->MakeBox (glue_down_name.c_str (), epoxyMed, sensor_width / 2 , sensor_height / 2 , epoxy_thickness / 2 );
618+ sensor = geoManager ->MakeBox (glue_down_name.c_str (), epoxyMed, sensor_width / 2 , sensor_height / 2 , epoxy_thickness / 2 );
616619 sensor->SetLineColor (kBlue );
617620 sensor->SetFillColorAlpha (kBlue , 1.0 );
618621 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (x_offset + active_x_shift, y + y_offset, mZ + z_offset + epoxy_thickness / 2 ));
619622
620623 // Kapton
621624 std::string fpc_name = " FT3fpc_back_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
622- sensor = gGeoManager ->MakeBox (fpc_name.c_str (), kaptonMed, sensor_width / 2 , sensor_height / 2 , kapton_thickness / 2 );
625+ sensor = geoManager ->MakeBox (fpc_name.c_str (), kaptonMed, sensor_width / 2 , sensor_height / 2 , kapton_thickness / 2 );
623626 sensor->SetLineColor (kGreen );
624627 sensor->SetFillColorAlpha (kGreen , 0.4 );
625628 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (active_x_shift + x_offset, y + y_offset, mZ + z_offset + epoxy_thickness + kapton_thickness / 2 ));
626629
627630 if (r_squared < R_material_threshold * R_material_threshold) {
628631 // replace copper with alu
629632 std::string alu_name = " FT3aluminum_back_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
630- sensor = gGeoManager ->MakeBox (alu_name.c_str (), AluminumMed, sensor_width / 2 , sensor_height / 2 , copper_thickness / 2 );
633+ sensor = geoManager ->MakeBox (alu_name.c_str (), AluminumMed, sensor_width / 2 , sensor_height / 2 , copper_thickness / 2 );
631634 sensor->SetLineColor (kBlack );
632635 sensor->SetFillColorAlpha (kBlack , 0.4 );
633636 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (active_x_shift + x_offset, y + y_offset, mZ + z_offset + epoxy_thickness + kapton_thickness + copper_thickness / 2 ));
634637
635638 } else {
636639 std::string copper_name = " FT3copper_back_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
637- sensor = gGeoManager ->MakeBox (copper_name.c_str (), copperMed, sensor_width / 2 , sensor_height / 2 , copper_thickness / 2 );
640+ sensor = geoManager ->MakeBox (copper_name.c_str (), copperMed, sensor_width / 2 , sensor_height / 2 , copper_thickness / 2 );
638641 sensor->SetLineColor (kBlack );
639642 sensor->SetFillColorAlpha (kBlack , 0.4 );
640643 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (active_x_shift + x_offset, y + y_offset, mZ + z_offset + epoxy_thickness + kapton_thickness + copper_thickness / 2 ));
641644 }
642645
643646 // silicon-to-FPC epoxy glue
644647 std::string glue_up_name = " FT3glue_up_back_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
645- sensor = gGeoManager ->MakeBox (glue_up_name.c_str (), epoxyMed, sensor_width / 2 , sensor_height / 2 , epoxy_thickness / 2 );
648+ sensor = geoManager ->MakeBox (glue_up_name.c_str (), epoxyMed, sensor_width / 2 , sensor_height / 2 , epoxy_thickness / 2 );
646649 sensor->SetLineColor (kBlue );
647650 sensor->SetFillColorAlpha (kBlue , 1.0 );
648651 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (x_offset + active_x_shift, y + y_offset, mZ + z_offset + epoxy_thickness + kapton_thickness + copper_thickness + epoxy_thickness / 2 ));
649652
650653 if (sensor_width == 2.5 ) {
651654
652655 std::string sensor_name = " FT3sensor_back_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
653- sensor = gGeoManager ->MakeBox (sensor_name.c_str (), siliconMed, active_width / 2 , active_height / 2 , silicon_thickness / 2 );
656+ sensor = geoManager ->MakeBox (sensor_name.c_str (), siliconMed, active_width / 2 , active_height / 2 , silicon_thickness / 2 );
654657 sensor->SetLineColor (SiColor);
655658 sensor->SetFillColorAlpha (SiColor, 0.4 );
656659 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (active_x_shift_sensor + x_offset, y + y_offset, mZ + z_offset + epoxy_thickness + kapton_thickness + copper_thickness + epoxy_thickness + silicon_thickness / 2 ));
657660
658661 std::string inactive_name = " FT3inactive_back_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
659- sensor = gGeoManager ->MakeBox (inactive_name.c_str (), siliconMed, (sensor_width - active_width) / 2 , sensor_height / 2 , silicon_thickness / 2 );
662+ sensor = geoManager ->MakeBox (inactive_name.c_str (), siliconMed, (sensor_width - active_width) / 2 , sensor_height / 2 , silicon_thickness / 2 );
660663 sensor->SetLineColor (kRed );
661664 sensor->SetFillColorAlpha (kRed , 1.0 );
662665 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (x_offset + inactive_x_shift, y + y_offset, mZ + z_offset + epoxy_thickness + kapton_thickness + copper_thickness + epoxy_thickness + silicon_thickness / 2 ));
663666
664667 } else {
665668 // active (4.6 cm centered)
666669 std::string sensor_name = " FT3sensor_back_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
667- sensor = gGeoManager ->MakeBox (sensor_name.c_str (), siliconMed, active_width / 2 , sensor_height / 2 , silicon_thickness / 2 );
670+ sensor = geoManager ->MakeBox (sensor_name.c_str (), siliconMed, active_width / 2 , sensor_height / 2 , silicon_thickness / 2 );
668671 sensor->SetLineColor (SiColor);
669672 sensor->SetFillColorAlpha (SiColor, 0.4 );
670673 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (x_offset + x_shifted + inactive_width / 2 , y + y_offset, mZ + z_offset + epoxy_thickness + kapton_thickness + copper_thickness + epoxy_thickness + silicon_thickness / 2 ));
671674
672675 // left inactive strip
673676 std::string inactive_name_left = " FT3inactive_left_back_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
674- sensor = gGeoManager ->MakeBox (inactive_name_left.c_str (), siliconMed, inactive_width / 2 , sensor_height / 2 , silicon_thickness / 2 );
677+ sensor = geoManager ->MakeBox (inactive_name_left.c_str (), siliconMed, inactive_width / 2 , sensor_height / 2 , silicon_thickness / 2 );
675678 sensor->SetLineColor (kRed );
676679 sensor->SetFillColorAlpha (kRed , 1.0 );
677680 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (x_offset + inactive_x_shift_left, y + y_offset, mZ + z_offset + epoxy_thickness + kapton_thickness + copper_thickness + epoxy_thickness + silicon_thickness / 2 ));
678681
679682 // right inactive strip
680683 std::string inactive_name_right = " FT3inactive_right_back_" + std::to_string (layerNumber) + " _" + std::to_string (direction) + " _" + std::to_string (sensor_count);
681- sensor = gGeoManager ->MakeBox (inactive_name_right.c_str (), siliconMed, inactive_width / 2 , sensor_height / 2 , silicon_thickness / 2 );
684+ sensor = geoManager ->MakeBox (inactive_name_right.c_str (), siliconMed, inactive_width / 2 , sensor_height / 2 , silicon_thickness / 2 );
682685 sensor->SetLineColor (kRed );
683686 sensor->SetFillColorAlpha (kRed , 1.0 );
684687 motherVolume->AddNode (sensor, sensor_count++, new TGeoTranslation (x_offset + inactive_x_shift_right, y + y_offset, mZ + z_offset + epoxy_thickness + kapton_thickness + copper_thickness + epoxy_thickness + silicon_thickness / 2 ));
@@ -691,9 +694,13 @@ void FT3Module::create_layout(double mZ, int layerNumber, int direction, double
691694 rowCounter++;
692695 }
693696 }
697+ LOG (debug) << " FT3Module: done create_layout" ;
694698}
695699
696700void FT3Module::createModule (double mZ , int layerNumber, int direction, double Rin, double Rout, double overlap, const std::string& face, const std::string& layout_type, TGeoVolume* motherVolume)
697701{
702+
703+ LOG (debug) << " FT3Module: createModule - Layer " << layerNumber << " , Direction " << direction << " , Face " << face;
698704 create_layout (mZ , layerNumber, direction, Rin, Rout, overlap, face, layout_type, motherVolume);
705+ LOG (debug) << " FT3Module: done createModule" ;
699706}
0 commit comments