Get error of TGraphAsymmError

I have a TGraphAsymmError object and I need to find out its y-value and its error, given an x-value. For the y-value I can use graph->Eval(x) For the uncertainty, there is graph->GetErrorX(n) but it takes bin number n as an input and I don’t know that. I tried graph->GetXaxis()->FindBin(n)but I think this uses a different binning (?). I know that TGraph’s are unbinned, hence using a bin number is probably not a good idea. But how would I do something like graph->GetError(x)

Hi,
In fact Eval doesn’t return value at point but value from interpolation function. I suppose that only solution it’s making loop and checking all points e.g.

Double_t x,y;
for(int i=0;i<graph->GetN();i++){
	graph->GetPoint(i,x,y);
	if(x==what_you_want){
	return gr->GetEYhigh/low();
	}
}

Thanks. Yes, I did something similar now. Although x is not necessarily a point in the TGraph, so I first have to find the nearest point. Making a histogram out of this TGraphAsymmError is not possible either?

What do you mean by making histogram? Do you want to convert TGraphAssymErrors into TH1D? It might be problem because as far as I know TH1D doesn’t support “asymetric errors”

Hi,

Can you give us some context? What are you trying to do?

Axel.