Hello, Lorenzo!
Thank you!
I have some questions to your reply.
- You say that I can multiply my results by -2. Does it imply that in order to get the significance that I need, I simply multiply obtained significance by the factor -2?
- So every event for my test statistic will be generated with x = 150?
- Here I attach my code so you can better understand my procedure.
#Setup workspace for models
wspace = ROOT.RooWorkspace(“wspace”)
#Configure alternative (s+b) distribution
wspace.factory(“Poisson::px(x[150, 0,500], sum::splusb(s[0,50],b[100,0,150]))”)
#Configure prior distribution for background (tau*b)
wspace.factory(“Poisson::py(y[100,0,500], sum::taub(tau[1.],b))”)
wspace.factory(“PROD::model(px,py)”)
#Define observables, parameters of interest and nuisance parameters
wspace.defineSet(“obs”, “x”)
wspace.defineSet(“poi”, “s”)
wspace.defineSet(“nui”, “b”)
#Create toy dataset with x=60
data = ROOT.RooDataSet(“d”, “d”, wspace.set(“obs”))
data.add(wspace.set(“obs”))
#Construct and configure alternative and null models
#Null(background only model)
b_model = ROOT.RooStats.ModelConfig(“B_model”, wspace)
b_model.SetPdf(wspace.pdf(“px”))
b_model.SetObservables(wspace.set(“obs”))
b_model.SetParametersOfInterest(wspace.set(“poi”))
wspace.var(“s”).setVal(0.0)
b_model.SetSnapshot(wspace.set(“poi”))
#Alternative(signal + background model)
sb_model = ROOT.RooStats.ModelConfig(“S+B_model”, wspace)
sb_model.SetPdf(wspace.pdf(“px”))
sb_model.SetObservables(wspace.set(“obs”))
sb_model.SetParametersOfInterest(wspace.set(“poi”))
wspace.var(“s”).setVal(50.0)
sb_model.SetSnapshot(wspace.set(“poi”))
#Define test statistic that is going to be used for testing the hypothesis
teststat = ROOT.RooStats.SimpleLikelihoodRatioTestStat(sb_model.GetPdf(), b_model.GetPdf())
teststat.SetNullParameters(sb_model.GetSnapshot())
teststat.SetAltParameters(b_model.GetSnapshot())
#Construct hypothesis test
hc2 = ROOT.RooStats.HybridCalculator(data, b_model, sb_model)
toymcs2 = hc2.GetTestStatSampler()
toymcs2.SetNEventsPerToy(0)
toymcs2.SetTestStatistic(teststat)
hc2.SetToys(20000, 20000)
hc2.ForcePriorNuisanceAlt(wspace.pdf(“py”))
hc2.ForcePriorNuisanceNull(wspace.pdf(“py”))
#Print the results
r2 = hc2.GetHypoTest()
print(“RESULTS:”)
r2.Print()
#Draw the plot
c1 = ROOT.gROOT.Get(“c1”)
if not c1:
c1 = ROOT.TCanvas(“c1”)
p2 = ROOT.RooStats.HypoTestPlot(r2, 1000)
p2.Draw()
c1.SaveAs(“Roostats1.jpg”)
I use simple likelihood ratio test for alternative (s+b) hypothesis against null (only b) hypothesis. In order to conduct such a procedure I use HybridCalculator and SimpleLikelihoodTestStat.
Thank you in advance!