Hello, I have a problem when loading and reloading “*.C” macros in root.
I’m using root version 5.10/00.
It’s a general reloading problem, so I’m using a general Macro name.
Heres’s the beginning of my root script “fill_l1.C”:
[code]int fill_l1(TString mode, TString cut = “”, TString action=“his”)
{
gROOT->LoadMacro(“ksphig_l1.C”);
gROOT->LoadMacro(“ksphig_cut.C”);
//… my code then starts … …
}
[/code]
When I run the script using `.x fill_l1.C("blabla")' for the first time,
it runs well. But when I run again using `.x fill_l1.C(“other_option”)’ , the
CINT reports:
Function fill_l1() busy. loaded after "/a05home/lijin/WORK/ana/dotC/ksphig_l1.C"
Error: G__unloadfile() Can not unload "/a05home/lijin/WORK/ana/dotC/ksphig_l1.C"
, file busy /a05home/lijin/WORK/ana/dotC/fill_l1.C:5:
*** Interpreter error recovered ***
Function fill_l1() busy. loaded after "/a05home/lijin/WORK/ana/dotC/ksphig_l1.C"
Error: G__unloadfile() Can not unload "/a05home/lijin/WORK/ana/dotC/ksphig_l1.C"
, file busy /a05home/lijin/WORK/ana/dotC/fill_l1.C:6:
*** Interpreter error recovered ***
It seems CINT can’t reload the script “ksphig_l1.C” automatically,
and any changes I made to “ksphig_l1.C” later will not be in effect.
I can only quit root, and restart root to re-run the main “fill_l1.C”.
Or I can type `.L ksphig_l1.C’ explicitly, in this case, the above error
message still remains.
The reason that I use “gROOT->LoadMacro(…)” in a script is that I
don’t want to type many “.L xxxx.C” before executing my main script. And the
files “*.C” to load will depend on my options passed to my main script, as
I have the following-alike code in my main script:
[code] //…
gROOT->LoadMacro(“option_general.C”);
if (!strcmp(action,“opt1”))
{ gROOT->LoadMacro(“option1.C”);
gROOT->LoadMacro(“option1_dependent.C”);
}
else if (!strcmp(action,“opt2”))
{ gROOT->LoadMacro(“option2_dependent.C”); }
//…
[/code]
Any way to let CINT automatically reload my scripts, and avoild the above
error messages? Thanks.