Toy MC generation with RooEffProd involved

Hi,

I want to generate some toy MCs where my overall PDF is an ideal PDF x Efficiency function (using RooEffProd class)

Now, when I generate a toy with the overall PDF, it appears to be completely neglecting the efficiency function and events are generated following the ideal PDF. Is it a generic behavior or am I doing something wrong? If generic, how do I generate toy which will have effect of the efficiency function too?

TiA,
Nikhil

Someone help, please !!

Hi Nikhil,

The efficiency function should be taken into account in the generation.
What ROOT version are you using?

Wouter

Hi Wouter,

Thanks for your reply. I was using Root v5.22 earlier, but after you asked I upgraded to v5.26. But, the problem remains. It may be that I am doing something wrong.

For that reason, I am attaching the excerpt of the code, so that you can point out to any possible bug/mistake.

TiA,
Nikhil


// PDF
RooGenericPdf signalPolarization("signalPolarization", 
									 "(1 - fLong)*(1 + dsstHelicity*dsstHelicity)*(1-rhoHelicity*rhoHelicity) + 4*fLong*(1-dsstHelicity*dsstHelicity)*rhoHelicity*rhoHelicity",
									 RooArgList(fLong, dsstHelicity, rhoHelicity));


// Efficiency
RooChebychev dsstAcceptance("dsstAcceptance", "dsstAcceptance",
								dsstHelicity, RooArgList(s0, s1, s2));
	RooChebychev rhoAcceptance("rhoAcceptance", "rhoAcceptance",
							   rhoHelicity, RooArgList(s3, s4, s5, s6, s7, s8, s9));
	
	RooProdPdf signalAcceptance("signalAcceptance", "signalAcceptance",
								RooArgList(dsstAcceptance, rhoAcceptance));
	
	RooEffProd signalPolarizationCorrected("signalPolarizationCorrected", "signalPolarizationCorrected",
										   signalPolarization, signalAcceptance);

// generation
*data = signalPolarizationCorrected.Generate(RooArgList(dsstHelicity, rhoHelicity), Extended(kTRUE));

Hi,

I only wanted to remind, that I have been unable to solve the problem I am facing, till now and any kind of input is deeply needed :slight_smile:

TiA,
Nikhil

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 :frowning: … 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 :frowning:

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)

Hi,

I deeply request for some help or clues.

regards,
Nikhil