44 x = ROOT.RooRealVar(name, name, 0, -3, 3)
47 mu_name =
"mu_x{}".
format(i)
48 mu_x = ROOT.RooRealVar(mu_name, mu_name, 0, -2, 2)
56cov = ROOT.TMatrixDSym(dim)
65mvg = ROOT.RooMultiVarGaussian(
"mvg",
"mvg", xVec, muVec, cov)
69data = mvg.generate(xVec, 100)
72w = ROOT.RooWorkspace(
"MVG")
73modelConfig = ROOT.RooStats.ModelConfig(w)
74modelConfig.SetPdf(mvg)
75modelConfig.SetParametersOfInterest(poi)
83fit = mvg.fitTo(data, Save=
True)
84ph = ROOT.RooStats.ProposalHelper()
85ph.SetVariables(fit.floatParsFinal())
86ph.SetCovMatrix(fit.covarianceMatrix())
87ph.SetUpdateProposalParameters(
True)
89pdfProp = ph.GetProposalFunction()
92mc = ROOT.RooStats.MCMCCalculator(data, modelConfig)
93mc.SetConfidenceLevel(0.95)
94mc.SetNumBurnInSteps(100)
97mc.SetProposalFunction(pdfProp)
99mcInt = mc.GetInterval()
100poiList = mcInt.GetAxes()
103plc = ROOT.RooStats.ProfileLikelihoodCalculator(data, modelConfig)
104plc.SetConfidenceLevel(0.95)
105plInt = plc.GetInterval()
108mcPlot = ROOT.RooStats.MCMCIntervalPlot(mcInt)
111mcPlot.SetLineColor(ROOT.kGreen)
112mcPlot.SetLineWidth(2)
115plPlot = ROOT.RooStats.LikelihoodIntervalPlot(plInt)
120 print(
"MCMC interval: [{}, {}]".
format(mcInt.LowerLimit(p), mcInt.UpperLimit(p)))
125 scatter = ROOT.TCanvas()
126 print(
"MCMC interval on p0: [{}, {}]".
format(mcInt.LowerLimit(p0), mcInt.UpperLimit(p0)))
127 print(
"MCMC interval on p1: [{}, {}]".
format(mcInt.LowerLimit(p1), mcInt.UpperLimit(p1)))
132 mcPlot.DrawChainScatter(p0, p1)
134 scatter.SaveAs(
"MultivariateGaussianTest_scatter.png")
139c1.SaveAs(
"MultivariateGaussianTest_plot.png")
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format