Skip to content

Commit da34331

Browse files
committed
[RF] Remove ExpectedRelative normalization flag from rf202 tutorial
Since #19656, scaling the pdf to the expected number of events in the plot is the default behavior, because this is what makes sense when comparing predictions to data. Therefore, the explicit `ExpectedRelative` normalization flag can be removed.
1 parent 136e065 commit da34331

File tree

3 files changed

+12
-27
lines changed

3 files changed

+12
-27
lines changed

roofit/roofitcore/test/stressRooFit_tests.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -900,18 +900,16 @@ class TestBasic202 : public RooUnitTest {
900900
// Fit model to data, extended ML term automatically included
901901
model.fitTo(*data);
902902

903-
// Plot data and PDF overlaid, use expected number of events for p.d.f projection normalization
904-
// rather than observed number of events (==data->numEntries())
903+
// Plot data and PDF overlaid
905904
RooPlot *xframe = x.frame(Title("extended ML fit example"));
906905
data->plotOn(xframe);
907-
model.plotOn(xframe, Normalization(1.0, RooAbsReal::RelativeExpected));
906+
model.plotOn(xframe);
908907

909908
// Overlay the background component of model with a dashed line
910-
model.plotOn(xframe, Components(bkg), LineStyle(kDashed), Normalization(1.0, RooAbsReal::RelativeExpected));
909+
model.plotOn(xframe, Components(bkg), LineStyle(kDashed));
911910

912911
// Overlay the background+sig2 components of model with a dotted line
913-
model.plotOn(xframe, Components(RooArgSet(bkg, sig2)), LineStyle(kDotted),
914-
Normalization(1.0, RooAbsReal::RelativeExpected));
912+
model.plotOn(xframe, Components(RooArgSet(bkg, sig2)), LineStyle(kDotted));
915913

916914
/////////////////////
917915
// M E T H O D 2 //

tutorials/roofit/roofit/rf202_extendedmlfit.C

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,16 @@ void rf202_extendedmlfit()
6969
// Fit model to data, extended ML term automatically included
7070
model.fitTo(*data, PrintLevel(-1));
7171

72-
// Plot data and PDF overlaid, use expected number of events for pdf projection normalization
73-
// rather than observed number of events (==data->numEntries())
72+
// Plot data and PDF overlaid
7473
RooPlot *xframe = x.frame(Title("extended ML fit example"));
7574
data->plotOn(xframe);
76-
model.plotOn(xframe, Normalization(1.0, RooAbsReal::RelativeExpected));
75+
model.plotOn(xframe);
7776

7877
// Overlay the background component of model with a dashed line
79-
model.plotOn(xframe, Components(bkg), LineStyle(kDashed), Normalization(1.0, RooAbsReal::RelativeExpected));
78+
model.plotOn(xframe, Components(bkg), LineStyle(kDashed));
8079

8180
// Overlay the background+sig2 components of model with a dotted line
82-
model.plotOn(xframe, Components(RooArgSet(bkg, sig2)), LineStyle(kDotted),
83-
Normalization(1.0, RooAbsReal::RelativeExpected));
81+
model.plotOn(xframe, Components(RooArgSet(bkg, sig2)), LineStyle(kDotted));
8482

8583
// Print structure of composite pdf
8684
model.Print("t");

tutorials/roofit/roofit/rf202_extendedmlfit.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,17 @@
5555
# Fit model to data, ML term automatically included
5656
model.fitTo(data, PrintLevel=-1)
5757

58-
# Plot data and PDF overlaid, expected number of events for pdf projection normalization
59-
# rather than observed number of events (==data.numEntries())
58+
# Plot data and PDF overlaid
6059
xframe = x.frame(Title="extended ML fit example")
6160
data.plotOn(xframe)
62-
model.plotOn(xframe, Normalization=dict(scaleFactor=1.0, scaleType=ROOT.RooAbsReal.RelativeExpected))
61+
model.plotOn(xframe)
6362

6463
# Overlay the background component of model with a dashed line
65-
model.plotOn(
66-
xframe,
67-
Components={bkg},
68-
LineStyle=":",
69-
Normalization=dict(scaleFactor=1.0, scaleType=ROOT.RooAbsReal.RelativeExpected),
70-
)
64+
model.plotOn(xframe, Components={bkg}, LineStyle=":")
7165

7266
# Overlay the background+sig2 components of model with a dotted line
7367
ras_bkg_sig2 = {bkg, sig2}
74-
model.plotOn(
75-
xframe,
76-
Components=ras_bkg_sig2,
77-
LineStyle=":",
78-
Normalization=dict(scaleFactor=1.0, scaleType=ROOT.RooAbsReal.RelativeExpected),
79-
)
68+
model.plotOn(xframe, Components=ras_bkg_sig2, LineStyle=":")
8069

8170
# Print structure of composite pdf
8271
model.Print("t")

0 commit comments

Comments
 (0)