15#define BOOST_TEST_MODULE Test MCHSimulation Geometry
16#define BOOST_TEST_DYN_LINK
17#define BOOST_TEST_MAIN
19#include <boost/test/unit_test.hpp>
23#include "TGeoManager.h"
24#include "boost/format.hpp"
25#include <boost/test/data/test_case.hpp>
28#include <fmt/format.h>
30namespace bdata = boost::unit_test::data;
45const std::array<std::string, 12>
slatChamberNames{
"SC05I",
"SC05O",
"SC06I",
"SC06O",
"SC07I",
"SC07O",
46 "SC08I",
"SC08O",
"SC09I",
"SC09O",
"SC10I",
"SC10O"};
57 {
"DE500",
"DE501",
"DE502",
"DE503",
"DE504",
"DE514",
"DE515",
"DE516",
"DE517"},
58 {
"DE505",
"DE506",
"DE507",
"DE508",
"DE509",
"DE510",
"DE511",
"DE512",
"DE513"},
59 {
"DE600",
"DE601",
"DE602",
"DE603",
"DE604",
"DE614",
"DE615",
"DE616",
"DE617"},
60 {
"DE605",
"DE606",
"DE607",
"DE608",
"DE609",
"DE610",
"DE611",
"DE612",
"DE613"},
61 {
"DE700",
"DE701",
"DE702",
"DE703",
"DE704",
"DE705",
"DE706",
"DE720",
"DE721",
"DE722",
"DE723",
"DE724",
"DE725"},
62 {
"DE707",
"DE708",
"DE709",
"DE710",
"DE711",
"DE712",
"DE713",
"DE714",
"DE715",
"DE716",
"DE717",
"DE718",
"DE719"},
63 {
"DE800",
"DE801",
"DE802",
"DE803",
"DE804",
"DE805",
"DE806",
"DE820",
"DE821",
"DE822",
"DE823",
"DE824",
"DE825"},
64 {
"DE807",
"DE808",
"DE809",
"DE810",
"DE811",
"DE812",
"DE813",
"DE814",
"DE815",
"DE816",
"DE817",
"DE818",
"DE819"},
65 {
"DE900",
"DE901",
"DE902",
"DE903",
"DE904",
"DE905",
"DE906",
"DE920",
"DE921",
"DE922",
"DE923",
"DE924",
"DE925"},
66 {
"DE907",
"DE908",
"DE909",
"DE910",
"DE911",
"DE912",
"DE913",
"DE914",
"DE915",
"DE916",
"DE917",
"DE918",
"DE919"},
67 {
"DE1000",
"DE1001",
"DE1002",
"DE1003",
"DE1004",
"DE1005",
"DE1006",
"DE1020",
"DE1021",
"DE1022",
"DE1023",
"DE1024",
"DE1025"},
68 {
"DE1007",
"DE1008",
"DE1009",
"DE1010",
"DE1011",
"DE1012",
"DE1013",
"DE1014",
"DE1015",
"DE1016",
"DE1017",
"DE1018",
"DE1019"}};
70BOOST_FIXTURE_TEST_SUITE(geometrycreator,
GEOMETRY)
78 for (
auto chname : chamberNames) {
79 auto vol = gGeoManager->GetVolume(chname.c_str());
80 BOOST_TEST_REQUIRE((vol !=
nullptr));
86 std::vector<TGeoNode*> slats;
88 auto vol = gGeoManager->GetVolume(chname.c_str());
89 TIter next(vol->GetNodes());
90 while (TGeoNode* node =
static_cast<TGeoNode*
>(next())) {
91 if (strstr(node->GetName(),
"support") ==
nullptr) {
92 slats.push_back(node);
101 std::vector<TGeoNode*> quadrants;
103 auto vol = gGeoManager->GetVolume(chname.c_str());
104 TIter next(vol->GetNodes());
105 while (TGeoNode* node =
static_cast<TGeoNode*
>(next())) {
106 quadrants.push_back(node);
126 TIter next(gGeoManager->GetTopNode()->GetNodes());
130 std::vector<std::string> codeLines;
132 while ((node =
static_cast<TGeoNode*
>(next()))) {
133 std::cout << node->GetName() <<
"\n";
134 TIter next2(node->GetNodes());
135 while ((n2 =
static_cast<TGeoNode*
>(next2()))) {
136 std::string n2name{n2->GetName()};
137 auto index = n2name.find_last_of(
'_');
138 int detElemId = std::atoi(n2name.substr(
index + 1).c_str());
139 if (detElemId >= 100) {
141 s <<
"if (detElemId==" << detElemId <<
") {\n";
142 s << R
"( return ")" << node->GetName() << "/" << n2name <<
"\";\n";
144 codeLines.push_back(s.str());
149 for (
auto s : codeLines) {
160│ ├──Quadrant (chamber 1)_100
161│ └──Quadrant (chamber 1)_103
163│ ├──Quadrant (chamber 1)_101
164│ └──Quadrant (chamber 1)_102
166│ ├──Quadrant (chamber 2)_200
167│ └──Quadrant (chamber 2)_203
169│ ├──Quadrant (chamber 2)_201
170│ └──Quadrant (chamber 2)_202
172│ ├──Station 2 quadrant_300
173│ └──Station 2 quadrant_303
175│ ├──Station 2 quadrant_301
176│ └──Station 2 quadrant_302
178│ ├──Station 2 quadrant_400
179│ └──Station 2 quadrant_403
181│ ├──Station 2 quadrant_401
182│ └──Station 2 quadrant_402
184│ ├──Chamber 5 support panel_8
195│ ├──Chamber 5 support panel_9
206│ ├──Chamber 6 support panel_10
217│ ├──Chamber 6 support panel_11
228│ ├──Chamber 7 support panel_12
243│ ├──Chamber 7 support panel_13
258│ ├──Chamber 8 support panel_14
273│ ├──Chamber 8 support panel_15
288│ ├──Chamber 9 support panel_16
303│ ├──Chamber 9 support panel_17
318│ ├──Chamber 10 support panel_18
333 ├──Chamber 10 support panel_19
349 std::ostringstream str;
356 BOOST_REQUIRE(gGeoManager !=
nullptr);
358 for (
int i = 0;
i < 20;
i++) {
359 BOOST_CHECK((gGeoManager->GetAlignableEntry((fmt::format(
"MCH/HC{}",
i)).c_str())));
365 BOOST_REQUIRE(gGeoManager !=
nullptr);
367 for (
int hc = 0; hc < 20; hc++) {
369 BOOST_CHECK((gGeoManager->GetAlignableEntry((fmt::format(
"MCH/HC{}/{}", hc,
deSymNames[hc][
de].c_str())).c_str())));
373BOOST_AUTO_TEST_SUITE_END()
Interface for MCH geometry creation.
void addAlignableVolumes(TGeoManager &geom)
void showGeometryAsTextTree(const char *fromPath, int maxdepth, std::ostream &out)
tree like textual dump of the geometry nodes
void createStandaloneGeometry()
std::map< std::string, ID > expected
std::vector< TGeoNode * > getSlatNodes()
const std::vector< std::vector< std::string > > deSymNames
BOOST_AUTO_TEST_CASE(CanGetAllChambers)
const std::array< std::string, 12 > slatChamberNames
const std::array< std::string, 8 > quadrantChamberNames
std::vector< TGeoNode * > getQuadrantNodes()
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())