Re: gROOT->Reset("a")

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 15 May 2007 22:39:14 +0200


Never use "gROOT->Reset" inside a named script! This function should only be called at the start of unnamed macros to cleanup
the previous environment, unnamed macros creating variables in the global scope.

In your example, the call to gROOT->Resets wipes out your include statements.

Rene Brun

Jochen Mikosch wrote:
> Hi,
>
> I would like to use gROOT->Reset("a") to clean up before executing my
> program. On the command line it works fine, but within a script (see
> example below) the error message is :
>
> root [0] .x test.cpp
> Error: Unexpected EOF G__exec_statement() test.cpp:6:
> Advice: You may need to use +P or -p option
> *** Interpreter error recovered ***
>
> Without option "a" it works fine, but I need this option to avoid some
> reload problem. I tried root versions 5.11 and 5.12.
>
> #include "TROOT.h"
> #include "TSystem.h"
>
> void test()
> {
> gROOT->Reset("a");
> gROOT->LoadMacro("myscript.cpp");
> cout << " hello world " << endl;
> }
>
> Any suggestions how to solve that?
>
> Cheers,
> Jochen
>
Received on Tue May 15 2007 - 22:39:21 CEST

This archive was generated by hypermail 2.2.0 : Tue May 15 2007 - 23:50:01 CEST