Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
reconstruction_benchmarks
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
benchmarks
reconstruction_benchmarks
Commits
3bc0da10
Commit
3bc0da10
authored
2 years ago
by
Christopher Dilks
Browse files
Options
Downloads
Patches
Plain Diff
feat: draw plots to PNGs
parent
4150e622
Branches
Branches containing commit
No related tags found
2 merge requests
!309
Irt algo
,
!293
feat: dRICH benchmarks
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
benchmarks/rich/draw_benchmark.py
+112
-0
112 additions, 0 deletions
benchmarks/rich/draw_benchmark.py
benchmarks/rich/run_benchmark.rb
+10
-1
10 additions, 1 deletion
benchmarks/rich/run_benchmark.rb
with
122 additions
and
1 deletion
benchmarks/rich/draw_benchmark.py
0 → 100755
+
112
−
0
View file @
3bc0da10
#!/usr/bin/env python
# Copyright 2023, Christopher Dilks
# Subject to the terms in the LICENSE file found in the top-level directory.
import
ROOT
as
r
import
sys
,
getopt
,
pathlib
# suppress graphics
r
.
gROOT
.
SetBatch
(
True
)
# ARGUMENTS
################################################################
ana_file_name
=
'
out/ana.edm4hep.root
'
output_dir
=
'
out/ana_plots
'
helpStr
=
f
'''
{
sys
.
argv
[
0
]
}
[OPTIONS]
-i <input file>: specify an input file, e.g., hepmc
default:
{
ana_file_name
}
-o <output dir>: specify an output directory
default:
{
output_dir
}
-h: show this usage guide
'''
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'
i:o:h
'
)
except
getopt
.
GetoptError
:
print
(
'
\n\n
ERROR: invalid argument
\n
'
,
helpStr
,
file
=
sys
.
stderr
)
sys
.
exit
(
2
)
for
opt
,
arg
in
opts
:
if
(
opt
==
'
-i
'
):
ana_file_name
=
arg
.
lstrip
()
if
(
opt
==
'
-o
'
):
output_dir
=
arg
.
lstrip
()
if
(
opt
==
'
-h
'
):
print
(
helpStr
)
sys
.
exit
(
2
)
print
(
f
'''
ana_file_name =
{
ana_file_name
}
output_dir =
{
output_dir
}
'''
)
# PLOTTING
################################################################
# make canvases
ana_file
=
r
.
TFile
.
Open
(
ana_file_name
,
"
READ
"
)
def
make_canv
(
name
,
dimx
=
1200
,
dimy
=
800
):
return
r
.
TCanvas
(
name
,
name
,
dimx
,
dimy
)
canv_dict
=
{
"
photon_spectra
"
:
make_canv
(
"
photon_spectra
"
),
"
digitization
"
:
make_canv
(
"
digitization
"
),
"
pidAerogel
"
:
make_canv
(
"
pidAerogel
"
),
"
pidGas
"
:
make_canv
(
"
pidGas
"
),
"
pidMerged
"
:
make_canv
(
"
pidMerged
"
),
}
# draw photon spectra
canv
=
canv_dict
[
"
photon_spectra
"
]
canv
.
Divide
(
1
,
2
)
for
i
in
range
(
2
):
canv
.
GetPad
(
i
+
1
).
SetGrid
(
1
,
1
)
canv
.
GetPad
(
i
+
1
).
SetLogy
()
canv
.
cd
(
1
)
ana_file
.
Get
(
"
phot/phot_spectrum_sim
"
).
Draw
()
canv
.
cd
(
2
)
ana_file
.
Get
(
"
digi/phot_spectrum_rec
"
).
Draw
()
# draw digitization
canv
=
canv_dict
[
"
digitization
"
]
canv
.
Divide
(
2
,
2
)
for
i
in
range
(
4
):
canv
.
GetPad
(
i
+
1
).
SetGrid
(
1
,
1
)
if
(
i
<
2
):
canv
.
GetPad
(
i
+
1
).
SetLogy
()
else
:
canv
.
GetPad
(
i
+
1
).
SetLogz
()
canv
.
cd
(
1
)
ana_file
.
Get
(
"
digi/adc_dist
"
).
Draw
()
canv
.
cd
(
2
)
ana_file
.
Get
(
"
digi/tdc_dist
"
).
Draw
()
canv
.
cd
(
3
)
ana_file
.
Get
(
"
digi/tdc_vs_adc
"
).
Draw
(
"
COLZ
"
)
# draw CherenkovPID
for
rad
in
[
"
Aerogel
"
,
"
Gas
"
,
"
Merged
"
]:
pid_name
=
f
'
pid
{
rad
}
'
canv
=
canv_dict
[
pid_name
]
canv
.
Divide
(
2
,
2
)
for
i
in
range
(
4
):
canv
.
GetPad
(
i
+
1
).
SetGrid
(
1
,
1
)
canv
.
cd
(
1
)
ana_file
.
Get
(
f
'
{
pid_name
}
/npe_dist_
{
rad
}
'
).
Draw
()
canv
.
cd
(
2
)
ana_file
.
Get
(
f
'
{
pid_name
}
/theta_dist_
{
rad
}
'
).
Draw
()
canv
.
cd
(
3
)
ana_file
.
Get
(
f
'
{
pid_name
}
/thetaResid_dist_
{
rad
}
'
).
Draw
()
canv
.
cd
(
4
)
ana_file
.
Get
(
f
'
{
pid_name
}
/highestWeight_dist_
{
rad
}
'
).
Draw
()
# FINISH
################################################################
pathlib
.
Path
(
output_dir
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
for
name
,
canvas
in
canv_dict
.
items
():
canvas
.
SaveAs
(
f
'
{
output_dir
}
/
{
name
}
.png
'
)
ana_file
.
Close
()
This diff is collapsed.
Click to expand it.
benchmarks/rich/run_benchmark.rb
+
10
−
1
View file @
3bc0da10
#!/usr/bin/ruby
#!/usr/bin/
env
ruby
# Copyright 2023, Christopher Dilks
# Subject to the terms in the LICENSE file found in the top-level directory.
...
...
@@ -201,6 +201,14 @@ analysis_cmd = [
analysis_cmd
.
append
"-a
#{
opt
.
algos
.
join
' '
}
"
if
opt
.
algos
.
size
>
0
analysis_cmd
.
append
'-'
+
'v'
*
opt
.
verbosity
if
opt
.
verbosity
>
0
# define analysis draw command
# ---------------------------------------------------
draw_cmd
=
[
"
#{
__dir__
}
/draw_benchmark.py"
,
"-i
#{
opt
.
ana_file
}
"
,
"-o
#{
opt
.
ana_file
.
gsub
(
/edm4hep.root$/
,
"plots"
)
}
"
]
# execute commands
# ---------------------------------------------------
...
...
@@ -229,3 +237,4 @@ puts '-'*50
exe
.
call
evgen_cmd
,
'event generation'
,
:sim
exe
.
call
recon_cmd
,
'reconstruction'
,
:rec
exe
.
call
analysis_cmd
,
'analysis'
,
:ana
exe
.
call
draw_cmd
,
'draw'
,
:ana
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