9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
28 #include "TGeoManager.h"
29 #include "TGeoMaterial.h"
30 #include "TGeoMatrix.h"
31 #include "TGeoMedium.h"
32 #include "TGeoVolume.h"
36 namespace tt = boost::test_tools;
44 ViewConfig
red({200, 0, 0});
45 ViewConfig
green({0, 200, 0});
46 ViewConfig
blue({0, 0, 200});
61 new TGeoManager(
"box",
"poza1");
62 TGeoMaterial *mat =
new TGeoMaterial(
"Al", 26.98, 13, 2.7);
63 TGeoMedium *med =
new TGeoMedium(
"MED", 1, mat);
64 TGeoVolume *top = gGeoManager->MakeBox(
"TOP", med, 100, 100, 100);
65 gGeoManager->SetTopVolume(top);
66 TGeoVolume *vol = gGeoManager->MakeBox(
"BOX", med, dX, dY, dZ);
69 gGeoManager->CloseGeometry();
73 *vol->GetShape(), *gGeoIdentity,
"XY*", 1);
74 BOOST_CHECK_NE(plane_XYZ,
nullptr);
80 BOOST_CHECK_NE(bounds_XYZ,
nullptr);
89 auto transform_XYZ = plane_XYZ->transform(
tgContext);
90 auto rotation_XYZ = transform_XYZ.rotation();
91 BOOST_CHECK(transform_XYZ.isApprox(Transform3::Identity()));
93 const Vector3 offset_XYZ{-5.5 * dX, 0., 0.};
99 center_XYZ + 0.6 * (maxX - minX) * rotation_XYZ.col(0), 4., 2.5,
red);
102 center_XYZ + 0.6 * (maxY - minY) * rotation_XYZ.col(1), 4., 2.5,
green);
104 objVis, center_XYZ, center_XYZ + 2 * rotation_XYZ.col(2), 4., 2.5,
blue);
108 *vol->GetShape(), *gGeoIdentity,
"xy*", 1);
109 BOOST_CHECK_NE(plane_xyz,
nullptr);
115 BOOST_CHECK_NE(bounds_xyz,
nullptr);
116 BOOST_CHECK_EQUAL(bounds_xyz, bounds_XYZ);
117 auto transform_xyz = plane_xyz->transform(
tgContext);
118 auto rotation_xyz = transform_xyz.rotation();
119 BOOST_CHECK(rotation_xyz.col(0).isApprox(-1 * rotation_XYZ.col(0)));
120 BOOST_CHECK(rotation_xyz.col(1).isApprox(-1 * rotation_XYZ.col(1)));
121 BOOST_CHECK(rotation_xyz.col(2).isApprox(rotation_XYZ.col(2)));
123 const Vector3 offset_xyz{-2 * dX, 0., 0.};
129 center_xyz + 0.6 * (maxX - minX) * rotation_xyz.col(0), 4., 2.5,
red);
132 center_xyz + 0.6 * (maxY - minY) * rotation_xyz.col(1), 4., 2.5,
green);
134 objVis, center_xyz, center_xyz + 2 * rotation_xyz.col(2), 4., 2.5,
blue);
138 *vol->GetShape(), *gGeoIdentity,
"xY*", 1);
139 BOOST_CHECK_NE(plane_xYz,
nullptr);
145 BOOST_CHECK_NE(bounds_xYz,
nullptr);
146 BOOST_CHECK_EQUAL(bounds_xYz, bounds_xYz);
147 auto transform_xYz = plane_xYz->transform(
tgContext);
148 auto rotation_xYz = transform_xYz.rotation();
149 BOOST_CHECK(rotation_xYz.col(0).isApprox(-1 * rotation_XYZ.col(0)));
150 BOOST_CHECK(rotation_xYz.col(1).isApprox(rotation_XYZ.col(1)));
151 BOOST_CHECK(rotation_xYz.col(2).isApprox(-1. * rotation_XYZ.col(2)));
153 const Vector3 offset_xYz{2 * dX, 0., 0.};
160 center_xYz + 0.6 * (maxX - minX) * rotation_xYz.col(0), 4., 2.5,
red);
163 center_xYz + 0.6 * (maxY - minY) * rotation_xYz.col(1), 4., 2.5,
green);
165 objVis, center_xYz, center_xYz + 2 * rotation_xYz.col(2), 4., 2.5,
blue);
169 *vol->GetShape(), *gGeoIdentity,
"YX*", 1);
170 BOOST_CHECK_NE(plane_YXz,
nullptr);
183 auto transform_YXz = plane_YXz->transform(
tgContext);
184 auto rotation_YXz = transform_YXz.rotation();
185 BOOST_CHECK(rotation_YXz.col(0).isApprox(rotation_XYZ.col(1)));
186 BOOST_CHECK(rotation_YXz.col(1).isApprox(rotation_XYZ.col(0)));
187 BOOST_CHECK(rotation_YXz.col(2).isApprox(-1. * rotation_XYZ.col(2)));
189 const Vector3 offset_YXz{5.5 * dX, 0., 0.};
195 center_YXz + 0.6 * (maxX - minX) * rotation_YXz.col(0), 4., 2.5,
red);
198 center_YXz + 0.6 * (maxY - minY) * rotation_YXz.col(1), 4., 2.5,
green);
200 objVis, center_YXz, center_YXz + 2 * rotation_YXz.col(2), 4., 2.5,
blue);
204 *vol->GetShape(), *gGeoIdentity,
"xY*", 10);
205 BOOST_CHECK_NE(plane_XYZ10,
nullptr);
217 objVis.
write(
"TGeoConversion_TGeoBBox_PlaneSurface");