Compilation error when performing numerical minimization

Hi,
I am writing a code that given two equal waveforms (with different vertical scales and time shifts) rescales and shifts the first to match the second minimizing the chisquare between the two, thus calculating the correct scale and shift.
I am following the tutorial : https://root.cern/doc/v612/NumericalMinimization_8C_source.html
But when I try to compile it says:

 In file included from QTruncatedFit.hh:21,
                 from QTruncatedFit.cc:1:
/criolab/user/temporary_soft/root6.22/install/include/Math/Functor.h: In instantiation of ‘class ROOT::Math::FunctorHandler<ROOT::Math::Functor, double(const double*)>’:
/criolab/user/temporary_soft/root6.22/install/include/Math/Functor.h:428:13:   required from ‘ROOT::Math::Functor::Functor(const Func&, unsigned int) [with Func = double(const double*)]’
QTruncatedFit.cc:55:68:   required from here
/criolab/user/temporary_soft/root6.22/install/include/Math/Functor.h:133:17: error: data member ‘ROOT::Math::FunctorHandler<ROOT::Math::Functor, double(const double*)>::fFunc’ invalidly declared function type
  133 |    mutable Func fFunc;  // should here be a reference and pass a non-const ref in ctor
      |         

what exactly am I doing wrong ? I attach the files with the code, you can see that the function is now static, I also tried removing this attribute but it would give me errors as well
QTruncatedFit.hh (2.7 KB)
QTruncatedFit.cc (4.6 KB)
.
Also if you have other suggestions on how to perform the minimization I am open to new solutions.
Thank you,
Giorgio

_ROOT Version: 6.22
_Platform: Debian 10.2.1-6Processing: QTruncatedFit.hh…
Processing: QTruncatedFit.cc…

_Compiler: g++ 10.2.1 20210110


I guess @moneta can help you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.