Hi everyone,
I am quite enthusiastic about the features provided by your software! I like the RootObjectWriter for output due to the nice compression and file design, but I am not a ROOT person at all, more of a python type. I would prefer using the uproot package to read the data but it constructs itself surprisingly difficult. Maybe I am just a bit stupid, but I just cannot get it done properly… I would be very happy about some help/ enlightenment… so don’t judge me too hard, if my question does not make sense, is obvious or whatsoever
Some first struggles I could handle after some contact with the maintainers there, so that I can now read stuff so far that I get the individual entries from the MCParticle vector which have currently the following entries:
first_entry._fields =
['local_5f_start_5f_point_5f_',
'global_5f_start_5f_point_5f_',
'local_5f_end_5f_point_5f_',
'global_5f_end_5f_point_5f_',
'particle_5f_id_5f_',
'time_5f_',
'parent_5f_',
'track_5f_']
This is quite nice already and I can wrap this into so-called uproot-methods for proper getter methods for our project and everyone else. We want to simulate a time-of-flight system, so particle_id, parent and time are already awesome to get in this easy fashion. To create nice views of the particles hitting the detector though, it would be great to access the hit positions in the global and local start/end points.
At uproot though, we (well, the maintainer to be honest) hit a hard stop though trying to read the contents of the ROOT::Math::XYZPoint entries for the MCParticles, which are the local and global start and end points. There seems to be a problem with the embedded TStreamer describing the data which does not correctly deserialize the data types. The mentioned data types all include 4 byte objects which seem not to make to much sense to the interpreter. By extending uproot with a custom class (see code included in github issue mentioned above), the uproot maintainer could help me read the file. It basically just skips the first 20 byte entries (6 byte headers and 4 byte randomness each for the bunch of ROOT::Math::PositionVector3D<ROOT::Math::Cartesian3D<double>,
). This allows me to do something like
particle = t["detector1"].array()[0][0] # first particle in detector 1 in event 1
position = particle._global_5f_start_5f_point_5f_
print(position._x, position._y, position._z) # --> this is the hit i am after basically
Weird about this is also, that the ROOT Streamer indicates a wrong version number 0 which should not be. This might help maybe towards understanding what’s going on.
I suspect, the bit
/**
* @brief ROOT class definition
*/
ClassDefOverride(MCParticle, 6);
/**
* @brief Default constructor for ROOT I/O
*/
MCParticle() = default;
might have something to do with all this.
So the questions are:
- is this a dumb question?
- do you have experiences with uproot?
- do you think there might be something with the TStreamers embedded in MCParticle (and potentially other classes)?
- can I/ we do something about it? Reading data with uproot is so nice compared to PyROOT
Thanks so much to everyone taking the time reading through this bit