Re: [ROOT] Filling branches independently

From: Gines MARTINEZ (martinez@subatech.in2p3.fr)
Date: Wed Sep 17 2003 - 12:04:47 MEST


Rene,
Of course your option test4() solve the problem.
My macro test.C was a simplification.
The problem I have is that my analysis (alirooot MUON) 
is splitted in two reconstructions : reconstruction A and reconstruction B.
Both reconstructions use the same tree.
I would like to perform reconstruction A+B or B+A or A only or B only.
Reconstruction means also reading form a file(s) and writing in a file(s).
In this frame your option test4() does not work, but option test3() should work.
I do not understand why i cannot fill only one branch in option test3()
I hope it is clearer now.
Thanks for your help, Gines



Rene Brun wrote:
> 
> 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

-- 
http://www-subatech.in2p3.fr/~plasma/martinez/GinesMartinez.html



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