Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MaterialJsonConverter.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MaterialJsonConverter.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2021 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
17 
18 #include <nlohmann/json.hpp>
19 
20 // Custom Json encoder/decoders. Naming is mandated by nlohmann::json and thus
21 // can not match our naming guidelines.
22 namespace Acts {
23 class IVolumeMaterial;
24 
27 
28 void to_json(nlohmann::json& j, const Material& t);
29 
30 void from_json(const nlohmann::json& j, Material& t);
31 
32 void to_json(nlohmann::json& j, const MaterialSlab& t);
33 
34 void from_json(const nlohmann::json& j, MaterialSlab& t);
35 
36 void from_json(const nlohmann::json& j, MaterialSlabMatrix& t);
37 
38 void to_json(nlohmann::json& j, const volumeMaterialPointer& material);
39 
40 void from_json(const nlohmann::json& j, volumeMaterialPointer& material);
41 
42 void to_json(nlohmann::json& j, const surfaceMaterialPointer& material);
43 
44 void from_json(const nlohmann::json& j, surfaceMaterialPointer& material);
45 
46 // This macro create a conversion for the mapping type enum
47 NLOHMANN_JSON_SERIALIZE_ENUM(Acts::MappingType,
48  {
49  {Acts::MappingType::PreMapping, "PreMapping"},
50  {Acts::MappingType::Default, "Default"},
52  "PostMapping"},
53  {Acts::MappingType::Sensor, "Sensor"},
54  })
55 
56 } // namespace Acts