File indexing completed on 2025-07-12 07:52:52
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Plugins/GeoModel/GeoModelTree.hpp"
0010
0011 namespace Acts {
0012 GeoModelTree::VolumePublisher::VolumePublisher(
0013 const std::shared_ptr<GeoModelIO::ReadGeoModel>& geoReader) noexcept
0014 : m_reader{geoReader} {}
0015
0016 const GeoModelTree::VolumePublisher::VolumeMap_t&
0017 GeoModelTree::VolumePublisher::getPublishedVol(const std::string& systemName) {
0018 PublisherMap_t::const_iterator find_itr = m_publishedVols.find(systemName);
0019 if (find_itr != m_publishedVols.end()) {
0020 return find_itr->second;
0021 }
0022 if (m_reader) {
0023 auto qFPV =
0024 m_reader->getPublishedNodes<std::string, GeoFullPhysVol*>(systemName);
0025 VolumeMap_t newPublished{};
0026 newPublished.insert(qFPV.begin(), qFPV.end());
0027 return m_publishedVols
0028 .insert(std::make_pair(systemName, std::move(newPublished)))
0029 .first->second;
0030 }
0031 throw std::domain_error(
0032 "GeoModelTree::VolumePublisher() - No volumes have been published for " +
0033 systemName);
0034 }
0035 void GeoModelTree::VolumePublisher::publishVolumes(
0036 const std::string& systemName, VolumeMap_t&& publishedVols) {
0037 if (systemName.empty()) {
0038 throw std::logic_error(
0039 "GeoModelTree::VolumePublisher() - System name cannot be empty");
0040 }
0041 if (!m_publishedVols
0042 .insert(std::make_pair(systemName, std::move(publishedVols)))
0043 .second) {
0044 throw std::domain_error("GeoModelTree::VolumePublisher - System " +
0045 systemName + " has already published volumes.");
0046 }
0047 }
0048 GeoModelTree::GeoModelTree(const std::shared_ptr<GMDBManager>& db)
0049 : dbMgr{db},
0050 publisher{std::make_shared<VolumePublisher>(
0051 std::make_shared<GeoModelIO::ReadGeoModel>(db.get()))},
0052 worldVolume{publisher->reader()->buildGeoModel()} {}
0053
0054 }