Skip to content

added tutorial for RooMultiPdf #19451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GalinBistrev2
Copy link
Contributor

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.

Copy link

Test Results

    21 files      21 suites   3d 7h 2m 1s ⏱️
 3 218 tests  3 217 ✅ 0 💤 1 ❌
65 855 runs  65 854 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit d8e316d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants