"Promote" TGraph to TGraphErrors

Hi, I want to convert a TGraph I have into a TGraphErrors and I am finding this more tedious than I expected.

I would like to be able to do something like:

and have the object tge have zero for all the error entries. Unfortunately no such constructor exists.

As a related issue: why is there no overload for TGraphErrors in the case of constant errors? Currently it seems you have to make a new array or vector of constant numbers in order to construct your TGraphErrors, or construct it with 0 in place of the pointer, then iterate over the points to enter the constant value. I would expect it to be pretty common to need a TGraphErrors with all the same errors for the x or y values.


Hi Jean-François,

thanks for your suggestions.
For what concerns the promotion of the TGraph, the best way is still to either set up a loop on the points or to invoke the constructor needing the double/float arrays root.cern.ch/doc/master/classTG … b58c0a3ffb.