Re: [ROOT] gPad->Print() in a loop produces empty ps files

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Nov 28 2002 - 09:39:12 MET


Hi Mike,

Your few lines cannot work. You do not even draw the histograms!
May be you meant something like:

   TIter it(f.GetList());
   while(TH1* h=dynamic_cast<TH1*>(it())){
        string plot_name=h->GetName(); 
        plot_name+=".eps";
        h->Draw();
        gPad->Print(plot_name.c_str());
   }

Rene Brun

On Wed, 27 Nov 2002, Mike Kordosky wrote:

> Hi,
> 
> I have some histograms in a file and I loop through them to print:
> 
> // f is a TFile object
> 
> TIter it(f.GetList());
> while(TH1* h=dynamic_cast<TH1*>(hiter.Next())){
> 	string plot_name=h->GetName(); plot_name+=".eps";
> 	gPad->Print(plot_name.c_str());
> }
> 
> This is in an executable program linked with the root libraries.  Now, the
> problem is that the program outputs things like:
> 
> Info in <TCanvas::Print>: PostScript file myhist.eps has been created and
> corresponding files are produced.  When I use gv to look at them nothing
> is there. The same is true if I use the extension ".ps". Also, when trying
> this with the extension ".gif" rather than ".eps" I get an error:
> 
> Cannot create gif file in batch mode.
> 
> Can someone explain why what I am doing doesn't work?
> 
> I use gcc3.2 on a redhat 7.2 pc.  My root version is from cvs on nov6
> 2002.
> 
> Thanks,
> 
> Mike Kordosky
> 
>  --
> Graduate Research Assistant  // High Energy Physics Lab
> kordosky@hep.utexas.edu     // University of Texas at Austin
> kordosky@fnal.gov	   //
> ph: (512) 471-8426 (RLM Lab, Office)
>     (512) 475-8673 (ENS Lab)
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:21 MET