Number of Signal events in a subrange

Dear All,

I’m fitting a histogram with an extended maximum likelihood fit. The fit works perfectly and I get the number of signal and background events in the full range.
I want my histogram to be fitted in the full range [3,3.2] but I would like to have the number of signal events calculated only in the subrange [].

Anyone have any idea on how to do that? I already tried x.SetRange (you can find attached my code).

RooRealVar x1("x","M GeV/c^{2}",3.,3.2);
RooDataHist dh("dh","dataset",x,h);
RooPlot* frame = x1.frame(Title("")) ;
RooRealVar alpha("#alpha","",-1,-5,5 );
RooRealVar mean("#mu","mean of gaussians",3.091,3.09,3.098);
RooRealVar sigma("#sigma","width of gaussians",0.0045,0.0038,0.0065);
RooRealVar n("n","",1);
RooCBShape sig("sig", "sig", x, mean, sigma, alpha,n);

RooRealVar e0("e0","e0",0.0005,-2.,1.) ;
RooRealVar e1("e1","e1",-0.0002,-2.,1.) ;

RooChebychev bkg("bkg","background p.d.f.",x,RooArgList(e0,e1)) ;

x.setRange("signalRange",3.07,3.8) ;

RooRealVar nsig("N_{SIG}","signal events",500,0,1000000);
RooRealVar nbkg("N_{BKG}","signal background even0ts",500,0,1000000);

RooExtendPdf esig("esig","esig",sig,nsig) ;
RooExtendPdf ebkg("ebkg","ebkg",bkg,nbkg) ;
RooAddPdf all("all","all",RooArgList(esig,ebkg)) ;

RooFitResult* r = all.fitTo(dh,Extended(kTRUE),Save());



I am not 100% sure I have understood you.
You would like to fit a Sig+backg function in the full range, but the number of signal and background events which are defined as parameter in your model, you would like to be defined only in a subrange ?




Yes exactly. I would like to have the number of events in a subrange.

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