rootpy.stats.histfactory.write_measurement

rootpy.stats.histfactory.write_measurement(measurement, root_file=None, xml_path=None, output_path=None, output_suffix=None, write_workspaces=False, apply_xml_patches=True, silence=False)[source]

Write a measurement and RooWorkspaces for all contained channels into a ROOT file and write the XML files into a directory.

Parameters:

measurement : HistFactory::Measurement

An asrootpy’d HistFactory::Measurement object

root_file : ROOT TFile or string, optional (default=None)

A ROOT file or string file name. The measurement and workspaces will be written to this file. If root_file is None then a new file will be created with the same name as the measurement and with the prefix ws_.

xml_path : string, optional (default=None)

A directory path to write the XML into. If None, a new directory with the same name as the measurement and with the prefix xml_ will be created.

output_path : string, optional (default=None)

If root_file is None, create the ROOT file under this path. If xml_path is None, create the XML directory under this path.

output_suffix : string, optional (default=None)

If root_file is None then a new file is created with the same name as the measurement and with the prefix ws_. output_suffix will append a suffix to this file name (before the .root extension). If xml_path is None, then a new directory is created with the same name as the measurement and with the prefix xml_. output_suffix will append a suffix to this directory name.

write_workspaces : bool, optional (default=False)

If True then also write a RooWorkspace for each channel and for all channels combined.

apply_xml_patches : bool, optional (default=True)

Apply fixes on the output of Measurement::PrintXML() to avoid known HistFactory bugs. Some of the patches assume that the ROOT file containing the histograms will exist one directory level up from the XML and that hist2workspace, or any tool that later reads the XML will run from that same directory containing the ROOT file.

silence : bool, optional (default=False)

If True then capture and silence all stdout/stderr output from HistFactory.