Passing arguments to a root macro which is being run from a script which is passed to Condor


I have three scripts. First off I have a which creates many and submitScripts-X.sub to pass to Condor. The passes in variables to the and subScripts_X.sub. Here the ‘X’ is a string containing different variable names based on what variables are passed to the relevant scripts.

Inside the I (amongst other things) am trying to run a root macro. Normally when running the root macro it is done like this:

root -b -q 'Ratios.cxx+("STRINGNAME")'

When I am running locally (i.e on lxplus) but within the it is run like this:

root -b -q Ratios.cxx+(\"STRINGNAME\")

However, I am now trying to run on HTCondor and not sure how to adapt the command for the I pass in the variables to the as follows for example STRINGNAME, so I was hoping something like:

root -b -q Ratios.cxx+(\"${_STRINGNAME_}\")

would work, but it does not. I keep getting errors like:

 condor_exec.exe: line 97: syntax error near unexpected token `('

I am not sure how to correctly pass in the variables.

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

I am not sure if HTCondor environment is similar to what we have in a shell script but the following is working for me.


void hello(int i)
   printf("Hello %d !\n",i);

export NUM=123456
root -b -q -l 'hello.C('$NUM')'


% ./  

Processing hello.C(123456)...
Hello 123456 !

I have tried this, and other variants but it hasn’t worked :frowning:


root -b -q "Ratios.cxx+(\"${_STRINGNAME_}\")"

No that doesn’t work either :frowning:


the correct way may depend on the ROOT version - which one are you using? There was a very relevant change between ROOT versions 6.16 and 6.18…

root -b -q Ratios.cxx+\(\""$_STRINGNAME"\"\)


root -b -q Ratios.cxx+\(\"${_STRINGNAME}\"\)


root -b -q Ratios.cxx+\(\"$_STRINGNAME\"\)

could work?


are the curly brackets supposed to be missing?

Yes, and I have a working example to prove it.

…and what about the second ‘_’ in the variable name?

Nope, that was a mistake :man_facepalming: Sorry about that.


Unfortunately none of them worked. In each instance I got the following error:

 Warning in <TApplication::GetOptions>: macro Ratios.cxx not found

This is on Condor, right? Can you do ls -l right before that to ensure the Ratios.cxx exists indeed? And which ROOT version are you using?

That sounds like (in addition to the paramater passing?) you have a file location problem. I.e. the file may or may not have been copied to the worker nodes.


Yes the root macro exists and is in the right place.

The problem is passing in the variables correctly due to Condor. I have no issue running the script locally, but the syntax to run on Condor is different, or at least I think it is, and so it will not run.

That’s doubtful… I guess we need a minimal working example to debug things ourselves. Is it possible to provide one?

See edit below!

But there is no attached, is there?

What is the condor output is instead of calling the macro you do:

root.exe -b -l -q -e '.! ls *cxx' -e '.! pwd'

It isn’t really possible to provide a minimal working example as I am running with four different scripts to produce my output. But I have provided the runscript and the ratios file. However, as I cannot upload .sh files I have changed the runScript to a .cxx file, similary for the submbitScripts I have changed their extensions. I have commented out a lot of stuff in the runScript (it won’t run anyways as the .sub script takes in a tarballed up build and source directory containing the code to run), but at least one can see what I was trying to do.

Currently everything works (i.e the parts commented out), except for running the Ratios macro

To run the script I do


EDIT: I’ve since put the original file names back, the .sub file now has a .txt extension and everything else is .cxx (but should be .sh for the runScript and submitScript)

Ratios.cxx (5.0 KB) submitScript.txt (741 Bytes) runScript.cxx (3.5 KB) submitScript.cxx (2.8 KB)


I connected to the node that the script is running on, and as you can see the Ratios file is there from the image