Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-13 08:28:02

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/Plugins/Json/ActsJson.hpp"
0012 #include "Acts/Utilities/BinUtility.hpp"
0013 #include "Acts/Utilities/BinningData.hpp"
0014 #include "Acts/Utilities/BinningType.hpp"
0015 #include "Acts/Utilities/RangeXD.hpp"
0016 
0017 #include <nlohmann/json.hpp>
0018 
0019 // Custom Json encoder/decoders. Naming is mandated by nlohmann::json and thus
0020 // can not match our naming guidelines.
0021 
0022 namespace Acts {
0023 class BinningData;
0024 
0025 void to_json(nlohmann::json& j, const BinningData& bd);
0026 
0027 void from_json(const nlohmann::json& j, BinningData& bd);
0028 
0029 void to_json(nlohmann::json& j, const BinUtility& bu);
0030 
0031 void from_json(const nlohmann::json& j, BinUtility& bu);
0032 
0033 template <typename Type>
0034 void to_json(nlohmann::json& j, const Range1D<Type>& r) {
0035   j["min"] = r.min();
0036   j["max"] = r.max();
0037 }
0038 
0039 template <typename Type>
0040 void from_json(const nlohmann::json& j, Range1D<Type>& r) {
0041   r.setMin(static_cast<Type>(j["min"]));
0042   r.setMax(static_cast<Type>(j["max"]));
0043 }
0044 
0045 NLOHMANN_JSON_SERIALIZE_ENUM(AxisDirection,
0046                              {{AxisDirection::AxisX, "AxisX"},
0047                               {AxisDirection::AxisY, "AxisY"},
0048                               {AxisDirection::AxisZ, "AxisZ"},
0049                               {AxisDirection::AxisR, "AxisR"},
0050                               {AxisDirection::AxisPhi, "AxisPhi"},
0051                               {AxisDirection::AxisRPhi, "AxisRPhi"},
0052                               {AxisDirection::AxisTheta, "AxisTheta"},
0053                               {AxisDirection::AxisEta, "AxisEta"},
0054                               {AxisDirection::AxisMag, "AxisMag"}})
0055 
0056 }  // namespace Acts