Re: [ROOT] weird behavior with TUnixSystem

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Jul 02 2001 - 19:18:24 MEST


Hi Glen,

  always use access the system via the global gSystem pointer.
I'll add some protection so people can not instantiate their own TSystem
object.

Cheers, Fons.


"Glen R. Salo" wrote:
> 
> Fons:
> 
> >From the documentation, it was not clear to me that I should not use
> TUnixSystem.  I will now use the global pointer gSystem instead.  My
> example did not need to use TUnixSystem; rather, I used it to demonstrate
> the problem I was having using TUnixSystem in my "real" code.  Thanks for
> you help.
> 
> Glen
> 
> On 02-Jul-2001 Fons Rademakers wrote:
> > Hi Glen,
> >
> >    never create a TUnixSystem object yourself (why was your intention)?
> > Anyway, the following version of your viewer.cxx works fine:
> >
> > //==================================
> >#include <TApplication.h>
> >#include <TTree.h>
> >#include <TFile.h>
> >
> > class TViewer {
> >
> >  private:
> >   TTree *fTree;
> >   TFile *fFile;
> >
> >  public:
> >   TViewer() {
> >     fFile = new TFile("tree3.root");
> >     fTree = (TTree *)fFile->Get("t3");
> >     fTree->StartViewer();
> >   }
> >   ~TViewer() {delete fFile;}
> > };
> >
> > void main(int argc, char **argv) {
> >
> >   TApplication theApp("test",&argc,argv);
> >   new TViewer();
> >   theApp.Run();
> > }
> > //==================================
> >
> >
> > Cheers, Fons.
> >
> >
> >
> >
> > "Glen R. Salo" wrote:
> >>
> >> I am having strange problems when I use TUnixSystem as illustrated in
> >> the
> >> attached code.  Compile the code (g++ -o viewer viewer.cxx `root-config
> >> --cflags` `root-config --libs`), copy tree3.root from tutorials to the
> >> same directory, and run viewer.  On my computer, if I draw "ntrack" a
> >> histogram is drawn correctly.  However, if I try to draw any of the
> >> other
> >> branches ("stat", "sign", ...), the code immediately exits and writes
> >> "Alarm clock" to my shell window.  If the UnixSystem line is removed or
> >> replaced with "TUnixSystem *System = new TUnixSystem();" the program
> >> works
> >> fine.
> >>
> >> Thanks for your help,
> >>
> >> Glen
> >>
> >>   ----------------------------------------------------------------------
> >>   ----------
> >>                     Name: viewer.cxx
> >>    viewer.cxx       Type: unspecified type (application/octet-stream)
> >>                 Encoding: base64
> >>              Description: viewer.cxx
> >
> > --
> > 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

-- 
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 01 2002 - 17:50:51 MET