Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Geant4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
LHCb
Geant4
Commits
9410644f
Commit
9410644f
authored
7 years ago
by
Dmitry Popov
Browse files
Options
Downloads
Patches
Plain Diff
Fixed hadronic test to check return code; beamOn 1, not zero
parent
3240a090
Branches
switch_master_to_g4v10r3p1
No related tags found
1 merge request
!18
Migrate 'master' to G4 v10r3p1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Geant4/G4examples/extended/hadronic/G4Hadr00/scripts/run_hadronic_tests.py
+11
-9
11 additions, 9 deletions
.../extended/hadronic/G4Hadr00/scripts/run_hadronic_tests.py
with
11 additions
and
9 deletions
Geant4/G4examples/extended/hadronic/G4Hadr00/scripts/run_hadronic_tests.py
+
11
−
9
View file @
9410644f
...
...
@@ -55,7 +55,7 @@ template = '''#================================================
#/gun/particle proton
#/gun/energy 20. GeV
#
/run/beamOn
0
/run/beamOn
1
#
'''
...
...
@@ -74,21 +74,25 @@ def process(particle, target, phys_list):
with
NamedTemporaryFile
()
as
tmp
:
tmp
.
write
(
template
.
format
(
particle
=
particle
,
target
=
target
))
tmp
.
flush
()
job
=
Popen
([
'
hadr00.exe
'
,
tmp
.
name
,
phys_list
],
stdout
=
PIPE
,
stderr
=
PIPE
)
job_out
,
job_err
=
job
.
communicate
()
if
job
.
returncode
:
sys
.
exit
(
'
ERROR: hadr00.exe exited with an error code!
'
)
if
not
os
.
path
.
exists
(
"
tables
"
):
os
.
makedirs
(
"
tables
"
)
tables
=
open
(
os
.
path
.
join
(
'
tables
'
,
'
{0}_{1}_{2}.txt
'
.
format
(
phys_list
,
particle
,
target
)),
"
w
"
)
tables
.
write
(
"
Energy Elastic Inelastic Total
\n
"
)
job
=
Popen
([
'
hadr00.exe
'
,
tmp
.
name
,
phys_list
],
stdout
=
PIPE
)
regex
=
re
.
compile
(
r
'
^\s*\d+\s+([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)
'
)
found
=
False
energy
=
array
(
'
d
'
)
elastic
=
array
(
'
d
'
)
inelastic
=
array
(
'
d
'
)
total
=
array
(
'
d
'
)
for
line
in
job
.
stdout
:
for
line
in
job
_out
.
split
(
os
.
linesep
)
:
if
found
:
m
=
regex
.
match
(
line
)
if
m
:
...
...
@@ -156,12 +160,12 @@ for p,ap in zip(part,apart) :
if
"
kaon
"
in
p
:
gr0
.
SetMaximum
(
1.5
)
gr0
.
Draw
(
"
AL
"
)
gr1
.
SetLineWidth
(
2
)
gr1
.
SetLineColor
(
1
)
gr1
.
SetLineStyle
(
2
)
gr1
.
Draw
(
"
samesL
"
)
gr2
.
SetLineWidth
(
2
);
gr2
.
SetLineStyle
(
1
)
gr2
.
SetLineColor
(
4
);
...
...
@@ -184,5 +188,3 @@ for p,ap in zip(part,apart) :
c1
.
SetGridx
();
c1
.
Print
(
"
phys_list_comparison_
"
+
p
.
replace
(
"
-
"
,
""
)
+
"
.pdf
"
)
c1
.
Print
(
"
phys_list_comparison_
"
+
p
.
replace
(
"
-
"
,
""
)
+
"
.C
"
)
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