-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR: TBasket not defined #14
Comments
That's weird, it seems that the basket reading is somehow messed up. Is it possible to upload the file somewhere? I'll try to find some time to investigate... |
it is 600Mb, are you willing to download :) ? |
Yep sure |
https://cernbox.cern.ch/index.php/s/AzrPeo78d0bPGMA f = ROOTFile(joinpath(pathto_folder, "Ob2XicKK_tree.root"))
f["DecayTree"] # ERROR: zlib error: incorrect header check (code: -3)
#
f = ROOTFile(joinpath(pathto_folder, "Ob2XicpKpi_tree.root"))
f["DecayTree"] # ERROR: UndefVarError: TBasket not defined thanks! |
Thanks! Do you happen to have also the other file with the zlib-error? |
(edited) I misread the message first |
OK I see, so for now I will have a look at this UnROOT is currently an experimental package and I made it work with files from our own experiment (with custom streamers), so don't expect too much. I also have little time currently, but I will try my best to fix trivial issues! |
Now I see the second file "Ob2XicKK_tree.root" in your CERN box, it was not there before |
ah, perhaps, the cernbox took time to upload it |
I have no real progress yet, I suspect that it might be something related to the compression library I use. I will do a side-by-side comparison with |
TKey says the uncompressed data is slightly longer than 2^24, reading first 2^22 seems okay. I wonder if it's because some kind of default chunking in Zlib. maybe we just need to find that keyword argument. |
I know what's going on. The maximum of using the Which makes both of those files run into:
now upon further investigation, uproot would unpack TBasket in-place when it runs into one so there's not really a type/struct we need to define. will investigate soon |
update: julia> r["DecayTree"]
position(io) = 627
ERROR: UndefVarError: TBasket not defined
Stacktrace:
julia> ds = UnROOT.datastream(i, tkey)
julia> seek(ds, 627)
IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=30304363, maxsize=Inf, ptr=628, mark=-1)
julia> UnROOT.unpack(ds, UnROOT.TBasketKey)
UnROOT.TBasketKey
fNbytes: Int32 0
fVersion: Int16 2
fObjlen: Int32 255922
fDatime: UInt32 0x9c421000
fKeylen: Int16 78
fCycle: Int16 0
fSeekKey: Int64 0
fSeekPdir: Int64 0
fClassName: String "TBasket"
fName: String "nEvent"
fTitle: String "DecayTree"
fBufferSize: Int32 256000
fNevBufSize: Int32 4
fNevBuf: Int32 42640
fLast: Int32 170638 it is indeed just a basket in the middle of no where... |
OK, so it seems that we need to keep track of the |
It's not the sort of thing that would be documented as such; it's an artifact of how TTrees get written when an error interrupts the write. The completely different place is embedded within the TBranch—i.e. in the TTree object that contains all TBranches and TLeaves. A TBranch has a single TBasket attribute, which is the uncompressed TBasket that it was filling at the time when the writing process shut down. Under normal conditions, this TBasket is filled until it reaches its maximum capacity, then it's compressed and stored as an independent object, where we normally get TBasket data from. I can point you to some Uproot code that deals with this specifically. (The ROOT code doesn't call it out as a separate thing because that embedded TBasket is part of the TBranch streamer.) Ordinarily (when (I'm reminded by the code above that it's not just one TBasket: it's a TObjArray of embedded TBaskets.) As a last stage of creating the TBranch ( The embedded TBasket(s) number(s) is taken to be after the last normal TBasket, since this is the last data that ROOT was working on when it died. If that's included in the user's entry range when they read a TBranch, then it will go through the In addition to always being uncompressed, embedded TBaskets have a slightly different structure from free-standing TBaskets. This deserialization code shows the difference: Notes I think in practice, I've never seen more than one embedded TBasket. How could there be? It's the last one the TTree was writing when it died. Nevertheless, it's a TObjArray of them, so I treat it everywhere like a list. (A list of one element vs a list of zero elements vs None is a useful way to distinguish different states of having already read it, not having any to read, and needing it but not yet having read it. So the list does come in handy.) Uproot 3 code called this "recovery" and "recovered" TBaskets. My impression when I first encountered this was that it was obviously a corrupted file. But I've since learned that this is an intended feature, how it's supposed to work, so that failures during writing produce files that are nevertheless readable. For that reason, Uproot 4 calls them "embedded." Uproot's writing does not have this feature: if it fails before writing a standalone (normal) TBasket, then that TBasket is simply unavailable. So Uproot's writing process always makes empty embedded TBaskets. |
The file contains two trees that look the same
Here is a hear of the stacktrace:
I can read them with
uproot.py
what can it be?
The text was updated successfully, but these errors were encountered: