Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 08:18:46

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/BlueprintOptions.hpp"
0010 
0011 #include "Acts/Geometry/NavigationPolicyFactory.hpp"
0012 #include "Acts/Geometry/TrackingVolume.hpp"
0013 #include "Acts/Navigation/CylinderNavigationPolicy.hpp"
0014 #include "Acts/Navigation/INavigationPolicy.hpp"
0015 #include "Acts/Navigation/TryAllNavigationPolicy.hpp"
0016 
0017 #include <memory>
0018 
0019 namespace Acts {
0020 
0021 void BlueprintOptions::validate() const {
0022   if (!defaultNavigationPolicyFactory) {
0023     throw std::invalid_argument("Navigation policy factory is nullptr");
0024   }
0025 }
0026 
0027 std::unique_ptr<NavigationPolicyFactory>
0028 BlueprintOptions::makeDefaultNavigationPolicyFactory() {
0029   return NavigationPolicyFactory{}
0030       .add([](const GeometryContext& gctx, const TrackingVolume& volume,
0031               const Logger& logger) -> std::unique_ptr<INavigationPolicy> {
0032         // The cylinder policy only produces portal candidates, so it can only
0033         // be the sole policy of a volume that does not confine any surfaces.
0034         if (volume.surfaces().empty() &&
0035             CylinderNavigationPolicy::isApplicable(volume, logger)) {
0036           return std::make_unique<CylinderNavigationPolicy>(gctx, volume,
0037                                                             logger);
0038         }
0039         // Fall back to try-all for every volume the cylinder policy cannot
0040         // describe on its own.
0041         return std::make_unique<TryAllNavigationPolicy>(gctx, volume, logger);
0042       })
0043       .asUniquePtr();
0044 }
0045 
0046 }  // namespace Acts