TTree::GetMaximum()

Hello,

My tree consists of two branches:

*Br 1 :si : E[4][10][28][4]/F:Ed/F
*Br 5 :bgo : E[8][20][2]/F:ELayer[8]/F:Ed/F

As you can see, both branches contain the leaf “Ed”.
How can I get the maximum of “Ed” in “bgo” branch without drawing/projecting a histogram? The method T->GetMaximum(“bgo.Ed”) doesn’t work in this case.

Thank you,
Konstantin Batkov

Hi,

What is the error message? (i.e. how does it fail)?
Can you send me your root file (or a way to reproduce it)?

Cheers,
Philippe.

It doesn’t fail. Let’s consider this simple code:

[code]{
gROOT->Reset();
struct data1
{
Float_t fx;
Float_t fy;
} branch1;

struct data2
{
Float_t fy;
Float_t fz;
} branch2;

TFile *pFile = new TFile(“test.root”, “recreate”);
TTree *pTree = new TTree(“T”, “test tree”);
pTree->Branch(“br1”, &branch1, “x/F:y/F”);
pTree->Branch(“br2”, &branch2, “y/F:z/F”);

for (Int_t i=0; i<5; i++)
{
branch1.fx = i;
branch1.fy = i2;
branch2.fy = i
3;
branch2.fz = i*4;
pTree->Fill();
}
pTree->Write("", TObject::kOverwrite);
pFile->Write();
pTree->Print();
pFile->Close();
}
[/code]
As you can see, x and z leafs exist only in one branch (br1 and br2 accordingly), but y leaf belongs to both branches.
T->GetMaximum(“x”) gives 4 - that’s right;
T->GetMaximum(“z”) gives 16 - and that’s right too;
But my question is: how can one get the maximum of y column in the second branch, for example? I was awaiting to say:
T->GetMaximum(“br2.y”), but it gives 0 instead of 12!

The prototype of GetMaximum() method is
Double_t TTree::GetMaximum(const char *columname)
What does columname mean in this very case?

This a bug in the ROOT code. The simpliest work-around is to generate an histogram.

Cheers,
Philippe.