Belle II Software
light-2601-hyperion
utils.py
1
#!/usr/bin/env python3
2
3
10
from
yaml
import
full_load
11
from
basf2
import
find_file
12
13
14
def
get_variables(particle_list, ranked_variable, variables=None, particleNumber=1):
15
""" creates variable name pattern requested by the basf2 variable getVariableByRank()
16
:param particle_list:
17
:param ranked_variable:
18
:param variables:
19
:param particleNumber:
20
:return:
21
"""
22
var_list = []
23
for
i_num
in
range(1, particleNumber + 1):
24
for
var
in
variables:
25
var_list.append(f
'getVariableByRank({particle_list}, {ranked_variable}, {var}, {str(i_num)})'
)
26
return
var_list
27
28
29
def
load_config(uniqueIdentifier):
30
"""
31
Loads the correct yaml config file for the specified TFlaT uniqueIdentifier.
32
All dynamic alterations of the config are handeled in this function.
33
The final config is returned as a dict.
34
"""
35
with
open(find_file(f
'analysis/data/{uniqueIdentifier}.yaml'
))
as
f:
36
config = full_load(f)
37
38
# Calculate input list lengths
39
config[
"parameters"
][
"num_trk_features"
] = len(config[
"trk_variable_list"
])
40
config[
"parameters"
][
"num_ecl_features"
] = len(config[
"ecl_variable_list"
])
41
config[
"parameters"
][
"num_roe_features"
] = len(config[
"roe_variable_list"
])
42
43
return
config
analysis
scripts
tflat
utils.py
Generated on Sun Feb 1 2026 22:20:40 for Belle II Software by
1.13.2