Hello Rooters!
I have the following code fragment that runs within a loop. I need to use the ProcessLine commands primarily because I call the “check_draw” script, which is built by a previous stage of the program. I have found that the only way I can get the sequence of commands to work is to use the ProcessLine for all of them.
gROOT->ProcessLine("TFile s_f(\"sim_nt.root\")");
gROOT->ProcessLine("s_tree = (TTree *) s_f.Get(\"h2\")");
gROOT->ProcessLine(".L check_draw.C");
found_sim = gROOT->ProcessLineFast("check_draw()");
gROOT->ProcessLine("s_tree->Delete()");
It is inefficient to constantly create and destroy the tree within the loop, not to mention the TFile as well. I would like to create them at the beginning of the program. However, if I try to do such a thing, I get a scope error b/c “check_draw” calls s_tree->Draw(…). Is there a way around this?
Sorry in advance if my explanation came out a little convoluted. Any help, as always, is greatly appreciated.
Cheers,
Ty