33 {
34 TimeDet time_det(
"TimeDet",
true);
35
37 ok &= time_det.GetNColumns() == 3;
38 ok &= time_det.GetNRows() == 110;
39 ok &= time_det.GetNBars() == 330;
40
41 ok &= check_close(
"bar size X", time_det.GetBarSizeX(), 140.0);
42 ok &= check_close(
"bar size Y", time_det.GetBarSizeY(), 6.0);
43 ok &= check_close(
"bar size Z", time_det.GetBarSizeZ(), 1.0);
44 ok &= check_close(
"bar overlap X", time_det.GetBarOverlapX(), 10.0);
45 ok &= check_close(
"bar overlap Y", time_det.GetBarOverlapY(), 0.55);
46
47 ok &= check_close(
"column 0 X", time_det.GetXCol(0), -130.0);
48 ok &= check_close(
"column 1 X", time_det.GetXCol(1), 0.0);
49 ok &= check_close(
"column 2 X", time_det.GetXCol(2), 130.0);
51 "column overlap X",
52 time_det.GetBarSizeX() - (time_det.GetXCol(1) - time_det.GetXCol(0)),
53 10.0);
54
55 ok &= check_close(
"row 0 Y", time_det.GetYRow(0), -297.025);
56 ok &= check_close(
"row 109 Y", time_det.GetYRow(109), 297.025);
57 ok &= check_close(
"row pitch Y", time_det.GetYRow(1) - time_det.GetYRow(0),
58 5.45);
60 "row overlap Y",
61 time_det.GetBarSizeY() - (time_det.GetYRow(1) - time_det.GetYRow(0)),
62 0.55);
63 ok &= check_close(
"covered height Y",
64 (time_det.GetYRow(109) + time_det.GetBarSizeY() / 2.0) -
65 (time_det.GetYRow(0) - time_det.GetBarSizeY() / 2.0),
66 600.05);
67
68 ok &= check_close(
"Z col0 row0", time_det.GetZBar(0, 0), 0.0);
69 ok &= check_close(
"Z col0 row1", time_det.GetZBar(1, 0), 1.2);
70 ok &= check_close(
"Z col1 row0", time_det.GetZBar(0, 1), 9.0);
71 ok &= check_close(
"Z col1 row1", time_det.GetZBar(1, 1), 10.2);
72
73 int row = -1;
74 int col = -1;
75 time_det.GetBarRowCol(329, row, col);
78
79 FairGeoLoader geo_loader("TGeo", "FairGeoLoader");
80 auto* geo_interface = geo_loader.getGeoInterface();
81 geo_interface->setMediaFile("geometry/media.geo");
82 if (!geo_interface->readMedia()) {
83 std::cerr << "Could not load geometry/media.geo" << std::endl;
84 return 1;
85 }
86
87 TGeoManager* geometry = gGeoManager;
88 auto*
material =
new TGeoMaterial(
"WorldMaterial", 14.7, 7.3, 0.0012);
89 auto* medium = new TGeoMedium("WorldMedium", 1, material);
90 auto*
top = geometry->MakeBox(
"World", medium, 1000.0, 1000.0, 1000.0);
91 geometry->SetTopVolume(top);
92
93 time_det.ConstructGeometry();
94
95 TGeoNode* detector_node =
top->GetNode(0);
96 if (detector_node == nullptr) {
97 std::cerr << "Timing Detector assembly was not placed in the world"
98 << std::endl;
99 return 1;
100 }
101
102 TGeoVolume* detector_volume = detector_node->GetVolume();
103 if (detector_volume == nullptr || detector_volume->GetNodes() == nullptr) {
104 std::cerr << "Timing Detector assembly has no bar placements" << std::endl;
105 return 1;
106 }
107
108 const int number_of_placements =
109 detector_volume->GetNodes()->GetEntriesFast();
110 if (number_of_placements != time_det.GetNBars()) {
111 std::cerr << "Expected " << time_det.GetNBars() << " bars, got "
112 << number_of_placements << std::endl;
113 return 1;
114 }
115
116 if (!ok) return 1;
117
118 std::cout << "Timing detector geometry matches ShipSoft/Geometry: "
119 << "3 columns x 110 rows, 1400 x 60 x 10 mm bars, "
120 << "5.5 mm vertical overlap, and " << number_of_placements
121 << " placements" << std::endl;
122 return 0;
123}