Hi,
Just to be a little more quantitative, I tried generating some toys with a flat- linear PDF, convoluted by a second order polynomial acceptance function (codes attached).
When I generate using RooEffProd for adding the acceptance function , I get something like in figure 1.eps,
while if generated using (probably a wrong way) RooProdPdf, the toy data and the fit look in very nice agreement (at least to the eyes). See figure 2.pdf.
Note, all the times the data is fitted using RooEffProd method.
Also, one step ahead, I did a pull study on 500 samples generated using RooProdPdf (figure 3.pdf), I am not sure why I get such a funny shape … I would expect a Gaussian!
Any ways, I did not care too much about this point, since I know using RooProdPdf is not the best possible method. But, the key point is, why do I get all observations shifted on the lower side? It definitely points to some bias …
I would be grateful to any directive on this and also on RooEffProd. I am attaching the codes for easy referencing.
TiA,
Nikhil
(generation code)
[code]
void generate(void) {
for(int i=0; i<500; i++){
// Fit observables
RooRealVar x("x","x", -1.0, 1.0);
RooDataSet* data = new RooDataSet("data", "raw data",
RooArgSet(x));
//// pdf:
RooRealVar c0("c0", "c0", 1.),
c1("c1", "c1", 0.0);
RooChebychev pdf("pdf", "pdf", x, RooArgList(c0));
// Efficiency
RooRealVar eff0("eff0", "eff0", 0),
eff1("eff1", "eff1", -1);
RooChebychev eff("eff", "eff", x, RooArgSet(eff0, eff1));
RooProdPdf pdfCorrected("pdfCorrected", "pdfCorrected", pdf, eff);
// Generate the data
RooDataSet* data = pdfCorrected.generate(x, 10000);
// The Results
string filename("toys/toy");
std::ostringstream tmp;
tmp << filename << i;
filename = tmp.str();
filename.append(".txt");
// saving to file
data->write(filename.c_str());
}
return;
}[/code]
(fitting code)
void fit(void) {
fstream biasCheck("biasCheck.txt", ios::out | ios::app);
for(int i=0; i < 500; i++){
// Fit observables
RooRealVar x("x","x", -1.0, 1.0);
// Read the data file
string filename("toys/toy");
std::ostringstream tmp;
tmp << filename << i;
filename = tmp.str();
filename.append(".txt");
RooDataSet* data = RooDataSet::read(filename.c_str(),
RooArgSet(x));
//// pdf:
RooRealVar c0("c0", "c0", 0., -2.0, 2.0),
c1("c1", "c1", 0.0, -2.0, 2.0);
RooChebychev pdf("pdf", "pdf", x, RooArgList(c0));
// Efficiency
RooRealVar eff0("eff0", "eff0", 0),
eff1("eff1", "eff1", -1);
RooChebychev eff("eff", "eff", x, RooArgSet(eff0, eff1));
RooEffProd pdfCorrected("pdfCorrected", "pdfCorrected", pdf, eff);
// Fit
RooFitResult* fitRes = pdfCorrected.fitTo(*data,"er");
biasCheck<< (c0.getVal() - (1.0)) <<"\t"<< c0.getError()<< "\t"<<(c0.getVal()-(1.0))/c0.getError()<<endl;
}
biasCheck.close();
// The Results
string filename("toyStudy");
filename.append(".txt");
string dEcanvasName("toyStudy");
//// Plot the Results
TCanvas *a1 = new TCanvas(dEcanvasName.c_str(), dEcanvasName.c_str(), 600, 700);
TPad *pad = new TPad("pad", "pad", 0.05, .05, .95, .95);
pad->SetLeftMargin(0.15);
pad->Draw();
pad->cd();
RooPlot *DEPlot = data->plotOn(x.frame(40));
pdfCorrected.plotOn(DEPlot);
pdfCorrected.paramOn(DEPlot, //Parameters(RooArgList(signalMean, signalSigma, nSignal, nDsstCrossFeed, nRhoCrossFeed)),
Layout(0.55,0.8,0.8));
TPaveLabel *chiSq = new TPaveLabel(0.65, 0.5, 0.9, 0.6,
Form("#chi^{2} = %f", DEPlot->chiSquare()),"brNDC");
chiSq->Draw();
DEPlot->addObject(chiSq);
DEPlot->SetTitle("B^{0} #rightarrow D_{s}^{*+}#rho^{-}");
DEPlot->GetYaxis()->SetTitleFont(62);
DEPlot->GetYaxis()->CenterTitle();
DEPlot->GetYaxis()->SetTitleSize(0.046);
DEPlot->GetYaxis()->SetTitleOffset(1.2);
DEPlot->GetYaxis()->SetLabelSize(0.036);
DEPlot->GetXaxis()->SetLabelSize(0.036);
DEPlot->GetXaxis()->CenterTitle();
DEPlot->Draw();
// title
TPaveLabel *deTitle = new TPaveLabel(0.3, 0.87, 0.7, 0.93, "#DeltaE Distribution", "NDC");
deTitle->Draw();
return;
}
figures.rar (12.5 KB)