Interpretation of GetStreamerInfo()->ls()

Hi everybody,

I (still) have problems reading ROOT files which were written with ROOT 4 in ROOT 4. For one class BbrUuidK I managed to get things work, but for a second class KanObj I always get errors like

Error in : object of class KanObj read too few bytes: 6 instead of 34

If I look to the output of GetStreamerInfo()->ls() for these two classes

root [0] gROOT->GetClass(“BbrUuidK”)->GetStreamerInfo()->ls()

StreamerInfo for class: BbrUuidK, version=1
TObject BASE offset= 0 type=-1 Basic ROOT object
UChar_t _uuid[16] offset= 12 type=31 The Persistent Data
UShort_t _successor offset= 32 type=12 The continuation File Index
TString _extension offset= 36 type=65 Extension of continuation file
i= 0, _uuid type= 31, offset= 12, len=16, method=0
i= 1, _successor type= 12, offset= 32, len=1, method=0
i= 2, _extension type= 65, offset= 36, len=1, method=0
root [1] gROOT->GetClass(“KanObj”)->GetStreamerInfo()->ls()

StreamerInfo for class: KanObj, version=1
TObject BASE offset= 0 type=66 Basic ROOT object
KanPersistable BASE offset= 12 type= 0 Basic Kanga persistent object
KanPersistentRefOwner BASE offset= 36 type= 0 Simple class to keep track of owned references
i= 0, TObject type= 66, offset= 0, len=1, method=0
i= 1, KanPersistable type= 0, offset= 12, len=1, method=206796496
i= 2, KanPersistentRefOwner type= 0, offset= 36, len=1, method=206816992

I noticed that for KanObj TObject shows up at
i= 0, TObject type= 66, offset= 0, len=1, method=0
but for BbrUuid it does not.
To make BbrUuidK work I had to set IgnoreTObjectStreamer(). For KanObj I did the same, but the StreamerInfo looks different. This I do not understand.
BTW, both classes are derived from TObject:
class BbrUuidK : public TObject {
class KanObj : public TObject, public KanPersistable, public KanPersistentRefOwner {

Any help or idea is welcome.
Thanks,
Matthias

Hi,

If I remember correctly, you were not using the + option in Linkdef.
If this is the case, in your release with ROOT 4, you would have (in the dictionary) a method KanObj::Streamer. Could you send us the content of this method?

I noticed that for KanObj TObject shows up at i= 0, TObject type= 66, offset= 0, len=1, method=0 but for BbrUuid it does not. To make BbrUuidK work I had to set IgnoreTObjectStreamer().
The line: TObject BASE offset= 0 type=-1 Basic ROOT object
is a consequence of calling IgnoreTObjectStreamer. It is stranget that you would also have call it for KanObj but got a different resut.

Philippe

Hi Philippe,

yes, we had no + options in the LinkDef files.
The ROOT 4.04.02 Streamer of KanObj looks like

void KanObj::Streamer(TBuffer &R__b)
{
   // Stream an object of class KanObj.
 
   UInt_t R__s, R__c;
   if (R__b.IsReading()) {
      Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
      TObject::Streamer(R__b);
      KanPersistable::Streamer(R__b);
      KanPersistentRefOwner::Streamer(R__b);
      R__b.CheckByteCount(R__s, R__c, KanObj::IsA());
   } else {
      R__c = R__b.WriteVersion(KanObj::IsA(), kTRUE);
      TObject::Streamer(R__b);
      KanPersistable::Streamer(R__b);
      KanPersistentRefOwner::Streamer(R__b);
      R__b.SetByteCount(R__c, kTRUE);
   }
}

Matthias

[quote=“pcanal”]Hi,

If I remember correctly, you were not using the + option in Linkdef.
If this is the case, in your release with ROOT 4, you would have (in the dictionary) a method KanObj::Streamer. Could you send us the content of this method?

I noticed that for KanObj TObject shows up at i= 0, TObject type= 66, offset= 0, len=1, method=0 but for BbrUuid it does not. To make BbrUuidK work I had to set IgnoreTObjectStreamer().
The line: TObject BASE offset= 0 type=-1 Basic ROOT object
is a consequence of calling IgnoreTObjectStreamer. It is stranget that you would also have call it for KanObj but got a different resut.

Philippe[/quote][/code]

So for KanObj you should not call IgnoreTObjectStreamer.
You should also check the streamer/linkdef of KanPersistable and KanPersistentRefOwner

Cheers,
Philippe

Hi Philippe,

maybe I now understand what I have to do or how things work. Please correct me if I’m wrong:

I compared the output of GetStreamerInfo()->ls() for BbrUuidK and for KanObj in ROOT 4 with the
output in ROOT 5. In ROOT 4 for BbrUuid there’s a TObject at i = 0, in ROOT 5 there’s no.
Therefore I have to IgnoreTObjectStreamer() if I want toe read in ROOT 5.

For KanObj there’s a TObject at i=0 in both cases. Here I do not have to IgnoreTObjectStreamer().

I I systematically check all streamer infos in ROOT 4 and in ROOT 5 and then call
IgnoreTObjectStreamer for all classes which look like BbrUuidK, things may work.

Is this more or less right?

Matthias

[quote=“pcanal”]So for KanObj you should not call IgnoreTObjectStreamer.
You should also check the streamer/linkdef of KanPersistable and KanPersistentRefOwner

Cheers,
Philippe[/quote]

Yes I think you understood.

However since (if memory serve) you use:

and

The authoritative answer in ROOT 4 comes from the Streamer function (and not the TStreamerInfo) while in ROOT 5 it comes from the TStreamerInfo. (and it has more to do with the + or not + than the version of ROOT)

Cheers,
Philippe.