Compiling macros to run without ROOT

Is it possible to compile a ROOT macro so that it can run without ROOT on any machine?

Alternatively, on a machine with ROOT installed, is there a way to compile/run a ROOT macro without entering the ROOT interface.

For instance, if I wanted to compile/run the macro test.C
I would first start ROOT with: root -l
Then type: .x test.C+

Is there a way for this to be integrated into a single command that can be run directly from the unix terminal?

[quote=“nocloud”]…
For instance, if I wanted to compile/run the macro test.C
I would first start ROOT with: root -l
Then type: .x test.C+

Is there a way for this to be integrated into a single command that can be run directly from the unix terminal?[/quote]Did you try

is it possible to take this one step further and make it run the ROOT processes in the background.

For instance, something like

root -q -l text.C+ >& output.txt &

It did not work for me when I tried running the above command

This would make it much easier to parallelize running the same code on multiple processors.

Hi,

root -l -b -q tutorials/hsimple.C+ >&out & works for me. Which ROOT version are you using?

Cheers, Axel.

[quote=“nocloud”]…It did not work for me when I tried running the above command…[/quote]What does that mean :unamused:

I am using version 5.26.00 on RHEL 5.4

When I run:
root -l -b -q test.C+ >& output.txt &

the output.txt is always empty and the ROOT file that is supposed to be created by test.C does not appear in my working directory.

Actually, I did some more investigation and found a rather strange behavior

When I run:
root -q -l -b text.C+ >& output.txt
it behaves correctly (although I lose the ability to run other jobs from the terminal).

To the problem is being caused by the last “&” symbol in the command:
root -q -l -b text.C+ >& output.txt &

another update.

i appear to have been able to get it running correctly by using the nohup command, ie:

nohup root -q -l -b text.C+ >& output.txt &

Can you try “root.exe” instead of just “root” ?

Hi,

Yes this problem (a background root process trying to access the input terminal) has been fixed several weeks ago in the trunk and in the v5.26 patch branch.

Cheers,
Philippe.