20 #include <DD4hep/Detector.h>
21 #include <DD4hep/Handle.h>
22 #include <DD4hep/Volumes.h>
23 #include <Parsers/Printout.h>
31 if (
m_cfg.xmlFileNames.empty()) {
32 throw std::invalid_argument(
"Missing DD4hep XML filenames");
37 if (m_detector !=
nullptr) {
38 m_detector->destroyInstance();
44 switch (
m_cfg.dd4hepLogLevel) {
64 dd4hep::setPrintLevel(dd4hep::PrintLevel::ALWAYS);
67 m_detector = &dd4hep::Detector::getInstance();
69 m_detector->fromCompact(
file.c_str());
71 m_detector->volumeManager();
72 m_detector->apply(
"DD4hepVolumeManager", 0,
nullptr);
73 m_geometry = m_detector->world();
80 if (m_detector ==
nullptr) {
81 buildDD4hepGeometry();
88 buildDD4hepGeometry();
95 buildDD4hepGeometry();
97 return *m_geometry.placement().ptr();
108 m_cfg.sortDetectors, gctx,
m_cfg.matDecorator,
109 m_cfg.geometryIdentifierHook);
113 std::shared_ptr<const Acts::TrackingGeometry>
116 if (!m_trackingGeometry) {
117 buildTrackingGeometry(gctx);
119 return m_trackingGeometry;
123 std::vector<dd4hep::DetElement>& det) {
124 std::vector<dd4hep::DetElement> tracker;
125 std::vector<dd4hep::DetElement> eCal;
126 std::vector<dd4hep::DetElement> hCal;
127 std::vector<dd4hep::DetElement> muon;
128 for (
auto& detElement : det) {
130 if (detName.find(
"Muon") != std::string::npos) {
131 muon.push_back(detElement);
132 }
else if (detName.find(
"ECal") != std::string::npos) {
133 eCal.push_back(detElement);
134 }
else if (detName.find(
"HCal") != std::string::npos) {
135 hCal.push_back(detElement);
137 tracker.push_back(detElement);
140 sort(muon.begin(), muon.end(),
141 [](
const dd4hep::DetElement&
a,
const dd4hep::DetElement&
b) {
142 return (a.id() <
b.id());
144 sort(eCal.begin(), eCal.end(),
145 [](
const dd4hep::DetElement&
a,
const dd4hep::DetElement&
b) {
146 return (a.id() <
b.id());
148 sort(hCal.begin(), hCal.end(),
149 [](
const dd4hep::DetElement&
a,
const dd4hep::DetElement&
b) {
150 return (a.id() <
b.id());
152 sort(tracker.begin(), tracker.end(),
153 [](
const dd4hep::DetElement&
a,
const dd4hep::DetElement&
b) {
154 return (a.id() <
b.id());
159 det.insert(det.end(), eCal.begin(), eCal.end());
160 det.insert(det.end(), hCal.begin(), hCal.end());
161 det.insert(det.end(), muon.begin(), muon.end());