Save object with STL data member to ROOT file

Hi,

I have a problem saving STL data members to a ROOT file. They are data members of a class that is saved allright to the ROOT file using

TBranch *b_evt = fOutputTree->Branch("Event", "SEvent", &fEvent, 32000, 99); When I open the ROOT file I can though only see the data members of primitive types (integers, floats,…) and of type TObject/TObjectArray and so on. I initialise the STL data members the same way as the ROOT types (see below).

From the following example, only fObject can be seen in the Object in the output file:

[code]class SEvent : public TObject {
private:
std::vector* fNHits_A;
std::vector fNVector;
std::string fString;
TObject fObject;

}

SEvent::SEvent() : TObject() {
fNHits_A = new vector;
fNVector = vector();
fString = string();
fObject = TObject();

}[/code]
Using the object in the code before saving does not seem to cause any problems. The compiler does also accept it without any problem. The non-saved data members are also present in the SEventDict.cxx file. Any hint what could cause the problem?

Cheers,

Jan.

Hi,

How do you look at the values of the data members of the read object? With a TBrowser? Or with code?

Cheers, Axel.

[quote=“Axel”]Hi,

How do you look at the values of the data members of the read object? With a TBrowser? Or with code?

Cheers, Axel.[/quote]
Hi Axel,

I looked with a TBrowser and using CINT on the console. Both wouldn’t access the containers.

Cheers,

Jan.

HI Jan,

This should work fine (as long as you compile the class and provide a dictionary for it). Could you provide a complete running example showing the failure?

Thanks,
Philippe.

[quote=“pcanal”]HI Jan,

This should work fine (as long as you compile the class and provide a dictionary for it). Could you provide a complete running example showing the failure?

Thanks,
Philippe.[/quote]
Hi Philippe,

ok, I’ll try to figure out a working example. I put together a minimal example as a check using the User’s guide and it worked fine. I’ll look if I can reproduce it on a small scale somehow.

Cheers,

Jan.