Re: [ROOT] accessing several variables inside a branch.(more info)

From: Luiz Martins Mundim Filho (mundim@uerj.br)
Date: Fri Mar 28 2003 - 14:38:40 MET


Hi Philippe

THANK YOU VERY MUCH. You are right, the code was generated by HepTuple.
So, if I understood well, the best solution is to create structures and 
set the Leaf address
for all of the variable, in such a way I can use, for instante:

ELE_LOOSE_VTX_p_off.n -> number of electrons

and so on?

Thanks again.

Philippe Canal escreveu:

>Hi Luis,
>
>You have the bad luck of having a problem when all the root team members are
>in a conference.  Anyway, I just looked at your C/h files and they seems to
>look as I would expect.  In your case (using struct or variables instead of
>classes) the resulting tree contains one branch for many variables.  It is
>expected that the SetBranch is called only once per branch (so much less
>than the number of leaves in your cases).
>
>One thing that might explain why you can not read the data using those files
>is the size of the array.  In some cases (like older version of HepTuple in
>conjunction with user's code mis-coding) MakeClass could get confused with
>the actual size of the array.  Figuring out what the length should be
>involves calling GetOffset on one leaf per branch and its successor (in the
>same branch) and divide the difference by 4 (the  size of ints and floats).
>Alternatively you could call TLeaf::SetAddress for all the leaves in the
>Notify method.
>
>In addition, unless you used HepTuple or some other sofisticated code, it is
>very possible that that the data is incorrect because your have the index of
>the array on the same branch and use the same name in different branch.
>
>Cheers,
>Philippe.
>
>-----Original Message-----
>From: owner-roottalk@pcroot.cern.ch
>[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Luiz Martins Mundim
>Filho
>Sent: Thursday, March 27, 2003 8:13 PM
>To: roottalk@pcroot.cern.ch
>Subject: [ROOT] accessing several variables inside a branch.(more info)
>
>
>I included in attachment the skeleton program generated by MakeClass. I
>noticed that there are much less branch addresses set up than the number
>of branchs/leaves (in case it has been split) that exist on the tree.
>
>
>---------------------------------------------------------------------
>
>I sent this message yesterday and got no reply. I checked the roottalk
>rules and I do not think this messages is not in accordance with them,
>so I'm posting it again, since I need urgente help because I need to get
>some result till monday.
>Thanks in advande for you help.
>
>
>---------------------------------------------------------------------
>Hello
>
>I have a Tree with several branches and inside them, also several
>leaves. This tree has not been written by me, but I have to analyse it.
>
>I generated a skeleton code (using both MakeClass and
>MakeSelector), but I could not access the data I want with the code root
>gave me. I can draw the variable using tree->Draw("branch.var"), but when
>trying to access them inside the skeleton program, it fails. I realized that
>on the header file, the variables are defined like
>
>branchname_var
>
>(with an underscore), that means, it do not seem to be a structure like
>object.
>I tried several variation of statements and all of them failled.
>
>Do I need to add more (accessing) code to be able to read the data, like
>setting branch /leaf address? I mean, apart from the the code particular
>to the my analysis? I guessed
>that MakeClass and/or MakeSelector should write a skeleton ready to
>access the data.
>
>I took a look on the root pages and found nothing conclusive, since all
>the instruction seems to be related to unamed macro. I also downloaded
>the new
>User Guide and it did not help me too.
>
>Other information:
>
>Root version: 3.05/03
>OS          : Linux Red Hat 8.0
>
>In attachment it is a file describing the ntuple variables, since the
>tree is too big and I cannot generated a smaller one. The important
>branch for me is one starting with ELE (for eletrons) and ending with p_off:
>
>p      -> means physics information (d stands for debug information)
>off   -> off line processing.
>
>Thank you.
>
>
>
>
>
>  
>



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