Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:53

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 #pragma once
0010 
0011 #include "Acts/Geometry/GeometryContext.hpp"
0012 #include "Acts/Geometry/GeometryIdentifier.hpp"
0013 #include "Acts/Geometry/ITrackingGeometryBuilder.hpp"
0014 #include "Acts/Geometry/ITrackingVolumeHelper.hpp"
0015 #include "Acts/Utilities/Logger.hpp"
0016 
0017 #include <functional>
0018 #include <memory>
0019 #include <vector>
0020 
0021 namespace Acts {
0022 
0023 class TrackingVolume;
0024 class TrackingGeometry;
0025 class IMaterialDecorator;
0026 
0027 /// The Acts::TrackingGeometry Builder for volumes that wrap around another
0028 ///
0029 /// It retrieves an array of std::functions that build the TrackingGeometry
0030 /// sequentially in order, with the following options:
0031 /// - contained (e.g. a final insertion of a beam pipe of longer extend)
0032 /// - wrapped (e.g. an outer detector wrapping an inner one)
0033 /// - attached (e.g. a neighbor detector attaching to the previous one)
0034 ///
0035 /// The returned volume of each step must be processable by the previous step
0036 class TrackingGeometryBuilder : public ITrackingGeometryBuilder {
0037  public:
0038   /// @struct Config
0039   /// Nested Configuration for the CylinderVolumeBuilder
0040   struct Config {
0041     /// The list of tracking volume builders
0042     std::vector<std::function<std::shared_ptr<TrackingVolume>(
0043         const GeometryContext& gctx, const TrackingVolumePtr&,
0044         const std::shared_ptr<const VolumeBounds>&)>>
0045         trackingVolumeBuilders;
0046 
0047     /// The tracking volume helper for detector construction
0048     std::shared_ptr<const ITrackingVolumeHelper> trackingVolumeHelper = nullptr;
0049 
0050     /// The optional material decorator for this
0051     std::shared_ptr<const IMaterialDecorator> materialDecorator = nullptr;
0052 
0053     /// Optional geometry identifier hook to be used during closure
0054     std::shared_ptr<const GeometryIdentifierHook> geometryIdentifierHook =
0055         std::make_shared<GeometryIdentifierHook>();
0056   };
0057 
0058   /// Constructor
0059   ///
0060   /// @param [in] cgbConfig is the configuration struct for this builder
0061   /// @param [in] logger logging instance
0062   TrackingGeometryBuilder(const Config& cgbConfig,
0063                           std::unique_ptr<const Logger> logger =
0064                               getDefaultLogger("TrackingGeometryBuilder",
0065                                                Logging::INFO));
0066 
0067   /// Destructor
0068   ~TrackingGeometryBuilder() override = default;
0069 
0070   /// TrackingGeometry Interface method
0071   ///
0072   /// @param gctx geometry context of that building call
0073   ///
0074   /// @return a unique pointer to a TrackingGeometry
0075   std::unique_ptr<const TrackingGeometry> trackingGeometry(
0076       const GeometryContext& gctx) const final;
0077 
0078   /// Set configuration method
0079   ///
0080   /// @param cgbConfig is the new configuration struct
0081   void setConfiguration(const Config& cgbConfig);
0082 
0083   /// Get configuration method
0084   /// @return the current configuration
0085   const Config& getConfiguration() const;
0086 
0087   /// set logging instance
0088   /// @param newLogger the new logging instance
0089   void setLogger(std::unique_ptr<const Logger> newLogger);
0090 
0091  private:
0092   /// Configuration member
0093   Config m_cfg;
0094 
0095   /// Private access method to the logger
0096   const Logger& logger() const { return *m_logger; }
0097 
0098   /// the logging instance
0099   std::unique_ptr<const Logger> m_logger;
0100 };
0101 
0102 }  // namespace Acts