added tutorial for RooMultiPdf #19451
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this pull request I present a tutorial showcasing the usage of RooMultiPdf with its full implementation.The NLL value is poroduced with codegen in order to show how the RooMultiPdf object acts under the implementation of AD.The output of the code is the following:Processing RooMultiPdf_tutorial.C...
[#1] INFO:Fitting -- RooAbsPdf::fitTo(multiPdf) fixing normalization set for coefficient determination to observables in data
[#1] INFO:Fitting -- Creation of NLL object took 3.38277 ms
[#1] INFO:Fitting -- using generic CPU library compiled with no vectorizations
MathFunc call used
[#1] INFO:Fitting -- Function JIT time: 59.1723 ms
[#1] INFO:Fitting -- Gradient generation time: 19.3769 ms
[#1] INFO:Fitting -- Gradient IR to machine code time: 28.6284 ms
[#1] INFO:Fitting -- [FitHelpers] Detected correction term from RooAbsPdf::getCorrection(). Adding penalty to NLL.
[#1] INFO:Fitting -- RooAbsPdf::fitTo(gauss2_over_gauss2_Int[x]) fixing normalization set for coefficient determination to observables in data
[#1] INFO:Fitting -- Creation of NLL object took 119.719 μs
[#1] INFO:Fitting -- Function JIT time: 5.04805 ms
[#1] INFO:Fitting -- Gradient generation time: 5.68462 ms
[#1] INFO:Fitting -- Gradient IR to machine code time: 6.00547 ms
[#1] INFO:Fitting -- RooAbsPdf::fitTo(gauss3_over_gauss3_Int[x]) fixing normalization set for coefficient determination to observables in data
[#1] INFO:Fitting -- Creation of NLL object took 98.145 μs
[#1] INFO:Fitting -- Function JIT time: 3.95232 ms
[#1] INFO:Fitting -- Gradient generation time: 5.44243 ms
[#1] INFO:Fitting -- Gradient IR to machine code time: 5.60852 ms
[#1] INFO:Fitting -- RooAddition::defaultErrorLevel(nll_multiPdf_true_pdfData_corrected) WARNING: Summation contains neither RooNLLVar nor RooChi2Var server, using default level of 1.0
Minuit2Minimizer: Minimize with max-calls 500 convergence for edm < 1 strategy 1
Info in : MnSeedGenerator Computing seed using NumericalGradient calculator
Info in : MnSeedGenerator Evaluated function and gradient in 116.115 μs
Info in : MnSeedGenerator Initial state: FCN = 12.64016428 Edm = 0.02017136278 NCalls = 5
Info in : MnSeedGenerator Initial state
Minimum value : 12.64016428
Edm : 0.02017136278
Internal parameters: [ 0]
Internal gradient : [ -0.8583232415]
Internal covariance matrix:
[[ 0.10952001]]]
Info in : VariableMetricBuilder Start iterating until Edm is < 0.002 with call limit = 500
Info in : VariableMetricBuilder 0 - FCN = 12.64016428 Edm = 0.02017136278 NCalls = 5
Info in : VariableMetricBuilder 1 - FCN = 12.61999292 Edm = 2.729690095e-09 NCalls = 8
Info in : MnHesse Done after 19.482 μs
Info in : VariableMetricBuilder After Hessian
Info in : VariableMetricBuilder 2 - FCN = 12.61999292 Edm = 2.733192651e-09 NCalls = 13
Info in : VariableMetricBuilder Stop iterating after 68.252 μs
Minuit2Minimizer : Valid minimum - status = 0
FVAL = 12.6199929169252236
Edm = 2.73319265141214306e-09
Nfcn = 13
mean1 = 0.0704767 +/- 0.487376 (limited)
ROOT comes with a web-based canvas, which is now being started.
Revert to the legacy canvas by setting "Canvas.Name: TRootCanvas" in rootrc file or
by starting "root --web=off".
Find more info on https://root.cern/for_developers/root7/#twebcanvas
Info in THttpEngine::Create: Starting HTTP server on port 127.0.0.1:9016
Fitting model index 0
[#1] INFO:Fitting -- RooAbsPdf::fitTo(multiPdf) fixing normalization set for coefficient determination to observables in data
[#1] INFO:Fitting -- Creation of NLL object took 390.083 μs
MathFunc call used
[#1] INFO:Fitting -- Function JIT time: 7.12597 ms
[#1] INFO:Fitting -- Gradient generation time: 11.4141 ms
[#1] INFO:Fitting -- Gradient IR to machine code time: 10.8609 ms
[#1] INFO:Fitting -- [FitHelpers] Detected correction term from RooAbsPdf::getCorrection(). Adding penalty to NLL.
[#1] INFO:Fitting -- RooAddition::defaultErrorLevel(nll_multiPdf_true_pdfData_corrected) WARNING: Summation contains neither RooNLLVar nor RooChi2Var server, using default level of 1.0
Minuit2Minimizer: Minimize with max-calls 500 convergence for edm < 1 strategy 1
Minuit2Minimizer : Valid minimum - status = 0
FVAL = 12.6199929141921352
Edm = 6.34967010218829214e-16
Nfcn = 15
mean1 = 0.0705027 +/- 0.487376 (limited)
NLL value for index 0 = 12.62
Fitting model index 1
[#1] INFO:Fitting -- RooAbsPdf::fitTo(multiPdf) fixing normalization set for coefficient determination to observables in data
[#1] INFO:Fitting -- Creation of NLL object took 110.883 μs
MathFunc call used
[#1] INFO:Fitting -- Function JIT time: 4.99575 ms
[#1] INFO:Fitting -- Gradient generation time: 10.9593 ms
[#1] INFO:Fitting -- Gradient IR to machine code time: 10.6752 ms
[#1] INFO:Fitting -- [FitHelpers] Detected correction term from RooAbsPdf::getCorrection(). Adding penalty to NLL.
[#1] INFO:Fitting -- RooAddition::defaultErrorLevel(nll_multiPdf_true_pdfData_corrected) WARNING: Summation contains neither RooNLLVar nor RooChi2Var server, using default level of 1.0
Minuit2Minimizer: Minimize with max-calls 500 convergence for edm < 1 strategy 1
Warning in : VariableMetricBuilder No improvement in line search
Minuit2Minimizer : Valid minimum - status = 0
FVAL = 12.5548275045952344
Edm = 6.46781407352796359e-16
Nfcn = 13
mean1 = 0.0705027 +/- 0.483145 (limited)
NLL value for index 1 = 12.5548
Fitting model index 2
[#1] INFO:Fitting -- RooAbsPdf::fitTo(multiPdf) fixing normalization set for coefficient determination to observables in data
[#1] INFO:Fitting -- Creation of NLL object took 113.9 μs
MathFunc call used
[#1] INFO:Fitting -- Function JIT time: 4.94741 ms
[#1] INFO:Fitting -- Gradient generation time: 11.3563 ms
[#1] INFO:Fitting -- Gradient IR to machine code time: 10.7763 ms
[#1] INFO:Fitting -- [FitHelpers] Detected correction term from RooAbsPdf::getCorrection(). Adding penalty to NLL.
[#1] INFO:Fitting -- RooAddition::defaultErrorLevel(nll_multiPdf_true_pdfData_corrected) WARNING: Summation contains neither RooNLLVar nor RooChi2Var server, using default level of 1.0
Minuit2Minimizer: Minimize with max-calls 500 convergence for edm < 1 strategy 1
Warning in : VariableMetricBuilder No improvement in line search
Minuit2Minimizer : Valid minimum - status = 0
FVAL = 12.2273385412252757
Edm = 7.09959020188141533e-16
Nfcn = 13
mean1 = 0.0705027 +/- 0.461925 (limited)
NLL value for index 2 = 12.2273
Brute-force Best model index = 2
Brute-force Best NLL value = 12.2273
.
Along with this output a plot showing the values of the NLL with respect to the mean variable, which is left floating , is shown.Also in the end of the code there is a procedure created in order to determine the best value of the NLL when one of the parameters is left floating.This peace of code will be replaced when discrete profiling is added as a minimization method in RooMinimizer.