# Barlow-Beeston in subrange

**URL:** <https://root-forum.cern.ch/t/barlow-beeston-in-subrange/43909>\
**Category:** Roofit and RooStats\
**Created:** [March 10, 2021, 12:07pm UTC](https://root-forum.cern.ch/t/barlow-beeston-in-subrange/43909 "2021-03-10T12:07:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![quantiser](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/q/73ab20/32.png) [@quantiser](https://root-forum.cern.ch/u/quantiser)\
**Post date:** [March 10, 2021, 12:07pm UTC](https://root-forum.cern.ch/t/barlow-beeston-in-subrange/43909/1 "2021-03-10T12:07:05Z")

</div>

I posted about an issue with integral in a subrange with Barlo-Beeston [1] and recently saw on root github that a fix [2] was made. Thanks for this.

However, I find that there’s still a bug with the getPropagatedError() method with the object returned by createIntegral(). The output that I get with the test code shared in [1] is this:

```auto
**Code snippet:**
x.setRange(“window”,-20,20);
RooAbsReal * integral_sig1 = p_ph_sig1.createIntegral(RooArgSet(x), RooArgSet(x), “window”);
Double_t Asig1val = Asig1.getVal();
Double_t Asig1val_err = Asig1.getError();
Double_t integval_sig = integral_sig1->getVal();
Double_t dintegval_sig = integral_sig1->getPropagatedError(*result1, RooArgSet(x));
cout << "Asig1 : " << Asig1val << " +/- " << Asig1val_err << endl;
cout << "Signal Integral in window: " << integval_sig << " +/- " << dintegval_sig << endl;

x.setRange(“window1”,-5,0);
RooAbsReal * integral_sig2 = p_ph_sig1.createIntegral(RooArgSet(x), RooArgSet(x), “window1”);
integval_sig = integral_sig2->getVal();
dintegval_sig = integral_sig2->getPropagatedError(*result1, RooArgSet(x));
cout << "Signal Integral in window1: " << integval_sig << " +/- " << dintegval_sig << endl;

```

```auto
**Output**
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'window' created with bounds [-20,20]
Asig1 : 0.850507 +/- 0.235778
Signal Integral in window: 80.026 +/- 11.3836
[#1] INFO:Eval -- RooRealVar::setRange(x) new range named 'window1' created with bounds [-5,0]
Signal Integral in window1: 29.4324 +/- 11.3836

```

The integral error doesn’t change after altering the range.

Seems there is still a bug. Would you be able to take a look?

[1] [CreateIntegral giving wrong results](https://root-forum.cern.ch/t/createintegral-giving-wrong-results/43508)  
[2] [[RF] Consider rangeName for integration in RooParamHistFunc · root-project/root@c250ee4 · GitHub](https://github.com/root-project/root/commit/c250ee4be3d4216a1f7ad5c5ba43ce93cccc00f1)

---

<div class="post-metadata">

**Author:** ![jblomer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/439d5e/32.png) [@jblomer](https://root-forum.cern.ch/u/jblomer)\
**Post date:** [March 10, 2021, 5:19pm UTC](https://root-forum.cern.ch/t/barlow-beeston-in-subrange/43909/2 "2021-03-10T17:19:53Z")

</div>

Just to be sure, this is with the latest master branch from github?

---

<div class="post-metadata">

**Author:** ![quantiser](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/q/73ab20/32.png) [@quantiser](https://root-forum.cern.ch/u/quantiser)\
**Post date:** [March 10, 2021, 9:51pm UTC](https://root-forum.cern.ch/t/barlow-beeston-in-subrange/43909/3 "2021-03-10T21:51:00Z")

</div>

Yes, that’s correct.

---

<div class="post-metadata">

**Author:** ![jblomer](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/439d5e/32.png) [@jblomer](https://root-forum.cern.ch/u/jblomer)\
**Post date:** [March 11, 2021, 6:37am UTC](https://root-forum.cern.ch/t/barlow-beeston-in-subrange/43909/4 "2021-03-11T06:37:23Z")

</div>

@moneta @jonas Can you help?

---

<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:** [March 11, 2021, 6:07pm UTC](https://root-forum.cern.ch/t/barlow-beeston-in-subrange/43909/5 "2021-03-11T18:07:38Z")

</div>

Hi @quantiser, thanks a lot for reporting this! There is indeed a problem when evaluating the uncertainty of an integral. I have made a pull request to fix this issue:

> <https://github.com/root-project/root/pull/7477>

By the way, do you need this to be fixed in the 6.24 release? I guess you don’t want to keep using the ROOT master branch in your analysis.

---

<div class="post-metadata">

**Author:** ![quantiser](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/q/73ab20/32.png) [@quantiser](https://root-forum.cern.ch/u/quantiser)\
**Post date:** [March 11, 2021, 8:12pm UTC](https://root-forum.cern.ch/t/barlow-beeston-in-subrange/43909/6 "2021-03-11T20:12:20Z")

</div>

Thanks for the fix! Yes, it would great if you could put it in 6.24

---

<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:** [March 16, 2021, 11:02am UTC](https://root-forum.cern.ch/t/barlow-beeston-in-subrange/43909/7 "2021-03-16T11:02:45Z")

</div>

Sure! Just to document this issue completely in this forum thread:

The bug was now fixed with an another pull request (not the one linked in my previous post):

> <https://github.com/root-project/root/pull/7478>

It also got integrated in the 6.24 branch so you can profit from this in the next release:

> <https://github.com/root-project/root/pull/7479>

---

<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:** [March 30, 2021, 11:02am UTC](https://root-forum.cern.ch/t/barlow-beeston-in-subrange/43909/8 "2021-03-30T11:02:52Z")

</div>

Closed on March 30, 2021, 11:02am UTC

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