Skip to content

[RF] Unexpected behaviour when clipping domain ranges and fitting #22740

Description

@Phmonski

Check duplicate issues.

  • Checked for duplicates

Description

Something unexpected happens, when clipping an observable to a range, smaller than the data range.
The normalization is done with the clipped domain of the observable inside the workspace, but the nll evaluates for all data points.

The expected behaviour for the following Reproducer should either yield a mean close to 1.5, if the data is clipped, or 2 if not.

Reproducer

The following code yields:

import ROOT

x = ROOT.RooRealVar("x", "x", 0, 5)
mean = ROOT.RooRealVar("mean", "mean of gaussian", 0, 0, 10)
sigma = ROOT.RooRealVar("sigma", "width of gaussian", 3, 0.1, 10)
gauss = ROOT.RooGaussian("gauss", "gaussian PDF", x, mean, sigma)
obs = ROOT.RooArgSet(x)
data = ROOT.RooDataSet("data", "dataset with gaussian PDF", obs)

for val in 50*[3, 2, 1 ]:
    x.setVal(val)
    data.add(obs)

x.setMax(2.5)
gauss.fitTo(data)
...
Minuit2Minimizer : Valid minimum - status = 0
FVAL  = 52.4771597237256202
Edm   = 5.97673480237035639e-06
Nfcn  = 112
mean	  = 9.99999	 +/-  0.554671	(limited)
sigma	  = 2.15466	 +/-  0.102534	(limited)
Info in <Minuit2>: Minuit2Minimizer::Hesse Using max-calls 1000
Info in <Minuit2>: MnHesse Done after 44.354 μs
Info in <Minuit2>: Minuit2Minimizer::Hesse Hesse is valid - matrix is accurate

ROOT version

'6.41.01'

Installation method

build from source

Operating system

Linux version 6.12.91-1-MANJARO (linux612@manjaro) (gcc (GCC) 16.1.1 20260430, GNU ld (GNU Binutils) 2.46.0)

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions