Hi Daniel,
You can do this when in "MakeClass" mode. In this case,
you must be careful to set the addresses for all active branches
or read only the specified branch, eg:
TTree *atree = (TTree*)file->Get("atree");
atree->SetMakeClass(1);
TBranch *br = atree->GetBranch("energy");
double energy;
br->SetAddress(&energy);
br->GetEntry(10);
cout <<energy<<endl;
Rene Brun
On Tue, 1
Apr 2003,
Daniel De Marco wrote:
> Hi All,
>
> I have a program that creates a root file with an Event branch. The branch
> is split so opening the file in root I can Draw the variables inside Event
> just doing (assume that in Event there is: double energy;)
> atree.Draw("energy")
> Is it possible to do a similar thing with SetBranchAddress? I mean to use
> the split variables as if they weren't in a class?
> Something like this:
> double energy;
> atree->SetBranchAddress("energy",&energy);
> atree.GetEntry(10);
> I tried this approach, but the energy variable doesn't change.
>
> Thanks is advance.
> Ciao, Daniel.
>
> --ddm
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET