72using namespace RooFit;
73using namespace RooStats;
75class BinCountTestStat : public TestStatistic {
77 BinCountTestStat(void) : fColumnName("tmp") {}
78 BinCountTestStat(string columnName) : fColumnName(columnName) {}
80 virtual Double_t Evaluate(RooAbsData &data, RooArgSet & /*nullPOI*/)
82 // This is the main method in the interface
84 for (int i = 0; i < data.numEntries(); i++) {
85 value += data.get(i)->getRealValue(fColumnName.c_str());
89 virtual const TString GetVarName() const { return fColumnName; }
95 ClassDef(BinCountTestStat, 1)
127w.factory(
"Poisson::px(x[150,0,500],sum::splusb(s[0,0,100],b[100,0.1,300]))")
128w.factory(
"Poisson::py(y[100,0.1,500],prod::taub(tau[1.],b))")
148w.factory(
"PROJ::averagedModel(PROD::foo(px|b,py,prior_b),b)")
153frame =
w.var(
"x").frame(Range=(50, 230))
154w.pdf(
"averagedModel").plotOn(frame, LineColor=
"r")
155w.pdf(
"px").plotOn(frame, LineColor=
"g")
156w.var(
"s").setVal(50.0)
157w.pdf(
"averagedModel").plotOn(frame, LineColor=
"b")
160w.var(
"s").setVal(0.0)
167w.var(
"y").setVal(100)
168w.var(
"x").setVal(150)
172print(
"-----------------------------------------")
174print(f
"Hybrid p-value from direct integration = {1 - cdf.getVal()}")
175print(f
"Z_Gamma Significance = {ROOT.RooStats.PValueToSignificance(1 - cdf.getVal())}")
188print(
"-----------------------------------------")
190print(f
"Z_Bi p-value (analytic): {p_Bi}")
191print(f
"Z_Bi significance (analytic): {Z_Bi}")
229w.var(
"s").setVal(0.0)
238w.var(
"s").setVal(50.0)
272w.factory(
"Gaussian::gauss_prior(b,y, expr::sqrty('sqrt(y)',y))")
276w.factory(
"Lognormal::lognorm_prior(b,y, expr::kappa('1+1./sqrt(y)',y))")
321print(
"-----------------------------------------")
370print(
"-----------------------------------------")
400w.var(
"x").setVal(150.0)
401w.var(
"y").setVal(100.0)
411w.var(
"s").setVal(0.0)
421w.var(
"s").setVal(50.0)
453w.factory(
"Gamma::gamma_y0(b,sum::temp0(y0,1),1,0)")
454w.factory(
"Gaussian::gauss_prior_y0(b,y0, expr::sqrty0('sqrt(y0)',y0))")
480print(
"-----------------------------------------")
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.