Dear all,
I have a question which may be related to ROOT/Roofit versions,
I use ROOT5.28 with RooFit enabled, and want to fit a distribution with three MC based pdf:
// MC histogram
TH1F* hZtautau = new TH1F( "hZtautau", "", nbin, start, end );
TH1F* hZmumu = new TH1F( "hZmumu", "", nbin, start, end );
TH1F* hHiggs = new TH1F( "hHiggs", "", nbin, start, end );
// Filling the histograms
...
// Building the Histo dataset and the HistPdf
RooRealVar massVar ( "massVar", "", start, end );
RooDataHist* dZtautau = new RooDataHist( "dZtautau", "", RooArgList( massVar ), hZtautau, 1. );
RooDataHist* dZmumu = new RooDataHist( "dZmumu", "", RooArgList( massVar ), hZmumu, 1. );
RooDataHist* dHiggs = new RooDataHist( "dHiggs", "", RooArgList( massVar ), hHiggs, 1. );
RooHistPdf* pdf_Ztautau = new RooHistPdf ( "pdf_Ztautau", "", RooArgSet( massVar ), *dZtautau, 0 );
RooHistPdf* pdf_Zmumu = new RooHistPdf ( "pdf_Zmumu", "", RooArgSet( massVar ), *dZmumu, 0 );
RooHistPdf* pdf_Higgs = new RooHistPdf ( "pdf_Higgs", "", RooArgSet( massVar ), *dHiggs, 0 );
// Adding the pdf
RooRealVar n_Ztautau ( "n_Ztautau", "", hZtautau->Integral(), -100., 10000. );
RooRealVar n_Zmumu ( "n_Zmumu", "", hZmumu->Integral(),-100., 10000. );
RooRealVar n_Higgs ( "n_Higgs", "", hHiggs->Integral(),-100., 10000. );
RooAddPdf* pdf_tot =
new RooAddPdf( "pdf_tot", "", RooArgList(*pdf_Ztautau, *pdf_Zmumu, *pdf_Higgs), RooArgList(n_Ztautau, n_Zmumu, n_Higgs) );
// Retrieve dataset
TH1F* hAll = new TH1F( "hAll", "", nbin, start, end );
...
RooDataHist* dAll = new RooDataHist( "dAll", "", RooArgList( massVar ), hAll, 1. );
// Fit the dataset
pdf_tot->fitTo( *dAll, "eqr" );
// Plot everybody
TCanvas* c1 = new TCanvas( "c1", "", 800, 800 );
RooPlot* frame1 = massVar.frame();
c1->cd();
frame1->Draw();
dAll->plotOn( frame1 );
pdf_tot->plotOn( frame1 );
pdf_tot->plotOn( frame1, Components(*pdf_Zmumu), LineColor(6) );
frame1->Draw();
but I get then that ‘Components’ and ‘LineColor’ are not known, I am puzzled because on the other hand all Pdf, Rooplot and other RooFit objects are well defined…
Do you have an idea of what I missed ?
Thanks in advance,
Xavier