I created six RooKeysPdf for six MC samples. Now I want to sum over these RooKeyspdf based on each MC sample’s entries * its scale factor to data. I tried to sum them using:
w->factory("SUM::HighMass_m1(1.2594848*DY1J_pdf_m1, 2.1432564*DY2J_pdf_m1, 4.1874639*qqToZZ_pdf_m1, 2.7497135*TTJets_pdf_m1, 1.0148314*ggHToZZ_pdf_m1, 0.3392106*ggToZZ_pdf_m1)");
However, it complains:
[#0] ERROR:ObjectHandling -- RooFactoryWSTool::add(HighMass_m1) ERROR creating RooAddPdf: RooAbsPdf named DY1J_pdf_m1 not found [#0] ERROR:ObjectHandling -- RooFactoryWSTool::processExpression() ERRORS detected, transaction to workspace aborted, no objects committed
But each of the RooKeysPdf (for example, DY1J_pdf_m1) is available and I can plot each of these PDFs separately.
RooKeysPdf DY1J_pdf_m1("DY1J_pdf_m1", "DY1J_pdf_m1", m1_above_Upsilon, *ds_dimudimu_DY1J_m1_above_Upsilon, RooKeysPdf::NoMirror);
Do you know how to sum these pdf, plot the sum, and save to a RooWorkspace?