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
Merge requests
!287
Add plot script for e/pi separation performance
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Add plot script for e/pi separation performance
update_imaging_ml_benchmarks
into
master
Overview
0
Commits
6
Pipelines
0
Changes
5
Open
Chao Peng
requested to merge
update_imaging_ml_benchmarks
into
master
2 years ago
Overview
0
Commits
6
Pipelines
0
Changes
5
Expand
update the json output from epcut and ML so rejection power and uncertainties can be directly read from them
add a json output for run_benchmark.py to collect all run information
add a script reading the run info files and plot the e/pi separation power curve
0
0
Merge request reports
Compare
master
version 5
47cf99a4
2 years ago
version 4
6d3955ea
2 years ago
version 3
7cec8449
2 years ago
version 2
41825bf0
2 years ago
version 1
1516a7c6
2 years ago
master (HEAD)
and
latest version
latest version
b54cfc4e
6 commits,
2 years ago
version 5
47cf99a4
5 commits,
2 years ago
version 4
6d3955ea
4 commits,
2 years ago
version 3
7cec8449
3 commits,
2 years ago
version 2
41825bf0
2 commits,
2 years ago
version 1
1516a7c6
1 commit,
2 years ago
5 files
+
143
−
10
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
benchmarks/imaging_shower_ML/scripts/draw_imaging_event3d.py
0 → 100644
+
108
−
0
Options
"""
A script to draw imaging events in 3D
Assumed the input reconstruction file has only single-particle events
Chao Peng (ANL)
2022/12/06
"""
import
ROOT
import
os
import
gc
import
sys
import
json
import
numpy
as
np
import
pandas
as
pd
import
argparse
from
utils
import
flatten_collection
,
cartesian_to_polar
,
imcal_info
,
center_of_gravity
pd
.
set_option
(
'
display.max_rows
'
,
500
)
if
__name__
==
'
__main__
'
:
parser
=
argparse
.
ArgumentParser
(
description
=
'
Visualize the cluster (layer-wise) from analysis
'
)
parser
.
add_argument
(
'
file
'
,
type
=
str
,
help
=
'
path to the input file.
'
)
parser
.
add_argument
(
'
-o
'
,
type
=
str
,
default
=
'
.
'
,
dest
=
'
outdir
'
,
help
=
'
output directory.
'
)
parser
.
add_argument
(
'
-e
'
,
type
=
int
,
default
=
0
,
dest
=
'
event
'
,
help
=
'
event number to draw.
'
)
parser
.
add_argument
(
'
--nhits
'
,
type
=
int
,
default
=
50
,
dest
=
'
nhits
'
,
help
=
'
number of hits per layer.
'
)
parser
.
add_argument
(
'
-b
'
,
'
--branch
'
,
type
=
str
,
dest
=
'
branch
'
,
default
=
'
EcalBarrelImagingHitsReco
'
,
help
=
'
name of data branch (edm4eic::CalorimeterHitCollection).
'
)
parser
.
add_argument
(
'
--eta-ngrid
'
,
type
=
int
,
dest
=
'
eta_ngrid
'
,
default
=
40
,
help
=
'
number of eta grids for drawing.
'
)
parser
.
add_argument
(
'
--eta-grid
'
,
type
=
float
,
dest
=
'
eta_grid
'
,
default
=
0.01
,
help
=
'
eta grid size for drawing.
'
)
parser
.
add_argument
(
'
--phi-ngrid
'
,
type
=
int
,
dest
=
'
phi_ngrid
'
,
default
=
40
,
help
=
'
number of phi grids for drawing.
'
)
parser
.
add_argument
(
'
--phi-grid
'
,
type
=
float
,
dest
=
'
phi_grid
'
,
default
=
0.01
,
help
=
'
phi grid size for drawing (rad).
'
)
parser
.
add_argument
(
'
--topo-range
'
,
type
=
float
,
default
=
50.0
,
dest
=
'
topo_range
'
,
help
=
'
half range for projection plot (mrad)
'
)
args
=
parser
.
parse_args
()
# read data and MCParticles
rdf
=
ROOT
.
RDataFrame
(
"
events
"
,
args
.
file
)
# event range
ntotal
=
rdf
.
Count
().
GetValue
()
iev
=
int
(
np
.
clip
(
args
.
event
,
0
,
ntotal
))
# data
data
=
flatten_collection
(
rdf
,
args
.
branch
,
(
iev
,
iev
+
1
),
cols
=
[
'
layer
'
,
'
energy
'
,
'
position.x
'
,
'
position.y
'
,
'
position.z
'
,
])
etot
=
data
[
'
energy
'
].
sum
()
xc
,
yc
,
zc
=
center_of_gravity
(
*
data
[[
'
position.x
'
,
'
position.y
'
,
'
position.z
'
]].
values
.
T
,
np
.
log
(
data
[
'
energy
'
].
values
/
etot
),
4.6
)
rc
,
thetac
,
phic
,
r0c
,
etac
=
cartesian_to_polar
(
xc
,
yc
,
zc
)
r
,
theta
,
phi
,
rc
,
eta
=
cartesian_to_polar
(
*
data
[[
'
position.x
'
,
'
position.y
'
,
'
position.z
'
]].
values
.
T
)
dfg
=
pd
.
DataFrame
(
data
=
np
.
vstack
((
*
data
[[
'
layer
'
,
'
energy
'
]].
values
.
T
,
eta
,
phi
)).
T
,
columns
=
[
'
layer
'
,
'
energy
'
,
'
eta
'
,
'
phi
'
])
eta_bins
=
np
.
arange
(
args
.
eta_ngrid
+
1
)
*
args
.
eta_grid
eta_bins
=
eta_bins
-
eta_bins
[
-
1
]
/
2.
+
etac
phi_bins
=
np
.
arange
(
args
.
phi_ngrid
+
1
)
*
args
.
phi_grid
phi_bins
=
phi_bins
-
phi_bins
[
-
1
]
/
2.
+
phic
dfg
.
loc
[:,
'
eta_bin
'
]
=
np
.
digitize
(
dfg
[
'
eta
'
],
eta_bins
)
dfg
.
loc
[:,
'
phi_bin
'
]
=
np
.
digitize
(
dfg
[
'
phi
'
],
phi_bins
)
print
(
dfg
)
# eta = eta - etac
# phi = phi - phic
# determine eta and phi windows according to event (cluster) center
Loading