Maximum/Minimum of entries in a RooDataSet

I’m interested in finding the maximum of the the entries in a RooDataSet.
I’ve had a look and didn’t find a native RooFit method for this. Instead I tried to acccess the maximum with
maximum=data->tree().GetMaximum(“variable name”);
This works fine interactively, but ACLiC complains about const-ness problems:
error: passing const TTree' asthis’ argument of `virtual Double_t TTree::GetMaximum(const char*)’ discards qualifiers

What can I do instead?


It is probably fine to do just this and cast the const away, pending the answer on the question below:

–> Question to the ROOT team: Is there a reason that TTree::GetMaximum() not a const function?

Alternatively you can also use

RooDataSet::getRange(RooRealVar& var, Double_t& lowest, Double_t& highest, Double_t marginFrac=0, Bool_t symMode=kFALSE) const ;

to retrieve the minimum and maximum value of any observable in a dataset.


Making TTree::GetMaximum, GetMinimum const is quite difficult. The functions are overloaded in TChain where constness is difficult to implement without cheating.


Thank you for the quick response.