Problem with splitting and coefAnalyticalIntegral()


It has taken me several painful weeks so I can isolate this problem.

I have written a PDF class similar to RooBCPGenDecay/RooBMixDecay.

It is similar to RooBMixDecay in that the constructor accepts two RooCategories (btag and brec in my case).

It is similar to RooBCPGenDecay in that the PDF is of the same form:
(e^{-t/tau})( (1-btagdw) - Cbtagbrec*(1-2w)sin(dmt)+Sbtagbrec*(1-2w)cos(dmt) )

Everything is fine until I try to split S (the coeff in the sin term) over brec and do a simultaneous fit [fine meaning the fit gives back sensible results and visually corresponds to the data its fitted to].

The only thing that I can see happening differently between splitting and not splitting is the way
’getCoefAnalyticalIntegral’ and ‘coefAnalyticalIntegral’ behave.

When I do not split S, I can see that the function ‘getCoefAnalyticalIntegral’ returns the code=3 to ‘coefAnalyticalIntegral’ where it returns the following values.
if (basisIndex==_basisExp) {
return 4.0 ;
if (basisIndex==_basisSin) {
return 0.0 ;
if (basisIndex==_basisCos) {
return 0.0 ;

When I do split S over Brec ‘getCoefAnalyticalIntegral’ returns code=2 to coefAnalyticalIntegral. I have forcing coefAnalyticalIntegral to return different things for each basis to get the fit to work properly to no avail.

Also, the fit seems be setting the normalization of the different combinations of btag;breco categories in some way that has nothing to do with the data depite my attempts at using Slice() and ProjectWData()

Perhaps if you could enlighten me as to how coefAnalyticalIntegral affects the fit, that would help.

If you would like to look at my code and data, I can provide it.


Can you provide a minimal working example that illustrates the problem (e.g. your class
and a small macro that executes the split as desired)? That would allow me to look into this
and analyze the problem.