Problem with Extended fit in RooFit

Dear Experts,

I am trying to do an extended fit to an unbinned data using RooFit.
I have two template histograms for background and signal model.
If I do like this:

RooArgList shapes;
shapes.add(roopdf_bkg);
shapes.add(roopdf_sig);
RooArgList yields;
yields.add(bkg_yield);                                                                                                              
RooAddPdf totalPdf("totalPdf", "Sum of signal and bkg pdf", shapes, yields);
RooAbsReal* nll = totalPdf.createNLL(*reddata,Extended(doext)) ;  
RooMinuit(*nll).migrad();
RooMinuit(*nll).hesse();
RooMinuit(*nll).minos();  //optional                                                     

Then it says:

[#0] ERROR:InputArguments -- totalPdf: this PDF does not support extended maximum likelihood

What wrong could possibly be going on?
For defining the PDF’s, I do it like this:

      f1 = TFile::Open(filename1) ;
      f1->cd();
      
      hsig = (TH1D*)f1->Get(sighistname)->Clone();
      hbkg  = (TH1D*)f1->Get(bkghistname)->Clone();

       RooRealVar sie("Pho_SigmaIEtaIEta", "#sigma_{i#etai#eta} distribution",0.0, 0.025);
     ////signal
      RooDataHist roohist_sig("sig_sie", "sieie of sig", sie, hsig);
      RooHistPdf roopdf_sig("sigpdf", "sieie of sig", sie,roohist_sig);
      //////BKG
      RooDataHist roohist_bkg("bkg_sie", "sieie of bkg", sie, hbkg);
      RooHistPdf roopdf_bkg("bkgpdf", "sieie of bkg", sie,roohist_bkg);

Thanks for the help,
Shilpi

Hi,

I got my problem. I was fitting with

RooArgList yields;
yields.add(bkg_yield);
RooAddPdf totalPdf(“totalPdf”, “Sum of signal and bkg pdf”, shapes, yields);

with bkg_yield being a fraction.
I now redid the fit with bkg_yield being the actual number of events ( so for that I have to provide
sig_yield in yields )

Thanks,
Shilpi