Using Option_t in a TSelector analysis

Hi ROOT experts,

I am trying to modify an analysis macro to be able to use the Option_t parameter in “Process”.

Here’s some relevant code from runAnalysis.C:

// Headers

void runAnalysis (int job = 0) {

TChain chain("dy"); 
if(job==0) chain.Add("data_A.root");
if(job==0) chain.Add("data_B.root");
if(job==1) chain.Add("data_C.root");
if(job==1) chain.Add("data_D.root");

// Here goes some code that converts int "job" to a string "job_string"

chain.Process("myTSelector.C++", job_string);


But that doesn’t work as it seems the option parameter must be a constant. So while I’d be able to get it to work by including/modifying the following lines:

const char fakejob[] = "1";  // included at the top
chain.Process("myTSelector.C++", fakejob);  // modified at the bottom

that is no help in being able to pass the information (int job) used when calling runAnalysis.

Is there a way around this or is this a limitation of Option_t?


I should a priori work. Did you try:chain.Process("myTSelector.C++", job_string.c_str());?