Gines,
Why to do things complicated when they can be simple? ::)
void test4()
{
TTree T("test","test",99);
TNamed * data1 = new TNamed("AAAA","AAAA");
TNamed * data2 = new TNamed("BBBB","BBBB");
T.Branch("A","TNamed",&data1,35000);
T.Branch("B","TNamed",&data2,35000);
T->Fill();
Int_t nentries = T.GetEntries();
printf(">>> nentries=%d \n",nentries);
TNamed * lire = 0;
TNamed * lire2 = 0;
T.SetBranchAddress("A",&lire);
T.SetBranchAddress("B",&lire2);
T.GetEvent(0);
lire->Print("");
lire2->Print("");
}
Rene Brun
Gines MARTINEZ wrote:
>
> Hi,
> ===
> gcc -v
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
> gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)
> root-config --version
> 3.05/07
> ===
> I would like to create branches in a tree, subsequently.
> Enclosed, you will find a macro with 3 function test1() test2() and test3().
>
> In test1, when a new branch is created, the TTree::Fill() method is used.
> You realize that the first event contains AAAA in branch A and BBBB in branch B.
> This is what we want, however, Tree T contains two entries and we would like to
> have only one entry.
>
> In test2, the problem with the number of entries is solved, since when B branch
> is created we only fill the branch B.
> In this case the only problem is "B" should be fill always after branch A is
> created and "A" should be there.
>
> In test3, I thought this would be the solution, when a branch is created it is
> filled using TBranch::Fill().
> However, I realize this is not working for the branch "A".
> I realize that the number of entries is 0.
> I would like to know why option test3() is not working, since this is the option
> I would implement in my code.
>
> Thanks in advance, Ginés
>
> --------------------------------------------------------------------------------
> Name: test.C
> test.C Type: Plain Text (text/plain)
> Encoding: 7bit
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET