Hello,
Just a quick query: If EvalInstance of a TTreeFormula is called repeatedly, is its content re-evaluated each time?
This is in the context of having a number of TTreeFormula that all call methods of an object stored in my TTree. e.g. one branch is: std::vector* type, and MyClass has lots of methods, then I have TTreeFormula that look like this:
branch.method1()
branch.method2()
…
each method is costly to evaluate. I use my TTreeFormula in a loop like this (my formulae are managed in a TTreeFormulaManager):
int nObjects = formulaManager->GetNData();
for(int i=0;i<nObjects;i++) {
formula1->EvalInstance(i); //if I call this again, will it be costly? Should I cache the value?
...
}
I would like to know if I should invest in coding up a caching method so that these methods only get called once for each instance in the formula, rather than multiple times, to improve performance. If TTreeFormula already has a caching mechanism internal to it (e.g. a vector of instance values which gets filled as they are evaluated, so that subsequent calls to EvalInstance just use that cached value) then I wont bother.
Thanks