Hi everybody, I am fitting with different functions an histogram: h_en_cm_photon.Draw("e1") c1.SetLogy() h_en_cm_photon.Fit("expo","R","EI",60,120) TF1 *Au_fit_direct = new TF1(*(h_en_cm_photon.GetFunction("expo"))) Au_fit_direct.SetName("Au_fit_direct") Au_fit_direct.SetRange(0,200); Au_fit_direct.Draw("e1same") TH1F *Au_direct = new TH1F(*(Au_fit_direct.GetHistogram())) TH1F *Au_direct_subs = new TH1F("Au_direct_subs","Au_direct_subs",h_en_cm_photon.GetNbinsX(),0,200) Au_direct_subs.Sumw2(); Au_direct_subs.Add(h_en_cm_photon,Au_direct,1,-1); Au_direct_subs.Draw("e1") Au_direct_subs.Fit("expo","R","EI",30,50) TF1 *Au_fit_therm = new TF1(*(Au_direct_subs.GetFunction("expo"))) Au_fit_therm.SetRange(0,200); Au_fit_therm.SetName("Au_fit_therm") Au_fit_therm.Draw("e1same") TH1F *Au_therm = new TH1F(*(Au_fit_therm.GetHistogram())) Au_therm.Draw("e1same") h_en_cm_photon.Draw("e1") Au_direct.Draw("e1same") Au_therm.Draw("e1same") h_en_cm_photon.Fit("Au_fit_direct + Au_fit_therm","R","",10,25) Everything works as expected but the last instruction gives: "Unknown function: Au_fit_direct + Au_fit_therm" When, alternatively, trying to define a new function from the existent ones via : TF1 *Au_fit_total = new TF1("Au_fit_direct + Au_fit_therm") I get "Error: illegal pointer to class object Au_fit_total" when trying to draw it (Au_fit_total.Draw()).... Briefly, I don't get to know how to operate with functions created via histo.GetFunction() to create new functions or to use them to fit histograms .... and the Class Description for TFormula and TF1 (as well as the different examples in the web) don't give me an answer (as far as I know) .... So, where I'm wrong ? Thanks in advance, David d'Enterria ---------------- TAPS (Subatech) phone : 02.51.85.84.89 mailto:enterria@in2p3.fr http://taps.in2p3.fr/nof/
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:28 MET