Removing x error bars in TEfficiency

Hi,
I am constructing a TEfficiency using the TEfficiency(const TH1& passed, const TH1& total) method. How do I stop x errors from being drawn in the subsequent TEfficiency?

Cheers
James


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Can you try:

gStyle->SetErrorX(0.);

?

That does not work. I have an example macro which shows this:

void example(){
	gStyle->SetOptStat(0);
	gStyle->SetErrorX(0.);
	
	TH1F* passed = new TH1F("passed","",10,-0.5,9.5);
	TH1F* all = new TH1F("all","",10,-0.5,9.5);

	for (int i = 0; i < passed->GetNbinsX(); i++){
		passed->Fill(i);
		all->Fill(i);
		all->Fill(i);

	}

	TEfficiency * myEff = new TEfficiency(*passed,*all);
	myEff->Draw();
	
}

Yes TEfficiency is special. May be @moneta knows.

Hi,

Unfortunately, if you want to set to 0 the x error of TEfficiency, you need to clone and modify by hand the painted object,
a TGraphAsymmErrors.
You need to do the following:

void example(){

	
	TH1F* passed = new TH1F("passed","",10,-0.5,9.5);
	TH1F* all = new TH1F("all","",10,-0.5,9.5);

	for (int i = 0; i < passed->GetNbinsX(); i++){
		passed->Fill(i);
		all->Fill(i);
		all->Fill(i);

	}

	TEfficiency * myEff = new TEfficiency(*passed,*all);
	myEff->Draw();
	
        gPad->Update(); 

        auto gr = (TGraphAsymmErrors*) myEff->GetPaintedGraph()->Clone();
        for (int i = 0; i < gr->GetN(); ++i) {
             gr->GetEXlow()[i] = 0;  
             gr->GetEXhigh()[i] = 0;  
        }
        gr->Draw("AP");
}

We should however modify TEfficiency internally to have this option.

Lorenzo

Thanks for your help!