Hi,
I am using version 3.05/00 of root under linux
I don’t manage to read several trees with a TChain. I try to with this piece of macro :
TChain t1(“Global”);
t1.Add(“189227_001_p160100.root”);
t1.Add(“189227_002_p160100.root”);
t1.SetBranchStatus("*",0);
t1.SetBranchStatus(“L3MuoPR”,1);
TBranch *_B1PR = t1.GetBranch(“L3MuoPR”);
_h1_MUON_chisq = new TH1F("_h1_MUON_chisq","",50,0,500);
Int_t _i1_NMUON;
TLeaf *_L1_NMUON = _B1PR->GetLeaf(“L3Muon_01_off_NMUON”);
_L1_NMUON->SetAddress(&_i1_NMUON);
Float_t _f1_MUON_chisq[200];
TLeaf *_L1_MUON_chisq = _B1PR->GetLeaf(“L3Muon_01_off_MUON_chisq”);
_L1_MUON_chisq->SetAddress(&_f1_MUON_chisq[0]);
for (Int_t i=0; i<N; i++)
//for (Int_t i=0; i<t1.GetEntries(); i++)
{
t1.GetEntry(i);
_h1_NMUON->Fill(_i1_NMUON);
for (Int_t j=0; j<_i1_NMUON; j++)
{
if (_f1_MUON_chisq[j] != -1) _h1_MUON_chisq->Fill(_f1_MUON_chisq[j];
}
}
Then my problems :
1)The call of t1.GetEntries() in the program produces a strange results, the trees are not read! _i1_NMUON variable is always 0 and
_h1_MUON_chisq is empty.
2)I replaced t1.GetEntries() by Int_t N = X and this time the first tree is read correctly but for the second I have the same problem encountered in 1) (X>number of entries of first tree of course)
3)I keep the use of N in my loop and I just add a
cout <<t1.GetEntries() before the loop. The result is same as 1). The call of GetEntries() seems to be responsible for this. I also try to add the cout <<t1.GetEntries() in the loop when i>3 for instance and the result is that the first 3 entries are read correctly and for the others, still the 1) problem.
So, does anyone sees a mistake or have any idea?
thanks, vincent