Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:22

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 Acts::GlueVolumesDescriptor::GlueVolumesDescriptor(
0017     const std::map<BoundarySurfaceFace,
0018                    std::shared_ptr<const TrackingVolumeArray>>& gvs)
0019     : m_glueVolumes(gvs) {
0020   // fill the available faces
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   // register the face
0030   auto searchIter = m_glueVolumes.find(bsf);
0031   if (searchIter == m_glueVolumes.end()) {
0032     m_glueFaces.push_back(bsf);
0033   }
0034   // simple assignment overwrites already existing entries
0035   m_glueVolumes[bsf] =
0036       std::move(gvs);  //!< @todo change to addGlueVolumes principle
0037 }
0038 
0039 std::shared_ptr<const Acts::TrackingVolumeArray>
0040 Acts::GlueVolumesDescriptor::glueVolumes(Acts::BoundarySurfaceFace bsf) const {
0041   // searching for the glue volumes according
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   // loop over the faces
0056   for (auto& gFace : glueFaceVector) {
0057     const std::vector<TrackingVolumePtr>& glueVolumesVector =
0058         glueVolumes(gFace)->arrayObjects();
0059     // loop over the TrackingVolumes
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 }