# Fitting composite models in RooFit

Dear rooters,

I have a question of rather theoretical nature. Firstly, I fitted a Crystal-Ball(CB) and a Gaussian (G) to a histogram using TF1 and fitting panel. I got relative heights of the CB an G, for example, 377 and 74.3. Now, if I want to use them as a composite model for roofit, should I use these values ( change them to a fraction 377/74.3 and 1) or should I rather integrate the CB and G separately on the range that I was fitting and use a different the ratio of events (results of integration, here it gave me 97332 and 26168).
By the way, if I fit a CB I usually add a parameter describing it’s height, so that the total fitting function looks like:

``````ROOT::Math::crystalball_function(x, [0], [1], [2], [3])*[4]+gaus(5)
``````

What is the correct way to calculate the fractions? Is there a way to fit a CB and gaussian without the height parameter?

EDIT:
OK, so I did some more fitting and displayed only the needed model components. For one signal component which is a sum of CB and G, it should look like this: (dashed light blue line from TF1 fit, ratio of events ~3.72)

While it looks like this (light blue line for sum CB+G, green for gaussian and black for CB):

One can see that the ratio of CB and G is totally different. A piece of code to show how I do this:

``````RooRealVar sigratioCat1("sigratioCat1","Cb/G frac",3.72,0.0,10.0) ;
RooRealVar one("one","one",5,0,10) ;
one.setConstant(kTRUE);
sigratioCat1.setConstant(kTRUE);
``````

Cheers,
Maks

OK, so I think I found a solution: use recursive fractions as specified in: