Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-11 07:50:10

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Geometry/GlueVolumesDescriptor.hpp"
0010 
0011 #include "Acts/Geometry/TrackingVolume.hpp"
0012 
0013 #include <ostream>
0014 #include <utility>
0015 
0016 namespace Acts {
0017 
0018 GlueVolumesDescriptor::GlueVolumesDescriptor(
0019     const std::map<BoundarySurfaceFace,
0020                    std::shared_ptr<const TrackingVolumeArray>>& gvs)
0021     : m_glueVolumes(gvs) {
0022   // fill the available faces
0023   for (auto& gvIter : m_glueVolumes) {
0024     m_glueFaces.push_back(gvIter.first);
0025   }
0026 }
0027 
0028 void GlueVolumesDescriptor::registerGlueVolumes(
0029     BoundarySurfaceFace bsf, std::shared_ptr<const TrackingVolumeArray> gvs) {
0030   // register the face
0031   auto searchIter = m_glueVolumes.find(bsf);
0032   if (searchIter == m_glueVolumes.end()) {
0033     m_glueFaces.push_back(bsf);
0034   }
0035   // simple assignment overwrites already existing entries
0036   m_glueVolumes[bsf] =
0037       std::move(gvs);  //!< @todo change to addGlueVolumes principle
0038 }
0039 
0040 std::shared_ptr<const TrackingVolumeArray> GlueVolumesDescriptor::glueVolumes(
0041     BoundarySurfaceFace bsf) const {
0042   // searching for the glue volumes according
0043   auto searchIter = m_glueVolumes.find(bsf);
0044   if (searchIter != m_glueVolumes.end()) {
0045     return searchIter->second;
0046   }
0047   return nullptr;
0048 }
0049 
0050 std::string GlueVolumesDescriptor::screenOutput() const {
0051   std::stringstream sl;
0052   sl << "GlueVolumesDescriptor: " << std::endl;
0053   const std::vector<BoundarySurfaceFace>& glueFaceVector = glueFaces();
0054   sl << "     has Tracking Volumes registered for : " << glueFaceVector.size()
0055      << " Volume faces." << std::endl;
0056   // loop over the faces
0057   for (auto& gFace : glueFaceVector) {
0058     const std::vector<TrackingVolumePtr>& glueVolumesVector =
0059         glueVolumes(gFace)->arrayObjects();
0060     // loop over the TrackingVolumes
0061     sl << "        -----> Processing Face: " << static_cast<int>(gFace)
0062        << " - has ";
0063     sl << glueVolumesVector.size()
0064        << " TrackingVolumes marked as 'GlueVolumes' " << std::endl;
0065     for (auto& glueVolume : glueVolumesVector) {
0066       sl << "             - TrackingVolume: " << glueVolume->volumeName()
0067          << std::endl;
0068     }
0069   }
0070   return sl.str();
0071 }
0072 
0073 }  // namespace Acts
0074 
0075 std::ostream& Acts::operator<<(std::ostream& sl,
0076                                const GlueVolumesDescriptor& gvd) {
0077   sl << gvd.screenOutput();
0078   return sl;
0079 }