Commit ff91fc0
committed
[RF] Forbid integration of a
Integrating a RooAbsRealLValue like a RooRealVar doesn't work in RooFit,
which one can check with this code:
```C++
RooRealVar x{"x", "x", 2.0, -5.0, 5.0};
std::unique_ptr<RooAbsReal> xint{x.createIntegral(x)};
xint->Print();
```
The integral of x from -5 to 5 should be zero, but the integral object
only returns the current value of the variable.
Some users expect the integral to work, and give the same result as
this, which correctly prints out zero:
```C++
RooRealVar x{"x", "x", 2.0, -5.0, 5.0};
RooProduct xId{"xId", "xId", RooArgList{x}};
std::unique_ptr<RooAbsReal> xint{xId.createIntegral(x)};
xint->Print();
```
This is assumed in two RooFit unit tests:
* [testRooWrapperPdf](https://github.com/root-project/root/blob/master/roofit/roofitcore/test/testRooWrapperPdf.cxx#L27)
* [testNestedPDFs](https://github.com/guitargeek/roottest/blob/master/root/roofitstats/vectorisedPDFs/testNestedPDFs.cxx#L45) in roottest
Both tests **work only by chance** because the stored x value is the
same as its integral! As soon as the x value or limits would change, the
results don't make sense anymore.
As the integration of RooAbsRealLValues never worked correctly and was
not used anywhere outside artificial unit tests, this commit suggests so
prohibit the integration of RooAbsRealLValues by throwing an exception
if `RooAbsRealLValue::createIntegral()` is called.RooAbsRealLValue
1 parent 0de46d4 commit ff91fc0
File tree
3 files changed
+18
-3
lines changed- roofit/roofitcore
- inc
- src
- test
3 files changed
+18
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1030 | 1030 | | |
1031 | 1031 | | |
1032 | 1032 | | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | | - | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
63 | | - | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
0 commit comments