void TCollection::Write(const Text_t *name, Int_t option, Int_t bsize)
{
// Write all objects in this collection. By default all objects in
// the collection are written individually (each object gets its
// own key). To write all objects using one key specify a name and
// set option to kSingleKey (i.e. 1).
You can ORed differend options if you like.
Rene Brun
Victor Perevoztchikov wrote:
>
> Dear rooters,
>
> I have tried to write TList object and without success.
> Does that mean, that TList inspite of it is TObject, can not be
> written like normal TObject? Short example is followed.
> It does not work for TList, but works for TNamed.
> Victor.
>
> {
> 2 TList *tl = new TList();
> !!!Calling constructor 0x0.TList for new TList
> 7 TFile *fo= new TFile("TL.root","new");
> !!!Calling constructor 0x0.TFile for new TFile
> 8 printf("fo=%x\n",fo);fo=49d090
> 9 fo->cd();
> 12 tl->Write("TL",TObject::kOverwrite);
> 13 fo->Flush();
> 14 fo->Write();
> 15 fo->Close();
> 17 TFile *fi=new TFile("TL.root","read");
> !!!Calling constructor 0x0.TFile for new TFile
> 18 fi->cd();
> 19 TList *tll = new TList();
> !!!Calling constructor 0x0.TList for new TList
> 20 tll->Read("TL");
>
> Error in <TList::Read>: Key not found
> ****************************************
>
> --
> Victor M. Perevoztchikov perev@bnl.gov perev@vxcern.cern.ch
> Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
> tel office : 516-344-7894; fax 516-344-4206; home 516-345-2690