Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chao Peng
benchmarks
Commits
e752d32f
Commit
e752d32f
authored
Jul 28, 2020
by
Chao Peng
Browse files
Options
Downloads
Patches
Plain Diff
add benchmark script
parent
920200e2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pid/rich_benchmark.py
+69
-0
69 additions, 0 deletions
pid/rich_benchmark.py
pid/rich_benchmark.sh
+2
-2
2 additions, 2 deletions
pid/rich_benchmark.sh
with
71 additions
and
2 deletions
pid/rich_benchmark.py
0 → 100644
+
69
−
0
View file @
e752d32f
import
os
import
argparse
from
ROOT
import
TCanvas
,
TFile
,
TH1F
,
TLegend
,
THStack
from
ROOT
import
gROOT
,
gInterpreter
,
gStyle
from
ROOT
import
kBlack
,
kBlue
,
kRed
,
kGreen
# interested particles
PARTICLES
=
{
2212
:
r
'
p
'
,
321
:
r
'
K+
'
,
211
:
r
'
$\pi+$
'
,
}
parser
=
argparse
.
ArgumentParser
(
'
RICH pid analysis (simple)
'
)
parser
.
add_argument
(
'
root_file
'
,
help
=
'
input root file
'
)
parser
.
add_argument
(
'
-o
'
,
'
--out-dir
'
,
default
=
'
.
'
,
dest
=
'
out_dir
'
,
help
=
'
directory for output files
'
)
parser
.
add_argument
(
'
-n
'
,
'
--number-events
'
,
type
=
int
,
default
=
0
,
dest
=
'
nev
'
,
help
=
'
number of events to process, <= 0 means all
'
)
parser
.
add_argument
(
'
--npdet-inc
'
,
default
=
'
/usr/local/include
'
,
dest
=
'
npdet_inc
'
,
help
=
'
NPDet include directory
'
)
parser
.
add_argument
(
'
--dd4hep-inc
'
,
default
=
'
/usr/local/include
'
,
dest
=
'
dd4hep_inc
'
,
help
=
'
DD4hep include directory
'
)
args
=
parser
.
parse_args
()
# include files
gInterpreter
.
AddIncludePath
(
args
.
npdet_inc
)
gInterpreter
.
AddIncludePath
(
args
.
dd4hep_inc
)
gInterpreter
.
Declare
(
r
'
#include
"
npdet/PhotoMultiplierHit.h
"'
)
gInterpreter
.
Declare
(
r
'
#include
"
DDG4/Geant4Particle.h
"'
)
# style
gROOT
.
SetStyle
(
'
Modern
'
)
# read root file and fill data
f
=
TFile
.
Open
(
args
.
root_file
)
tree
=
f
.
EVENT
hists
=
{
pid
:
TH1F
(
name
,
'
N.p.e
'
,
50
,
0
,
201
)
for
pid
,
name
in
PARTICLES
.
items
()}
for
iev
in
range
(
tree
.
GetEntries
()):
tree
.
GetEntry
(
iev
)
npe
=
tree
.
ForwardRICHHits
.
size
()
if
npe
>
0
:
pid
=
tree
.
MCParticles
[
2
].
pdgID
hists
[
pid
].
Fill
(
npe
)
gStyle
.
SetOptStat
(
0
)
# plot
c1
=
TCanvas
(
'
c1
'
,
'
Dynamic Filling Example
'
,
200
,
10
,
1200
,
800
)
c1
.
GetFrame
().
SetBorderSize
(
6
)
c1
.
GetFrame
().
SetBorderMode
(
-
1
)
colors
=
[
kRed
,
kBlue
,
kGreen
]
leg
=
TLegend
(.
7
,.
7
,.
9
,.
9
)
hstack
=
THStack
(
"
hs
"
,
"
N.p.e Distributions;Number of photo-electrons;counts
"
)
for
(
pid
,
hist
),
color
in
zip
(
hists
.
items
(),
colors
):
hist
.
SetFillStyle
(
3001
)
hist
.
SetFillColorAlpha
(
color
,
0.5
)
hist
.
SetLineColor
(
color
)
hstack
.
Add
(
hist
)
leg
.
AddEntry
(
hist
,
PARTICLES
[
pid
],
'
LF
'
)
hstack
.
Draw
(
"
nostack
"
)
leg
.
Draw
()
c1
.
SaveAs
(
os
.
path
.
join
(
args
.
out_dir
,
"
rich_npe.png
"
))
This diff is collapsed.
Click to expand it.
pid/rich_benchmark.sh
+
2
−
2
View file @
e752d32f
#!/bin/bash
#
source /usr/local/bin/thisdd4hep.sh
source
/usr/local/bin/thisdd4hep.sh
#
python rich_benchmark.py
--compact=./pid/GenericRICH_example.xml --input=
./sim_output/rich_sim.root --out
put
=./results
/rich_benchmarks.root
python
./pid/
rich_benchmark.py ./sim_output/rich_sim.root
--out
-dir
=
./results
--npdet-inc
=
/home/cpeng/Apps/NPDet/include
--dd4hep-inc
=
/home/cpeng/Apps/DD4hep/include
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