Merging HypoTestInverterResults

Dear All,

I would like to calculate an upper limit in RooStat using HypoTestInverter.
My goal is to parallelize to the jobs, possibly avoiding PROOF and third-party programs. In principle I thought it was possible to produce different HypoTestInverterResults for each point ( GetInterval() ), merge them using the Add method of HypoTestInverterResults and finally ask the UpperLimit using the method UpperLimit().
However, looking at the code, it looks like some steps are missing (and I get a segmentation violation…).

Is there an alternative way to caluclate different points, store them and then merge the results finding the limit ina safe way?



The Add method should work, if ita does not, please post a working example or two root file with the result you want to merge



this is a working example.
I would like to calculate a fixed number of points (just two in this test case), introducing the possibility to recalculate some points twice (thus increasing toys statistics).
Of course the calculation (even for the same point) should be made by different jobs, merging the results from different root files.
Am I wrong somewhere?

Thanks a lot.
HybridInverterTest.C (3.3 KB) (415 Bytes)

Thank you for the example, the problem is that you are using the HybridCalculatorOriginal, which is an original implementation of the HybridCalculator. I think it does not work well anymore in combination with the HypoTestInverter. The recommended way is to use the RooStats::HybridCalculator class.
If you want to calculate the upper limit, you just need to create a workspace and write in a file, then you can use the macro tutorials/roostats/StandardHypoTestInvDemo.C to compute the limit and/or save the HypoTestResult in a file which can be merged with other results.
If you need any help to use the new class, please let me know


Hi Lorenzo,

thank you very much, I’ll fix my HybridCalculator then.
I’ll let you know then in case of other issues.



I need to calculate an Upper Limit using HypoTestInverter.
Since I have to speed up the code, I need to produce as many job as the scanned points are, and then I would merge all the HypoTestInverterResults in a new object. I used CLs, setting the “CL” to 0.95.
Since I needed to calculate a limit, I swapped b and sb models, making this latter the null model.
Both the code I used to calculate points with HypoTestInverter and to get Limits with HypoTestInverterResults are attached.
I hope the setup is fine… In fact the upper limit value look like to be reasonable…

But indeed I’m also interested in the significance value (which should be indipendent from any CLs calculation) for a given value of the parameter of interest. I thought HypoTestInvertResult should give it for free.
However when I access the k-th element of my HypoTestInvertResults, I got a negative value of significance, and in my opinion this wouldn’t make any sense…

Am I wrong anywhere?

I attached both the fragments for the points calculation and for the calculation of upper limit and the significance, if needed.

Thanks a lot.

inverter.C (1.34 KB)
Join.C (446 Bytes)


One may get a negative significance if the data has fluctuated downward, to values below the median expectation of the background-only model.

It is a bit of a convention but that’s the convention that is used at LHC experiments (and Tevatron); it is logical that if you consider that if you observe exactly the expected background distribution, a zero signal significance would be the outcome and a dip in the background distribution would have a negative signal yield and therefore a negative significance.


– Gregory