File indexing completed on 2025-01-18 09:11:22
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/GlueVolumesDescriptor.hpp"
0010
0011 #include "Acts/Geometry/TrackingVolume.hpp"
0012
0013 #include <ostream>
0014 #include <utility>
0015
0016 Acts::GlueVolumesDescriptor::GlueVolumesDescriptor(
0017 const std::map<BoundarySurfaceFace,
0018 std::shared_ptr<const TrackingVolumeArray>>& gvs)
0019 : m_glueVolumes(gvs) {
0020
0021 for (auto& gvIter : m_glueVolumes) {
0022 m_glueFaces.push_back(gvIter.first);
0023 }
0024 }
0025
0026 void Acts::GlueVolumesDescriptor::registerGlueVolumes(
0027 Acts::BoundarySurfaceFace bsf,
0028 std::shared_ptr<const TrackingVolumeArray> gvs) {
0029
0030 auto searchIter = m_glueVolumes.find(bsf);
0031 if (searchIter == m_glueVolumes.end()) {
0032 m_glueFaces.push_back(bsf);
0033 }
0034
0035 m_glueVolumes[bsf] =
0036 std::move(gvs);
0037 }
0038
0039 std::shared_ptr<const Acts::TrackingVolumeArray>
0040 Acts::GlueVolumesDescriptor::glueVolumes(Acts::BoundarySurfaceFace bsf) const {
0041
0042 auto searchIter = m_glueVolumes.find(bsf);
0043 if (searchIter != m_glueVolumes.end()) {
0044 return searchIter->second;
0045 }
0046 return nullptr;
0047 }
0048
0049 std::string Acts::GlueVolumesDescriptor::screenOutput() const {
0050 std::stringstream sl;
0051 sl << "Acts::GlueVolumesDescriptor: " << std::endl;
0052 const std::vector<Acts::BoundarySurfaceFace>& glueFaceVector = glueFaces();
0053 sl << " has Tracking Volumes registered for : " << glueFaceVector.size()
0054 << " Volume faces." << std::endl;
0055
0056 for (auto& gFace : glueFaceVector) {
0057 const std::vector<TrackingVolumePtr>& glueVolumesVector =
0058 glueVolumes(gFace)->arrayObjects();
0059
0060 sl << " -----> Processing Face: " << static_cast<int>(gFace)
0061 << " - has ";
0062 sl << glueVolumesVector.size()
0063 << " TrackingVolumes marked as 'GlueVolumes' " << std::endl;
0064 for (auto& glueVolume : glueVolumesVector) {
0065 sl << " - TrackingVolume: " << glueVolume->volumeName()
0066 << std::endl;
0067 }
0068 }
0069 return sl.str();
0070 }
0071
0072 std::ostream& Acts::operator<<(std::ostream& sl,
0073 const GlueVolumesDescriptor& gvd) {
0074 sl << gvd.screenOutput();
0075 return sl;
0076 }