Use case:
1.) Reading entries (double) from a TTRee Reader, xi.
2.) Transforming the entries as
-Using TF1
TF1* f = new TF1("pol2");
f->SetParameters(a0, b0, c0);
double yi = f->Eval(xi);
-directly evaluating the polynmial
yi = a0 + b0*xi + c0*xi*xi;
I have a trivial query for a ‘large’ number of operations, is there any significant difference in computational times for the two cases - using TF1 vs direct evaluation?
Further, is any one is aware of more ‘efficient’ ways of doing this, please share them, it will be highly helpful.
Thanks a lot !
The evaluation of the TF1 does not have a significant overhead wrt the evaluation of the parabola directly in C++, provided that you set the value of the parameters and not re-create an instance per entry.
Hi @Danilo ,
I followed the tutorial and think RVecOps() may be a good substitute for the case at hand,
Currently,
1.)Reading a TTree having different branches (energy, time, hit_info etc) using
TTreeReader ReaderName()
2.) Each TTree entry corresponds to one “event.”
3.) Based on certain conditions(multiplicity, detector id, etc) on the branches, I am trying extracting data(energy) from other branches and transforming the energy using a pol2.
I am thinking of using RVecOps here however I am not sure how to substitute a TTreeReader with RVecOps?
Most probably this is a naive query but I am a complete beginner to RVecOps and vector operations in general, so any assistance will be highly valued. ?
PS: I understand that I am digressing from the original title of the thread and just put this up here for continuity.
Thanks a lot for the help!