Hi @moneta,

I’ve tried to implement things following your example. However I’m still getting an error

```
error: cannot convert ‘Double_t {aka double}’ to ‘Double_t* {aka double*}’ for argument ‘1’ to ‘Double_t chi2_1D(Double_t*, Double_t, TH1D*, TF1*)’
ROOT::Math::Functor f(&chi2_1D(Apeak[i], slice[i], PadResponseFunction), 1);
^
```

Compared to your example, my functor is also f and your RosenBrock is my chi2_1D.

The only difference I can see is that, to compute my chi2_1D, I need values from my ROOT file so when I compute it I passed TH1* and TF1* etc as arguments *(see below)*.

```
Double_t chi2_1D(Double_t *ytrack, Double_t A_peak, TH1D* slice, TF1* PadResponseFunction)
{
Double_t chi2 = 0;
for (int j = 0; j < geom::nPady; j++){
chi2 += pow(1/slice->GetBinContent(j) - (A_peak*PadResponseFunction->Eval(j+0.5 - ytrack[0]))/pow(slice->GetBinContent(j), 2), 2);
}
return(chi2);
}
```

Here is the part of my code in the main where I define and use the Minimizer.

```
// Minimize chi2 of each line to extract ytrack (https://root.cern.ch/doc/master/NumericalMinimization_8C.html)
ROOT::Math::Minimizer* minimum = ROOT::Math::Factory::CreateMinimizer("Minuit2", "Migrad");
minimum->SetMaxFunctionCalls(1000000); // for Minuit/Minuit2
minimum->SetMaxIterations(10000); // for GSL
minimum->SetTolerance(0.001);
minimum->SetPrintLevel(1);
// create function wrapper for minimizer
// a IMultiGenFunction type
ROOT::Math::Functor f(&chi2_1D(Apeak[i], slice[i], PadResponseFunction), 1);
Double_t step = 0.01;
// starting point
Double_t variable = slice[i]->GetMean();
minimum->SetFunction(f);
// Set the free variables to be minimized !
minimum->SetVariable(0,"ytrack",variable, step);
// do the minimization
minimum->Minimize();
ytrack[i] = minimum->X()[0];
myChi2->AddBinContent(it, minimum->MinValue());
```

Do you have any indication on how to fix the error ? Or a workaround ?

Thanks a lot for your help,

Cheers

Marion