Hello everybody,
I would like to generate events according to 2 histograms (1 for the signal 1 for the background).
I am able to generate pseudo events following one histogram :
RooDataHist* data_pass = new RooDataHist(“data_pass”,“data_pass”, RooArgList(x), h3);
RooHistPdf histpdf1(“histpdf1”,“histpdf1”,x,*data_pass,0) ;
RooDataSet *data = histpdf1.generate(RooArgSet(x),500);
My goal is to generate events according to two histograms, and then estimate NS and NB by using the shape of the pseudo-events (with a chi² minimization ? ).
Do you have any suggestions how to do that ?
Thank you very much for your help,
Cheers,
Bertrand
Without having done so myself, you could in principle use RooAddPdf (if I understand your problem correctly)
Here assuming your signal and background are read into seperate RooDataSets
RooDataHist *h1 = signalData.binnedClone();
RooDataHist* h2 = backgroundData.binnedClone()
RooHistPdf firstPdf("firstPdf","firstPdf",RooArgList(signalVar),*h1,0);
RooHistPdf secondPdf("firstPdf","firstPdf",RooArgList(backgroundVar),*h2,0);
RooAddPdf sumPdf("sumPdf","sumPdf",RooArgList(firstPdf,secondPdf),RooArgList(some appropriate weighing));
//Then data can be generated from sumPdf just as from an ordinary pdf
RooDataSet *generatedData=sumPdf.generate(RooArgSet(Var),nevents);
Cheers