Belle II Software
development
Toggle main menu visibility
Main Page
Topics
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
x
z
Typedefs
a
b
c
d
e
g
i
k
l
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
e
f
g
n
p
s
v
z
Enumerator
c
d
f
p
t
v
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Symbols
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
Typedefs
Macros
▼
Belle II Software
►
Topics
►
Namespaces
►
Classes
▼
Files
▼
File List
►
alignment
►
analysis
►
arich
►
b2bii
►
background
►
beast
►
calibration
►
cdc
►
daq
►
decfiles
►
display
►
dqm
►
ecl
►
framework
►
generators
►
geometry
►
hlt
►
ir
►
klm
►
masterclass
►
mdst
►
mva
►
online_book
►
pxd
►
rawdata
►
reconstruction
►
simulation
►
site_scons
►
structure
►
svd
►
top
►
tracking
►
trg
▼
validation
►
scripts
▼
tests
json_serialize_test.py
test_clustercontroldrmaa.py
test_comparison.py
test_folder_creation.py
test_full_stack.py
test_quantity_extract.py
test_script_discovery.py
test_server_detect_no_results.py
test_validation.py
test_validation_metadata_tools.py
test_validationfunctions.py
test_validationscript.py
validation_doxygen_check.py
validationtestutil.py
►
validation
►
validation-test
►
vxd
Doxygen.h
resource_analyzer.py
►
File Members
test_quantity_extract.py
1
#!/usr/bin/env python3
2
3
10
11
import
unittest
12
import
ROOT
13
14
from
quantity_extract
import
RootQuantityExtract, default_extractor
15
16
17
class
TestQuantityExtract
(unittest.TestCase):
18
19
"""
20
Various test cases for the Quantity Extractor class
21
"""
22
23
def
test_h1d
(self):
24
"""
25
Test getting the quantities of a TH1d
26
"""
27
28
h1 = ROOT.TH1D(
"ext_test1"
,
"ext_test1"
, 40, 0, 40.0)
29
h1.Fill(10.0)
30
h1.Fill(20.0)
31
h1.Fill(30.0)
32
33
rext =
RootQuantityExtract
(default_extractor())
34
res = rext.extract(h1)
35
36
self.assertIn(
"mean_x"
, res)
37
self.assertAlmostEqual(res[
"mean_x"
], 20)
38
self.assertIn(
"mean_y"
, res)
39
self.assertAlmostEqual(res[
"mean_y"
], 0.075)
40
self.assertIn(
"mean_y_zero_suppressed"
, res)
41
self.assertAlmostEqual(res[
"mean_y_zero_suppressed"
], 1.0)
42
self.assertIn(
"entries"
, res)
43
23
def
test_h1d
(self):
…
44
def
test_profile
(self):
45
"""
46
Test getting the quantities of a TProfile
47
"""
48
49
h1 = ROOT.TProfile(
"ext_test1"
,
"ext_test1"
, 40, 0, 40.0)
50
h1.Fill(10.0, 4.0)
51
h1.Fill(20.0, 5.0)
52
h1.Fill(30.0, 6.0)
53
54
rext =
RootQuantityExtract
(default_extractor())
55
res = rext.extract(h1)
56
57
self.assertIn(
"mean_y"
, res)
58
self.assertAlmostEqual(res[
"mean_y"
], 0.375)
59
self.assertIn(
"mean_y_zero_suppressed"
, res)
60
self.assertAlmostEqual(res[
"mean_y_zero_suppressed"
], 5.0)
61
44
def
test_profile
(self):
…
62
def
test_ntuple
(self):
63
"""
64
Test getting the quantities contained in a TNtuple
65
"""
66
67
tn = ROOT.TNtuple(
"particle_list"
,
"particle_list"
,
"x:y:z:energy"
)
68
tn.Fill(5, 6, 7, 10)
69
70
rext =
RootQuantityExtract
(default_extractor())
71
res = rext.extract(tn)
72
self.assertEqual(len(res), 4)
73
self.assertIn(
"particle_list_z"
, res)
74
self.assertAlmostEqual(res[
"particle_list_z"
], 7.0)
75
76
62
def
test_ntuple
(self):
…
17
class
TestQuantityExtract
(unittest.TestCase):
…
77
if
__name__ ==
"__main__"
:
78
unittest.main()
quantity_extract.RootQuantityExtract
Definition
quantity_extract.py:84
test_quantity_extract.TestQuantityExtract
Definition
test_quantity_extract.py:17
test_quantity_extract.TestQuantityExtract.test_profile
test_profile(self)
Definition
test_quantity_extract.py:44
test_quantity_extract.TestQuantityExtract.test_ntuple
test_ntuple(self)
Definition
test_quantity_extract.py:62
test_quantity_extract.TestQuantityExtract.test_h1d
test_h1d(self)
Definition
test_quantity_extract.py:23
validation
tests
test_quantity_extract.py
Generated on Sat May 17 2025 03:10:22 for Belle II Software by
1.13.2