I have a file that contains TGeoTracks on one branch element. TGeoTracks have two private members that I'm interested in, a number of points and an array that's 4*nPoints (https://root.cern.ch/doc/master/TGeoTrack_8h_source.html#l00040).
private :
Int_t fPointsSize; // capacity of points array
Int_t fNpoints; // number of stored points
Double_t *fPoints; //[fNpoints] array of points (x,y,z,t) belonging to this track
This is that the ROOT file looks like in the TBrowser:
Note that the interpretation in the TBrowser is slightly misleading since all four elements per event are stored in the same histogram.
Now, I'm trying to read the file with uproot. The default interpreation for this branch element was wrong:
mcFileThin1_5 = uproot.open("/media/CacheDrive2TB/Arbeit/PandaRoot/macro/detectors/lmd/testFullChain-thinKapton/mom-1_5/Lumi_MC_0.root")
startXarray = mcFileThin1_5["pndsim/GeoTracks.fPoints"]
print(startXarray.interpretation)
AsObjects(AsArray(True, False, AsArray(False, True, dtype('>f8'), ()), ()))
So i tried with a custom interpretation:
mcFileThin1_5 = uproot.open("/media/CacheDrive2TB/Arbeit/PandaRoot/macro/detectors/lmd/testFullChain-thinKapton/mom-1_5/Lumi_MC_0.root")
startXarray = mcFileThin1_5["pndsim/GeoTracks.fPoints"]
dtype = np.dtype([("x", ">f8"),("y", ">f8"),("z", ">f8"),("t", ">f8")])
interpret = uproot.AsDtype(dtype)
arr = mcFileThin1_5["pndsim/GeoTracks.fPoints"].array(interpret)
But that fails:
ValueError: basket 0 in tree/branch /pndsim;4:GeoTracks/GeoTracks.fPoints has the wrong number of bytes (22902) for interpretation AsDtype("[('x', '>f8'), ('y', '>f8'), ('z', '>f8'), ('t', '>f8')]")
in file /media/CacheDrive2TB/Arbeit/PandaRoot/macro/detectors/lmd/testFullChain-thinKapton/mom-1_5/Lumi_MC_0.root
How can I specify the interpretation of this branch element to be four doubles per point?