Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
FreeForestML
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CERN
fsauerbu
FreeForestML
Merge requests
!53
WIP: Resolve "Add option to include under and overflow bins"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
WIP: Resolve "Add option to include under and overflow bins"
58-add-option-to-include-under-and-overflow-bins
into
master
Overview
0
Commits
1
Pipelines
1
Changes
3
Merged
Frank Sauerburger
requested to merge
58-add-option-to-include-under-and-overflow-bins
into
master
4 years ago
Overview
0
Commits
1
Pipelines
1
Changes
3
Expand
Closes
#58 (closed)
0
0
Merge request reports
Viewing commit
0839a695
Show latest version
3 files
+
48
−
22
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
Unverified
0839a695
Add include_outside argument to hist and stack
· 0839a695
Frank Sauerburger
authored
4 years ago
examples/Histogram.ipynb
+
8
−
5
Options
%% Cell type:code id: tags:
```
python
import
pandas
as
pd
import
seaborn
as
sns
from
nnfwtbn
import
Variable
,
Process
,
Cut
,
hist
,
McStack
,
DataStack
,
Stack
from
nnfwtbn
import
toydata
```
%% Cell type:code id: tags:
```
python
df
=
toydata
.
get
()
```
%% Cell type:code id: tags:
```
python
df
```
%% Cell type:code id: tags:
```
python
p_ztt
=
Process
(
r
"
$Z\rightarrow\tau\tau$
"
,
range
=
(
0
,
0
))
p_sig
=
Process
(
r
"
Signal
"
,
range
=
(
1
,
1
))
p_asimov
=
Process
(
r
"
Asimov
"
,
selection
=
lambda
d
:
d
.
fpid
>=
0
)
```
%% Cell type:code id: tags:
```
python
colors
=
[
"
windows blue
"
,
"
amber
"
,
"
greyish
"
,
"
faded green
"
,
"
dusty purple
"
]
s_bkg
=
McStack
(
p_ztt
,
p_sig
,
palette
=
sns
.
xkcd_palette
(
colors
))
s_data
=
DataStack
(
p_asimov
)
```
%% Cell type:code id: tags:
```
python
v_higgs_m
=
Variable
(
r
"
$m^H$
"
,
"
higgs_m
"
,
"
GeV
"
)
```
%% Cell type:code id: tags:
```
python
c_vbf
=
Cut
(
lambda
d
:
d
.
dijet_p4__M
>
400
)
&
\
Cut
(
lambda
d
:
d
.
jet_1_p4__Pt
>=
30
)
&
\
Cut
(
lambda
d
:
d
.
is_dijet_centrality
==
1
)
&
\
Cut
(
lambda
d
:
d
.
jet_0_p4__Eta
*
df
.
jet_1_p4__Eta
<
0
)
&
\
Cut
(
lambda
d
:
(
d
.
jet_0_p4__Eta
-
df
.
jet_1_p4__Eta
).
abs
()
>
3
)
```
%% Cell type:code id: tags:
```
python
hist
(
df
,
v_higgs_m
,
20
,
[
s_bkg
,
s_data
],
range
=
(
0
,
200
),
selection
=
None
,
weight
=
"
weight
"
,
ratio_label
=
"
Data / SM
"
)
None
```
%% Cell type:code id: tags:
```
python
hist
(
df
,
v_higgs_m
,
22
,
[
s_bkg
,
s_data
],
range
=
(
75
,
130
),
selection
=
None
,
weight
=
"
weight
"
,
ratio_label
=
"
Data / SM
"
,
include_outside
=
True
)
None
```
%% Cell type:code id: tags:
```
python
hist
(
df
,
v_higgs_m
,
20
,
[
s_bkg
,
s_data
],
range
=
(
0
,
200
),
selection
=
None
,
weight
=
"
weight
"
,
ratio_label
=
"
Data / SM
"
,
y_log
=
True
,
numerator
=
None
)
None
```
%% Cell type:code id: tags:
```
python
hist
(
df
,
v_higgs_m
,
20
,
[
s_bkg
,
s_data
],
range
=
(
0
,
200
),
selection
=
None
,
weight
=
"
weight
"
,
ratio_label
=
"
MC / Data
"
,
y_log
=
True
,
y_min
=
1e-1
,
vlines
=
[
80
,
{
'
x
'
:
100
,
'
color
'
:
'
b
'
}])
None
```
%% Cell type:code id: tags:
```
python
s_sig
=
McStack
(
p_sig
)
s_ztt
=
McStack
(
p_ztt
)
hist
(
df
,
v_higgs_m
,
20
,
[
s_bkg
,
s_data
],
range
=
(
40
,
120
),
selection
=
None
,
weight
=
"
weight
"
,
ratio_label
=
"
Signal / Bkg
"
,
y_log
=
True
,
y_min
=
1e-1
,
vlines
=
[
80
,
{
'
x
'
:
100
,
'
color
'
:
'
b
'
}],
numerator
=
s_sig
,
denominator
=
s_ztt
)
None
```
%% Cell type:code id: tags:
```
python
hist
(
df
,
v_higgs_m
,
20
,
[
s_bkg
,
s_data
],
range
=
(
0
,
200
),
selection
=
None
,
weight
=
"
weight
"
,
ratio_label
=
"
Data - Bkg
"
,
y_log
=
True
,
y_min
=
1e-1
,
diff
=
True
,
vlines
=
[
80
,
{
'
x
'
:
100
,
'
color
'
:
'
b
'
}],
numerator
=
s_data
,
denominator
=
s_ztt
)
None
```
%% Cell type:code id: tags:
```
python
hist
(
df
,
v_higgs_m
,
20
,
[
s_bkg
,
s_data
],
range
=
(
0
,
200
),
selection
=
None
,
weight
=
"
weight
"
,
ratio_label
=
"
Data / SM
"
,
info
=
False
,
atlas
=
"
Work in progress
"
)
None
```
%% Cell type:code id: tags:
```
python
import
nnfwtbn.plot
as
nnp
nnp
.
INFO
=
"
$\sqrt{s} = 13\,\mathrm{TeV}$, $140\,\mathrm{fb}^{-1}$
"
```
%% Cell type:code id: tags:
```
python
hist
(
df
,
v_higgs_m
,
20
,
[
s_bkg
,
s_data
],
range
=
(
0
,
200
),
selection
=
None
,
weight
=
"
weight
"
,
ratio_label
=
"
Data / SM
"
)
None
```
%% Cell type:code id: tags:
```
python
colors
=
[
"
windows blue
"
,
"
amber
"
,
"
greyish
"
,
"
faded green
"
,
"
dusty purple
"
]
colors
=
sns
.
xkcd_palette
(
colors
)
s_sig
=
McStack
(
p_sig
,
color
=
colors
[
0
],
histtype
=
'
step
'
)
s_ztt
=
McStack
(
p_ztt
,
color
=
colors
[
1
],
histtype
=
'
step
'
)
hist
(
df
,
v_higgs_m
,
20
,
[
s_sig
,
s_ztt
],
range
=
(
0
,
200
),
selection
=
None
,
weight
=
"
weight
"
,
numerator
=
None
,
density
=
True
)
None
```
%% Cell type:code id: tags:
```
python
```
%%
Cell
type
:
code
id
:
tags
:
```
python
```
Loading