gROOT->ProcessLine() problem

From: Tom Roberts <tjrob_at_fnal.gov>
Date: Mon, 18 Apr 2011 16:11:29 -0500


BACKGROUND:
I have written a large Root macro, HistoRoot.C, that runs both with and without ACLiC. I distribute it to many users, some of whom have a compiler, but most don't. This macro reads a large TNtuple almost 100 times faster when compiled, so compilation is highly desirable whenever possible. Until now it has been a macro only (it took a major effort to get it to compile and run via ACLiC).

I am using Mac OS X 10.5.8 (Leopard), and Root 5.26 installed from binary (that's the most recent version for this OS). I also distribute for Linux and Windows.

PROBLEM:
gROOT->ProcessLineSync() does not return any error code.

METHOD:
I deliberately put a compilation error into HistoRoot.C, and ran

        root -l Bootstrap.C
The Bootstrap macro (below) is intended to compile HistoRoot.C if possible, and to run it as a macro if not. But even though the compilation failed, the supposed error codes from ProcessLineSync() are the same as when compilation succeeds:
err=0 retVal=0

So how can I determine if compilation failed, WITHOUT user intervention?

Also: how can I suppress all the error messages from the compilation when it fails? (Users are not going to debug the code)

Tom Roberts

void Bootstrap()
{

	// the default optimization ".O 4" fails miserably in HistoRootWindow
	gROOT->ProcessLineSync(".O 3");
	
	Int_t err=0;

	// First, try to load HistoRoot.C via ACLiC
	Long_t retVal = gROOT->ProcessLineSync(".L HistoRoot.C+",&err);
printf("err=%d retVal=%d\n",err,retVal);         

        // here is where I would test the error codes and load the macro

        new HistoRootWindow(); // in HistoRoot.C }

force compile error

// class HistoRootWindow has a constructor that displays a GUI window which
// handles user input, opens Root files, generates plots, etc.
// Omitted for brevity.
Received on Mon Apr 18 2011 - 23:11:36 CEST

This archive was generated by hypermail 2.2.0 : Wed Apr 20 2011 - 05:50:01 CEST