Hi all,
Well, after the last discussion with Philippe I learned a lot about TTreeFormula and I finally succeeded in building in the TTreeFormula class in my code. There I process a big number of events and create a big number of histograms from it. So the code works in principle but is rather slow. I tought that would be because of the large number of events and hists but when looking deeper into that I realized that ~80% of the processing time goes into the TTreeFormula::EvalInstance-method(s). Now the question is is there a way to speed up this method?
I had a look to the source code of this method and it seems to me that the whole expression is parsed again and again for each call of EvalInstance(). So is there a way to invoke something like Compile() like it is in TFormula?
Another approach to speed up my code lies in the structure of my cuts. The final cuts are combined from a set of “base cuts”. Something like:
TCut basecut1(...);
TCut basecut2(...);
...
TCut finalcut1 = basecut1 && basecut2;
TCut finalcut2 = (basecut1 && basecut2) || basecut3;
...
where the finalcutx are the cuts going to TTreeFormulas. So in fact bascutx is evaluated n-times for one event. Is there a simple way in root to tell TTreeFormula to evaluate the basecuts only once? Sure I could do this for my own but I was very surprised in the past about the masses of features already present in root so I thought I aks before implementing my own hack
Thanks a lot,
Mathias