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
da34149c
Commit
da34149c
authored
11 months ago
by
Andre Sailer
Browse files
Options
Downloads
Patches
Plain Diff
DDSim: add checking that files exists to input argument parsing
parent
87757a38
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
DDG4/python/DDSim/DD4hepSimulation.py
+15
-0
15 additions, 0 deletions
DDG4/python/DDSim/DD4hepSimulation.py
with
15 additions
and
0 deletions
DDG4/python/DDSim/DD4hepSimulation.py
+
15
−
0
View file @
da34149c
...
@@ -223,8 +223,10 @@ class DD4hepSimulation(object):
...
@@ -223,8 +223,10 @@ class DD4hepSimulation(object):
self
.
_dumpSteeringFile
=
parsed
.
dumpSteeringFile
self
.
_dumpSteeringFile
=
parsed
.
dumpSteeringFile
self
.
compactFile
=
ConfigHelper
.
makeList
(
parsed
.
compactFile
)
self
.
compactFile
=
ConfigHelper
.
makeList
(
parsed
.
compactFile
)
self
.
__checkFilesExist
(
self
.
compactFile
,
fileType
=
'
compact
'
)
self
.
inputFiles
=
parsed
.
inputFiles
self
.
inputFiles
=
parsed
.
inputFiles
self
.
inputFiles
=
self
.
__checkFileFormat
(
self
.
inputFiles
,
POSSIBLEINPUTFILES
)
self
.
inputFiles
=
self
.
__checkFileFormat
(
self
.
inputFiles
,
POSSIBLEINPUTFILES
)
self
.
__checkFilesExist
(
self
.
inputFiles
,
fileType
=
'
input
'
)
self
.
outputFile
=
parsed
.
outputFile
self
.
outputFile
=
parsed
.
outputFile
self
.
__checkFileFormat
(
self
.
outputFile
,
(
'
.root
'
,
'
.slcio
'
))
self
.
__checkFileFormat
(
self
.
outputFile
,
(
'
.root
'
,
'
.slcio
'
))
self
.
runType
=
parsed
.
runType
self
.
runType
=
parsed
.
runType
...
@@ -539,6 +541,19 @@ class DD4hepSimulation(object):
...
@@ -539,6 +541,19 @@ class DD4hepSimulation(object):
field
.
delta_one_step
=
self
.
field
.
delta_one_step
field
.
delta_one_step
=
self
.
field
.
delta_one_step
field
.
largest_step
=
self
.
field
.
largest_step
field
.
largest_step
=
self
.
field
.
largest_step
def
__checkFilesExist
(
self
,
fileNames
,
fileType
=
''
):
"""
Make sure all files in the given list exist, add to errorMessage otherwise.
:param list fileNames: list of files to check for existence
:param str fileType: type if file, for nicer error message
"""
if
isinstance
(
fileNames
,
str
):
fileNames
=
[
fileNames
]
for
fileName
in
fileNames
:
if
not
os
.
path
.
exists
(
fileName
):
self
.
_errorMessages
.
append
(
f
"
ERROR: The
{
fileType
}
file
'
{
fileName
}
'
does not exist
"
)
def
__checkFileFormat
(
self
,
fileNames
,
extensions
):
def
__checkFileFormat
(
self
,
fileNames
,
extensions
):
"""
check if the fileName is allowed, note that the filenames are case
"""
check if the fileName is allowed, note that the filenames are case
sensitive, and in case of hepevt we depend on this to identify short and long versions of the content
sensitive, and in case of hepevt we depend on this to identify short and long versions of the content
...
...
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