ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
ECCE @ EIC Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
blob
master
CI
Core
doc
Examples
Algorithms
Detectors
Framework
Io
Run
Scripts
MaterialMaping
configureMap.py
Mat_map.C
Mat_map_surface_plot.C
Mat_map_surface_plot_1D.C
Mat_map_surface_plot_dist.C
Mat_map_surface_plot_ratio.C
materialPlotHelper.cpp
materialPlotHelper.hpp
writeMapConfig.py
boundParamResolution.C
compareAssignedRealPos.C
compareDistributions.C
compareHistograms.C
compareHitHistograms.C
compareRootFiles.C
compareRootFiles.hpp
errorOfHistograms.C
fullMaterial.C
KF_timing.py
layerMaterial.C
momentumDistributions.C
perigeeParamResolution.C
printBField.C
printHits.C
propagation_timing.py
Fatras
Plugins
Tests
thirdparty
analysis
coresoftware
Doxygen_Assist
ecce-detectors
fun4all_eicdetectors
geant4
macros
online_distribution
tutorials
doxygen_mainpage.h
File Members
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
writeMapConfig.py
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file writeMapConfig.py
1
# This file is part of the Acts project.
2
#
3
# Copyright (C) 2020 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
import
json
10
import
sys
11
12
# Should be run with Python 3 if possible
13
# Script that parse a Json surfaces map to create an easy to use json config file for the mapping
14
# Take two arguments in input : The path to the surfaces map and the path of the json config file
15
# By default the input is : 'surfaces-map.json' and the output is : 'config-map.json'
16
# The config file can be used to define a binning for all the surface of a specific type and boundary type in a given volume
17
# If the binning is kept to (1,1) the surface will not be mapped on.
18
19
if
sys.version_info[0] < 3:
20
print
(
'Using Python 2'
)
21
print
(
'To obtain the proper ordering in the Json files Python 3 is recomanded'
)
22
23
if
len(sys.argv) < 2 :
24
inFileName =
'surfaces-map.json'
25
else
:
26
inFileName = sys.argv[1]
27
28
with
open
(inFileName,
'
r') as json_file:
29
config = {}
30
data = json.load(json_file)
31
32
for
kvol
in
data[
'volumes'
]:
33
vconfig = {}
34
bconfig = {}
35
rconfig = {}
36
aconfig = {}
37
abin = {}
38
sconfig = {}
39
40
if
'boundaries'
in
data[
'volumes'
][kvol] :
41
for
kbound
in
data[
'volumes'
][kvol][
'boundaries'
] :
42
dbound = data[
'volumes'
][kvol][
'boundaries'
][kbound]
43
if
not
dbound[
'stype'
]
in
bconfig :
44
bconfig[dbound[
'stype'
]] = [dbound[
'bin0'
], dbound[
'bin1'
]]
45
vconfig[
'boundaries'
]=bconfig
46
47
if
'layers'
in
data[
'volumes'
][kvol] :
48
for
klay
in
data[
'volumes'
][kvol][
'layers'
] :
49
50
if
'representing'
in
data[
'volumes'
][kvol][
'layers'
][klay] :
51
drep = data[
'volumes'
][kvol][
'layers'
][klay][
'representing'
]
52
if
not
drep[
'stype'
]
in
rconfig :
53
rconfig[drep[
'stype'
]] = [drep[
'bin0'
], drep[
'bin1'
]]
54
vconfig[
'representing'
] = rconfig
55
56
if
'approach'
in
data[
'volumes'
][kvol][
'layers'
][klay] :
57
for
kapp
in
data[
'volumes'
][kvol][
'layers'
][klay][
'approach'
] :
58
dapp = data[
'volumes'
][kvol][
'layers'
][klay][
'approach'
][kapp]
59
abin[kapp] = [dapp[
'bin0'
], dapp[
'bin1'
]]
60
aconfig[dapp[
'stype'
]] = abin
61
vconfig[
'approach'
] = aconfig
62
63
if
'sensitive'
in
data[
'volumes'
][kvol][
'layers'
][klay] :
64
for
ksen
in
data[
'volumes'
][kvol][
'layers'
][klay][
'sensitive'
] :
65
dsen = data[
'volumes'
][kvol][
'layers'
][klay][
'sensitive'
][ksen]
66
if
not
dsen[
'stype'
]
in
sconfig :
67
sconfig[dsen[
'stype'
]] = [dsen[
'bin0'
], dsen[
'bin1'
]]
68
vconfig[
'sensitive'
] = sconfig
69
config[data[
'volumes'
][kvol][
'Name'
]] = vconfig
70
71
72
if
len(sys.argv) < 3 :
73
outFileName =
'config-map.json'
74
else
:
75
outFileName = sys.argv[2]
76
77
with
open
(outFileName,
'w'
)
as
outfile:
78
json.dump(config, outfile, indent=4)
acts
blob
master
Examples
Scripts
MaterialMaping
writeMapConfig.py
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:24
using
1.8.2 with
ECCE GitHub integration