Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lhcb-dpa
Analysis Productions
LbAPCommon
Commits
1261e32c
Commit
1261e32c
authored
Jan 09, 2022
by
Aidan Richard Wiederhold
Browse files
Merge branch 'aiwieder/close_file' into 'master'
Close file and simplify hist_counter See merge request
!44
parents
a8b118db
4d840251
Pipeline
#3426192
passed with stages
in 2 minutes and 19 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/LbAPCommon/checks_utils.py
View file @
1261e32c
...
...
@@ -26,14 +26,11 @@ def hist_to_root(job_name, check_result, output_path):
checks_with_histo
=
[
"range"
,
"range_nd"
,
"range_bkg_subtracted"
]
if
check_result
.
check_type
in
checks_with_histo
:
file_name
=
f
"
{
job_name
}
_
{
check_result
.
check_type
}
_histograms.root"
file_root
=
uproot
.
recreate
(
join
(
output_path
,
file_name
))
for
key
,
data
in
check_result
.
tree_data
.
items
():
hist_counter
=
0
for
_histo
in
data
.
get
(
"histograms"
,
[]):
hist_counter
+=
1
histo_name
=
f
"
{
key
}
/
{
hist_counter
-
1
}
"
file_root
[
histo_name
]
=
_histo
with
uproot
.
recreate
(
join
(
output_path
,
file_name
))
as
file_root
:
for
key
,
data
in
check_result
.
tree_data
.
items
():
for
hist_counter
,
_histo
in
enumerate
(
data
.
get
(
"histograms"
,
[])):
histo_name
=
f
"
{
key
}
/
{
hist_counter
-
1
}
"
file_root
[
histo_name
]
=
_histo
def
checks_to_JSON
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment