RooMCStudy: Wrong pull distribution

Dear Expert,

I am using ROOMCStudy for the toy study.
I want to make the pull distribution calculated by RooMCStudy using the below piece of code:

  RooMCStudy *mcs = new RooMCStudy(model, RooArgSet(mD0, mD0pi), Binned(true), Extended(), Silence(), FitOptions(Save(kTRUE), PrintEvalErrors(0))); 
  mcs->generateAndFit(500, 145072, true);
  RooPlot* frame1  = mcs->plotParam(sig_peak_yield, Bins(100)) ;
  frame1->SetTitle("Distribution of fitted signal yield") ;

  RooPlot* frame2 = mcs->plotError(sig_peak_yield, Bins(100),FitGauss(false)) ;
  frame2->SetTitle("Distribution of fit uncertainty on signal yield") ;

  RooPlot* frame3 = mcs->plotPull(sig_peak_yield, Bins(100),FitGauss(false)) ;
  frame3->SetTitle("Distribution of signal yield pull") ;

  TCanvas* c = new TCanvas("TestPulls","TestPulls",1200,400);
  c->Divide(3, 2) ;
  c->cd(1) ; gPad->SetLeftMargin(0.15) ; frame1->GetYaxis()->SetTitleOffset(1.4) ; frame1->Draw() ;
  c->cd(2) ; gPad->SetLeftMargin(0.15) ; frame2->GetYaxis()->SetTitleOffset(1.4) ; frame2->Draw() ;
  c->cd(3) ; gPad->SetLeftMargin(0.15) ; frame3->GetYaxis()->SetTitleOffset(1.4) ; frame3->Draw() ;

Here fitted yield seems fine but the pull does not seem good (not around zero).

As far as I know, the pull definition is pull(nsig) = ( Nsig_fit - Nsig_true ) / error_Nfit. but how Nsig_true is taken?

Here is the complete code that I am using:
toy_data_new.C (13.8 KB)

Can you please comment on this and suggest to improve this?


I think @moneta can help you.

Hello @chanchal, happy new year!

I would like to reproduce your issue, but I’m missing some other course files to make your script work because of these lines:

#include "/home/chanchal/Documents/chanchal phd/analysis_new/bkg_study_mc15rib/WS_sample/myRooJohnsonSU.cpp"
#include "/home/chanchal/Documents/chanchal phd/analysis_new/bkg_study_mc15rib/WS_sample/myRooPolBG.cpp"

Could you please also upload these files, and any other custom header files that these files might include themselves?


Hi @jonas,

Thanks for the reply.

Here the is the additional files:
myRooJohnsonSU.cpp (1.8 KB)
myRooJohnsonSU.h (1.1 KB)
myRooPolBG.cpp (1.8 KB)
myRooPolBG.h (929 Bytes)



For some reason I get a segfault when I try to run your script :frowning:

Which ROOT version are you using? That would be useful info for me to figure out the problem.


My root version is 6.20/00.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.