I would like to build a model of this type:
// Model : two categories :
// category A : L = P(n1 | mu x s1 x f1+ alpha x b1) x P(n2 | mu x s1 * (1-f1) + b1) --> obviously cannot be extended (this is the extended term…)
// category B : pdf = mu * s2 * Gaus(myy,mH,smyy) + b2 * Exp(-0.8 x (myy-100)/60) --> must be extended
// Floating parameters : mu, a0, b1, b2
// Observables : n1, n2, myy (x nEvents), cat
where P is a Poisson. I tried to fit this to a background-only Asimov dataset (mu = 0). The result depends on the “initial state” of the category. It is wrong if the initial state is A, and correct if it is B (although many error messages are printed, saying that A does not support extended maximum likelihood, to which I agree of course).
Maybe this behavior is expected (although not nice), as I see in the “extendMode()” implementation of RooSimultaneous the comment “/// WVE NEEDS FIX”. In fact, in this method, I do not see where one iterates of the various pdfs, as _indexCat.label() never changes… In my case, I think one should find : allCanExtend = false, anyMustExtend = true. But as it is, if the initial label is A, one finds allCanExtend = false, anyMustExtend = false, and I guess B is not extended, and the results are wrong. If the initial state is B, one finds allCanExtend = true, anyMustExtend = true, which is still not true, but fine for the fit as B will be extended (and A won’t as it can’t, but this will trigger (harmeless ?) error messages).
Am I right ? If yes, could the “extendMode()” implementation of RooSimultaneous be fixed ?
I attached a macro for illustration. I did:
root  .L testWSsimul.C+
root  go()
The 2 first combined fits are identical, and return wrong results. The last one, where the initial state of the category is set to the one using a “MustBeExtended” pdf returns results that seem more plausible.
Jean-BaptistetestWSsimul.C (11.1 KB)