ROOT in bash script for jobs

Hello,

I compiled my root macro FillHistos.C with:

root FillHistos.C+'(arguments)'

I want to use the compiled macro to run on many files in a condor environment. To do this, I need a bash script that runs the macro and takes each file as an argument. How can I do that? Locally, I run the following commands but in a bash script, it reads the first line and then waits for another command within the interactive ROOT mode, and never goes to the next command.

root -b FillHistos_C.so
FillHistos(arguments)
.q

Is there, either:

  1. A way to run these commands (at least the two first one) in a single go?
  2. Or a way to tell the script that the second command is still to be read within the root interactive mode?

Hope I’m being clear.
David

Type
root --help

Then look at the option -e

Yes, I’ve seen that but I don’t get how I’m supposed to use it. I tried:

root -b FillHistos_C.so -e FillHistos(arguments)

But it fails with the message:

-bash: condor_area/fillHisto.sh: line 17: syntax error near unexpected token `('
-bash: condor_area/fillHisto.sh: line 17: `root -b FillHistos_C.so -e FillHistos(arguments)'

Aren’t you missing the single quotes?

Execute the command passed between single quotes

Yes, that was it. What works for me reads:

root -b FillHistos_C.so -e 'FillHistos(arguments)'

Thanks!

Yes, its worked for me
Thank you !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.