go-hep / hep

hep is the mono repository holding all of go-hep.org/x/hep packages and tools
https://go-hep.org
BSD 3-Clause "New" or "Revised" License
231 stars 36 forks source link

groot/root-gen-streamer with ClonesArray #479

Open aphecetche opened 5 years ago

aphecetche commented 5 years ago

Trying to generate streamers for a type with a ClonesArray I get :

root-gen-streamer -p github.com/alice-go/aligo/ocdb -t AliSplineFit -o streamers2.go
root-gen-streamer: unhandled type: *go-hep.org/x/hep/groot/rcont.ClonesArray (underlying: *go-hep.org/x/hep/groot/rcont.ClonesArray)

Is that linked to https://github.com/go-hep/hep/issues/449 or is it something else ?

splinefit.go.txt

Note that I am actually not particularly interested in that object, but it is part of another one that I do need : is there a way to "bypass" an object in streamers ?

sbinet commented 5 years ago

Thx for the report. I'll have a look at this this evening (buying a house right now...)

sbinet commented 5 years ago

ok. it's not related to #449: it's because I haven't yet handled the case of fields that are pointers-type.

that said, I suspect you have a ROOT file with a an AliSplineFit object in there. did you try running root-gen-type on that instead of root-gen-streamer (wich is more for Go-only types) ?

aphecetche commented 5 years ago

OK, I think I completely misunderstood what root-gen-streamer is.

What I did was :

> root-gen-type -p grp -t AliSplineFit -o splinefit.go $HOME/cernbox/ocdbs/2018/OCDB/GRP/GRP/Data/Run295820_295820_v1_s0.root

I thought I needed another step to get the factory part... but that's not (/ no longer ?) the case and root-gen-type does everything, is that right ?

sbinet commented 5 years ago

I thought I needed another step to get the factory part... but that's not (/ no longer ?) the case and root-gen-type does everything, is that right ?

yep.

aphecetche commented 5 years ago

should probably have started with the original issue :

~/cernbox/ocdbs/2018/OCDB $ ocdb-ls GRP/GRP/Data/Run295820_295820_v1_s0.root
2019/03/14 22:38:57 key: AliCDBEntry
2019/03/14 22:38:57 riofs: could not unmarshal key payload: rbytes: read too few bytes. got=423, want=459 (pos=341 count=114 start=341) [class="AliSplineFit"]

Run295820_295820_v1_s0.root.zip

sbinet commented 5 years ago

root-gen-streamer is for when you develop a Go type for your pure-Go analysis (ie: the starting point is Go, not C++) and want to be able to store values of that type inside a ROOT file (and eventually share that data with C++, python or something code.)

sbinet commented 5 years ago

ah then this one might be related with #449 indeed.