pyroot question about TTrees containing TObjects

From: Erkcan Ozcan <erkcan.ozcan_at_cern.ch>
Date: Fri, 20 Jan 2012 20:23:15 +0000


Hi,

I have recently started using pyroot extensively. One thing I found most useful/beautiful (thanks to all the developers!) is the fact that one does not need any of the MakeClass, SetBranchAddress, etc. stuff while reading TTrees as shown on page 359 of the User's Guide 5.26.

However I am having difficulty with the following situation: A TTree has branches that are from objects of some user-defined TObject-inheriting classes. I have neither the source code for the classes, nor the libraries. With MakeClass(), I would still some variables named blabla_xyz, which would correspond to blabla.xyz in the ROOT file. Is there a way to get the same functionality with some python magic?

To make the question more concrete, here is an example:

chain.Photon_size works fine, as this is a simple Int_t branch.
chain.Photon returns a <ROOT.TClonesArray object ("NtpPhotons")>
chain.Photon[1] returns a <ROOT.TObject object ("TObject")>, which has no Pt member in its dictionary. But if I do a MakeClass, I see members like: Double_t  Photon_Pt[kMaxPhoton];

I have searched for an answer and found some relevant posts like http://root.cern.ch/phpBB3//viewtopic.php?t=9450 but I would really appreciate if someone could point me to a more direct solution if possible.

Thanks a lot,
e.

--

In case they are not written explicitly, please be aware that my greetings and farewell are inherently implied in this email. If you have emailed me and did not get a quick response, please accept by apologies and resend, as I parse through more than 200 non-spam emails per day.

V. Erkcan Özcan, PhD
Bogazici University
Department of Physics
Received on Fri Jan 20 2012 - 21:23:22 CET

This archive was generated by hypermail 2.2.0 : Fri Jan 20 2012 - 23:50:01 CET