Hi,
I am trying to use SetObjectFit to specify my own object to feed to
a minuit FCN. I create an object of my own class TUnbinFitObj which is
just an NTUPLE, a FUNCTION and a list of names of the Ntuple variables
to be fed into my function (the arguments, not the parameters). The
class definition is included below.
As in a previous roottalk solution, I try using SetObjectFit to pass
this object to my Minuit fcn. This is done in the constructor for my
TUnbinnedFit object which will fit the object of class TUnbinFitObj.
When I try to run the code included below this I get the message:
TUnbinFitObj* fitobject;
gMinuit = new TMinuit(nparam);
fitobject = new TUnbinFitObj( "MassFit", "Mass Fit", func, ntuple,
x_name );
gMinuit->SetFCN(NtFitLikelihood);
gMinuit->SetObjectFit( fitobject ); //FAILS HERE!!
Error: Can't call TMinuit::SetObjectFit(fitobject) in current scope
FILE:TUnbinnedFit.cxx LINE:152
Possible candidates are...
filename line:size busy function type and name (in TMinuit)
(compiled) 0:0 0 public: virtual void SetObjectFit(TObject* obj);
filename line:size busy function type and name (in TNamed)
filename line:size busy function type and name (in TObject)
Error: Symbol gMinuit is not defined in current scope
FILE:TUnbinnedFit.cxx LINE:152
Error: Failed to evaluate gMinuit->SetObjectFit(fitobject)Possible
candidates are...
filename line:size busy function type and name
*** Interpreter error recovered ***
What am I doing wrong?!?
Thanks,
Alex Smith
------------------------------------
Object I'm trying to pass
------------------------------------
class TUnbinFitObj {
private:
const char* name;
char* title;
TF1 *func; // pointer to probability function
TNtuple* ntuple; // pointer to data ntuple
Double_t x_val; // values of fit variables
Int_t nparam; // number of function parameters
Int_t ndim; // dimension of fit probability fn
// (number of fit variables)
char* x_name; // list of parameters to fit
Int_t nevent; // number of events in Ntuple
public:
TUnbinFitObj( const char* name, char* title, TF1 *func, TNtuple*
ntuple, char* x_name );
~TUnbinFitObj();
Double_t GetFunctionValue(Int_t index);
Int_t GetNumEvent();
Int_t GetNumPar();
Int_t GetNumDim();
char* GetName();
char* GetTitle();
// char*[] GetXNames();
ClassDef (TUnbinFitObj,1) // Unbinned Fit object
};
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:05 MET