Dear Rooters, Here is demo code; I put in only the declaration of the fitf function. ********************** Double_t fitf(Double_t *x, Double_t *par); //_____________________macro fitexample.C___________________________ Double_t fitf(Double_t *x, Double_t *par) { Double_t arg = 0; if (par[2]) arg = (x[0] - par[1])/par[2]; Double_t fitval = par[0]*TMath::Exp(-0.5*arg*arg); return fitval; } void fitexample() { TFile *f = new TFile("qph6869_kppp_320b.root"); TH1F *h46 = (TH1F*)f->Get("h46"); TF1 *func = new TF1("fit",fitf,-3,3,3); func->SetParameters(500,h46->GetMean(),h46->GetRMS()); func->SetParNames("Constant","Mean_value","Sigma"); h46->Fit("fit"); } ************************* When I fit a histo with a compiled user function, the fitf in the body of fitexample() should be (void *) pointer. However, when I do step-by-step debugging in CINT, I see the following: the fitf parameter is recognized as *char ???? ************** FILE:fit2.C LINE:17 cint> 18 19 TF1 *func = new TF1("fit",fitf,-3,3,3); !!!Calling constructor 0x0.TF1 for new TF1 !!!Calling compiled function TF1() arg1 = (char* 0x4063e1b0)"fit" arg2 = (char* 0x4061023c)"fitf" arg3 = (int)(-3) arg4 = (int)3 arg5 = (int)3 FILE:fit2.C LINE:19 cint> ******************* If you can tell me what is going on, I'll greatly appreciate the help. Denis \\\|/// \\ - - // ( @ @ ) +-------------------oOOo-(_)-oOOo-----------------------+ | | | Denis.Prokofiev@cern.ch | | | +---------------------------Oooo------------------------+ oooO ( ) ( ) ) / \ ( (_/ \_)
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:38 MET