To add to Rene's answer, if your application should always be
in batch mode (without you having to specify -b) do:
int main(int argc, char **argv)
{
gROOT->SetBatch(); // must be set before TApplication is created
TApplication theApp("App", &argc, argv);
Cheers, Fons.
----- Forwarded message from Rene Brun <Rene.Brun@cern.ch> -----
Date: Mon, 25 Sep 2000 08:03:52 +0200 (METDST)
From: Rene Brun <Rene.Brun@cern.ch>
To: Kevin Reil <reil@physics.utah.edu>
cc: roottalk@pcroot.cern.ch
Subject: Re: [ROOT] No Xwindows
Hi Kevin,
Use the option "-b" when you invoke your application. Assuming that
your executable is called myprog, do
myprog -b
In order to read the parameter given to the application, you should modify
your code as indicated in your below:
#include ...
#include "TROOT.h"
TROOT simple("simple","Extract Flashers");
int is_laser3(...);
int main(int argc, char **argv)
{
TApplication theApp("App", &argc, argv);
Rene Brun
On Fri, 22 Sep 2000, Kevin Reil wrote:
> Hi,
>
> I have a program which consists of a main procedure in one file and a
> library routine compiled in another.
>
> I wish to only fill histograms, fit and take the fit parameters, never
> to display anything. I do this successfully, however, when I run
> remotely I get cannot open DISPLAY errors (or with DISPLAY exported) I
> get alot of network activity (I assume X packets) before the program
> starts running. No windows pop up as I have been careful not to request
> any. Here is the sketch.
> QUESTION: how do I tell it to use NO xwindows?
> At work it's not noticeable, but through ssh tunnel behind firewall and
> over cable to my house is a little slow and annoying (and pointless).
>
> I thought perhaps removing the TROOT or TApplication lines, but I want
> to be able to turn on display of the hists with a command line
> parameter.
>
> extract_laser2.cpp (main)
>
> #include ...
> #include "TROOT.h"
> TROOT simple("simple","Extract Flashers");
> TApplication theApp("App", 0, NULL);
> int is_laser3(...);
>
> int main(int argc, char *argv[])
> {
> no root calls...
> check1=is_laser3();
> }
>
> is_laser3.cpp (library)
>
> #include "TROOT.h"
> #include "TH1.h"
> #include "TCanvas.h"
> #include "TF1.h"
>
> int is_laser3(...)
> {
> ... fillsome numbers for hist...
>
> TH1F *t1 = new TH1F("t1","Hist of deviation",200,-90,90);
> for (int j=0; j<ntubes; ++j)
> {
> t1->Fill(acos(tubehits[j].dev)*r2d-90);
> }
> TF1 *f1 = new TF1("f1","gaus",1,3);
> t1->Fit("f1","NQ");
> Double_t chi2 = f1->GetChisquare();
> Double_t amp = f1->GetParameter(0);
> Double_t x0 = f1->GetParameter(1);
> Double_t sig = f1->GetParameter(2);
> t1->Delete();
>
> }
>
----- End forwarded message -----
--
Org: CERN, European Laboratory for Particle Physics.
Mail: 1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248
WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:33 MET