Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
Analysis Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
blob
sPHENIX
Alignment
CI
cmake
Core
docs
Examples
Fatras
Plugins
Tests
Benchmarks
CommonHelpers
DownstreamProject
DownstreamProjectNodeps
IntegrationTests
UnitTests
Alignment
Benchmarks
Core
Examples
Algorithms
Io
Csv
Json
JsonDigitizationConfigTests.cpp
Root
Fatras
Plugins
acts-fatras
analysis
analysis_tpc_prototype
coresoftware
Doxygen_Assist
g4exampledetector
GenFit
JETSCAPE
KFParticle
macros
online_distribution
OnlMon
prototype
pythia6
rcdaq
RDBC
tutorials
doxygen_mainpage.h
File Members
Examples
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
JsonDigitizationConfigTests.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file JsonDigitizationConfigTests.cpp
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
#include <boost/test/unit_test.hpp>
10
11
#include "
Acts/Definitions/Algebra.hpp
"
12
#include "
Acts/Definitions/TrackParametrization.hpp
"
13
#include "
Acts/Utilities/BinUtility.hpp
"
14
#include "
Acts/Utilities/BinningType.hpp
"
15
#include "
ActsExamples/Digitization/DigitizationConfig.hpp
"
16
#include "
ActsExamples/Digitization/Smearers.hpp
"
17
#include "
ActsExamples/Io/Json/JsonDigitizationConfig.hpp
"
18
#include "
ActsFatras/Digitization/UncorrelatedHitSmearer.hpp
"
19
20
#include <fstream>
21
#include <string>
22
#include <vector>
23
24
#include <nlohmann/json.hpp>
25
26
using namespace
Acts;
27
28
BOOST_AUTO_TEST_SUITE(JsonDigitizationConfig)
29
30
BOOST_AUTO_TEST_CASE
(DigitizationConfigRoundTrip) {
31
std::ofstream
out
;
32
33
// As all SurfaceBounds have the same streaming API only a one is
34
// tested here, all others are tests are identical
35
36
ActsExamples::DigiComponentsConfig
dcf;
37
38
ActsExamples::GeometricConfig
gdc
;
39
40
Acts::BinUtility
segmentation;
41
segmentation +=
Acts::BinUtility
(336, -8.4, 8.4,
Acts::open
,
Acts::binX
);
42
segmentation +=
Acts::BinUtility
(1280, -36, 36,
Acts::open
,
Acts::binY
);
43
44
gdc.
segmentation
= segmentation;
45
gdc.
threshold
= 0.01;
46
gdc.
thickness
= 0.15;
47
gdc.
indices
= {
Acts::eBoundLoc0
,
Acts::eBoundLoc1
};
48
gdc.
chargeSmearer
=
ActsExamples::Digitization::Gauss
(1.0);
49
50
ActsExamples::DigiComponentsConfig
dcRef;
51
dcRef.
geometricDigiConfig
=
gdc
;
52
53
nlohmann::json dcJsonOut(dcRef);
54
out.open(
"DigiComponentsConfig.json"
);
55
out << dcJsonOut.dump(2);
56
out.close();
57
58
auto
in
= std::ifstream(
"DigiComponentsConfig.json"
,
59
std::ifstream::in
| std::ifstream::binary);
60
BOOST_CHECK(
in
.good());
61
nlohmann::json dcJsonIn;
62
in
>> dcJsonIn;
63
in
.close();
64
65
ActsExamples::DigiComponentsConfig
dcTest(dcJsonIn);
66
BOOST_CHECK(dcTest.
geometricDigiConfig
.
indices
==
67
dcRef.
geometricDigiConfig
.
indices
);
68
BOOST_CHECK(dcTest.
geometricDigiConfig
.
segmentation
.
dimensions
() ==
69
dcRef.
geometricDigiConfig
.
segmentation
.
dimensions
());
70
}
71
72
BOOST_AUTO_TEST_SUITE_END()
acts
blob
sPHENIX
Tests
UnitTests
Examples
Io
Json
JsonDigitizationConfigTests.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:45
using
1.8.2 with
sPHENIX GitHub integration