Re: [ROOT] Unexpected reading of TH1 objects from a tree

From: Nesterov Stanislav (qleap@mail.pnpi.spb.ru)
Date: Mon Jun 17 2002 - 17:38:42 MEST


Hello Rene,

 Thank You for Your reply. Now I understand the point..
 Now I just want to ask: 
    1) why objects start to duplicate in my case?
    2) is it really good to create objects in memory by default while
reading a tree?
    3) if I don't want default behavior what should I do ( I mean, what
flag must be set to avoid creating objects in memory).

   Once more Thank You very much
			Best regards,
					Stanislav.

On Mon, 17 Jun 2002, Rene Brun wrote:

> Hi Nesterov,
> 
> When calling whell->GetEntry, you request to read all the branches
> of your Tree. If you want to read only one single branch, get
> the pointer to the branch and call branch->GetEntry.
> 
> In your case, you should do something like:
> 
> TBranch *b_Spec = wheel->GetBranch("Spec");
> TH1 *Spec=0;
> b_Spec->SetAddress(&Spec);
> b_Spec->GetEntry(22);
> delete Spec; Spec=0; //to delete the current hist
> Spec=0; // if you want to keep the current hist in memory
> b_Spec->GetEntry(23); /etc..
> 
> Rene Brun
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:57 MET