You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm wondering if this is at all possible with rootpy; I have an existing python data model (sketch below), which i want to convert/migrate to a rootpy one:
class ReconstructedPosition(object):
x
y
....
class Peak(object):
area
detector
...
reconstructed_positions = list(ReconstructedPosition)
class Event(object):
event_number
dataset_name
...
peaks = list(Peak)
From the examples, I see the only possible "hierarchical" modeling is by passsing .prefix()/.suffix(), but this essentially flattens the model, as the attributes are copied over.
The user_object example would be a good start (except that generating C++ code is ugly), but then I would need somethng like ObjectArrayCol or stl.vector to model the collection of peaks, etc.
Is it possible at all to make this kind of truly hierarchical structure with rootpy in a clean way?
Thanks upfront!
The text was updated successfully, but these errors were encountered:
Hmm... Handling nested structure like this with TreeModel is currently not implemented, unless, like you say, you use stl.vector and structs.
The hierarchical nature of TreeModel is really in the sense that you can define a basic object like a FourVector and extend that in subclasses for separate types of particles (for example), as well as mixing classes through multiple inheritance.
Any list of something is probably best implemented as a vector in the TTree. This is what I've used in various TreeModels, but it always feels more finicky than it should.
I agree that implementing something to automatically map such a nested structure to the appropriate vectors (possibly nested vectors) would be very useful.
Hi,
I'm wondering if this is at all possible with rootpy; I have an existing python data model (sketch below), which i want to convert/migrate to a rootpy one:
From the examples, I see the only possible "hierarchical" modeling is by passsing
.prefix()/.suffix()
, but this essentially flattens the model, as the attributes are copied over.The user_object example would be a good start (except that generating C++ code is ugly), but then I would need somethng like ObjectArrayCol or stl.vector to model the collection of peaks, etc.
Is it possible at all to make this kind of truly hierarchical structure with rootpy in a clean way?
Thanks upfront!
The text was updated successfully, but these errors were encountered: