How to write a std::vector into a TFile (not a TTree)

Hello,

is it possible to write a std::vector into a TFile without usnig a TTree (I have just 1 vector to write)?

Hi,

Yes, use

gFile->WriteObjectAny(&vec, TClass::GetClass("vector<double>"), "myDoubles");

See root.cern.ch/root/htmldoc/TDire … bjectAny@1

Cheers, Axel.

Hi,

The following simpler syntax should also work:gFile->WriteObject(&vec, "myDoubles");

Cheers,
Philippe.