Problem getting an object from TFile (5.24)

Dear Rooters,

with the att rootfile I do:

 TFile f("63Ni-10.root");
f.ls()
   KEY: TMrbWindow2D     63Ni_schluss;1  Graph
   KEY: TMrbWindow2D     nickel;1        Graph
TCutG *cc;
cc = (TCutG*)f.Get("nickel");
  TMrbWindow2D TCutG streamer
cc->GetName()
   (const char* 0x2b19fc8)"63Ni_schluss"

What did / do we wrong when writing or reading?
Or is it the name starting with a non letter?

Cheers
Otto
63Ni-10.root (5.12 KB)

Hi Otto,

I do not understand how this file has been written. I do not see the StreamerInfo for your class TMrbWindow2D.

Rene

Hi,

Note that your object (on the file) are of type TMrbWindow2D and thus you can not assign their address to a TCutG* unless you load a library that implements TMrbWindow2D.

Cheers,
Philippe.

Hi Rene, Philippe,
thanks for your answers.
In fact our user doesnt know exactly how he produced this file
except he used my HistPresent :cry: . With f.Map() I see at least
a key StreamerInfo and with Inspect I see the variables of
class TMrbWindow2D : public TCutG.
root loads for me libTGMrbUtils.so containing class TMrbWindow2D automagically since I have a .root.map.
So I think you cant really help us since you dont have our machinery.

I attach a similiar file made with the “same” program for which all
works as expected :slight_smile::

Since I never saw this effect before I was curious.
Our user could not reproduce this either.

Cheers
Otto
w5.root (4.72 KB)

Hi,

(related but In general, rather than the syntax:TCutG *cc; cc = (TCutG*)f.Get("nickel"); We recommend to use TCutG *cc; f.GetObject("nickel",cc); where GetObject will set cc to the address of the objec if and only if the actual object is a type suitable to be stored in ‘cc’; otherwise cc is set to 0.

Cheers,
Philippe.