Re: (no subject)

From: Dmitry Naumov <naumov_at_nusun.jinr.ru>
Date: Thu, 24 Nov 2005 18:39:16 +0300


Dear Rene,

thank you for this advice. I tried it but it does not read anyway the second event:

root [0] TChain *t = new TChain("nuclon") root [1] t->AddFile("t1.root")
(Int_t)1
root [2] t->AddFile("t2.root")
(Int_t)1
root [3] t->GetBranch("fEvent")->SetEntries(2) root [4] t->GetBranch("fEvent")->GetEntries() // to check! (const Long64_t)2
root [5] t->GetBranch("fEvent")->GetEntry(0) (Int_t)425 // OK
root [6] t->GetBranch("fEvent")->GetEntry(1) (Int_t)0 // empty ?!

root Version 5.02/00
Dmitry

Rene Brun wrote:

> Dmitry,
>
> Call t->SetEntries(nentries);
> where nentries is the number of entries if your branches.
>
> Rene Brun
>
> On Thu, 24 Nov 2005, Dmitry Naumov wrote:
>
>> Dear rooters,
>>
>> I have a strange problem:
>> I create TTree with two branches: fRunPars and fEvent.
>> fRunPars is filled only once and it containes simulation settings
>> fEvent s filled for each event:
>>
>> fTree->GetBranch("fEvent")->Fill()
>>
>> Now I created a set of files with these trees. I want to make a
>> TChain of them:
>> TChain *t = new TChain("nuclon");
>> t->AddFile("t1.root"); // has 1 event
>> t->AddFile("t2.root"); // has 1 event
>> t->GetEntries(); // gives 0. It is OK because TTree
>> // has two branches one of
>> which is filled
>> // many times, another only
>> once, thus Entries probably has no sense
>> t->GetBranch("fEvent")->GetEntries(); // gives 1 ?! Why not 2?
>>
>> If I do
>> t->GetBranch("fEvent")->GetEntry(0); // it is OK
>> t->GetBranch("fEvent")->GetEntry(1); // this event is empty.
>>
>>
>> Do I misunderstand something? Many thanks in advance, Dmitry
>>
Received on Thu Nov 24 2005 - 15:39:04 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:13 MET