Problem using HistFactory - AttributeError with RooStats


I’m having issues using HistFactory using a standard build of ROOT for Windows (5.34/36) - using the simplest code (with PyROOT):

import ROOT as r
meas = r.RooStats.HistFactory.Measurement(“meas”, “meas”)

I’m getting

AttributeError: type object ‘RooStats’ has no attribute ‘HistFactory’

Searching online, I found one particular thread which is similar,
in which it is suspected that the problem derives from the lack of xml. I checked any Windows binary I could find and they all have xml disabled (in config/Makefile.config), in contrast to any Ubuntu/OSX release I checked.

Is there any consistent way to alter my release to fix this?

Thank you very much in advance.


On Windows, ROOT is not built with XML (since we don’t distribute binaries of external dependencies). The only solution is to install libXML2 on your system and rebuild ROOT from source…

Cheers, Bertrand.

Hey, thank you very much for the reply.

I must ask though, how involved is rebuilding ROOT? For someone without experience doing that would you suggest continuing down this path or alternatively, say, work around the problem in other means (e.g. get a Linux system, use an alternative to HistFactory, etc.)?

Well, rebuilding ROOT requires Visual Studio (free versions are available), CMake, and in your case Python and the libXML2 package. Then, the build procedure is described here. And feel free to ask if you have any problem.
And sure, there is also the option of using a Virtual Machine running Linux (then you can also use ROOT 6)…
Cheers, Bertrand.

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