Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-16 07:47:08

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/Utilities/IAxis.hpp"
0010 
0011 #include "Acts/Utilities/Axis.hpp"
0012 
0013 #include <algorithm>
0014 #include <stdexcept>
0015 
0016 namespace Acts {
0017 
0018 std::unique_ptr<IAxis> IAxis::createEquidistant(
0019     AxisBoundaryType aBoundaryType, double min, double max, std::size_t nbins,
0020     std::optional<AxisDirection> direction) {
0021   using enum AxisType;
0022   using enum AxisBoundaryType;
0023 
0024   switch (aBoundaryType) {
0025     case Open:
0026       return std::make_unique<Axis<Equidistant, Open>>(min, max, nbins,
0027                                                        direction);
0028     case Bound:
0029       return std::make_unique<Axis<Equidistant, Bound>>(min, max, nbins,
0030                                                         direction);
0031     case Closed:
0032       return std::make_unique<Axis<Equidistant, Closed>>(min, max, nbins,
0033                                                          direction);
0034     default:  // should never happen
0035       throw std::logic_error("Unknown axis boundary type");
0036   }
0037 }
0038 
0039 std::unique_ptr<IAxis> IAxis::createVariable(
0040     AxisBoundaryType aBoundaryType, const std::vector<double>& edges,
0041     std::optional<AxisDirection> direction) {
0042   using enum AxisType;
0043   using enum AxisBoundaryType;
0044 
0045   switch (aBoundaryType) {
0046     case Open:
0047       return std::make_unique<Axis<Variable, Open>>(edges, direction);
0048     case Bound:
0049       return std::make_unique<Axis<Variable, Bound>>(edges, direction);
0050     case Closed:
0051       return std::make_unique<Axis<Variable, Closed>>(edges, direction);
0052     default:  // should never happen
0053       throw std::logic_error("Unknown axis boundary type");
0054   }
0055 }
0056 
0057 }  // namespace Acts