Hi,
Is there any way currently (6.10.04) to get the Maximum or minimum value for a TMultiGraph
? I see methods for setting, but not for getting.
Thanks
Hi,
Is there any way currently (6.10.04) to get the Maximum or minimum value for a TMultiGraph
? I see methods for setting, but not for getting.
Thanks
I attempted to add Getter methods, but they always return -1111
virtual Double_t GetMaximum() const {return fMaximum;}
virtual Double_t GetMinimum() const {return fMinimum;}
For that matter, even TGraph
which already has the methods responds the same way:
{
const int n = 3;
const double x[n] = {5.5, 6.7, 9.8};
const double y[n] = {34.4, 56.8, 12.3};
TGraph g(n,x,y);
std::cout << g.GetMinimum() << " " << g.GetMaximum() << "\n";
g.Draw();
std::cout << g.GetMinimum() << " " << g.GetMaximum() << "\n";
}
$ root test.C
root [0]
Processing test.C...
-1111 -1111
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
-1111 -1111
root [1]
what about:
g->GetHistogram()->GetMaximum();
Ahh, yes that meets my needs. It does leave the question of what TGraph::SetMaximum
purpose is?
It is a shortcut to
GetHistogram()->SetMaximum().;
See the code here:
https://root.cern/doc/master/TGraph_8cxx_source.html#l02138
Ok, that narrows it down to why is GetMaximum()
not a shortcut? I see that SetMaximum()
sets fMaximum
, but that this value is not set anywhere else, why do we need fMaximum
at all if the value is stored in the histogram?. Calling GetMaximum()
without ever calling SetMaximum()
only returns the default -1111
value, since the fMaximum
value is not set from the histogram. I would go ahead and change this, but it is not clear to me what the intended behavior is.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.