Re: getting values of leaves from ntuples

From: Timothy Smith (tim_smith@MIT.EDU)
Date: Fri Sep 06 2002 - 14:41:03 EDT


Hello Jason,

        It looks to me as if you root file is just a simple ntuple?
If that is true then, I think, you read it like you can loops
through an ntuple.

        Float_t p;
(if t is you ntuple)
        t->SetBranchAddress("leafp",&p);
         Int_t nentries = n->GetEntries();
          Int_t nbytes = 0;
        Int_t i;
          for ( i=0; i<nentries;i++) {
                    nbytes->GetEntry(i);
                cout << p << endl;
        }

                Tim
On Fri, 6 Sep 2002, Jason Seely wrote:

> hi eveyone,
>
> how's it going?  i'm trying to figure out how to get the numerical value
> of a leaf in a chain for a particular event.  This seems like it should
> be straightforward, but i can't find a member that does it.  i would like
> to be able to do something like this:
>
>   TChain *t = new TChain("ntp");
>   t->Add("rootfile.root");
>
>   Float_t p = t->GetValue("leafp",eventindex);
>
> does any one know an easy way to do this?
>
> thanks,
>
> jason
>
> -- 
> --------------------------------------------------------------------
> jason seely
> 26.650.b
> massachusetts institute of technology
> 77 massachusetts avenue
> cambridge, ma 02139-4307
>
> email:  seely@mit.edu
> phone:  617.253.4772/6734
>  html:  web.mit.edu/seely/www
> --------------------------------------------------------------------
>  
>

-- 
____________________________________________________________________
 Timothy Paul Smith                     Assistant Research Professor
      still using my MIT email for now ->          tim_smith@mit.edu
      no voice mail yet                ->       tel:  (603) 646-9346
 Dartmouth College
 Department of Physics and Astronomy
 6127 Wilder Lab. 
 Hanover, New Hampshire 03755



This archive was generated by hypermail 2.1.2 : Mon Feb 24 2014 - 14:07:28 EST