Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
athena
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIC
detectors
athena
Merge requests
!23
Feature: Convert to GDML script and pipeline integration
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feature: Convert to GDML script and pipeline integration
feature-convert-to-gdml
into
master
Overview
0
Commits
6
Pipelines
0
Changes
2
Merged
Wouter Deconinck
requested to merge
feature-convert-to-gdml
into
master
3 years ago
Overview
0
Commits
6
Pipelines
0
Changes
2
Expand
0
0
Merge request reports
Compare
master
version 4
62b24689
3 years ago
version 3
f2c2c358
3 years ago
version 2
e2a13158
3 years ago
version 1
66b07edd
3 years ago
master (base)
and
latest version
latest version
52137d77
6 commits,
3 years ago
version 4
62b24689
5 commits,
3 years ago
version 3
f2c2c358
4 commits,
3 years ago
version 2
e2a13158
3 commits,
3 years ago
version 1
66b07edd
2 commits,
3 years ago
2 files
+
56
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
scripts/convert_to_gdml.py
0 → 100755
+
47
−
0
Options
from
__future__
import
absolute_import
,
unicode_literals
import
os
import
time
import
logging
import
argparse
parser
=
argparse
.
ArgumentParser
(
prog
=
'
convert_to_gdml.py
'
,
description
=
'''
Convert DD4Hep description to GDML
'''
,
epilog
=
'''
This program converts the compact detector file to a single GDML file.
'''
)
parser
.
add_argument
(
"
--compact
"
,
help
=
"
compact detector file
"
,
default
=
"
athena.xml
"
)
parser
.
add_argument
(
"
--output
"
,
help
=
"
gdml detector file
"
,
default
=
"
athena.gdml
"
)
args
=
parser
.
parse_args
()
import
DDG4
from
g4units
import
keV
,
GeV
,
mm
,
ns
,
MeV
def
run
():
kernel
=
DDG4
.
Kernel
()
description
=
kernel
.
detectorDescription
()
kernel
.
loadGeometry
(
str
(
"
file:
"
+
args
.
compact
))
DDG4
.
importConstants
(
description
)
geant4
=
DDG4
.
Geant4
(
kernel
)
ui
=
geant4
.
setupCshUI
(
ui
=
None
)
#
# Setup the GDML writer action
writer
=
DDG4
.
Action
(
kernel
,
'
Geant4GDMLWriteAction/Writer
'
)
writer
.
enableUI
()
kernel
.
registerGlobalAction
(
writer
)
ui
.
Commands
=
[
'
/ddg4/Writer/Output {}
'
.
format
(
args
.
output
),
'
/ddg4/Writer/OverWrite 1
'
,
'
/ddg4/Writer/write
'
]
kernel
.
configure
()
kernel
.
initialize
()
kernel
.
run
()
kernel
.
terminate
()
if
__name__
==
"
__main__
"
:
run
()
Loading