Re: [ROOT] No X-window

From: Christophe DELAERE (c.delaere@fynu.ucl.ac.be)
Date: Fri Mar 08 2002 - 15:16:38 MET


Hi Luis,

Just try 
gROOT->SetBatch(kTRUE);

to get rid of all graphical output.


Cheers,
Christophe.

+-----------------------------------------------------------\|/---+
| Christophe DELAERE            office: e253               !o o!  |
| UCL - FYNU                    phone : 32-(0)10-473234    ! i !  |
| chemin du cyclotron, 2        fax   : 32-(0)10-452183     `-'   |
| 1348 Louvain-la-Neuve BELGIUM e-mail: delaere@fynu.ucl.ac.be    |
+-----------------------------------------------------------------+

On Fri, 8 Mar 2002, Luis Silva wrote:

> 	Dear roottalk.
> 
> 	I'm doing a program that use ROOT's ability to generate
> postscripts.
> 
> 	Essentiailly, this program is called by cron in a machine with no
> X-window (no grafical interface).
> 
> 	The postscripts are gererated from histos.
> 
> 
> 	So i do something like this:
> 
> ...
>    TFile *f;
>    TH1F *histo;
>    TCanvas *myc=new TCanvas("c","c",0,0,600,400);
> 
> ...
> 
>  f = new TFile("servers_stats.root","RECREATE");
> ...
> 
>    gStyle->SetOptStat(0);
> 
>    for (int i=0;i<nlines;i++) {
> 
>        Float_t size=0.0;
> 
>        TPostScript *ps = new TPostScript(name[i]+".ps",112);
> ...
> 
>        histo=new TH1F(name[i].Data(),"database server
> progression",3000,0,3000);
>        histo->SetFillColor(4);
>        histo->SetMaximum(2100000);
>        int count=0;
>        while(rs->Next()) {
> 	   size = rs->GetFloat(1);
> 	   histo->Fill(count,size);
> 	   count++;
>        }
> 
> ...
> 
>        if (size>500000.0)
> 	   myc->SetLogy(0);
> 	   else myc->SetLogy(1);
> 
>        f->Write();
> 
>          histo->Draw();
> 
>        TF1 *max=new TF1("max","2100000",0,3000);
>        max->SetLineColor(6);
>        max->Draw("same");
> 
>        TF1 *dangerous=new TF1("dangerous","1900000",0,3000);
>        dangerous->SetLineColor(2);
>        dangerous->Draw("same");
> 
>        TLegend Legend(0.8, 0.2, 1.0, 0.4);
>        Legend.SetHeader(name[i]+"Kb/hour:");
>        Legend.AddEntry(histo, "Growth Size", "f");
>        Legend.AddEntry(max, "Maximum File size", "f");
>        Legend.AddEntry(dangerous, "Dangerous size level", "f");
>        Legend.Draw();
>        myc->Update();
> 
>        ps->Close();
> ...
> 
> 	Is there any way to this like "silent"; in a way that not need the
> X-window?. There is, probably, a method to do that. I hope.
> 
> 	Thanks in advance.
> 
> 	Best Regards.
> 
> 	Um abraço,
> 	Luís Silva.
> 
> +*************************+***********************************+
> |Luís Silva		  |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
> |Colaborator at DESY 	  |Adress:FCUL 	      		      |
> |in Hamburg Germany	  |Campo Grande, Edifício C8,room 8518|
> |Experiment Hera-b        |1749-016 Lisboa-Portugal           |
> |e-mail:Luis.Silva@desy.de|Tel.: +351 21 750 00 00 Ext.:28518 |
> +=========================+===================================+
> 
> 



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