Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Core/include/Acts/Geometry/RzGridVolumeLookup.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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/IVolumeLookup.hpp"
0012 #include "Acts/Utilities/Logger.hpp"
0013 
0014 #include <cstddef>
0015 #include <memory>
0016 
0017 namespace Acts {
0018 /// Built-in RZ grid spatial index. Construct after geometry closure, once
0019 /// bounds, hierarchy and descendant policies are finalized; prefer installing
0020 /// through a Blueprint or StaticBlueprintNode lookup factory.
0021 /// Rebuild after changing
0022 /// volume bounds, transforms, hierarchy or descendant lookup policies. Indexes
0023 /// the full subtree, stopping at explicitly configured descendant lookups.
0024 /// Child volumes must be contained within their parents.
0025 /// Unsupported bounds are checked linearly alongside indexed candidates.
0026 class RzGridVolumeLookup final : public IVolumeLookup {
0027  public:
0028   /// Serializable construction parameters; assignments are rebuilt from
0029   /// volumes.
0030   struct Config {
0031     /// Largest accelerated tolerance; other tolerances use linear lookup
0032     double maxTolerance = 1e-3;
0033     /// Warn when more than this fraction of volumes in the indexed scope
0034     /// requires linear fallback. Explicit descendant policies remain active.
0035     /// Range [0, 1]; 1 disables the warning. Not a query-frequency metric.
0036     double fallbackWarningFraction = 0.1;
0037     /// Limit allocated grid cells, including reserved under-/overflow slots;
0038     /// larger grids use linear lookup
0039     std::size_t maxGridCells = 1000000;
0040   };
0041 
0042   /// Build an immutable index over a finalized subtree.
0043   /// @param gctx Construction context
0044   /// @param world Root of the indexed subtree
0045   /// @param config Construction settings
0046   /// @param logger Construction diagnostics
0047   /// @throws std::invalid_argument For invalid configuration or Gen1 storage
0048   /// (confined layers/volumes or dense volumes) encountered in the indexed
0049   /// scope.
0050   RzGridVolumeLookup(const GeometryContext& gctx, const TrackingVolume& world,
0051                      const Config& config,
0052                      const Logger& logger = getDummyLogger());
0053   ~RzGridVolumeLookup() override;
0054 
0055   /// @copydoc IVolumeLookup::findLowest
0056   const TrackingVolume* findLowest(const GeometryContext& gctx,
0057                                    const Vector3& position,
0058                                    double tolerance) const override;
0059 
0060   /// Return construction parameters for serialization.
0061   /// @return Construction settings
0062   const Config& config() const;
0063 
0064  private:
0065   struct Impl;
0066   std::unique_ptr<const Impl> m_impl;
0067 };
0068 }  // namespace Acts