a morphing function is setup as a function of three variables and a fit is performed on a pseudo-dataset.
void rf712_lagrangianmorphfit()
{
std::string observablename = "pTV";
RooRealVar obsvar(observablename.c_str(),
"observable of pTV", 10, 600);
RooRealVar cHq3(
"cHq3",
"EFT modifier", -10.0, 10.0);
cHq3.setAttribute("NewPhysics", true);
RooRealVar cHl3(
"cHl3",
"EFT modifier", -10.0, 10.0);
cHl3.setAttribute("NewPhysics", true);
RooRealVar cHDD(
"cHDD",
"EFT modifier", -10.0, 10.0);
cHDD.setAttribute("NewPhysics", true);
std::string infilename = std::string(
gROOT->GetTutorialDir()) +
"/roofit/roofit/input_histos_rf_lagrangianmorph.root";
std::vector<std::string> samplelist = {"SM_NPsq0", "cHq3_NPsq1", "cHq3_NPsq2", "cHl3_NPsq1",
"cHl3_NPsq2", "cHDD_NPsq1", "cHDD_NPsq2", "cHl3_cHDD_NPsq2",
"cHq3_cHDD_NPsq2", "cHl3_cHq3_NPsq2"};
morphfunc.setParameter("cHq3", 0.01);
morphfunc.setParameter("cHl3", 1.0);
morphfunc.setParameter("cHDD", 0.2);
auto pseudo_hist = morphfunc.createTH1("pseudo_hist");
morphfunc.setParameter("cHq3", 0.0);
morphfunc.setParameter("cHl3", 0.0);
morphfunc.setParameter("cHDD", 0.0);
cHq3.setError(0.1);
cHl3.setError(0.1);
cHDD.setError(0.1);
auto hcorr = fitres->correlationHist();
auto postfit_hist = morphfunc.createTH1("morphing_postfit_hist");
auto frame0 = obsvar.frame(
Title(
"Fitted histogram of p_{T}^{V}"));
pseudo_dh->plotOn(frame0,
Name(
"input"));
gPad->SetLeftMargin(0.15);
gPad->SetRightMargin(0.05);
frame0->GetXaxis()->SetTitle("p_{T}^{V}");
frame0->Draw();
gPad->SetLeftMargin(0.15);
gPad->SetRightMargin(0.15);
gStyle->SetPaintTextFormat(
"4.1f");
hcorr->SetMarkerSize(3.);
hcorr->SetTitle("correlation matrix");
hcorr->GetYaxis()->SetTitleOffset(1.4);
hcorr->GetYaxis()->SetLabelSize(0.1);
hcorr->GetXaxis()->SetLabelSize(0.1);
hcorr->GetYaxis()->SetBinLabel(1, "c_{HDD}");
hcorr->GetYaxis()->SetBinLabel(2, "c_{Hl^{(3)}}");
hcorr->GetYaxis()->SetBinLabel(3, "c_{Hq^{(3)}}");
hcorr->GetXaxis()->SetBinLabel(3, "c_{HDD}");
hcorr->GetXaxis()->SetBinLabel(2, "c_{Hl^{(3)}}");
hcorr->GetXaxis()->SetBinLabel(1, "c_{Hq^{(3)}}");
hcorr->Draw("colz text");
c1->SaveAs(
"rf712_lagrangianmorphfit.png");
}
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
RooArgList is a container object that can hold multiple RooAbsArg objects.
Container class to hold N-dimensional binned data.
Class RooLagrangianMorphing is a implementation of the method of Effective Lagrangian Morphing,...
Variable that can be changed from the outside.
The RooWrapperPdf is a class that can be used to convert a function into a PDF.
RooCmdArg Parameters(const RooArgSet ¶ms)
RooCmdArg Title(const char *name)
RooCmdArg Layout(double xmin, double xmax=0.99, double ymin=0.95)
RooCmdArg Save(bool flag=true)
RooCmdArg SumW2Error(bool flag)
RooCmdArg PrintLevel(Int_t code)
RooCmdArg DataError(Int_t)
RooCmdArg DrawOption(const char *opt)
RooCmdArg LineColor(TColorNumber color)
RooCmdArg XErrorSize(double width)
RooCmdArg Name(const char *name)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
std::string observableName
std::vector< std::string > folderNames
[#0] PROGRESS:InputArguments -- initializing physics inputs from file /home/stephan/code/root-opt/tutorials/roofit/roofit/input_histos_rf_lagrangianmorph.root with object name(s) 'pTV'
[#0] PROGRESS:Caching -- creating cache from getCache function for 0x7ffd1a429da0
[#0] PROGRESS:Caching -- current storage has size 10
[#0] PROGRESS:ObjectHandling -- observable: pTV
[#0] PROGRESS:ObjectHandling -- binWidth: binWidth_pTV
[#1] INFO:DataHandling -- RooDataHist::adjustBinning(pseudo_dh): fit range of variable pTV expanded to nearest bin boundaries: [10,600] --> [0,600]
[#0] PROGRESS:Caching -- creating cache from getCache function for 0x55dba4526a60
[#0] PROGRESS:Caching -- current storage has size 10
[#0] PROGRESS:ObjectHandling -- observable: pTV
[#0] PROGRESS:ObjectHandling -- binWidth: binWidth_pTV
[#1] INFO:Fitting -- RooAbsPdf::fitTo(wrap_pdf_over_wrap_pdf_Int[pTV]) fixing normalization set for coefficient determination to observables in data
[#1] INFO:Fitting -- using generic CPU library compiled with no vectorizations
[#1] INFO:Fitting -- Creation of NLL object took 25.8428 ms
[#1] INFO:Fitting -- RooAddition::defaultErrorLevel(nll_wrap_pdf_over_wrap_pdf_Int[pTV]_pseudo_dh) Summation contains a RooNLLVar, using its error level
[#1] INFO:Minimization -- [fitFCN] No discrete parameters, performing continuous minimization only
RooAbsMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (39620.3) to force MIGRAD to back out of this region. Error log follows.
Parameter values: cHDD=0.22238 cHl3=2.00088 cHq3=0.00780325
RooFit::Detail::RooNormalizedPdf::wrap_pdf_over_wrap_pdf_Int[pTV][ numerator=wrap_pdf denominator=wrap_pdf_Int[pTV] ]
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.0889525, denominator=wrap_pdf_Int[pTV]=4479.59
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.0889525, denominator=wrap_pdf_Int[pTV]=4479.59
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.0889525, denominator=wrap_pdf_Int[pTV]=4479.59
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.0889525, denominator=wrap_pdf_Int[pTV]=4479.59
RooAbsMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (39620.3) to force MIGRAD to back out of this region. Error log follows.
Parameter values: cHDD=1.16153 cHl3=8.6965 cHq3=0.0408466
RooFit::Detail::RooNormalizedPdf::wrap_pdf_over_wrap_pdf_Int[pTV][ numerator=wrap_pdf denominator=wrap_pdf_Int[pTV] ]
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.894368, denominator=wrap_pdf_Int[pTV]=3980.01
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.894368, denominator=wrap_pdf_Int[pTV]=3980.01
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.894368, denominator=wrap_pdf_Int[pTV]=3980.01
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.894368, denominator=wrap_pdf_Int[pTV]=3980.01
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.894368, denominator=wrap_pdf_Int[pTV]=3980.01
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.894368, denominator=wrap_pdf_Int[pTV]=3980.01
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.894368, denominator=wrap_pdf_Int[pTV]=3980.01
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.894368, denominator=wrap_pdf_Int[pTV]=3980.01
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.894368, denominator=wrap_pdf_Int[pTV]=3980.01
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.894368, denominator=wrap_pdf_Int[pTV]=3980.01
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.894368, denominator=wrap_pdf_Int[pTV]=3980.01
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.894368, denominator=wrap_pdf_Int[pTV]=3980.01
... (remaining 4 messages suppressed)
RooAbsMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (39620.3) to force MIGRAD to back out of this region. Error log follows.
Parameter values: cHDD=0.607791 cHl3=5.23432 cHq3=0.0213386
RooFit::Detail::RooNormalizedPdf::wrap_pdf_over_wrap_pdf_Int[pTV][ numerator=wrap_pdf denominator=wrap_pdf_Int[pTV] ]
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.315769, denominator=wrap_pdf_Int[pTV]=237.773
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.315769, denominator=wrap_pdf_Int[pTV]=237.773
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.315769, denominator=wrap_pdf_Int[pTV]=237.773
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.315769, denominator=wrap_pdf_Int[pTV]=237.773
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.315769, denominator=wrap_pdf_Int[pTV]=237.773
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.315769, denominator=wrap_pdf_Int[pTV]=237.773
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.315769, denominator=wrap_pdf_Int[pTV]=237.773
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.315769, denominator=wrap_pdf_Int[pTV]=237.773
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.315769, denominator=wrap_pdf_Int[pTV]=237.773
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.315769, denominator=wrap_pdf_Int[pTV]=237.773
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.315769, denominator=wrap_pdf_Int[pTV]=237.773
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.315769, denominator=wrap_pdf_Int[pTV]=237.773
... (remaining 16 messages suppressed)
RooAbsMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (39620.3) to force MIGRAD to back out of this region. Error log follows.
Parameter values: cHDD=0.330108 cHl3=2.94627 cHq3=0.0115846
RooFit::Detail::RooNormalizedPdf::wrap_pdf_over_wrap_pdf_Int[pTV][ numerator=wrap_pdf denominator=wrap_pdf_Int[pTV] ]
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.131032, denominator=wrap_pdf_Int[pTV]=2465.37
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.131032, denominator=wrap_pdf_Int[pTV]=2465.37
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.131032, denominator=wrap_pdf_Int[pTV]=2465.37
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.131032, denominator=wrap_pdf_Int[pTV]=2465.37
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.131032, denominator=wrap_pdf_Int[pTV]=2465.37
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.131032, denominator=wrap_pdf_Int[pTV]=2465.37
RooAbsMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (39620.3) to force MIGRAD to back out of this region. Error log follows.
Parameter values: cHDD=0.191157 cHl3=1.72296 cHq3=0.00670752
RooFit::Detail::RooNormalizedPdf::wrap_pdf_over_wrap_pdf_Int[pTV][ numerator=wrap_pdf denominator=wrap_pdf_Int[pTV] ]
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.0801556, denominator=wrap_pdf_Int[pTV]=5193.38
p.d.f value is less than zero, trying to recover @ numerator=wrap_pdf=0.0801556, denominator=wrap_pdf_Int[pTV]=5193.38
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.0801556, denominator=wrap_pdf_Int[pTV]=5193.38
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.0801556, denominator=wrap_pdf_Int[pTV]=5193.38
RooAbsMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (39620.3) to force MIGRAD to back out of this region. Error log follows.
Parameter values: cHDD=0.138238 cHl3=1.24892 cHq3=0.00485049
RooFit::Detail::RooNormalizedPdf::wrap_pdf_over_wrap_pdf_Int[pTV][ numerator=wrap_pdf denominator=wrap_pdf_Int[pTV] ]
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.0688277, denominator=wrap_pdf_Int[pTV]=6538.46
RooAbsMinimizerFcn: Minimized function has error status.
Returning maximum FCN so far (39620.3) to force MIGRAD to back out of this region. Error log follows.
Parameter values: cHDD=0.121667 cHl3=1.24299 cHq3=0.004269
RooFit::Detail::RooNormalizedPdf::wrap_pdf_over_wrap_pdf_Int[pTV][ numerator=wrap_pdf denominator=wrap_pdf_Int[pTV] ]
getLogVal() top-level p.d.f evaluates to NaN @ numerator=wrap_pdf=0.0667251, denominator=wrap_pdf_Int[pTV]=6553.34
[#1] INFO:Fitting -- RooAbsPdf::fitTo(wrap_pdf) Calculating sum-of-weights-squared correction matrix for covariance matrix
[#1] INFO:InputArguments -- RooAbsData::plotOn(pseudo_dh) INFO: dataset has non-integer weights, auto-selecting SumW2 errors instead of Poisson errors
[#1] INFO:Plotting -- RooPlot::updateFitRangeNorm: New event count of 7389.24 will supersede previous event count of 7388.38 for normalization of PDF projections