Re: (no subject)

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


Sorry, I forgot to mention that I first tried what you suggested and it did not work (By the way
why it should work if the tree can have in principle different branches each having
different number of events? What does it mean "Entries" in this case?) Thus I though that you probably meant setting number of events in the given branch.
Just a check of your first message:

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->SetEntries(2)
(Long64_t)2
root [4] t->GetBranch("fEvent")->GetEntry(0) (Int_t)425
root [5] t->GetBranch("fEvent")->GetEntry(1) (Int_t)0

Just a check that each event has its 1 event:

root [0] TFile f1("t1.root")
root [1] TTree *t1 = (TTree*)f1.Get("nuclon")
root [2] t1->GetBranch("fEvent")->GetEntries()
(const Long64_t)1
root [3] TFile f2("t2.root")
root [4] TTree *t2 = (TTree*)f2.Get("nuclon")
root [5] t2->GetBranch("fEvent")->GetEntries()
(const Long64_t)1

Rene Brun wrote:

> You did not read my mail correctly. I told you to do
> t->SetEntries(nentries);
> and not
> t->GetBranch("fEvent")->SetEntries*();
>
> Rene Brun
>
> On Thu, 24 Nov 2005, Dmitry Naumov wrote:
>
>> 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:53:38 MET

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