I believe I have found a bug in ROOT 2.23.12 with TF1 and TF2. It appears that a TF1 or a TF2 can't call a user defined function that is loaded from a shared library under Linux. For example, when I take the example out of the class description for TF1 (see http://root.cern.ch/root/html/TF1.html#TF1:description) and run it only through the CINT interpreter, the example works properly, However, when I compile the function "myfunction" and put it into a shared library, then ROOT segvios (i.e. the error message is ubiquitous " *** Break *** segmentation violation"). For reference, I have cut-and_pasted the example from the class description for TF1 here. Has anyone else seen this problem? It seems like it could be a significant problem if one needed to use a compiled function to do a fit using Minuit (which is my case). -------------macro myfunc.C----------------------------- Double_t myfunction(Double_t *x, Double_t *par) { Float_t xx =x[0]; Double_t f = TMath::Abs(par[0]*sin(par[1]*xx)/xx); return f; } void myfunc() { TF1 *f1 = new TF1("myfunc",myfunction,0,10,2); f1->SetParameters(2,1); f1->SetParNames("constant","coefficient"); f1->Draw(); } void myfit() { TH1F *h1=new TH1F("h1","test",100,0,10); h1->FillRandom("myfunc",20000); TF1 *f1=gROOT->GetFunction("myfunc"); f1->SetParameters(800,1); h1.Fit("myfunc"); } --------end of macro myfunc.C--------------------------------- In an interactive session you can do: Root > .L myfunc.C Root > myfunc(); Root > myfit(); -- Matthew D. Langston SLD, Stanford Linear Accelerator Center langston@SLAC.Stanford.EDU 650.926.3279
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:22 MET