Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Detector.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Detector.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022-2023 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 
9 #pragma once
10 
19 
20 #include <cstddef>
21 #include <memory>
22 #include <stdexcept>
23 #include <string>
24 #include <unordered_map>
25 #include <vector>
26 
27 namespace Acts {
28 
29 class Surface;
30 
31 namespace Experimental {
32 struct NavigationState;
33 
34 class Detector : public std::enable_shared_from_this<Detector> {
35  protected:
46  std::vector<std::shared_ptr<DetectorVolume>> rootVolumes,
47  DetectorVolumeUpdator detectorVolumeUpdator) noexcept(false);
48 
49  public:
51  static std::shared_ptr<Detector> makeShared(
52  std::string name,
53  std::vector<std::shared_ptr<DetectorVolume>> rootVolumes,
54  DetectorVolumeUpdator detectorVolumeUpdator);
55 
65  std::shared_ptr<Detector> getSharedPtr();
66 
76  std::shared_ptr<const Detector> getSharedPtr() const;
77 
81  std::vector<std::shared_ptr<DetectorVolume>>& rootVolumePtrs();
82 
86  const std::vector<const DetectorVolume*>& rootVolumes() const;
87 
91  std::vector<std::shared_ptr<DetectorVolume>>& volumePtrs();
92 
96  const std::vector<const DetectorVolume*>& volumes() const;
97 
102 
109  NavigationState& nState) const;
110 
120  const Vector3& position) const;
121 
127  const DetectorVolume* findDetectorVolume(const std::string& name) const;
128 
132  void updateDetectorVolumeFinder(DetectorVolumeUpdator detectorVolumeUpdator);
133 
136 
138  const std::string& name() const;
139 
140  private:
143 
146 
149 
152 
154  std::unordered_map<std::string, size_t> m_volumeNameIndex;
155 
158 };
159 
160 } // namespace Experimental
161 } // namespace Acts