21 print "It seems that pyROOT isn't properly configured" 25 Create a HistFactory measurement from python 28 InputFile =
"./data/example.root" 31 meas = ROOT.RooStats.HistFactory.Measurement(
"meas",
"meas")
33 meas.SetOutputFilePrefix(
"./results/example_UsingPy" )
34 meas.SetPOI(
"SigXsecOverSM" )
35 meas.AddConstantParam(
"Lumi")
36 meas.AddConstantParam(
"alpha_syst1")
39 meas.SetLumiRelErr( 0.10 )
40 meas.SetExportOnly(
False )
44 chan = ROOT.RooStats.HistFactory.Channel(
"channel1" )
45 chan.SetData(
"data", InputFile )
46 chan.SetStatErrorConfig( 0.05,
"Poisson" )
51 signal = ROOT.RooStats.HistFactory.Sample(
"signal",
"signal", InputFile )
52 signal.AddOverallSys(
"syst1", 0.95, 1.05 )
53 signal.AddNormFactor(
"SigXsecOverSM", 1, 0, 3 )
54 chan.AddSample( signal )
58 background1 = ROOT.RooStats.HistFactory.Sample(
"background1",
"background1", InputFile )
59 background1.ActivateStatError(
"background1_statUncert", InputFile )
60 background1.AddOverallSys(
"syst2", 0.95, 1.05 )
61 chan.AddSample( background1 )
65 background2 = ROOT.RooStats.HistFactory.Sample(
"background2",
"background2", InputFile )
66 background2.ActivateStatError()
67 background2.AddOverallSys(
"syst3", 0.95, 1.05 )
68 chan.AddSample( background2 )
74 meas.AddChannel( chan )
78 meas.CollectHistograms()
85 meas.PrintXML(
"xmlFromPy", meas.GetOutputFilePrefix() );
88 ROOT.RooStats.HistFactory.MakeModelAndMeasurementFast( meas );
93 if __name__ ==
"__main__":