Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions roofit/roofitcore/test/stressRooFit_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -900,18 +900,16 @@ class TestBasic202 : public RooUnitTest {
// Fit model to data, extended ML term automatically included
model.fitTo(*data);

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

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

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

/////////////////////
// M E T H O D 2 //
Expand Down
10 changes: 4 additions & 6 deletions tutorials/roofit/roofit/rf202_extendedmlfit.C
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,16 @@ void rf202_extendedmlfit()
// Fit model to data, extended ML term automatically included
model.fitTo(*data, PrintLevel(-1));

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

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

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

// Print structure of composite pdf
model.Print("t");
Expand Down
19 changes: 4 additions & 15 deletions tutorials/roofit/roofit/rf202_extendedmlfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,17 @@
# Fit model to data, ML term automatically included
model.fitTo(data, PrintLevel=-1)

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

# Overlay the background component of model with a dashed line
model.plotOn(
xframe,
Components={bkg},
LineStyle=":",
Normalization=dict(scaleFactor=1.0, scaleType=ROOT.RooAbsReal.RelativeExpected),
)
model.plotOn(xframe, Components={bkg}, LineStyle=":")

# Overlay the background+sig2 components of model with a dotted line
ras_bkg_sig2 = {bkg, sig2}
model.plotOn(
xframe,
Components=ras_bkg_sig2,
LineStyle=":",
Normalization=dict(scaleFactor=1.0, scaleType=ROOT.RooAbsReal.RelativeExpected),
)
model.plotOn(xframe, Components=ras_bkg_sig2, LineStyle=":")

# Print structure of composite pdf
model.Print("t")
Expand Down
Loading