Hi Alberto, there are two ways: 1) just call for each histogram: hist->Write(); // see TObject::Write() to write a histogram in the current file directory. 2) attach all histograms to the current directory hist->SetDirectory(gDirectory); and then call: file->Write(); which will write all objects attached to the files directories to disk. Probably 1) is easiest in your case. Cheers, Fons. Alberto Baldisseri wrote: > > Hi rooters, > > I have a macro that build some histograms and I would like to save it on > a file. The standard > way suggested on the tutorial is to open the file before creating the > histograms, in that way > all the histograms are located in the current directory of the open > file. But, I would like to > save the histograms AFTER the book+fill. > When I open the file after the histogram book+fill, the file becomes the > current directory > which is empty. There is a way to copy all the histograms to the file > directory ? Or another > solution ? > > Regards, > > Alberto > > +-------------------------------+-------------------+ > | Alberto BALDISSERI | Tel : (33-1) 69 08 93 33 | > | DAPNIA/SPhN, Bat 703 piece 42 | Fax : (33-1) 69 08 75 84 | > | CEA Saclay | E-mail : baldiss@hep.saclay.cea.fr | > | F 91191 Gif-sur-Yvette cedex | | > +-------------------------------+------------------------------------+ -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248 E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:34 MET