Re: Access to each ntuple element

From: Nam Young Kim (Nam.Young.Kim@cern.ch)
Date: Mon Jan 03 2000 - 11:58:06 MET


Hi..

TFile *ntfile = new TFile("your file","READ");
TTree *si_adc = (TTree*)ntfile->Get("si_adc");

Float_t inx;
si_adc->SetBranchAddress("inx",&inx);

Int_t nentries = si_adc->GetEntries();
Int_t nbytes = 0;

for (Int_t i = 0;i<nentries;i++) {
    nbytes = si_adc->GetEntry(i);

   // This is your space //

}

bye.
NYKim


On Thu, 30 Dec 1999, Jayoung Wu wrote:

> Hi,
> 
> I created a ntuple, for example
>    TNtuple *si_adc = new TNtuple("si_adc","SIADC","inx:iny:lay:lad:pat:pix:a0");
> And I filled the ntuple.
> 
> Later I want to access that ntuple by
>    TNtuple *si_adc = (TNtuple *)ntfile->Get("si_adc");
> 
> Then what should I do to access to indivisual variable, for example, 
>    inx, iny , a0. ... ?
> Should  I do something like si_adc->inx->SetAddress(&inx)?
> 
> ---
> Thanks,
> Jayoung
> 
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:16 MET