Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DD4hep
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cepc
externals
mirroring
DD4hep
Commits
8ada9d5f
Commit
8ada9d5f
authored
2 years ago
by
Markus Frank
Committed by
MarkusFrankATcernch
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix python style according to Flake8
parent
8b0770ab
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/DDG4/scripts/TestProperties.py
+77
-72
77 additions, 72 deletions
examples/DDG4/scripts/TestProperties.py
with
77 additions
and
72 deletions
examples/DDG4/scripts/TestProperties.py
+
77
−
72
View file @
8ada9d5f
...
...
@@ -10,9 +10,8 @@
# ==========================================================================
from
__future__
import
absolute_import
,
unicode_literals
import
DDG4
import
sys
import
os
from
g4units
import
GeV
,
MeV
,
m
from
g4units
import
GeV
,
m
#
#
"""
...
...
@@ -37,74 +36,80 @@ def run():
ui
=
geant4
.
setupCshUI
(
vis
=
None
)
# Now the calorimeters
act
=
DDG4
.
Action
(
kernel
,
str
(
'
PropertyTestAction/Test
'
));
act
.
prop_str
=
'
Hello World!
'
act
.
prop_bool
=
True
act
.
prop_int
=
1234
act
.
prop_long
=
3456
act
.
prop_ulong
=
4567
act
.
prop_float
=
1234567.8
act
.
prop_double
=
1234567.8
act
.
prop_XYZPoint
=
(
1
,
2
,
3
)
act
.
prop_XYZVector
=
(
1
*
m
,
2
*
m
,
3
*
m
)
act
.
prop_PxPyPzEVector
=
(
1
*
GeV
,
2
*
GeV
,
3
*
GeV
,
4
*
GeV
)
act
.
map_str_str
=
{
'
a
'
:
'
AA
'
,
'
b
'
:
'
BB
'
,
'
c
'
:
'
CC
'
}
act
.
map_str_bool
=
{
'
a
'
:
1
,
'
b
'
:
0
,
'
c
'
:
1
}
act
.
map_str_int
=
{
'
a
'
:
11
,
'
b
'
:
22
,
'
c
'
:
33
}
act
.
map_str_long
=
{
'
a
'
:
111
,
'
b
'
:
222
,
'
c
'
:
333
}
#act.map_str_ulong = {'a': 1111, 'b': 2222, 'c': 3333}
act
.
map_str_float
=
{
'
a
'
:
11.11
,
'
b
'
:
22.22
,
'
c
'
:
33.33
}
act
.
map_str_double
=
{
'
a
'
:
11.111
,
'
b
'
:
22.222
,
'
c
'
:
33.333
}
act
.
map_int_str
=
{
100
:
'
AA
'
,
200
:
'
BB
'
,
300
:
'
CC
'
}
act
.
map_int_bool
=
{
100
:
1
,
200
:
0
,
300
:
1
}
act
.
map_int_int
=
{
100
:
11
,
200
:
22
,
300
:
33
}
act
.
map_int_long
=
{
100
:
111
,
200
:
222
,
300
:
333
}
#act.map_int_ulong = {100: 1111, 200: 2222, 300: 3333}
act
.
map_int_float
=
{
100
:
11.11
,
200
:
22.22
,
300
:
33.33
}
act
.
map_int_double
=
{
100
:
11.111
,
200
:
22.222
,
300
:
33.333
}
act
.
map_int_str
=
{
100
*
10
:
'
AA
'
,
200
*
10
:
'
BB
'
,
300
*
10
:
'
CC
'
}
act
.
map_int_bool
=
{
100
*
10
:
1
,
200
*
10
:
0
,
300
*
10
:
1
}
act
.
map_int_int
=
{
100
*
10
:
11
,
200
*
10
:
22
,
300
*
10
:
33
}
act
.
map_int_long
=
{
100
*
10
:
111
,
200
*
10
:
222
,
300
*
10
:
333
}
#act.map_int_ulong = {100*10: 1111, 200*10: 2222, 300*10: 3333}
act
.
map_int_float
=
{
100
*
10
:
11.11
,
200
*
10
:
22.22
,
300
*
10
:
33.33
}
act
.
map_int_double
=
{
100
*
10
:
11.111
,
200
*
10
:
22.222
,
300
*
10
:
33.333
}
act
.
set_str
=
[
'
aa
'
,
'
bb
'
,
'
cc
'
,
'
dd
'
]
act
.
set_bool
=
[
0
,
0
,
0
,
1
,
1
,
1
]
act
.
set_int
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
set_long
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
#act.set_ulong = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8]
act
.
set_float
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
set_double
=
[
0
*
m
,
1
*
m
,
2
*
m
,
3
*
m
,
4
*
m
,
5
*
m
,
6
*
m
,
7
*
m
,
8
*
m
,
8
*
m
,
8
*
m
]
act
.
set_XYZPoint
=
[(
1
,
2
,
3
),(
11
,
22
,
33
),(
111
,
222
,
333
),(
1111
,
2222
,
3333
)]
act
.
set_XYZVector
=
[(
1
,
2
,
3
),(
11
,
22
,
33
),(
111
,
222
,
333
),(
1111
,
2222
,
3333
)]
act
.
set_PxPyPzEVector
=
[(
1
*
GeV
,
2
*
GeV
,
3
*
GeV
,
4
*
GeV
),
(
11
*
GeV
,
22
*
GeV
,
33
*
GeV
,
44
*
GeV
),
(
111
*
GeV
,
222
*
GeV
,
333
*
GeV
,
444
*
GeV
)]
act
.
list_str
=
[
'
aa
'
,
'
bb
'
,
'
cc
'
,
'
dd
'
]
act
.
list_bool
=
[
0
,
0
,
0
,
1
,
1
,
1
]
act
.
list_int
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
list_long
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
list_ulong
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
list_float
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
list_double
=
[
0
*
m
,
1
*
m
,
2
*
m
,
3
*
m
,
4
*
m
,
5
*
m
,
6
*
m
,
7
*
m
,
8
*
m
,
8
*
m
,
8
*
m
]
act
.
list_XYZPoint
=
[(
1
,
2
,
3
),(
11
,
22
,
33
),(
111
,
222
,
333
),(
1111
,
2222
,
3333
)]
act
.
list_XYZVector
=
[(
1
,
2
,
3
),(
11
,
22
,
33
),(
111
,
222
,
333
),(
1111
,
2222
,
3333
)]
act
.
list_PxPyPzEVector
=
[(
1
*
GeV
,
2
*
GeV
,
3
*
GeV
,
4
*
GeV
),
(
11
*
GeV
,
22
*
GeV
,
33
*
GeV
,
44
*
GeV
),
(
111
*
GeV
,
222
*
GeV
,
333
*
GeV
,
444
*
GeV
)]
act
.
vector_str
=
[
'
aa
'
,
'
bb
'
,
'
cc
'
,
'
dd
'
]
act
.
vector_bool
=
[
0
,
0
,
0
,
1
,
1
,
1
]
act
.
vector_int
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
vector_long
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
vector_ulong
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
vector_float
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
vector_double
=
[
0
*
m
,
1
*
m
,
2
*
m
,
3
*
m
,
4
*
m
,
5
*
m
,
6
*
m
,
7
*
m
,
8
*
m
,
8
*
m
,
8
*
m
]
act
.
vector_XYZPoint
=
[(
1
,
2
,
3
),(
11
,
22
,
33
),(
111
,
222
,
333
),(
1111
,
2222
,
3333
)]
act
.
vector_XYZVector
=
[(
1
,
2
,
3
),(
11
,
22
,
33
),(
111
,
222
,
333
),(
1111
,
2222
,
3333
)]
act
.
vector_PxPyPzEVector
=
[(
1
*
GeV
,
2
*
GeV
,
3
*
GeV
,
4
*
GeV
),
(
11
*
GeV
,
22
*
GeV
,
33
*
GeV
,
44
*
GeV
),
(
111
*
GeV
,
222
*
GeV
,
333
*
GeV
,
444
*
GeV
)]
act
=
DDG4
.
Action
(
kernel
,
str
(
'
PropertyTestAction/Test
'
))
act
.
prop_str
=
'
Hello World!
'
act
.
prop_bool
=
True
act
.
prop_int
=
1234
act
.
prop_long
=
3456
act
.
prop_ulong
=
4567
act
.
prop_float
=
1234567.8
act
.
prop_double
=
1234567.8
act
.
prop_XYZPoint
=
(
1
,
2
,
3
)
act
.
prop_XYZVector
=
(
1
*
m
,
2
*
m
,
3
*
m
)
act
.
prop_PxPyPzEVector
=
(
1
*
GeV
,
2
*
GeV
,
3
*
GeV
,
4
*
GeV
)
act
.
map_str_str
=
{
'
a
'
:
'
AA
'
,
'
b
'
:
'
BB
'
,
'
c
'
:
'
CC
'
}
act
.
map_str_bool
=
{
'
a
'
:
1
,
'
b
'
:
0
,
'
c
'
:
1
}
act
.
map_str_int
=
{
'
a
'
:
11
,
'
b
'
:
22
,
'
c
'
:
33
}
act
.
map_str_long
=
{
'
a
'
:
111
,
'
b
'
:
222
,
'
c
'
:
333
}
# act.map_str_ulong = {'a': 1111, 'b': 2222, 'c': 3333}
act
.
map_str_float
=
{
'
a
'
:
11.11
,
'
b
'
:
22.22
,
'
c
'
:
33.33
}
act
.
map_str_double
=
{
'
a
'
:
11.111
,
'
b
'
:
22.222
,
'
c
'
:
33.333
}
act
.
map_int_str
=
{
100
:
'
AA
'
,
200
:
'
BB
'
,
300
:
'
CC
'
}
act
.
map_int_bool
=
{
100
:
1
,
200
:
0
,
300
:
1
}
act
.
map_int_int
=
{
100
:
11
,
200
:
22
,
300
:
33
}
act
.
map_int_long
=
{
100
:
111
,
200
:
222
,
300
:
333
}
# act.map_int_ulong = {100: 1111, 200: 2222, 300: 3333}
act
.
map_int_float
=
{
100
:
11.11
,
200
:
22.22
,
300
:
33.33
}
act
.
map_int_double
=
{
100
:
11.111
,
200
:
22.222
,
300
:
33.333
}
act
.
map_int_str
=
{
100
*
10
:
'
AA
'
,
200
*
10
:
'
BB
'
,
300
*
10
:
'
CC
'
}
act
.
map_int_bool
=
{
100
*
10
:
1
,
200
*
10
:
0
,
300
*
10
:
1
}
act
.
map_int_int
=
{
100
*
10
:
11
,
200
*
10
:
22
,
300
*
10
:
33
}
act
.
map_int_long
=
{
100
*
10
:
111
,
200
*
10
:
222
,
300
*
10
:
333
}
# act.map_int_ulong = {100 * 10: 1111, 200 * 10: 2222, 300 * 10: 3333}
act
.
map_int_float
=
{
100
*
10
:
11.11
,
200
*
10
:
22.22
,
300
*
10
:
33.33
}
act
.
map_int_double
=
{
100
*
10
:
11.111
,
200
*
10
:
22.222
,
300
*
10
:
33.333
}
act
.
set_str
=
[
'
aa
'
,
'
bb
'
,
'
cc
'
,
'
dd
'
]
act
.
set_bool
=
[
0
,
0
,
0
,
1
,
1
,
1
]
act
.
set_int
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
set_long
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
# act.set_ulong = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8]
act
.
set_float
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
set_double
=
[
0
*
m
,
1
*
m
,
2
*
m
,
3
*
m
,
4
*
m
,
5
*
m
,
6
*
m
,
7
*
m
,
8
*
m
,
8
*
m
,
8
*
m
]
act
.
set_XYZPoint
=
[(
1
,
2
,
3
),(
11
,
22
,
33
),(
111
,
222
,
333
),(
1111
,
2222
,
3333
)]
act
.
set_XYZVector
=
[(
1
,
2
,
3
),(
11
,
22
,
33
),(
111
,
222
,
333
),(
1111
,
2222
,
3333
)]
act
.
set_PxPyPzEVector
=
[(
1
*
GeV
,
2
*
GeV
,
3
*
GeV
,
4
*
GeV
),
(
11
*
GeV
,
22
*
GeV
,
33
*
GeV
,
44
*
GeV
),
(
111
*
GeV
,
222
*
GeV
,
333
*
GeV
,
444
*
GeV
)]
act
.
list_str
=
[
'
aa
'
,
'
bb
'
,
'
cc
'
,
'
dd
'
]
act
.
list_bool
=
[
0
,
0
,
0
,
1
,
1
,
1
]
act
.
list_int
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
list_long
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
list_ulong
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
list_float
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
list_double
=
[
0
*
m
,
1
*
m
,
2
*
m
,
3
*
m
,
4
*
m
,
5
*
m
,
6
*
m
,
7
*
m
,
8
*
m
,
8
*
m
,
8
*
m
]
act
.
list_XYZPoint
=
[(
1
,
2
,
3
),(
11
,
22
,
33
),(
111
,
222
,
333
),(
1111
,
2222
,
3333
)]
act
.
list_XYZVector
=
[(
1
,
2
,
3
),(
11
,
22
,
33
),(
111
,
222
,
333
),(
1111
,
2222
,
3333
)]
act
.
list_PxPyPzEVector
=
[(
1
*
GeV
,
2
*
GeV
,
3
*
GeV
,
4
*
GeV
),
(
11
*
GeV
,
22
*
GeV
,
33
*
GeV
,
44
*
GeV
),
(
111
*
GeV
,
222
*
GeV
,
333
*
GeV
,
444
*
GeV
)]
act
.
vector_str
=
[
'
aa
'
,
'
bb
'
,
'
cc
'
,
'
dd
'
]
act
.
vector_bool
=
[
0
,
0
,
0
,
1
,
1
,
1
]
act
.
vector_int
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
vector_long
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
vector_ulong
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
vector_float
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
8
,
8
]
act
.
vector_double
=
[
0
*
m
,
1
*
m
,
2
*
m
,
3
*
m
,
4
*
m
,
5
*
m
,
6
*
m
,
7
*
m
,
8
*
m
,
8
*
m
,
8
*
m
]
act
.
vector_XYZPoint
=
[(
1
,
2
,
3
),(
11
,
22
,
33
),(
111
,
222
,
333
),(
1111
,
2222
,
3333
)]
act
.
vector_XYZVector
=
[(
1
,
2
,
3
),(
11
,
22
,
33
),(
111
,
222
,
333
),(
1111
,
2222
,
3333
)]
act
.
vector_PxPyPzEVector
=
[(
1
*
GeV
,
2
*
GeV
,
3
*
GeV
,
4
*
GeV
),
(
11
*
GeV
,
22
*
GeV
,
33
*
GeV
,
44
*
GeV
),
(
111
*
GeV
,
222
*
GeV
,
333
*
GeV
,
444
*
GeV
)]
# Check read access:
print
(
'
-------------------------------------------------------
'
)
...
...
@@ -114,8 +119,8 @@ def run():
print
(
act
.
prop_float
)
# 1234567.8
print
(
act
.
prop_double
)
# 1234567.8
print
(
act
.
prop_XYZPoint
)
# (1,2,3)
print
(
act
.
prop_XYZVector
)
# (1
*m,2*m,3*
m)
print
(
act
.
prop_PxPyPzEVector
)
# (1
*
GeV,2
*
GeV,3
*
GeV,4
*
GeV)
print
(
act
.
prop_XYZVector
)
# (1
* m,2 * m,3 *
m)
print
(
act
.
prop_PxPyPzEVector
)
# (1
*
GeV,2
*
GeV,3
*
GeV,4
*
GeV)
print
(
'
-------------------------------------------------------
'
)
act
.
enableUI
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment