Callback function in TTree->Draw("someVar", "callBack(som

Hi All

I have a root script which I compile before execution. It contains the function:

float callBack(int somevar, int anothervar)
   return someFloat;

At some point, I would like to use this function as a callBack for the selection of what to draw:

myttree->Draw(“someVariable”, “weight*callBack(var2, var3)”);

Unfortunately, this doesn’t work. There is no error, but the function is never executed (checked with a debug message inside the function) and the statement is just ignored.

Do I need to register the callBack function in ROOT somehow beforehand? Or do the callback function inside the Draw command only work with interpreted scripts? Any help is appreciated.



The function obviously is called, but std::cout doesn’t work. So please ignore this thread :slight_smile: