Hi Timur,
I tried the code and the results are quite the same; maybe the issue it’s related with the TChain, the histograms draws fine and reproduces the cuts imposed. But the max and min are always related to the entire data collection.
Regards
[quote=“tpochep”]Hello cederik.
I think, what you need is an ‘entry list’, not an event list. And also, after a tree/chain creates this entry list in its Draw, you have to apply the selection:
[code]void evlist()
{
TTree tree(“tree”, “tree”);
Double_t x = 0;
tree.Branch(“x”, &x, “x/D”);
const unsigned nPoints = 1000;
const Double_t xMin = -10., xMax = 10., xStep = (xMax - xMin) / (nPoints - 1);
for (unsigned i = 0; i < nPoints; ++i) {
x = xMin + i * xStep;
tree.Fill();
}
std::cout<<"min == "<<tree.GetMinimum(“x”)<<std::endl;
std::cout<<"max == "<<tree.GetMaximum(“x”)<<std::endl;
tree.Draw(">>eList", “x>0”, “entrylist”);//Note: “entrylist” is a special option!
//Actually, it’s better to check the real type of object,
//but dynamic_cast does not work with CINT.
TEntryList * const eList = (TEntryList*)gDirectory->Get(“eList”);
if (eList) {
tree.SetEntryList(eList);
std::cout<<“After cut applied:\n”;
std::cout<<"min == "<<tree.GetMinimum(“x”)<<std::endl;
std::cout<<"max == "<<tree.GetMaximum(“x”)<<std::endl;
}
}
[/code]
As I’ve never worked with TTree/TChain, I can be wrong and may there is another way to use this ‘selection’ mechanics, but give it a try.
Best regards,
Timur.[/quote]