I would like to plot using TGraph. With
SetPoint(Int_t i, Double_t x, Double_t y)
I need the first argument to be a float or a double. Is it valid to typecast Int_t i to Float_t i , so that
SetPoint(Float_t i, Double_t x, Double_t y)
Or do i need to do something else?
I don’t really know what you’re trying to achieve.
For the “TGraph::SetPoint”, the first parameter is the “point number” so it is a “discrete” positive number (from 0 to “total number of points” - 1).
There is no problem if you cast:
or maybe better:
((Int_t)(MyFloat + 0.5))
If you need to store three float/double values, see the “TGraph2D” class: http://root.cern.ch/root/html/TGraph2D.html