Skip to content

Commit

Permalink
Add histogram for fractions
Browse files Browse the repository at this point in the history
  • Loading branch information
saganatt committed Nov 19, 2024
1 parent de0badf commit 4d552fa
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions machine_learning_hep/hf_pt_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ def hf_pt_spectrum(channel, # pylint: disable=too-many-locals, too-many-argument
0,
1
)
hfraction = TH1F(
"hfraction",
f";{axistit_pt};{axistit_fprompt}",
len(ptlims["rawyields"]) - 1,
ptlims["rawyields"],
)

for i_pt, (ptmin, ptmax) in enumerate(
zip(ptlims["rawyields"][:-1], ptlims["rawyields"][1:])
Expand Down Expand Up @@ -281,6 +287,8 @@ def hf_pt_spectrum(channel, # pylint: disable=too-many-locals, too-many-argument
gfraction.SetPointError(
i_pt, pt_delta / 2, pt_delta / 2, frac[0] - frac[1], frac[2] - frac[0]
)
hfraction.SetBinContent(i_pt + 1, frac[0])
hfraction.SetBinError(i_pt + 1, 0.0)

c = TCanvas("c", "c", 600, 800)
c.Divide (1, 2)
Expand All @@ -300,6 +308,7 @@ def hf_pt_spectrum(channel, # pylint: disable=too-many-locals, too-many-argument
hnorm.Write()
if frac_method != "ext":
gfraction.Write()
hfraction.Write()

for _, value in histos.items():
if isinstance(value, TH1):
Expand Down

0 comments on commit 4d552fa

Please sign in to comment.