Home | News | Documentation | Download

Pull Distribution in binned fits (not using Roofit)

Dear Experts,

I am trying to do a binned fit using the functions that I have written. I am able to do the fit but I am not able to make the pull distributions for this fit. I do.t want to use Roofit for this case

Would you please have a look? Here’s the working macro and the root file.
KS_binned_fit.tar.gz (18.6 KB)

Thanks in Advance.
_

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


How are you unable to make the pull distributions? Do you get an error, if so, what error? Over which entries do you want to plot the pulls - I only see one histogram? I suppose you want to plot the pull over each data point? Then this should help: Plot of Fit Residuals

Dear @Axel,

What I meant was, usually, when we use Roofit, we can do the following to get the pulls:

RooHist* hpull = mpipiplot->pullHist();

Here, I am not using Roofit and I cannot use RooHist* hpull = mpipiplot->pullHist();, is there a way I can try to make the pulls?

But, I will try what you suggested and get back to you.

Regards,
Sanjeeda

Dear @Axel,

I tried to calculate the pulls like:

TH1 *hpull = new TH1F(“hpull”,"",200, 0.45, 0.55);
Int_t bins = h1->GetNbinsX();
cout << "no. of bins = " << bins << endl;

cout<< h1->GetBinContent(10)<<endl;
cout<< tot->Eval(h1->GetBinCenter(10))<<endl;
cout<GetBinContent(10) - tot->Eval(h1->GetBinCenter(10)) <<endl;

for (int i =1;i<=bins;i++)
{
Double_t pull = (h1->GetBinContent(i) - tot->Eval(h1->GetBinCenter(i)));
cout << "pulls = " << pull << endl;
hpull->Fill(pull);
}

I am able to print the values but somehow I am not able to fill them. This is how my plot looks:

Would you please help me? Here’s the macro and the root file:
binned_fit_KS_mass.C (5.4 KB)
KS_pipi_histo_b17_05_02_05_200bin.root (20.6 KB)

That’s an uncommon definition of pulls.

Do they all lie between 0.45, 0.55? Check how many entries you have in under- / overflow bins of hpull.

Dear @Axel

I used the definition of pull which was was given in the link that you shared.

I have now slightly changed the code for the pull, now, I am doing hpull->SetBinContent(i,pull), and I am able to get stuff in the pull histogram but i don’t think they are correct.

TH1 *hpull = new TH1F(“hpull”,"",200, 0.45, 0.55);
Int_t bins = h1->GetNbinsX();
cout << "no. of bins = " << bins << endl;

cout<< h1->GetBinContent(10)<<endl;
cout<< tot->Eval(h1->GetBinCenter(10))<<endl;
cout<GetBinContent(10) - tot->Eval(h1->GetBinCenter(10)) <<endl;

for (int i =1;i<=bins;i++)
{
Double_t pull = (h1->GetBinContent(i) - tot->Eval(h1->GetBinCenter(i)));
cout << "pulls = " << pull << endl;
hpull->SetBinContent(i,pull);
}
[/quote]

This is what I get:

See my questions above:

The link I gave above is for residuals, not for pulls. See Please explain the difference between "pulls" and "residuals - #6 by moneta

Thank you for the links. There are no entries on over flow or underflow bins. I understand that the link was for residuals, but what should be the definition of the pull, I think I am missing a term in it.

The values I get are much higher than 0.45 to 0.55.

You might want to have a chat with your advisor to understand these terms, what under-/overflow means, and how to plot the pull. Just quickly:

You measure y_m \pm \Delta y, the fit for the corresponding x value is at y_f. Then the pull p is p = \frac{y_m - y_f}{\Delta y}.

If you create a histogram TH1F hist("h","h", 10, 0.45, 0.55) and call hist.Fill(0.51); hist.Fill(7.3); then you will see only one entry in the histogram, as the second Fill adds an entry out of range (“overflow”, as it’s larger than the upper limit of 0.55). You can see the number of under-/overflow entries with gStyle->SetOptStat(111111) before drawing. IOn your case, about 12 entries ended up in the range of 0.45…0.55, the rest of the 200 entries were in under-/overflow bins.

Now - we’re happy to help with how to use ROOT, but we get to our limits with a general introduction to experimental particle physics :slight_smile: You might find friendly people here in the forum who help you nonetheless, but it’s better to consult with your advisor / physics group / professor / … for these kind of non-ROOT-related questions.