EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GlueVolumesDescriptor.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GlueVolumesDescriptor.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 // GlueVolumesDescriptor.cpp, Acts project
12 
14 
16 
17 #include <utility>
18 
20  const std::map<BoundarySurfaceFace,
21  std::shared_ptr<const TrackingVolumeArray>>& gvs)
22  : m_glueVolumes(gvs) {
23  // fill the available faces
24  for (auto& gvIter : m_glueVolumes) {
25  m_glueFaces.push_back(gvIter.first);
26  }
27 }
28 
31  std::shared_ptr<const TrackingVolumeArray> gvs) {
32  // register the face
33  auto searchIter = m_glueVolumes.find(bsf);
34  if (searchIter == m_glueVolumes.end()) {
35  m_glueFaces.push_back(bsf);
36  }
37  // simple assignment overwrites already existing entries
38  m_glueVolumes[bsf] =
39  std::move(gvs);
40 }
41 
42 std::shared_ptr<const Acts::TrackingVolumeArray>
44  // searching for the glue volumes according
45  auto searchIter = m_glueVolumes.find(bsf);
46  if (searchIter != m_glueVolumes.end()) {
47  return searchIter->second;
48  }
49  return nullptr;
50 }
51 
53  std::stringstream sl;
54  sl << "Acts::GlueVolumesDescriptor: " << std::endl;
55  const std::vector<Acts::BoundarySurfaceFace>& glueFaceVector = glueFaces();
56  sl << " has Tracking Volumes registered for : " << glueFaceVector.size()
57  << " Volume faces." << std::endl;
58  // loop over the faces
59  for (auto& gFace : glueFaceVector) {
60  const std::vector<TrackingVolumePtr>& glueVolumesVector =
61  glueVolumes(gFace)->arrayObjects();
62  // loop over the TrackingVolumes
63  sl << " -----> Processing Face: " << int(gFace) << " - has ";
64  sl << glueVolumesVector.size()
65  << " TrackingVolumes marked as 'GlueVolumes' " << std::endl;
66  for (auto& glueVolume : glueVolumesVector) {
67  sl << " - TrackingVolume: " << glueVolume->volumeName()
68  << std::endl;
69  }
70  }
71  return sl.str();
72 }
73 
74 std::ostream& Acts::operator<<(std::ostream& sl,
75  const GlueVolumesDescriptor& gvd) {
76  sl << gvd.screenOutput();
77  return sl;
78 }