Calling root from a shell script

Hi All,

I have do create a bunch of plots and each set is made from a separate directory. I wrote a script to edit the macro which creates the plots and I edited the macro to save the correct plots so I can run this in batch mode.

when I run from the command line I use:

root -q -b …/…/llrPlots.r+

and get

Compiled on 7 March 2007 for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.169, Mar 14 2005
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0]
Processing …/…/llrPlots.r+…
Info in TUnixSystem::ACLiC: creating shared library /home/rep_note/fast/./…/…/llrPlots_r.so
In file included from /home/rep_note/fast/./…/…/llrPlots.r:10,
from /home/rep_note/fast/./…/…/fileT3m8Uy.h:32,
from /home/rep_note/fast/./…/…/fileT3m8Uy.cxx:16:
/home/rep_note/fast/./…/…/macros.C: In function `double computePValue(TH1F*, double)’:
/home/rep_note/fast/./…/…/macros.C:662: warning: unused variable ‘nBins’
/home/rep_note/fast/./…/…/macros.C: At global scope:
/home/rep_note/fast/./…/…/macros.C:131: warning: unused parameter ‘nsigmas’

then runs like a charm.

but when i call from the shell script using root.exe -b -q …/…/llrPlots.r+
I get

Compiled on 7 March 2007 for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.169, Mar 14 2005
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0]
Processing …/…//llrPlots.r+
Info in TUnixSystem::ACLiC: creating shared library /home/rep_note/fast/./…/…//llrPlots_r.so
Warning: link requested for unknown srcfile /home/rep_note/fast/./…/… FILE:/home/rep_note/fast/./…/…/fileFTV29Mlinkdef.h LINE:10
Syntax error: #pragma link FILE:/home/rep_note/fast/./…/…/fileFTV29Mlinkdef.h LINE:10
Warning: Error occured during reading source files
Warning: Error occured during dictionary source generation
!!!Removing /home/rep_note/fast/./…/…/fileFFoUDh.cxx /home/rep_note/fast/./…/…/fileFFoUDh.h !!!
Error: rootcint: error loading headers…
Error in : Dictionary generation failed!
Info in : Invoking compiler to check macro’s validity
f771: warning: command line option “-Woverloaded-virtual” is valid for C++/ObjC++ but not for F77
f771: warning: command line option “-fuse-cxa-atexit” is valid for C++/ObjC++ but not for F77
g++: installation problem, cannot exec `ratfor’: No such file or directory
In file included from :0:
:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See URL:http://gcc.gnu.org/bugs.html for instructions.
Error: Function llrPlots() is not defined in current scope FILE: LINE:0
Possible candidates are…
filename line:size busy function type and name
*** Interpreter error recovered ***

I am sorry if this is not enough information. I am new to the shell scripting and have the learn the tricks but I have called other programs from a shell script, but never compiled one.

gob

Hi,

something in your batch file’s environment is terribly wrong. Compare the output of “env” run in the batch script (where ACLiC doesn’t work for you) and on the prompt (where ACLiC does work); PATH is probably pointing to something invalid. You can also compare the output of “which gcc” in the two cases. Can you also make sure that you get consistent results with root -q -b …/…/llrPlots.r+ and root -q -b …/…//llrPlots.r+ (one vs. two slashes)?

Cheers, Axel.

Thanks for the ideas.

I tried the simplest first, and of course it was the problem.

root -b -q …/…//llrPlots.r does not work
but
root -b -q …/…/llrPlots.r does work

The path to the macro name is entered by the user so as insurance I usually add a slash when I piece together the full path incase. This is the first time it has ever given me a problem.

Thanks

Hi,

…and I would call it a bug. But I cannot reproduce it, so I suppose it has been fixed already. I tried cd $ROOTSYS/tutorials/fit/.svn root -b -q ../..//hsimple.C+ root [0] Processing ../..//hsimple.C++... Info in <TUnixSystem::ACLiC>: creating shared library /build/axel/root/deb/tutorials/fit/.svn/./../../hsimple_C.so hsimple : Real Time = 0.17 seconds Cpu Time = 0.18 seconds (class TFile*)0x16d4a00
So it works for me.

Cheers, Axel.