31ROOT.RooRandom.randomGenerator().SetSeed(3001)
 
   34wspace = ROOT.RooWorkspace()
 
   35wspace.factory(
"Gaussian::normal(x[-10,10],mu[-1,1],sigma[1])")
 
   36wspace.defineSet(
"poi", 
"mu")
 
   37wspace.defineSet(
"obs", 
"x")
 
   40modelConfig = ROOT.RooStats.ModelConfig(
"Example G(x|mu,1)")
 
   41modelConfig.SetWorkspace(wspace)
 
   42modelConfig.SetPdf(wspace[
"normal"])
 
   43modelConfig.SetParametersOfInterest(wspace.set(
"poi"))
 
   44modelConfig.SetObservables(wspace.set(
"obs"))
 
   47data = wspace[
"normal"].generate(wspace.set(
"obs"), 100)
 
   58plc = ROOT.RooStats.ProfileLikelihoodCalculator(data, modelConfig)
 
   59plc.SetConfidenceLevel(confidenceLevel)
 
   60plInt = plc.GetInterval()
 
   63fc = ROOT.RooStats.FeldmanCousins(data, modelConfig)
 
   64fc.SetConfidenceLevel(confidenceLevel)
 
   66fc.UseAdaptiveSampling(
True)  
 
   70fc.FluctuateNumDataEntries(
False)
 
   72interval = fc.GetInterval()
 
   76wspace.factory(
"Uniform::prior(mu)")
 
   77modelConfig.SetPriorPdf(wspace[
"prior"])
 
   80bc = ROOT.RooStats.BayesianCalculator(data, modelConfig)
 
   81bc.SetConfidenceLevel(confidenceLevel)
 
   82bcInt = bc.GetInterval()
 
   85mc = ROOT.RooStats.MCMCCalculator(data, modelConfig)
 
   86mc.SetConfidenceLevel(confidenceLevel)
 
   89mc.SetNumBurnInSteps(500)  
 
   91mc.SetLeftSideTailFraction(0.5)  
 
   92mcInt = mc.GetInterval()
 
   99print(
"expected interval is [{}, {}]".
format(expectedLL, expectedUL))
 
  100print(
"plc interval is [{}, {}]".
format(plInt.LowerLimit(mu), plInt.UpperLimit(mu)))
 
  101print(
"fc interval is [{}, {}]".
format(interval.LowerLimit(mu), interval.UpperLimit(mu)))
 
  102print(
"bc interval is [{}, {}]".
format(bcInt.LowerLimit(), bcInt.UpperLimit()))
 
  103print(
"mc interval is [{}, {}]".
format(mcInt.LowerLimit(mu), mcInt.UpperLimit(mu)))
 
  105print(
"is mu=0 in the interval? ", plInt.IsInInterval({mu}))
 
  108ROOT.gStyle.SetCanvasColor(0)
 
  109ROOT.gStyle.SetCanvasBorderMode(0)
 
  110ROOT.gStyle.SetPadBorderMode(0)
 
  111ROOT.gStyle.SetPadColor(0)
 
  112ROOT.gStyle.SetCanvasColor(0)
 
  113ROOT.gStyle.SetTitleFillColor(0)
 
  114ROOT.gStyle.SetFillColor(0)
 
  115ROOT.gStyle.SetFrameFillColor(0)
 
  116ROOT.gStyle.SetStatColor(0)
 
  119canvas = ROOT.TCanvas(
"canvas")
 
  131plot = ROOT.RooStats.LikelihoodIntervalPlot(plInt)
 
  136mcPlot = ROOT.RooStats.MCMCIntervalPlot(mcInt)
 
  137mcPlot.SetLineColor(ROOT.kGreen)
 
  138mcPlot.SetLineWidth(2)
 
  142bcPlot = bc.GetPosteriorPlot()
 
  150canvas.SaveAs(
"IntervalExamples.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 format
double normal_quantile(double z, double sigma)
Inverse ( ) of the cumulative distribution function of the lower tail of the normal (Gaussian) distri...
double normal_quantile_c(double z, double sigma)
Inverse ( ) of the cumulative distribution function of the upper tail of the normal (Gaussian) distri...