Recasting a tgrapherrors as a TH1D

Hi all,

I have a tgrapherrors which is really a pain to use cuz of the point like nature of the data. I was wondering if root allows someone to cast an existing tgrapherrors as a th1d so I can more easily manipulate the bins.

Thanks for any help,


Actually, exactly the opposite is easy: TGraphErrors:TGraphErrors(const TH1* h)

Hey Pepe,

Yeah I saw that in the constructor for a TGraphErrors, I guess the answer is something like the following:

TH1D* hcopy = (TH1D*) histoWithBinsILike->Clone();

for (int i=0;i<graph->GetN();i++)
double x = graph->GetX()[i];
double y = graph->GetY()[i];