Signal and background problem

Hi again !

I have a problem with background and signal. My fit for the signal+background is good but when I want to view the background only, it is always above the signal (see attached file).

I 'am trying to have something like the macro example rf201_composite.C.( And finally I want to subtract the background from the signal.)

Any ideas ?

Thanks in advance

Here is the code of my macro:

using namespace RooFit;

void All(char* treefile = “bntAnalysis_merged.root”, char* treename = “fTwoMuonNtuple”){

// Open the file

TFile *f = new TFile(treefile,“READ”);

// Connect to the tree

TTree* tree = (TTree*)f->Get(treename);

//Switch to the branch and fill the invariant mass histogram

Float_t m;

TH1F *hm = new TH1F(“hm”,“m distribution”,580,0,12);

Double_t nentries = (Double_t)tree->GetEntries();

for (Double_t i=0; i<nentries; i++) 

RooRealVar mass(“mass”,“invariant mass (GeV/c2)”,0,12);

RooDataHist *data = new RooDataHist(“data”,“data x”,mass,hm);

//Breit-Wigner for the phi

RooRealVar mean_phi(“mean_phi”,“mean_phi”,1.0,0.9,1.1);
RooRealVar g(“sigma_phi”,“sigma_phi”,1,0,2);
RooBreitWigner *phi_BW = new RooBreitWigner(“phi_BW”,“Breit Wigner PDF”,mass,mean_phi,g);

//Crystal ball for the J/psi

RooRealVar mean_jpsi(“mean_jpsi”,“mean_jpsi”,3,2.9,3.2);
RooRealVar sigma_jpsi(“sigma_jpsi”,“sigma_jpsi”,0.07,0,0.1);
RooRealVar alpha(“alpha”,“alpha”,1);
RooRealVar n(“n”,“n”,5);
RooCBShape *jpsi = new RooCBShape(“jpsi”,“crystal ball PDF”,mass,mean_jpsi,sigma_jpsi,alpha,n);

//Crystal ball for the psi

RooRealVar mean_psi(“mean_psi”,“mean_psi”,3.6,3.4,3.8);
RooRealVar sigma_psi(“sigma_psi”,“sigma_psi”,0.07,0,0.1);
RooRealVar alpha_psi(“alpha”,“alpha”,1.5);
RooRealVar n_psi(“n”,“n”,1);
RooCBShape *psi = new RooCBShape(“psi”,“crystal ball PDF”,mass,mean_psi,sigma_psi,alpha_psi,n_psi);

//Crystal ball for the Upsilon

RooRealVar mean_up(“mean_up”,“mean_up”,9.4,9.3,9.5);
RooRealVar sigma_up(“sigma_up”,“sigma_up”,0.07,0,0.1);
RooRealVar alpha_up(“alpha_up”,“alpha_up”,1,0,5);
RooRealVar n_up(“n_up”,“n_up”,1,0,10);
RooCBShape *upsilon = new RooCBShape(“upsilon”,“crystal ball PDF”,mass,mean_up,sigma_up,alpha_up,n_up);

//Exponential background

RooRealVar a(“a”,“a”,-0.85,-0.8,-0.9);
RooExponential bkg(“exp”,“exp”,mass,a);

RooRealVar fsig(“fsig”,“signal”,0.1,0.,1.);
RooRealVar fsig2(“fsig2”,“signal2”,0.1,0.,1.);
RooRealVar fsig3(“fsig3”,“signal3”,0.1,0.,1.);
RooRealVar fsig4(“fsig4”,“signal4”,0.1,0.,1.);

RooAddPdf sum(“sum”,“sum”,RooArgList(*phi_BW,*jpsi,*psi,*upsilon,bkg),RooArgList(fsig,fsig2,fsig3,fsig4),kTRUE);


RooPlot* mframe = mass.frame(Title(“Fit of invariant mass”));


}[/code] (83.8 KB)

Hi Bruno,

Which version of ROOT/RooFit are you using?

There was a problem in earlier RooFit versions with the plotting of components in a subrange of a fit where the wrong normalization is used for the plot. This should have been fixed in ROOT 5.21/04. (The fit should nevertheless be OK)


I 'm using the v 2.91 of RooFit and ROOT 5.21/04


I’m looking into it.


Sorry, i missed to precise: this macro was done with Root 5.21/02 and Roofit 2.90. I updated root yesterday. So now I 'm using roofit 2.91

Hi Bruno,

I don’t manage to reproduce your problem.

I’ve ran a slightly modified version of your macro (I don’t have your data, so I generate some from the p.d.f. with the default parameters you have) and all seems to work fine.

What happens if you run my version of your macro?

bruno.C (2.09 KB)