Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
UtilitiesJsonConverter.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file UtilitiesJsonConverter.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2021-2023 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
11
#include "
Acts/Plugins/Json/ActsJson.hpp
"
12
#include "
Acts/Utilities/BinUtility.hpp
"
13
#include "
Acts/Utilities/BinningData.hpp
"
14
#include "
Acts/Utilities/Range1D.hpp
"
15
16
#include <nlohmann/json.hpp>
17
18
// Custom Json encoder/decoders. Naming is mandated by nlohmann::json and thus
19
// can not match our naming guidelines.
20
21
namespace
Acts {
22
class
BinningData;
23
template
<
typename
Type>
24
class
Range1D;
25
26
void
to_json
(nlohmann::json&
j
,
const
BinningData& bd);
27
28
void
from_json
(
const
nlohmann::json&
j
, BinningData& bd);
29
30
void
to_json
(nlohmann::json&
j
,
const
BinUtility& bu);
31
32
void
from_json
(
const
nlohmann::json&
j
, BinUtility& bu);
33
34
template
<
typename
Type>
35
void
to_json
(nlohmann::json&
j
,
const
Range1D<Type>
&
r
) {
36
j[
"min"
] = r.
min
();
37
j[
"max"
] = r.
max
();
38
}
39
40
template
<
typename
Type>
41
void
from_json
(
const
nlohmann::json&
j
,
Range1D<Type>
&
r
) {
42
r.
setMin
(static_cast<Type>(j[
"min"
]));
43
r.
setMax
(static_cast<Type>(j[
"max"
]));
44
}
45
46
NLOHMANN_JSON_SERIALIZE_ENUM(
BinningValue
, {{
BinningValue::binX
,
"binX"
},
47
{
BinningValue::binY
,
"binY"
},
48
{
BinningValue::binZ
,
"binZ"
},
49
{
BinningValue::binR
,
"binR"
},
50
{
BinningValue::binPhi
,
"binPhi"
},
51
{
BinningValue::binRPhi
,
"binRPhi"
},
52
{
BinningValue::binH
,
"binH"
},
53
{
BinningValue::binEta
,
"binEta"
},
54
{
BinningValue::binMag
,
"binMag"
}})
55
56
}
// namespace Acts
acts
blob
sPHENIX
Plugins
Json
include
Acts
Plugins
Json
UtilitiesJsonConverter.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:41
using
1.8.2 with
sPHENIX GitHub integration