Compilation of a class derived from ROOT::Fit::Chi2Function

Hello everyone,

I would like to compile this class:

[code]#include “Fit/Chi2FCN.h”

class MyFCN: public ROOT::Fit::Chi2Function{
public:
MyFCN(const ROOT::Fit::BinData& data, const ROOT::Fit::Chi2Function::IModelFunction& func): ROOT::Fit::Chi2Function(data,func) {}
~MyFCN(){}
};[/code]

but I get this error:

root [0] .L myfun.C++ Info in <TUnixSystem::ACLiC>: creating shared library ./myfun_C.so ./myfun_C_ACLiC_dict.cxx: In function ‘int G__myfun_C_ACLiC_dict_2429_0_1(G__value*, const char*, G__param*, int)’: ./myfun_C_ACLiC_dict.cxx:151: error: no matching function for call to ‘MyFCN::MyFCN(ROOT::Fit::BinData&, int&)’ ./myfun.C:7: note: candidates are: MyFCN::MyFCN(const ROOT::Fit::BinData&, const ROOT::Math::IParamMultiFunction&) ./myfun.C:5: note: MyFCN::MyFCN(const MyFCN&) ./myfun_C_ACLiC_dict.cxx:153: error: no matching function for call to ‘MyFCN::MyFCN(ROOT::Fit::BinData&, int&)’ ./myfun.C:7: note: candidates are: MyFCN::MyFCN(const ROOT::Fit::BinData&, const ROOT::Math::IParamMultiFunction&) ./myfun.C:5: note: MyFCN::MyFCN(const MyFCN&) g++:./myfun_C_ACLiC_dict.o: No such file or directory Error in <ACLiC>: Compilation failed!

What is the problem? I guess that it is something “obvious” but I can’t figer out what it is :confused:

Cheers,
Jiri

ROOT: 5.26/00b

Hi,

there is an error in generating from ACLIC in generating the dictionary for your macro. I need to see also your code, myfun.C and in particular the line where you construct the MyFCN class.
Do you correctly declare the function type passed in the constructor ?
It seems it is interpreted by the compiler as an int

Best Regards

Lorenzo

Hello,

This is exatly what is confusing me because
myfun.C looks just like (see also attachment):

[code]#include “Fit/Chi2FCN.h”

class MyFCN: public ROOT::Fit::Chi2Function{
public:
MyFCN(const ROOT::Fit::BinData& data, const ROOT::Fit::Chi2Function::IModelFunction& func): ROOT::Fit::Chi2Function(data,func) {}
~MyFCN(){}
};
[/code]

i.e. I don’t even try to construct the MyFCN class. I just wanted to load it first (.L myfun.C++). So I’m litle bit confused why it is not possible to compile (load) this class :confused:

Cheers,
Jiri
myfun.C (256 Bytes)

Hi,

This is actually a deficiency in the way rootcint is used by ACLiC. I will be looking for a solution, in the meantime could report this is issue in savannah.cern.ch to keep track of it.

Thanks,
Philippe.

Hi,

As of revision 33584 in the trunk, this problem is fixed.

Cheers,
Philippe.

Hi Philippe,

it works perfectly now =D> .

Thank you,
Jiri

Hi,

I dont know wheter it is aclic or pyRoot related question but if i want to compile the same class as in previous posts (myfcn.C) ,i.e.:

[code]#include “Fit/Chi2FCN.h”

class MyFCN: public ROOT::Fit::Chi2Function{
public:
MyFCN(const ROOT::Fit::BinData& data, const ROOT::Fit::Chi2Function::IModelFunction& func): ROOT::Fit::Chi2Function(data,func) {};
~MyFCN(){};
};[/code]

under root like this:

root [0] .L myfcn.C++g Info in <TUnixSystem::ACLiC>: creating shared library /home/jiri/workspace/physics/./myfcn_C.so

it works without problems but if I create a python script (loadmyfcn.py) with just two lines:

import ROOT ROOT.gROOT.ProcessLine(".L myfun.C++g")

and run this script (python loadmyfcn.py) then it is not possible to compile it:

Info in <TUnixSystem::ACLiC>: creating shared library /home/jiri/workspace/./myfcn_C.so /home/jiri/workspace/./myfcn_C_ACLiC_dict.cxx: In function ‘int G__myfcn_C_ACLiC_dict_2429_0_1(G__value*, const char*, G__param*, int)’: /home/jiri/workspace/./myfcn_C_ACLiC_dict.cxx:151:95: error: no matching function for call to ‘MyFCN::MyFCN(ROOT::Fit::BinData&, int&)’ /home/jiri/workspace/./myfcn.C:5:5: note: candidates are: MyFCN::MyFCN(const ROOT::Fit::BinData&, const ROOT::Fit::Chi2FCN<ROOT::Math::IBaseFunctionMultiDim>::IModelFunction&) /home/jiri/workspace/./myfcn.C:3:44: note: MyFCN::MyFCN(const MyFCN&) /home/jiri/workspace/./myfcn_C_ACLiC_dict.cxx:153:108: error: no matching function for call to ‘MyFCN::MyFCN(ROOT::Fit::BinData&, int&)’ /home/jiri/workspace/./myfcn.C:5:5: note: candidates are: MyFCN::MyFCN(const ROOT::Fit::BinData&, const ROOT::Fit::Chi2FCN<ROOT::Math::IBaseFunctionMultiDim>::IModelFunction&) /home/jiri/workspace/./myfcn.C:3:44: note: MyFCN::MyFCN(const MyFCN&) g++: /home/jiri/workspace/./myfcn_C_ACLiC_dict.o: No such file or directory Error in <ACLiC>: Compilation failed!

It looks like the same problem/errors as before when one wanted to compile the class under CINT. Now it works under CINT but it doesn’t work if one use pyroot. Is there any solution? :bulb:

Thank you in advance,
Jiri
loadmyfcn.py (52 Bytes)
myfcn.C (236 Bytes)

I forgot to mention that I use trunk version of ROOT, revision 34588.

Cheers,
Jiri

[quote]and run this script (python loadmyfcn.py) then it is not possible to compile it:[/quote]Since the 2 operations are the same (your python code is calling the exact same thing as CINT), the only plausible issue is that in your 2nd case an older version of rootcint and/or libCint.so is still located on your PATH or LD_LIBRARY_PATH.

Cheers,
Philippe.

Your feeling was 100% correct. I realy mixed by accident two instalations of ROOT.

Many thanks Philippe again :slight_smile:

Jiri