elaird / supy

analyze events stored in TTrees in parallel
8 stars 7 forks source link

Dev obj read #175

Closed gerbaudo closed 11 years ago

gerbaudo commented 11 years ago

Hi Burt and Ted,

I was trying to use supy with trees that contain non-basic types, namely objects that inherit from TObject. I think I that this could work (the single-object branch should be almost there, while the vector branch still has some issues).

Could you please share your thoughts on this possible feature, please? I was wondering if this is something that wasn't implemented because you didn't need it, or if there is some technical obstacle in which I haven't bumped yet (and that I will discover soon... :-) ).

Thank you,

Davide

betchart commented 11 years ago

Hi Davide,

Ted and I have used the current implementation of wrappedChain to access ROOT::MATH::LorentzVector types, and vectors of those types since supy's inception. It was important that the correct dictionary be made available, otherwise it doesn't work. The extra code you've entered for the special case of 'class' in typeleaf doesn't look that different from the default catchall, so I am skeptical that any change at all needs to be made to wrappedChain. The specific cpp/ files probably belong in a satellite project (too specific for supy), but I appreciate the utility of providing them for the example tests.

As far as getting the right 'pragma' incantations to achieve dictionary recognition, you might check the examples in betchart/susycaf or betchart/topref.

https://github.com/betchart/topref/blob/master/configuration.py https://github.com/betchart/topref/blob/master/cpp/linkdef.cxx

It might be that I'm missing the problem that you're trying to solve, and if that's the case, please try to offer a more detailed description. A good thing to keep in mind is that PyROOT can do anything that CINT can do, so if you know how to do it in CINT first (sometimes easier), then you can get it done in PyROOT in short order.

gerbaudo commented 11 years ago

Hi Burt,

You are perfectly right. I was trying to read some ntuples from my group, and the error message got me off track. For some reason I thought that within supy I could only read basic types and vector, which is not the case once the dictionaries are loaded correctly. Sorry for the noise. I will now close this pull request. Thanks,

Davide

betchart commented 11 years ago

Hi Davide,

If there are branches in the ntuple that you don't need to read, but are giving you problems, you can always add them to the blacklist rather than work out the dictionary incantations.

Burt

gerbaudo commented 11 years ago

Hi Burt,

Thanks for the suggestion. I was actually loading the dictionaries correctly for all the branches, but some of the classes had a datamember 'eta' that would get python confused with TLorentzVector::eta(). Thanks again for your help!

Davide