9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/unit_test.hpp>
22 #include "TGeoManager.h"
23 #include "TGeoMaterial.h"
24 #include "TGeoMatrix.h"
25 #include "TGeoMedium.h"
26 #include "TGeoVolume.h"
30 namespace tt = boost::test_tools;
38 ViewConfig
red({200, 0, 0});
39 ViewConfig
green({0, 200, 0});
40 ViewConfig
blue({0, 0, 200});
54 new TGeoManager(
"box",
"poza1");
55 TGeoMaterial *mat =
new TGeoMaterial(
"Al", 26.98, 13, 2.7);
56 TGeoMedium *med =
new TGeoMedium(
"MED", 1, mat);
57 TGeoVolume *top = gGeoManager->MakeBox(
"TOP", med, 100, 100, 100);
58 gGeoManager->SetTopVolume(top);
59 TGeoVolume *vol = gGeoManager->MakeBox(
"BOX", med, x, y, z);
62 gGeoManager->CloseGeometry();
66 *gGeoIdentity,
"XY*", 1);
67 BOOST_CHECK_NE(plane_XYZ,
nullptr);
72 BOOST_CHECK_NE(bounds_XYZ,
nullptr);
81 auto transform_XYZ = plane_XYZ->transform(
tgContext);
82 auto rotation_XYZ = transform_XYZ.rotation();
83 BOOST_CHECK(transform_XYZ.isApprox(Transform3D::Identity()));
85 const Vector3D offset_XYZ{-5.5 *
x, 0., 0.};
91 center_XYZ + 0.6 * (maxX - minX) * rotation_XYZ.col(0), 4., 2.5,
red);
94 center_XYZ + 0.6 * (maxY - minY) * rotation_XYZ.col(1), 4., 2.5,
green);
96 objVis, center_XYZ, center_XYZ + 2 * rotation_XYZ.col(2), 4., 2.5,
blue);
100 *gGeoIdentity,
"xy*", 1);
101 BOOST_CHECK_NE(plane_xyz,
nullptr);
106 BOOST_CHECK_NE(bounds_xyz,
nullptr);
107 BOOST_CHECK_EQUAL(bounds_xyz, bounds_XYZ);
108 auto transform_xyz = plane_xyz->transform(
tgContext);
109 auto rotation_xyz = transform_xyz.rotation();
110 BOOST_CHECK(rotation_xyz.col(0).isApprox(-1 * rotation_XYZ.col(0)));
111 BOOST_CHECK(rotation_xyz.col(1).isApprox(-1 * rotation_XYZ.col(1)));
112 BOOST_CHECK(rotation_xyz.col(2).isApprox(rotation_XYZ.col(2)));
114 const Vector3D offset_xyz{-2 *
x, 0., 0.};
120 center_xyz + 0.6 * (maxX - minX) * rotation_xyz.col(0), 4., 2.5,
red);
123 center_xyz + 0.6 * (maxY - minY) * rotation_xyz.col(1), 4., 2.5,
green);
125 objVis, center_xyz, center_xyz + 2 * rotation_xyz.col(2), 4., 2.5,
blue);
129 *gGeoIdentity,
"xY*", 1);
130 BOOST_CHECK_NE(plane_xYz,
nullptr);
135 BOOST_CHECK_NE(bounds_xYz,
nullptr);
136 BOOST_CHECK_EQUAL(bounds_xYz, bounds_xYz);
137 auto transform_xYz = plane_xYz->transform(
tgContext);
138 auto rotation_xYz = transform_xYz.rotation();
139 BOOST_CHECK(rotation_xYz.col(0).isApprox(-1 * rotation_XYZ.col(0)));
140 BOOST_CHECK(rotation_xYz.col(1).isApprox(rotation_XYZ.col(1)));
141 BOOST_CHECK(rotation_xYz.col(2).isApprox(-1. * rotation_XYZ.col(2)));
143 const Vector3D offset_xYz{2 *
x, 0., 0.};
150 center_xYz + 0.6 * (maxX - minX) * rotation_xYz.col(0), 4., 2.5,
red);
153 center_xYz + 0.6 * (maxY - minY) * rotation_xYz.col(1), 4., 2.5,
green);
155 objVis, center_xYz, center_xYz + 2 * rotation_xYz.col(2), 4., 2.5,
blue);
159 *gGeoIdentity,
"YX*", 1);
160 BOOST_CHECK_NE(plane_YXz,
nullptr);
171 auto transform_YXz = plane_YXz->transform(
tgContext);
172 auto rotation_YXz = transform_YXz.rotation();
173 BOOST_CHECK(rotation_YXz.col(0).isApprox(rotation_XYZ.col(1)));
174 BOOST_CHECK(rotation_YXz.col(1).isApprox(rotation_XYZ.col(0)));
175 BOOST_CHECK(rotation_YXz.col(2).isApprox(-1. * rotation_XYZ.col(2)));
177 const Vector3D offset_YXz{5.5 *
x, 0., 0.};
183 center_YXz + 0.6 * (maxX - minX) * rotation_YXz.col(0), 4., 2.5,
red);
186 center_YXz + 0.6 * (maxY - minY) * rotation_YXz.col(1), 4., 2.5,
green);
188 objVis, center_YXz, center_YXz + 2 * rotation_YXz.col(2), 4., 2.5,
blue);
192 *gGeoIdentity,
"xY*", 10);
193 BOOST_CHECK_NE(plane_XYZ10,
nullptr);
204 objVis.
write(
"TGeoConversion_TGeoBBox_PlaneSurface");