Re: TNtuple class: only 14 entries in Fill?

Jiri Masik (jmasik@pcfzu1.cern.ch)
21 Jul 1999 10:29:08 +0200


Hi Peter,

you can use TTree which has no such limitation.
http://root.cern.ch/root/html/TTree.html has a simple example program
how to use TTree as an ntuple replacement.

Jiri

Send your questions to roottalk@root.cern.ch, I'm afraid posts to
cern.root don't go to the list.

irrgang@zedy07.desy.de (Peter Irrgang) writes:

> Hi ROOT users,
>
> I'm an absolute beginner in ROOT so, my question may be silly ...
>
> Description of the problem:
> I try to use the NTuple class in a function. But I need more than 14
> entries (32 at least for every event I want to fill with
> ntuple->Fill(data[0],...,data[31])).
> My program works fine, if I use only 14 entries
> ( ntuple->Fill(data[0],...,data[13]) ), but to solve my problem I need
> 32 entries.
> In the definition of NTuple class there are only 14 entries mentioned.
> But I think thats a joke, isn't it? This limitation is to strong. So I
> guess, I'm wrong and it is possible to fill the ntuple with 32 entries
> but I don't know how. Can you help me?
>
> Thanks a lot!
>
> Peter
>
>
>
>
>
>
> The code:
>
> void analtb(const Char_t *fname_raw, const Char_t *fname_root){
>
> ...
>
> Char_t dataline[16];
> float data[64];
> int ncols,valnum;
> TFile *f = new TFile(fname_root,"RECREATE");
> TNtuple *ntuple = new TNtuple("ntuple","test data","data[0]:data[1]:
> data[2]:data[3]:data[4]:data[5]:data[6]:data[7]:data[8]:data[9]:data[10]:
> data[11]:data[12]:data[12]:data[13]:data[14]:data[15]:data[16]:data[17]:
> data[0]:data[18]:data[19]:data[20]:data[21]:data[22]:data[23]:data[24]:
> data[25]:data[26]:data[27]:data[28]:data[29]:data[30]:data[31]");
>
> ...
>
> FILE *fp = fopen(fname_raw,"r");
>
> ...
>
> ncols = fscanf(fp,"%s",dataline);
>
> ... (processes the data in the variable dataline into an array of 32 float
> number and write it into data[0],data[1],...,data[31])
>
> ...
>
> ntuple->Fill(data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7],
> data[8],data[9],data[10],data[11],data[12],data[12],data[13]),data[14],
> data[15],data[16],data[17],data[0],data[18],data[19],data[20],data[21],
> data[22],data[23],data[24],data[25],data[26],data[27],data[28],data[29],
> data[30],data[31]);
>
> fclose(fp);
> f->Write();
> return(0);
>
> }
>

--