Re: [ROOT] Problem Filling a File

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Oct 06 2003 - 13:19:43 MEST


Hi Jose,

What you observe is the expected behaviour. You should create your branches
like:

MyTree->Branch("NumberOfData", &NTUPLE.number, "number/I");
MyTree->Branch("var1",         NTUPLE.var1,   "var1[number]/I" );
MyTree->Branch("var2",         NTUPLE.var2,   "var2[number]/I" );
MyTree->Branch("var3",         NTUPLE.var3,   "var3[number]/f" );
MyTree->Branch("va41",         NTUPLE.var4,   "var4[number]/f" );

See example in $ROOTSYS/tutorials/tree2.C

Note that, if using a class instead of a struct, you will need only
one call to TBranch. With a class, the branch creation is automatic.

Rene Brun

Jose Caballero wrote:
> 
> Hello:
> 
> I work with ROOT 3.05/05 on Linux RedHat
> 
> I have a Struct (C Like) similar to
> 
> struct ST{
> 
>    Int_t number;
> 
>    Int_t var1[1000];
> 
>    Int_t var2[1000];
> 
>    Float_t var3[1000];
> 
>    Float_t var4[1000];
> 
> } NTUPLE;
> 
> And then I define the following Branches:
> 
> MyTree->Branch("NumberOfData", &NTUPLE.number, "number/I");
> 
> MyTree->Branch("DATA1",         NTUPLE.var1,   "var1[number]/I:var2[number]" );
> 
> MyTree->Branch("DATA2",         NTUPLE.var3,   "var3[number]/F:var4[number]" );
> 
> When I execute MyTree->Fill(), and I Draw the content of the file, var1 and va2 have the same information, and var3 and var4 have the same information ...
> 
> Why? What am I doing wrong?
> 
> Thank you very much in advance for your help and patience.
> Jose Caballero.



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET