Re: ROOT's graphics

Valery Fine (Valeri.Faine@cern.ch)
Wed, 19 Mar 1997 09:24:38 +0100


On 18 Mar 97 at 12:52, Sergei Gerassimov wrote:

> Dear ROOTers,
>
> I'm wondering why this simple program does nothing
> (No error messages. Just nothing)
>
>
> #include "TROOT.h"
> #include "TCanvas.h"
>
> main(int argc, char **argv)
> {
> TROOT mytst("mytst","Canvas' window");
> TCanvas *c1 = new TCanvas("c1","Just a test");
> c1->Draw();
> }
>
>
> Is it possible at all to use ROOT graphics _not_ from interactive
> session?

It is possible but I believe it is a wrong way making a
stand-alone users's ROOT-like program. One gains nothing but
problems.

I'd like to highlight that stand-alone applications gains nothing.
It will include CINT interpreter anyway and will as large as ROOT
itself also. (since CINT is used by some of ROOT classes internally).

The right way is

1. Create your ROOT macro, let's say MyDraw.C as follows:
MyDraw.C

void MyDraw()
{
TCanvas *c1 = new TCanvas("c1","Just a test");
c1->Draw();
}
2. Run it with Root

root -q MyDraw.C

3. If you find it is slow - make share/DLL MyDraw.DLL and run it
again

root -q MyDraw.DLL.
or
$ root

root > gSystem.Load("MyDraw.DLL");
root > MyDraw();

One an create a macro as follows:

RunDLL.C:
{
gSystem->Load("MyDraw.DLL")
MyDraw();
}

and then run it via interpreter:

$ root -q RunDLL.C

The DLL way has some extra advantages. Your DLL may call ANY kind
of subroutines from any kind of Library (from Fortran CERNLIB for
instance).

The time to create your own macro/DLL is usually very short against of
re-creating of the full-scale ROOT-like stand-alone program.

Hope this helps.
Valery


=================================================================
Dr. Valery Fine Telex : 911621 dubna su
-----------
LCTA/Joint Inst.for NuclearRes Phone : +7 09621 6 40 80
141980 Dubna, Moscow region Fax : +7 09621 6 51 45
Russia mailto:fine@main1.jinr.dubna.su
mailto:fine@vxcern.cern.ch
Dr. Valeri Faine
------------ Phone: +41 22 767 6468
CERN FAX : +41 22 782 2601
CH-1211 Geneva, 23 mailto:fine@vxcern.cern.ch
Switzerland http://nicewww.cern.ch/~fine