# Cannot use Offset() with RooAbsPdf::fitTo()

**URL:** <https://root-forum.cern.ch/t/cannot-use-offset-with-rooabspdf-fitto/64293>\
**Category:** Roofit and RooStats\
**Created:** [October 8, 2025, 12:02pm UTC](https://root-forum.cern.ch/t/cannot-use-offset-with-rooabspdf-fitto/64293 "2025-10-08T12:02:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmeyerga](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/lmeyerga/32/26194_2.png) [@lmeyerga](https://root-forum.cern.ch/u/lmeyerga)\
**Post date:** [October 8, 2025, 12:02pm UTC](https://root-forum.cern.ch/t/cannot-use-offset-with-rooabspdf-fitto/64293/1 "2025-10-08T12:02:05Z")

</div>

Dear experts,

I’m trying to update my workflow from root v6.24/02 to 6.32/16, but it seems the Offset() option is ignored by the fitTo() function. This is quite important for me as I’m running an unbinned simultaneous fit where one category has orders of magnitude more events than the other, and I keep seeing `MACHINE ACCURACY LIMITS FURTHER IMPROVEMENT` if I don’t use it (together with the fact that the fit fails to find sensible results). I’ve attached a minimal example where Offset() is ignored, but it’s really nothing special. I have tried with both Offset(true) and Offset(“initial“).

Thank you in advance.

[test\_fit2.cpp](https://root-forum.cern.ch/uploads/short-url/xzU6mOFihDajjdoLMkQk1iniQDH.cpp) (1.2 KB)

---

<div class="post-metadata">

**Author:** ![jonas](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jonas/32/24756_2.png) [@jonas](https://root-forum.cern.ch/u/jonas)\
**Post date:** [October 11, 2025, 11:31am UTC](https://root-forum.cern.ch/t/cannot-use-offset-with-rooabspdf-fitto/64293/2 "2025-10-11T11:31:44Z")

</div>

Thank you very much! This was indeed a bug. I have opened a pull request to fix it:

> <https://github.com/root-project/root/pull/20082>
>
> Take the default offsetting flag value from the default \`MinimizerConfig\` struct…, where the offsetting flag is correctly initialized to \`int doOffset = -1\`:
> https://github.com/root-project/root/blob/master/roofit/roofitcore/src/FitHelpers.cxx#L247
> 
> This means to not change any offset setting by default.
> 
> The problem was that the default was set to zero before, which tells the minimizer to explicitly disable offsetting, even if the likelihood was created with offsetting.
> 
> This fixes an issue reported on the forum:
> https://root-forum.cern.ch/t/cannot-use-offset-with-rooabspdf-fitto/64293
> 
> Also, make sure that all other default config values are taken from the default options struct for consistency.
> 
> To be backported to the previous active ROOT releases.

In the meantime before a release that includes this fix, you can use the offsetting by creating the likelihood and then the RooMinimizer separately. Like this, the offset flag won’t be overridden:

```auto
   std::unique_ptr<RooAbsReal> nll{model.createNLL(*dataset, Offset(true))};

   RooMinimizer minim{*nll};
   minim.setStrategy(2);
   minim.minimize("Minuit", "");

```

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [October 25, 2025, 11:32am UTC](https://root-forum.cern.ch/t/cannot-use-offset-with-rooabspdf-fitto/64293/3 "2025-10-25T11:32:40Z")

</div>

Closed on October 25, 2025, 11:32am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
