Usage of TTreeFormula::EvalPar(double *x, double* p)

I couldn’t find how to use EvalPar(const double* x, const double* p) of TTreeFormula. My basic confusion is
how to provide x and p array those have tree variables and parameters in same sequence as the TTreeFormula.


Neither Eval not EvalPar are supported in TTreeFormula (those are relics of a somewhat odd inheritance tree).


Actually the reason I wanted it, was that, I want to optimize the coefficients of an user defined function.
The procedure of this optimisations is like,

  1. User provides the functional form in terms of different variables stored in different branches of a TTree, from an input file
  2. User provides the initial value, step size and and limits on parameters in same file
  3. This functional form is used to calculate some parameter called theta for each entry in TTree and then average theta of all entries is calculated
  4. The parameters are optimized by minimizing average theta.
    I have written the code using TTreeFormula, but it doesn’t seem to work as expected. Please tell me what’s wrong. I am attaching the code,input file and the ROOT file here. The parameter ‘PARA01’ in disp formula doesn’t get updated in each TMinuit minimization call and that’s the problem.
    DispOptimisation.txt (196 Bytes)
    DispOptimisation.cxx (9.4 KB)

This is the .root file that contains the data over which minimization works.
It is much smaller version of actual file.
g++ DispOptimisation.cxx root-config --cflags --libs --glibs -lMinuit -lTreePlayer -o DispOptimisation
./DispOptimisation DispOptimisation.input 1
ParamC.root (16 KB)

Okk… Solved the problem… It was small mistake… sorry