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
a1c57c92
Commit
a1c57c92
authored
2 years ago
by
Markus Frank
Committed by
MarkusFrankATcernch
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix python style errors
parent
811bc2e5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DDCore/python/dd4hep_base.py
+17
-7
17 additions, 7 deletions
DDCore/python/dd4hep_base.py
with
17 additions
and
7 deletions
DDCore/python/dd4hep_base.py
+
17
−
7
View file @
a1c57c92
...
...
@@ -10,15 +10,18 @@
# ==========================================================================
from
__future__
import
absolute_import
,
unicode_literals
import
cppyy
import
imp
ortlib
import
imp
import
logging
logger
=
logging
.
getLogger
(
__name__
)
# We compile the DDG4 plugin on the fly if it does not exist using the AClick mechanism:
logger
=
logging
.
getLogger
(
__name__
)
def
compileAClick
(
dictionary
,
g4
=
True
):
"""
We compile the DDG4 plugin on the fly if it does not exist using the AClick mechanism.
"""
from
ROOT
import
gInterpreter
,
gSystem
import
os.path
dd4hep
=
os
.
environ
[
'
DD4hepINSTALL
'
]
...
...
@@ -32,7 +35,7 @@ def compileAClick(dictionary, g4=True):
gSystem
.
AddIncludePath
(
inc
)
gSystem
.
AddLinkedLibs
(
lib
)
logger
.
info
(
'
Loading AClick %s
'
,
dictionary
)
package
=
imp
ortlib
.
import
_module
(
'
DDG4
'
)
package
=
imp
.
find
_module
(
'
DDG4
'
)
dic
=
os
.
path
.
dirname
(
package
[
1
])
+
os
.
sep
+
dictionary
gInterpreter
.
ProcessLine
(
'
.L
'
+
dic
+
'
+
'
)
from
ROOT
import
dd4hep
as
module
...
...
@@ -40,6 +43,9 @@ def compileAClick(dictionary, g4=True):
def
loaddd4hep
():
"""
Import DD4hep module from ROOT using ROOT reflection
"""
import
os
import
sys
# Add ROOT to the python path in case it is not yet there....
...
...
@@ -149,7 +155,6 @@ cond = dd4hep.cond
tools
=
dd4hep
.
tools
align
=
dd4hep
.
align
detail
=
dd4hep
.
detail
import
imp
units
=
imp
.
new_module
(
'
units
'
)
# ---------------------------------------------------------------------------
import_namespace_item
(
'
tools
'
,
'
Evaluator
'
)
...
...
@@ -413,20 +418,25 @@ class CommandLine:
#
try
:
import_namespace_item
(
'
core
'
,
'
dd4hep_units
'
)
def
import_units
(
ns
=
None
):
if
ns
is
None
:
ns
=
name_space
logger
.
debug
(
'
Importing units into namespace
'
+
str
(
ns
.
__name__
))
count
=
0
;
count
=
0
for
nam
in
dir
(
dd4hep
.
dd4hep_units
):
if
nam
[
0
]
!=
'
_
'
:
count
=
count
+
1
setattr
(
ns
,
nam
,
getattr
(
core
.
dd4hep_units
,
nam
))
#
#
setattr(ns, nam, getattr(core, nam))
#
setattr(ns, nam, getattr(core, nam))
return
count
except
Exception
as
e
:
logger
.
warning
(
'
No units can be imported.
'
+
str
(
e
))
def
import_units
(
ns
=
None
):
return
0
...
...
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