Re: more queries on using CINT & Root macros

Pasha Murat (murat@cdfsga.fnal.gov)
Mon, 5 Apr 1999 10:05:34 -0500 (CDT)


Richard Dubois writes:
...snip
>
> I want to .L a couple of macro files, then create some objects from the
> classes I loaded, then use those objects. I cannot find a combination
> where I can mix commands to CINT and C++ code. For example, I'd like to
> do
>
> .x LoadSharedLibs
> .L MyEvent.C
> .L EventDisplay.C
> MyEvent* m = new MyEvent("rootfile.root");
> EventDisplay* ed = new EventDisplay(m);
> m->Go(1);
> ed->Draw();
>
> How can I get these commands into the smallest number of files (one or
> two)?

Hi Richard,
for example, you can use the following macro:
----------------
int richard() {
gROOT->Reset();
gInterpreter->ProcessLine(".x LoadSharedLibs");
gInterpreter->ProcessLine(".L MyEvent.C");
gInterpreter->ProcessLine(".L EventDisplay.C");
MyEvent* m = new MyEvent("rootfile.root");
EventDisplay* ed = new EventDisplay(m);
m->Go(1);
ed->Draw();
return 0;
}
-----------------

i want to point out that in case of error it is not possible to reload
MyEvent.C, which is not the last macro in CINT stack without terminating
ROOT session.

I'd suggest the following strategy of reloading:

- if there is a request to reload a macro, which is not the last one
in stack, *all* the macros starting from the requested one and up
to the last one in stack have to be reloaded in order they have been
put in stack.

Masa, would this procedure work from your point of view?

-pasha