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
DigitizationConfigExample.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file DigitizationConfigExample.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2020-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 "
Acts/Geometry/GeometryHierarchyMap.hpp
"
10
#include "
Acts/Geometry/TrackingGeometry.hpp
"
11
#include "
ActsExamples/Detector/IBaseDetector.hpp
"
12
#include "
ActsExamples/Digitization/DigitizationConfigurator.hpp
"
13
#include "
ActsExamples/Geometry/CommonGeometry.hpp
"
14
#include "
ActsExamples/Io/Json/JsonDigitizationConfig.hpp
"
15
#include "
ActsExamples/Options/CommonOptions.hpp
"
16
#include "
ActsExamples/Options/DigitizationOptions.hpp
"
17
#include "
ActsExamples/Utilities/Options.hpp
"
18
#include "
ActsExamples/Utilities/Paths.hpp
"
19
20
#include <fstream>
21
#include <memory>
22
23
#include <boost/program_options.hpp>
24
25
#include "
DigitizationInput.hpp
"
26
27
using namespace
ActsExamples;
28
29
int
runDigitizationConfigExample
(
30
int
argc,
char
* argv[],
31
const
std::shared_ptr<ActsExamples::IBaseDetector>&
detector
) {
32
// Setup and parse options
33
auto
desc =
Options::makeDefaultOptions
();
34
Options::addSequencerOptions
(desc);
35
Options::addGeometryOptions
(desc);
36
Options::addMaterialOptions
(desc);
37
Options::addDigitizationOptions
(desc);
38
39
auto
opt = desc.add_options();
40
opt(
"digi-compactify-output"
, boost::program_options::bool_switch(),
41
"Try to compactify the resulting output .json file by "
42
"identifying common items."
);
43
44
// Add specific options for this geometry
45
detector->addOptions(desc);
46
auto
vm =
Options::parse
(desc, argc, argv);
47
if
(vm.empty()) {
48
return
EXIT_FAILURE;
49
}
50
51
// Get the input configuration
52
auto
inputConfig =
53
readDigiConfigFromJson
(vm[
"digi-config-file"
].as<std::string>());
54
55
// The geometry, material and decoration
56
auto
geometry
=
Geometry::build
(vm, *detector);
57
58
// Build a parser and visit the geometry
59
ActsExamples::DigitizationConfigurator
digiConfigurator;
60
digiConfigurator.
compactify
= vm[
"digi-compactify-output"
].as<
bool
>();
61
digiConfigurator.
inputDigiComponents
= inputConfig;
62
63
geometry
.first->visitSurfaces(digiConfigurator);
64
65
Acts::GeometryHierarchyMap<DigiComponentsConfig>
outputConfig(
66
digiConfigurator.
outputDigiComponents
);
67
68
if
(not vm[
"dump-digi-config"
].as<std::string>().empty()) {
69
writeDigiConfigToJson
(outputConfig,
70
vm[
"dump-digi-config"
].as<std::string>());
71
}
72
73
return
0;
74
}
acts
blob
sPHENIX
Examples
Run
Digitization
Common
DigitizationConfigExample.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:39
using
1.8.2 with
sPHENIX GitHub integration